Package org.opengis.referencing.operation

Examples of org.opengis.referencing.operation.MathTransform


                            //TODO: can we do a soft refresh here?
                            manager.refresh(notifier, null);
                        }
                        else{
                            try {                               
                                MathTransform layerToMapTransform = notifier.layerToMapTransform();
                                Envelope mapDelta =new Envelope();
                                if( layerToMapTransform.isIdentity() ){
                                    mapDelta = delta;
                                }
                                else {
                                    JTS.transform(delta, mapDelta, layerToMapTransform, 10);
                                }
View Full Code Here


            monitor.beginTask("", IProgressMonitor.UNKNOWN); //$NON-NLS-1$

            CoordinateReferenceSystem fromCRS = schema.getCoordinateReferenceSystem();
            CoordinateReferenceSystem crs = data.getCRS();
            MathTransform mt;

            if (fromCRS != null && crs != null) {
                mt = CRS.findMathTransform(fromCRS, crs, true);
            } else {
                if (crs != null)
View Full Code Here

     */
    public static void writeKml( File kmlFile, FeatureCollection<SimpleFeatureType, SimpleFeature> featureCollection ) throws Exception {
       
        CoordinateReferenceSystem epsg4326 = DefaultGeographicCRS.WGS84;
        CoordinateReferenceSystem crs = featureCollection.getSchema().getCoordinateReferenceSystem();
        MathTransform mtrans = CRS.findMathTransform(crs, epsg4326, true);

        DefaultFeatureCollection newCollection = new DefaultFeatureCollection();
        FeatureIterator<SimpleFeature> featuresIterator = featureCollection.features();
        while( featuresIterator.hasNext() ) {
            SimpleFeature f = featuresIterator.next();
            Geometry g = (Geometry) f.getDefaultGeometry();
            if (!mtrans.isIdentity()) {
                g = JTS.transform(g, mtrans);
            }
            f.setDefaultGeometry(g);
            newCollection.add(f);
        }
View Full Code Here

        GridStyle style = getStyle(context.getLayer());
        double[] gridSize=style.getGridSize();
    

        try{
            MathTransform mt = CRS.findMathTransform(DefaultGeographicCRS.WGS84, context.getCRS(), true);
       
            if( !mt.isIdentity() ){
                double x=gridSize[0]/2.0;
                double y=gridSize[1]/2.0;
                double[] toTransform=new double[]{-x,-y,x,y};
                double[] dest=new double[4];
                mt.transform(toTransform,0,dest,0,2);
                gridSize=new double[]{Math.abs(dest[2]-dest[0]), Math.abs(dest[3]-dest[1])};
            }
        }catch (Exception e) {
            MapGraphicPlugin.log("",e); //$NON-NLS-1$
        }
View Full Code Here

    }

    private double[] worldClosest( int x1, int y1, ILayer layer ) throws FactoryException {
        Coordinate coord = layer.getMap().getViewportModel().pixelToWorld(x1, y1);
        CoordinateReferenceSystem crs = layer.getMap().getViewportModel().getCRS();
        MathTransform mt = CRS.findMathTransform(DefaultGeographicCRS.WGS84, crs);

        double[] gridSize = getStyle(layer).getGridSize();
        try{
       
            if( !mt.isIdentity() ){
                double tx=gridSize[0]/2.0;
                double ty=gridSize[1]/2.0;
                double[] toTransform=new double[]{-tx,-ty,tx,ty};
                double[] dest=new double[4];
                mt.transform(toTransform,0,dest,0,2);
                gridSize=new double[]{Math.abs(dest[2]-dest[0]), Math.abs(dest[3]-dest[1])};
            }
        }catch (Exception e) {
            MapGraphicPlugin.log("",e); //$NON-NLS-1$
        }
View Full Code Here

                toTransform[1], toTransform[3], handler.getContext().getCRS());

        FilterFactory2 filterFactory = CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints());
        ReferencedEnvelope layerBounds;
        try {
            MathTransform transform = layer.mapToLayerTransform();
            layerBounds = new ReferencedEnvelope(JTS.transform(transformedBounds, transform), layer.getCRS());
        } catch (Exception e) {
            layerBounds = transformedBounds;
        }
        String geomAttributeName = layer.getSchema().getGeometryDescriptor().getLocalName();
View Full Code Here

            double scale, WMTSource wmtSource) throws Exception {
        CoordinateReferenceSystem crsMap = mapExtentMapCrs.getCoordinateReferenceSystem();
        CoordinateReferenceSystem crsTiles = wmtSource.getTileCrs(); // the CRS used for the tile cutting

        // Transformation: MapCrs -> TileCrs (mostly WGS_84)
        MathTransform transformMapToTileCrs = WMTRenderJob.getTransformation(crsMap, crsTiles);
       
        // Transformation: TileCrs (mostly WGS_84) -> MapCrs (needed for the blank tiles)
        MathTransform transformTileCrsToMap = WMTRenderJob.getTransformation(crsTiles, crsMap);
       
        // Get the mapExtent in the tiles CRS
        ReferencedEnvelope mapExtentTileCrs = WMTRenderJob.getProjectedEnvelope(mapExtentMapCrs,
                crsTiles, transformMapToTileCrs);
       
View Full Code Here

            WMTScaleZoomLevelMatcher.createMatcher(mapExtentMapCrs, scale, wmtSource);
 
        CoordinateReferenceSystem crsTilesProjected = wmtSource.getProjectedTileCrs(); // the CRS the tiles were projected in
       
        // Transformation: TileCrs (mostly WGS_84) -> TilesProjectedCrs (mostly Google's Mercator)
        MathTransform transformTileCrsToTilesProjected =
            getTransformation(zoomLevelMatcher.getCrsTiles(), crsTilesProjected);
                   
        // Transformation: TilesProjectedCrs (mostly Google's Mercator) -> MapCrs
        MathTransform transformTilesProjectedToMap =
            getTransformation(crsTilesProjected, zoomLevelMatcher.getCrsMap());          
       
        return new WMTRenderJob(
                crsTilesProjected,
                transformTileCrsToTilesProjected,
View Full Code Here

            ReferencedEnvelope bounds = (ReferencedEnvelope) currentContext.getImageBounds();
            bounds=bounds.transform(destinationCRS, true);
           
            GridEnvelope range=new GridEnvelope2D(0,0, mapDisplay.getWidth(), mapDisplay.getHeight() );
           
            MathTransform displayToLayer=currentContext.worldToScreenMathTransform().inverse();
            ReferencingFactoryFinder.getMathTransformFactory(null).createConcatenatedTransform(displayToLayer, currentContext.getLayer().mapToLayerTransform());
            GridGeometry2D geom=new GridGeometry2D(range, displayToLayer, destinationCRS );

            currentContext.setStatus(ILayer.WORKING);
            setState( STARTING );
View Full Code Here

            // ensure the bounds are in the right CRS
            if (!bounds.getCoordinateReferenceSystem().equals(
                    tileset.getCoordinateReferenceSystem())) {
                // need to reproject the bounds to the tile coordinate reference system.
                MathTransform transform = CRS.findMathTransform(
                        bounds.getCoordinateReferenceSystem(),
                        tileset.getCoordinateReferenceSystem());
                bounds = new ReferencedEnvelope(JTS.transform(bounds, transform),
                        tileset.getCoordinateReferenceSystem());
            }
View Full Code Here

TOP

Related Classes of org.opengis.referencing.operation.MathTransform

Copyright © 2018 www.massapicom. 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.