Package org.opengis.referencing.operation

Examples of org.opengis.referencing.operation.MathTransform.transform()


            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


      throw new RuntimeException(e.getMessage());
    }
    double[] src = { segment.p0.x, segment.p0.y, segment.p1.x, segment.p1.y };
    double[] dst = new double[4];
    try {
      mathTransform.transform(src, 0, dst, 0, 2);
    } catch (TransformException e) {
      throw new RuntimeException(e.getMessage());
    }
    Coordinate p0 = new Coordinate(dst[0], dst[1]);
    Coordinate p1 = new Coordinate(dst[2], dst[3]);
View Full Code Here

            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

            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

                    coord.x = gx;
                    coord.y = gy;
                    // find coordinates for current raster cell in tile CRS
                    DirectPosition sourcePos = gg.gridToWorld(coord);
                    // convert coordinates in tile CRS to WGS84
                    tr.transform(sourcePos, sourcePos);
                    // axis order can vary
                    double lon = sourcePos.getOrdinate(0);
                    double lat = sourcePos.getOrdinate(1);
                    Sample s = ss.getSample(lon, lat);
                    if (s != null)
View Full Code Here

                    coord.y = gy;
                    // find coordinates for current raster cell in tile CRS
                    DirectPosition sourcePos = gg.gridToWorld(coord);
                    // convert coordinates in tile CRS to WGS84
                    //LOG.debug("world : {}", sourcePos);
                    tr.transform(sourcePos, sourcePos);
                    //LOG.debug("wgs84 : {}", sourcePos);
                    // axis order can vary
                    double lon = sourcePos.getOrdinate(0);
                    double lat = sourcePos.getOrdinate(1);
                    // TODO: axes are reversed in the default mathtransform
View Full Code Here

                double lon, lat;
                if (transform) {
                    DirectPosition2D orig = new DirectPosition2D(x, y);
                    DirectPosition2D transformed = new DirectPosition2D();
                    mathTransform.transform(orig, transformed);

                    // x: lat, y: lon. This seems backwards but is the way Geotools does it.
                    if (latLon) {
                        lon = transformed.getY();
                        lat = transformed.getX()
View Full Code Here

                    DirectPosition sourcePos = gridGeometry.gridToWorld(coord);
                    // TODO: we are performing 2 transforms here, it would probably be more efficient to compose
                    // the grid-to-crs and crs-to-WGS84 transforms into grid-to-WGS84.
                    // cf. MathTransformFactory and CoordinateOperationFactory
                    // convert coordinates in raster CRS to WGS84
                    DirectPosition targetPos = tr.transform(sourcePos, null);
                    double lon = targetPos.getOrdinate(0);
                    double lat = targetPos.getOrdinate(1);
                    // evaluate using grid coordinates, which should be more efficient than using world coordinates
                    if (coverage != null)
                        coverage.evaluate(coord, val);
View Full Code Here

                    // reproject
                    MathTransform transform = CRS.findMathTransform(crs1, crs2,
                            true);
                    DirectPosition pos = new DirectPosition2D(48.417, 123.35);
                    try {
                        transform.transform(pos, null);
                    } catch (Exception e) {
                        // chomp
                    }
                } catch (Exception e) {
                    exceptions++;
View Full Code Here

                    // reproject
                    MathTransform transform = CRS.findMathTransform(crs1, crs2,
                            true);
                    DirectPosition pos = new DirectPosition2D(48.417, 123.35);
                    try {
                        transform.transform(pos, null);
                    } catch (Exception e) {
                        // chomp
                    }
                } catch (Exception e) {
                    exceptions++;
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.