@Override public void performWork( String work ,AttachmentDescriptor attDescription ) throws Exception { if( work == FileConversionPlugin.WORK_ANALYZE ) { analyzeFile(attDescription); } else if( work == FileConversionPlugin.WORK_APPROVE ) { approveFile(attDescription); } else { throw new Exception("Plugin can not perform work: "+work); } }
installCommonFields(approvedContext, context, obj); GpxBounds geometryBounds = new GpxBounds(); GpxBounds layerBounds = context.getLayerBounds(); geometryBounds.expandToInclude(lon, lat); layerBounds.expandToInclude(lon, lat); geom.put("wkt", "POINT("+lon+" "+lat+")"); JSONArray bbox = geometryBounds.asJSONArray(); geom.put("bbox", bbox);
if( null != tracks && tracks.size() > 0 ) { for(GpxTrack tr : tracks) { convertTrack(attDescription.getContext(), context, tr); if( null != routes && routes.size() > 0 ) { for(GpxRoute rt : routes) { convertRoute(attDescription.getContext(), context, rt); if( null != wayPoints && wayPoints.size() > 0 ) { for(GpxWayPoint wp : wayPoints) { convertWayPoint(attDescription.getContext(), context, wp); layerDef.put("id", context.getLayerName()); GpxBounds bounds = context.getLayerBounds(); JSONArray bbox = null; if( null != bounds ) { bbox = bounds.asJSONArray();
GpxConversionContext context = new GpxConversionContext(); context.setLayerName( doc.getString("_id") ); context.setSourceDocumentId( doc.getString("_id") ); convertGpx(attDescription, context, gpx, doc);
source.put("doc", context.getSourceDocumentId()); layers.put( context.getLayerName() ); obj.put("nunaliit_layers", layers);
uploadWorker.addConversionPlugin( mmPlugin ); uploadWorker.addConversionPlugin( new GpxFileConverter() ); uploadWorker.addConversionPlugin( new GeoJsonFileConverter() );
installCommonFields(approvedContext, context, obj); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); GpxBounds geometryBounds = new GpxBounds(); GpxBounds layerBounds = context.getLayerBounds(); for(GpxPoint pt : points) { geometryBounds.expandToInclude(pt.getLong(), pt.getLat()); layerBounds.expandToInclude(pt.getLong(), pt.getLat()); geometry = sw.toString(); bbox = geometryBounds.asJSONArray();
installCommonFields(approvedContext, context, obj); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); GpxBounds geometryBounds = new GpxBounds(); GpxBounds layerBounds = context.getLayerBounds(); for(GpxPoint pt : seg.getPoints()) { geometryBounds.expandToInclude(pt.getLong(), pt.getLat()); layerBounds.expandToInclude(pt.getLong(), pt.getLat()); geometry = sw.toString(); bbox = geometryBounds.asJSONArray();