Package org.geomajas.command.dto

Examples of org.geomajas.command.dto.TransformGeometryRequest


  private static final double DELTA = 1e-20;

  @Test
  public void testTransformBounds() throws Exception {
    TransformGeometryRequest request = new TransformGeometryRequest();
    Bbox origin = new Bbox(10, 30, 10, 10);
    request.setBounds(origin);
    request.setSourceCrs(MERCATOR);
    request.setTargetCrs(LONLAT);
    // execute
    TransformGeometryResponse response = (TransformGeometryResponse) dispatcher.execute(
        TransformGeometryRequest.COMMAND, request, null, "en");
    Bbox transformed = response.getBounds();
    Assert.assertEquals(8.983152841195215E-5, transformed.getX(), DELTA);
View Full Code Here


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

  @Test
  public void testTransformGeometry() throws Exception {
    TransformGeometryRequest request = new TransformGeometryRequest();
    WKTReader reader = new WKTReader();
    Geometry origin = converterService.toDto(reader.read("POLYGON((10 30, 20 30,20 40,10 40,10 30))"));
    request.setGeometry(origin);
    request.setSourceCrs(MERCATOR);
    request.setTargetCrs(LONLAT);
    // execute
    TransformGeometryResponse response = (TransformGeometryResponse) dispatcher.execute(
        TransformGeometryRequest.COMMAND, request, null, "en");
    Geometry transformed = response.getGeometry();
    Envelope bounds = converterService.toInternal(transformed).getEnvelopeInternal();
View Full Code Here

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

  @Test
  public void testTransformGeometryCollection() throws Exception {
    TransformGeometryRequest request = new TransformGeometryRequest();
    WKTReader reader = new WKTReader();
    Geometry origin = converterService.toDto(reader.read("POLYGON((10 30, 20 30,20 40,10 40,10 30))"));
    List<Geometry> geometries = request.getGeometryCollection(); // assure not-null
    geometries.add(origin);
    request.setGeometryCollection(geometries); // assure setter is called/tested
    request.setSourceCrs(MERCATOR);
    request.setTargetCrs(LONLAT);
    // execute
    TransformGeometryResponse response = (TransformGeometryResponse) dispatcher.execute(
        TransformGeometryRequest.COMMAND, request, null, "en");
    List<Geometry> transformed = response.getGeometryCollection();
    Assert.assertEquals(1, transformed.size());
View Full Code Here

TOP

Related Classes of org.geomajas.command.dto.TransformGeometryRequest

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.