Package org.geomajas.puregwt.client.spatial

Examples of org.geomajas.puregwt.client.spatial.LineString


  }

  private Path toPath(MultiLineString multiLineString) {
    Path path = toPath((LineString) multiLineString.getGeometryN(0));
    for (int i = 1; i < multiLineString.getNumGeometries(); i++) {
      LineString lineString = (LineString) multiLineString.getGeometryN(i);
      path.moveTo((int) lineString.getCoordinate().getX(), (int) lineString.getCoordinate().getY());
      for (int j = 1; j < lineString.getNumPoints(); j++) {
        Coordinate coordinate = lineString.getCoordinateN(j);
        path.lineTo((int) coordinate.getX(), (int) coordinate.getY());
      }
    }
    return path;
  }
View Full Code Here


    Assert.assertEquals(0, ((Point) result).getY(), DELTA);
  }

  @Test
  public void testTransformLineString() {
    LineString line = factory.createLineString(new Coordinate[] { new Coordinate(0, 0), new Coordinate(10, 10) });
    Geometry result = viewPort.transform(line, RenderSpace.WORLD, RenderSpace.SCREEN);
    Assert.assertEquals(MAP_WIDTH / 2, result.getCoordinates()[0].getX(), DELTA);
    Assert.assertEquals(MAP_HEIGHT / 2, result.getCoordinates()[0].getY(), DELTA);
    Assert.assertEquals((MAP_WIDTH / 2) + (viewPort.getScale() * 10), result.getCoordinates()[1].getX(), DELTA);
    Assert.assertEquals((MAP_HEIGHT / 2) - (viewPort.getScale() * 10), result.getCoordinates()[1].getY(), DELTA);
View Full Code Here

    Assert.assertEquals(10, coordinate.getY(), DELTA);
  }

  @Test
  public void testTransformMultiLineString() {
    LineString ls1 = factory.createLineString(new Coordinate[] { new Coordinate(-5, 10), new Coordinate(10, 5) });
    LineString ls2 = factory.createLineString(new Coordinate[] { new Coordinate(5, -10), new Coordinate(-10, -5) });
    MultiLineString mls = factory.createMultiLineString(new LineString[] { ls1, ls2 });

    Geometry result = viewPort.transform(mls, RenderSpace.WORLD, RenderSpace.SCREEN);
    Coordinate coordinate = result.getGeometryN(0).getCoordinates()[0];
    Assert.assertEquals((MAP_WIDTH / 2) - (viewPort.getScale() * 5), coordinate.getX(), DELTA);
View Full Code Here

TOP

Related Classes of org.geomajas.puregwt.client.spatial.LineString

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.