Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.GeometryFactory.createLineString()


    Assert.assertEquals(1050557.6016714368, coordinates[4].y, DELTA);
  }

  private Geometry getLineString() {
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326);
    return factory.createLineString(new Coordinate[] {
        new Coordinate(5, 4), new Coordinate(30, 10), new Coordinate(120, 150), new Coordinate(50, 50)});
  }

  @Test
  public void transformOutsideAreaTest() throws Exception {
View Full Code Here


  }

  @Test
  public void transformOutsideAreaTest() throws Exception {
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326);
    Geometry geometry = factory.createLineString(new Coordinate[] {
        new Coordinate(110, 50), new Coordinate(120, 60)});
    geometry = geoService.transform(geometry, LONLAT, LAMBERT72);
    Assert.assertTrue(geometry.isEmpty());
  }
View Full Code Here

    coordinate = geoService.calcDefaultLabelPosition(feature);
    // this tests current behaviour, without claims that this is the "best" (or even "good") position
    Assert.assertEquals(15.0, coordinate.x, DELTA);
    Assert.assertEquals(35.0, coordinate.y, DELTA);

    geometry = factory.createLineString(new Coordinate[] { new Coordinate(5,4), new Coordinate(30,10) });
    feature.setGeometry(geometry);
    coordinate = geoService.calcDefaultLabelPosition(feature);
    // this tests current behaviour, without claims that this is the "best" (or even "good") position
    Assert.assertEquals(5.0, coordinate.x, DELTA);
    Assert.assertEquals(4.0, coordinate.y, DELTA);
View Full Code Here

    Assert.assertEquals(1050557.6016714368, coordinates[3].y, DELTA);
  }

  private Geometry getLineString() {
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326);
    return factory.createLineString(new Coordinate[] {
        new Coordinate(5, 4), new Coordinate(30, 10), new Coordinate(120, 150), new Coordinate(50, 50)});

  }
 
  public class ThrowingTransform extends CrsTransformImpl {
View Full Code Here

public class CentroidTest {

  @Test
  public void testSinglePointString() {
    GeometryFactory factory = new GeometryFactory();
    LineString ls = factory.createLineString(new Coordinate[] {new Coordinate(0, 0),
        new Coordinate(0, 0)});
    com.vividsolutions.jts.geom.Point p = ls.getCentroid();
    assertTrue(Double.isNaN(p.getX()));
  }
}
View Full Code Here

    SplitPolygonRequest request = new SplitPolygonRequest();
    GeometryFactory factory = new GeometryFactory();
    request.setGeometry(
        dtoConverter.toDto(geoService.createCircle(factory.createPoint(new Coordinate(0, 0)), 10, 10)));
    request.setSplitter(
        dtoConverter.toDto(factory.createLineString(new Coordinate[] {
            new Coordinate(-10, -10), new Coordinate(10, 10)
        })));
    SplitPolygonResponse response = (SplitPolygonResponse) dispatcher.execute(
        SplitPolygonRequest.COMMAND, request, null, "en");
    if (response.isError()) {
View Full Code Here

    request.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS);
    request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS);
    request.setLayerIds(new String[] {LAYER_ID});

    GeometryFactory factory = new GeometryFactory();
    LineString equator = factory.createLineString(new Coordinate[] {new Coordinate(0, 0),
        new Coordinate(-180, 180)});
    request.setLocation(converter.toDto(equator));

    // execute
    SearchByLocationResponse response = (SearchByLocationResponse) dispatcher.execute(
View Full Code Here

    //note that setting a global filter on the SearchByLocationRequest will only work if the filter is applicable
    //to all layers! In this test case there is only one layer.
    request.setFilter("region='Region 1'");

    GeometryFactory factory = new GeometryFactory();
    LineString equator = factory.createLineString(new Coordinate[] {new Coordinate(0, 0),
        new Coordinate(-180, 180)});
    request.setLocation(converter.toDto(equator));

    // execute
    SearchByLocationResponse response = (SearchByLocationResponse) dispatcher.execute(
View Full Code Here

    request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS);
    request.setLayerIds(new String[] {LAYER_ID});
    request.setFilter(LAYER_ID, "region='Region 1'");

    GeometryFactory factory = new GeometryFactory();
    LineString equator = factory.createLineString(new Coordinate[] {new Coordinate(0, 0),
        new Coordinate(-180, 180)});
    request.setLocation(converter.toDto(equator));

    // execute
    SearchByLocationResponse response = (SearchByLocationResponse) dispatcher.execute(
View Full Code Here

    private static final long serialVersionUID = 180L;

    public UnserializableException() {
      super("Oops. I guess the server encountered some 'unexpected' exception.");
      GeometryFactory factory = new GeometryFactory();
      geometry = factory.createLineString(new Coordinate[] { new Coordinate(0, 0), new Coordinate(10, 0) });
    }

    public Geometry getGeometry() {
      return geometry;
    }
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.