Examples of MathTransform


Examples of org.opengis.referencing.operation.MathTransform

     */
    public void run( IProgressMonitor monitor ) throws Exception {
        if( !BUFFER_READY || graphics instanceof AWTGraphics ){
            if( syms==null )
                syms = Drawing.getSymbolizers(((Geometry)feature.getDefaultGeometry()).getClass(), color, false);
            MathTransform mt = getMathTransform(featureCRS);
            drawing.drawFeature(graphics, feature,
                    getMap().getViewportModel().worldToScreenTransform(), false, syms, mt);
        }else{
            if( image==null ){
                preRender();
View Full Code Here

Examples of org.opengis.referencing.operation.MathTransform

        b.add("the_geom", Point.class); //$NON-NLS-1$
        for( String fieldName : GEOPAPARAZZI_NOTES_DESCRIPTIONFIELDS ) {
            b.add(fieldName, String.class);
        }
        SimpleFeatureType featureType = b.buildFeatureType();
        MathTransform transform = CRS.findMathTransform(DefaultGeographicCRS.WGS84, mapCrs);
        pm.beginTask("Import notes...", IProgressMonitor.UNKNOWN);
        DefaultFeatureCollection newCollection = new DefaultFeatureCollection();

        Statement statement = null;
        try {
View Full Code Here

Examples of org.opengis.referencing.operation.MathTransform

        b.add("ENDDATE", String.class);
        b.add("DESCR", String.class);
        SimpleFeatureType featureType = b.buildFeatureType();

        try {
            MathTransform transform = CRS.findMathTransform(DefaultGeographicCRS.WGS84, mapCrs);
            pm.beginTask("Import gps to lines...", logsList.size());
            DefaultFeatureCollection newCollection = new DefaultFeatureCollection();
            int index = 0;
            for( GpsLog log : logsList ) {
                List<GpsPoint> points = log.points;

                List<Coordinate> coordList = new ArrayList<Coordinate>();
                String startDate = log.startTime;
                String endDate = log.endTime;
                for( GpsPoint gpsPoint : points ) {
                    Coordinate c = new Coordinate(gpsPoint.lon, gpsPoint.lat);
                    coordList.add(c);
                }
                Coordinate[] coordArray = (Coordinate[]) coordList.toArray(new Coordinate[coordList.size()]);
                if (coordArray.length < 2) {
                    continue;
                }
                LineString lineString = gF.createLineString(coordArray);
                LineString reprojectLineString = (LineString) JTS.transform(lineString, transform);
                MultiLineString multiLineString = gF.createMultiLineString(new LineString[]{reprojectLineString});

                SimpleFeatureBuilder builder = new SimpleFeatureBuilder(featureType);
                Object[] values = new Object[]{multiLineString, startDate, endDate, log.text};
                builder.addAll(values);
                SimpleFeature feature = builder.buildFeature(featureType.getTypeName() + "." + index++);

                newCollection.add(feature);
                pm.worked(1);
            }
            pm.done();

            ShapefileDataStoreFactory factory = new ShapefileDataStoreFactory();
            Map<String, Serializable> params = new HashMap<String, Serializable>();
            params.put("url", outputLinesShapeFile.toURI().toURL());
            params.put("create spatial index", Boolean.TRUE);
            ShapefileDataStore dStore = (ShapefileDataStore) factory.createNewDataStore(params);
            dStore.createSchema(featureType);
            dStore.forceSchemaCRS(mapCrs);

            JGrassToolsPlugin.getDefault().writeToShapefile(dStore, newCollection);

            JGrassToolsPlugin.getDefault().addServiceToCatalogAndMap(outputLinesShapeFile.getAbsolutePath(), true, true,
                    new NullProgressMonitor());

        } catch (Exception e1) {
            JGrassToolsPlugin.log(e1.getLocalizedMessage(), e1);
            e1.printStackTrace();
        }
        /*
         * create the points shapefile
         */

        File outputPointsShapeFile = new File(outputFolderFile, "gpspoints.shp");

        b = new SimpleFeatureTypeBuilder();
        b.setName("geopaparazzinotes");
        b.setCRS(mapCrs);
        b.add("the_geom", Point.class);
        b.add("ALTIMETRY", String.class);
        b.add("DATE", String.class);
        featureType = b.buildFeatureType();

        try {
            MathTransform transform = CRS.findMathTransform(DefaultGeographicCRS.WGS84, mapCrs);

            pm.beginTask("Import gps to points...", logsList.size());
            DefaultFeatureCollection newCollection = new DefaultFeatureCollection();
            int index = 0;
            for( GpsLog log : logsList ) {
View Full Code Here

Examples of org.opengis.referencing.operation.MathTransform

            b.add("DATE", String.class);
            b.add("AZIMUTH", Double.class);
            b.add("IMAGE", String.class);
            SimpleFeatureType featureType = b.buildFeatureType();

            MathTransform transform = CRS.findMathTransform(DefaultGeographicCRS.WGS84, mapCrs);

            DefaultFeatureCollection newCollection = new DefaultFeatureCollection();
            for( File imageFile : listFiles ) {
                String name = imageFile.getName();
                if (name.endsWith("jpg") || imageFile.getName().endsWith("JPG") || imageFile.getName().endsWith("png")
View Full Code Here

Examples of org.opengis.referencing.operation.MathTransform

                if( extent != null ){
                    CoordinateReferenceSystem crs = extent.getCoordinateReferenceSystem();
                    Geometry geometry = aoiService.getGeometry();
                    CoordinateReferenceSystem dataCRS = schema.getCoordinateReferenceSystem();
                    if (!CRS.equalsIgnoreMetadata(crs,dataCRS)) {
                        MathTransform transform = CRS.findMathTransform(crs, dataCRS);
                        geometry = JTS.transform(geometry, transform);
                    }
                    String the_geom = schema.getGeometryDescriptor().getName().getLocalPart();
                    Filter spatialFilter = ff.intersects( ff.property(the_geom), ff.literal( geometry ) );
                    if( filter != null ){
View Full Code Here

Examples of org.opengis.referencing.operation.MathTransform

                bounds = new ReferencedEnvelope(bounds, cRS);
                if (oldCRS != DefaultEngineeringCRS.GENERIC_2D
                        && oldCRS != DefaultEngineeringCRS.GENERIC_3D
                        && oldCRS != DefaultEngineeringCRS.CARTESIAN_2D
                        && oldCRS != DefaultEngineeringCRS.CARTESIAN_3D) {
                    MathTransform transform = CRS.findMathTransform(oldCRS, newCRS, true);
                    DirectPosition newCenter = transform
                            .transform(position, new DirectPosition2D());
                    setCenter(new Coordinate(newCenter.getOrdinate(0), newCenter.getOrdinate(1)));
                    setScale(scale);
                }
            } catch (FactoryException e) {
View Full Code Here

Examples of org.opengis.referencing.operation.MathTransform

            if (bounds2.getCoordinateReferenceSystem() == null || getCRS() == null
                    || bounds2.getCoordinateReferenceSystem().equals(getCRS())) {
                zoomToBox(bounds2);
            } else {
                MathTransform transform = null;
                transform = CRS.findMathTransform(bounds2.getCoordinateReferenceSystem(), getCRS(),
                        true);
                zoomToBox(JTS.transform(bounds2, transform));
            }
View Full Code Here

Examples of org.opengis.referencing.operation.MathTransform

     * null then getBounds will obtain the bounds from the IGeoResource. Else will use this bounds.
     */
    private volatile ReferencedEnvelope bounds;

    public MathTransform layerToMapTransform() {
        MathTransform layerToMapTransform;
        try {
            layerToMapTransform = CRS.findMathTransform(getCRS(), getMap().getViewportModel()
                    .getCRS(), true);
        } catch (Exception e) {
            layerToMapTransform = IdentityTransform.create(2);
View Full Code Here

Examples of org.opengis.referencing.operation.MathTransform

        }
        return layerToMapTransform;
    }

    public MathTransform mapToLayerTransform() {
        MathTransform mapToLayerTransform;
        try {
            mapToLayerTransform = CRS.findMathTransform(getMap().getViewportModel().getCRS(),
                    getCRS(), true);
        } catch (Exception e) {
            mapToLayerTransform = IdentityTransform.create(2);
View Full Code Here

Examples of org.opengis.referencing.operation.MathTransform

            return Filter.EXCLUDE;
        try {

            Envelope bbox;
            try {
                MathTransform transform = mapToLayerTransform();
                bbox = JTS.transform(boundingBox, transform);
            } catch (Exception e) {
                bbox = boundingBox;
            }
            String geom = getSchema().getGeometryDescriptor().getName().getLocalPart();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.