Package org.opengis.referencing.operation

Examples of org.opengis.referencing.operation.MathTransform


    private void transform() throws Exception {
        ILayer editLayer = getMap().getEditManager().getEditLayer();
        if (map.getViewportModel().getCRS().equals(editLayer.getCRS(null))) {
            return;
        }
        MathTransform mt = CRS.findMathTransform(map.getViewportModel().getCRS(), editLayer
                .getCRS(), true);
        if (mt == null || mt.isIdentity()) {
            return;
        }
        double[] coords = new double[coordinates.length * 2];
        for( int i = 0; i < coordinates.length; i++ ) {
            coords[i * 2] = coordinates[i].x;
            coords[i * 2 + 1] = coordinates[i].y;
        }
        mt.transform(coords, 0, coords, 0, coordinates.length);
        for( int i = 0; i < coordinates.length; i++ ) {
            coordinates[i].x = coords[i * 2];
            coordinates[i].y = coords[i * 2 + 1];
        }
    }
View Full Code Here


    /*
     * Test method for 'org.locationtech.udig.tools.edit.support.LazyCoord.get(Point)'
     */
    @Test
    public void testGet() throws Exception{
        MathTransform layerTransform = ReferencingFactoryFinder.getMathTransformFactory(null).createAffineTransform(new GeneralMatrix(new AffineTransform()));
        EditBlackboard bb = new EditBlackboard(100,100, new AffineTransform(), layerTransform);

        Point startingPoint = Point.valueOf(10,10);
        LazyCoord coord=new LazyCoord(startingPoint, bb.toCoord(startingPoint),bb);
       
View Full Code Here

         if(bookmarkCrs.equals(viewportCrs)){
           bookmarkedEnvelopeInVieportCRS = bookmarkEnvelope;
         }else{
           //reproject bookmark to viewport CRS
           boolean lenient = true;
           MathTransform transform = CRS.findMathTransform(bookmarkCrs, viewportCrs, lenient);
           Envelope xformedEnvelope = JTS.transform(bookmarkEnvelope, transform);
           bookmarkedEnvelopeInVieportCRS = new ReferencedEnvelope(xformedEnvelope, viewportCrs);
         }

         if (!bookmarkedEnvelopeInVieportCRS.equals(viewportBounds)) {
View Full Code Here

        }

        CoordinateReferenceSystem destinationCRS = context.getCRS();
        try {
            CoordinateReferenceSystem crs = CRS.decode(style.crsString);
            MathTransform transform = CRS.findMathTransform(crs, destinationCRS, true);

            Coordinate ul = new Coordinate(style.west, style.north);
            Coordinate ur = new Coordinate(style.east, style.north);
            Coordinate ll = new Coordinate(style.west, style.south);
            Coordinate lr = new Coordinate(style.east, style.south);
View Full Code Here

        Color color = (Color) style.get( ColorStyle.ID );

        // DATA TO WORLD
        CoordinateReferenceSystem dataCRS = layer.getCRS();
        CoordinateReferenceSystem worldCRS = context.getCRS();
        MathTransform dataToWorld = CRS.findMathTransform(dataCRS, worldCRS, false);

        // DRAW FILE
        monitor.beginTask("csv render", csv.getSize());
        reader = csv.reader();
       
View Full Code Here

    return crs;
  }

  public static Coordinate mapToLayer(IMap map, ILayer layer, Coordinate coordInMapCrs) {
    try {
      MathTransform toLayer = layer.mapToLayerTransform();
      double[] src = { coordInMapCrs.x, coordInMapCrs.y };
      double[] dst = new double[2];
      toLayer.transform(src, 0, dst, 0, 1);
      return new Coordinate(dst[0], dst[1]);
    } catch (IOException ex) {
      throw new RuntimeException(ex);
    } catch (TransformException ex) {
      throw new RuntimeException(ex);
View Full Code Here

                graticule.setStatusMessage(Messages.GraticuleGraphic_Error_Too_Many_Squares);
                return;
            }

            // Make transform from Graticule to map CRS
            MathTransform transform = CRS.findMathTransform(graticule.getCRS(), context.getCRS(),
                    false);

            // Transform bounds into Graticule CRS
            bounds = bounds.transform(graticule.getCRS(), true);
View Full Code Here

            editBlackBoard = getEditBlackBoardFromLayer(layer);
           
            if (editBlackBoard == null) {

                MathTransform layerToMapTransform;
                try {
                    layerToMapTransform = layer.layerToMapTransform();
                } catch (IOException e) {
                    EditPlugin.log("", e); //$NON-NLS-1$
                    layerToMapTransform = IDENTITY;
View Full Code Here

    Map<ILayer, Envelope> cache = new WeakHashMap<ILayer, Envelope>();
    private EditState previousState = EditState.NONE;

    private boolean canTransformTo( ILayer selectedLayer, Coordinate world ) {
        MathTransform t;
        try {
            t = selectedLayer.mapToLayerTransform();
        } catch (IOException e1) {
            throw (RuntimeException) new RuntimeException().initCause(e1);
        }
        try {
            double[] dest = new double[2];
            t.transform(new double[]{world.x, world.y}, 0, dest, 0, 1);
            if( Double.isNaN(dest[0]) || Double.isNaN(dest[1])
                    || Double.isInfinite(dest[0]) || Double.isInfinite(dest[1]))
                return false;
            return true;
        } catch (Throwable throwable) {
View Full Code Here

                            // the same assumption for NULL envelope.
                            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

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.