Examples of MathTransform


Examples of org.opengis.referencing.operation.MathTransform

            // CRS obtained from the ViewportModel
            Coordinate world = getContext().pixelToWorld(e.x, e.y);
           
            // now we must transform the coordinate to the CRS of the layer
            ILayer layer = getContext().getSelectedLayer();
            MathTransform tranform = layer.mapToLayerTransform();
           
            double[] from=new double[]{world.x, world.y};
            double[] to = new double[2];
            tranform.transform(from, 0, to, 0, 1);
           
            // Construct a envelope from the transformed coordinate
            Envelope env = new Envelope(new Coordinate(to[0],to[1]));

            // Query the feature source to get the features that intersect with that coordinate
View Full Code Here

Examples of org.opengis.referencing.operation.MathTransform

        if (coordinates == null) {
            return; // no coordinates to draw
        }
        try {
            MathTransform dataToWorldTransform = CRS.findMathTransform(DefaultGeographicCRS.WGS84, context.getCRS() );
   
            // for each location, create a circle and draw
            for (Coordinate location : coordinates) {
                Coordinate world = JTS.transform(location,  null, dataToWorldTransform);
                Point pixel = context.worldToPixel(world);
View Full Code Here

Examples of org.opengis.referencing.operation.MathTransform

    private static Coordinate transform( CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS,
            Coordinate envelopeCenterOrig ) throws TransformException {
        Coordinate evaluateCoord = envelopeCenterOrig;
        if (!CRS.equalsIgnoreMetadata(sourceCRS, targetCRS)) {
            try {
                MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS);
                evaluateCoord = JTS.transform(envelopeCenterOrig, null, transform);
                return evaluateCoord;
            } catch (FactoryException e1) {
                return null;
            }
View Full Code Here

Examples of org.opengis.referencing.operation.MathTransform

            ourCRS = context.getLayer().getCRS();
        }
       
        // figure out how to map our coordinate to the world
        CoordinateReferenceSystem worldCRS = context.getCRS();
        MathTransform dataToWorld;
        try {
            dataToWorld = CRS.findMathTransform(ourCRS, worldCRS, false);
        } catch (FactoryException e1) {
            throw (RuntimeException) new RuntimeException( ).initCause( e1 );
        }
View Full Code Here

Examples of org.opengis.referencing.operation.MathTransform

        resolution = gp.getSite().getViewportModel().getWidth() / gp.getSite().getMapDisplay().getWidth();
       
        // figure out how to map our coordinate to the world
        CoordinateReferenceSystem worldCRS =gp.getSite().getMap().getViewportModel().getCRS();
        MathTransform dataToWorld;
        try {
            dataToWorld = CRS.findMathTransform(ourCRS, worldCRS, false);
        } catch (FactoryException e1) {
            throw (RuntimeException) new RuntimeException( ).initCause( e1 );
        }
View Full Code Here

Examples of org.opengis.referencing.operation.MathTransform

    }
   
    EditBlackboard bb;
   
    public void resetEditBlackboard() throws FactoryException{
        MathTransform transform = CRS.findMathTransform(DefaultGeographicCRS.WGS84, DefaultGeographicCRS.WGS84);
        bb=new TestEditBlackboard(500,500, new AffineTransform(), transform);
    }
View Full Code Here

Examples of org.opengis.referencing.operation.MathTransform

       
        map.moveCoords(50,10, 30, 10);
        assertEquals(4, map.getGeoms(30,10).size());
       
        // test the case where the layer is not in the same projection as the map.
        MathTransform albersToWGS84 = CRS.findMathTransform(CRS.decode("EPSG:3005"), DefaultGeographicCRS.WGS84, true); //$NON-NLS-1$
        map = new EditBlackboard(SCREEN.x,SCREEN.y, AffineTransform.getTranslateInstance(0,0), albersToWGS84);
       
        map.addPoint(0,0, map.getGeoms().get(0).getShell());
        map.addPoint(0,0, map.getGeoms().get(0).getShell());
       
View Full Code Here

Examples of org.opengis.referencing.operation.MathTransform

        assertEquals(new Coordinate(15,7), modified.get(1));
    }
   
    @Test
    public void testTransform() throws Exception {
        MathTransform t=CRS.findMathTransform(CRS.decode("EPSG:3005"), DefaultGeographicCRS.WGS84); //$NON-NLS-1$
        AffineTransform translateInstance = AffineTransform.getTranslateInstance(180, 90);
        EditBlackboard map=new EditBlackboard( SCREEN.x, SCREEN.y, translateInstance, t);
       
        int x=-12+180;
        int y=52+90;
       
        map.addPoint(x,y, map.getGeoms().get(0).getShell());
        double [] tmp=new double[]{ x+.5,y+.5 };
        double [] expected=new double[2];
        translateInstance.inverseTransform(tmp, 0,tmp,0,1);
        t.inverse().transform(tmp, 0, expected,0,1);
        assertEquals(new Coordinate(expected[0], expected[1]),map.getCoords(x,y).get(0));
    }
View Full Code Here

Examples of org.opengis.referencing.operation.MathTransform

        assertEquals(Point.valueOf(5,10), geom.getShell().getPoint(2));
        assertEquals(Point.valueOf(0,10), geom.getShell().getPoint(3));
       
               
        // test the case where the layer is not in the same projection as the map.
        MathTransform albersToWGS84 = CRS.findMathTransform(CRS.decode("EPSG:3005"), DefaultGeographicCRS.WGS84, true); //$NON-NLS-1$
        map = new EditBlackboard(SCREEN.x,SCREEN.y, AffineTransform.getTranslateInstance(0,0), albersToWGS84);
       
        map.addPoint(0,0, map.getGeoms().get(0).getShell());
        Coordinate c = new Coordinate();
        JTS.transform(map.getCoords(0,0).get(0), c, albersToWGS84);
View Full Code Here

Examples of org.opengis.referencing.operation.MathTransform

        }
        CoordinateReferenceSystem featureCrs = featureBounds.getCoordinateReferenceSystem();
        ReferencedEnvelope tBounds = bounds.transform(featureCrs, true);
       
        boolean crsEqual = CRS.equalsIgnoreMetadata(featureCrs, mapCrs);
        MathTransform mathTransform = CRS.findMathTransform(featureCrs, mapCrs, true);
       
        String name = geometryDescriptor.getLocalName();
        Filter bboxFilter = getBboxFilter(name, tBounds);
        SimpleFeatureCollection featureCollection = featureSource.getFeatures(bboxFilter);
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.