Package org.geomajas.geometry

Examples of org.geomajas.geometry.CrsTransform


  }

  @Test
  public void transformGeometryCrsTransform() throws Exception {
    Geometry geometry = getLineString();
    CrsTransform transform = geoService.getCrsTransform(LONLAT, LAMBERT72);
    geometry = geoService.transform(geometry, transform);
    assertTransformedLineString(geometry);
  }
View Full Code Here


    if (sourceCrs == targetCrs) { // NOPMD
      // only works when the caching of the CRSs works
      return source;
    }

    CrsTransform crsTransform = geoService.getCrsTransform(sourceCrs, targetCrs);
    return geoService.transform(source, crsTransform);
  }
View Full Code Here

    Assert.assertEquals(3.593261136397527E-4, transformed.getMaxY(), DELTA);
  }

  @Test
  public void transformEnvelopeCrsTransformTest() throws Exception {
    CrsTransform crsTransform = geoService.getCrsTransform(MERCATOR, LONLAT);
    Envelope envelope = new Envelope(10, 20, 30, 40);
    Envelope transformed = geoService.transform(envelope, crsTransform);
    Assert.assertEquals(8.983152841195215E-5, transformed.getMinX(), DELTA);
    Assert.assertEquals(2.6949458522981454E-4, transformed.getMinY(), DELTA);
    Assert.assertEquals(1.796630568239043E-4, transformed.getMaxX(), DELTA);
View Full Code Here

    Assert.assertEquals(envelope, geoService.transform(envelope, MERCATOR, MERCATOR));
  }

  @Test
  public void transformEnvelopeCrsNoTransformTest() throws Exception {
    CrsTransform crsTransform = geoService.getCrsTransform(MERCATOR, MERCATOR);
    Envelope envelope = new Envelope(10, 20, 30, 40);
    Envelope transformed = geoService.transform(envelope, crsTransform);
    Assert.assertEquals(10, transformed.getMinX(), DELTA);
    Assert.assertEquals(30, transformed.getMinY(), DELTA);
    Assert.assertEquals(20, transformed.getMaxX(), DELTA);
View Full Code Here

    Assert.assertEquals(bbox, geoService.transform(bbox, MERCATOR, MERCATOR));
  }

  @Test
  public void transformBboxCrsTransformTest() throws Exception {
    CrsTransform crsTransform = geoService.getCrsTransform(MERCATOR, LONLAT);
    Bbox bbox = new Bbox(10, 30, 10, 10);
    Bbox transformed = geoService.transform(bbox, crsTransform);
    Assert.assertEquals(8.983152841195215E-5, transformed.getX(), DELTA);
    Assert.assertEquals(2.6949458522981454E-4, transformed.getY(), DELTA);
    Assert.assertEquals(1.796630568239043E-4, transformed.getMaxX(), DELTA);
View Full Code Here

    Assert.assertEquals(3.593261136397527E-4, transformed.getMaxY(), DELTA);
  }

  @Test
  public void transformBboxCrsNoTransformTest() throws Exception {
    CrsTransform crsTransform = geoService.getCrsTransform(MERCATOR, MERCATOR);
    Bbox bbox = new Bbox(10, 20, 30, 40);
    Bbox transformed = geoService.transform(bbox, crsTransform);
    Assert.assertEquals(10, transformed.getX(), DELTA);
    Assert.assertEquals(20, transformed.getY(), DELTA);
    Assert.assertEquals(30, transformed.getWidth(), DELTA);
View Full Code Here

  @Test
  public void getCrsTransformCrsTest() throws Exception {
    MathTransform mathTransform = geoService.findMathTransform(CRS.decode(LONLAT), CRS.decode(LAMBERT72));
    Assert.assertEquals("EPSG:4326->EPSG:31300", ((CrsTransform)mathTransform).getId());

    CrsTransform crsTransform = geoService.getCrsTransform(LONLAT, LAMBERT72);
    Assert.assertEquals("EPSG:4326->EPSG:31300", crsTransform.getId());
    Assert.assertTrue(crsTransform.equals(mathTransform));

    CrsTransform crsTransform2 = geoService.getCrsTransform(CRS.decode(LONLAT), CRS.decode(LAMBERT72));
    Assert.assertEquals("EPSG:4326->EPSG:31300", crsTransform2.getId());
    Assert.assertTrue(crsTransform2.equals(mathTransform));
  }
View Full Code Here

  }

  @Test
  public void transformGeometryCrsTransform() throws Exception {
    Geometry geometry = getLineString();
    CrsTransform transform = geoService.getCrsTransform(LONLAT, LAMBERT72);
    geometry = geoService.transform(geometry, transform);
    assertTransformedLineString(geometry);
  }
View Full Code Here

  }

  @Test
  public void transformGeometryCrsNoTransform() throws Exception {
    Geometry geometry = getLineString();
    CrsTransform transform = geoService.getCrsTransform(LONLAT, LONLAT);
    geometry = geoService.transform(geometry, transform);
    Coordinate[] coordinates = geometry.getCoordinates();
    Assert.assertEquals(4, coordinates.length);
    Assert.assertEquals(5, coordinates[0].x, DELTA);
    Assert.assertEquals(4, coordinates[0].y, DELTA);
View Full Code Here

    Assert.assertEquals(mx, mc.x, DELTA);
    Assert.assertEquals(my, mc.y, DELTA);
    mc = geoService.transform(ll, geoService.getCrs2(MERCATOR), geoService.getCrs2(LONLAT));
    Assert.assertEquals(mx, mc.x, DELTA);
    Assert.assertEquals(my, mc.y, DELTA);
    CrsTransform crsTransform = geoService.getCrsTransform(MERCATOR, LONLAT);
    mc = geoService.transform(ll, crsTransform);
    Assert.assertEquals(mx, mc.x, DELTA);
    Assert.assertEquals(my, mc.y, DELTA);
  }
View Full Code Here

TOP

Related Classes of org.geomajas.geometry.CrsTransform

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.