Examples of LineString


Examples of com.vividsolutions.jts.geom.LineString

  public void testLineString() throws MarshallException {
    GeometrySerializer ser = new GeometrySerializer();
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(100.0), 31300);
    CoordinateArraySequence coords = new CoordinateArraySequence(new Coordinate[] {
        new Coordinate(12.0, 34.23), new Coordinate(12.000, 54.555), new Coordinate(-0.01, -0.0)});
    LineString p = new LineString(coords, factory);
    JSONObject jo = (JSONObject) ser.marshall(null, p);
    assertEquals("LineString", jo.get("type").toString());
    assertEquals("31300", jo.get("srid").toString());
    assertEquals("2", jo.get("precision").toString());
    assertEquals("[12,34.23,12,54.56,-0.01,0]", jo.get("coordinates").toString());
View Full Code Here

Examples of com.vividsolutions.jts.geom.LineString

  public void testMultiLineString() throws MarshallException {
    GeometrySerializer ser = new GeometrySerializer();
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(100.0), 31300);
    CoordinateArraySequence coords = new CoordinateArraySequence(new Coordinate[] {
        new Coordinate(12.0, 34.23), new Coordinate(12.000, 54.555), new Coordinate(-0.01, -0.0)});
    LineString l = new LineString(coords, factory);
    MultiLineString m = new MultiLineString(new LineString[] {l}, factory);
    JSONObject jo = (JSONObject) ser.marshall(null, m);
    assertEquals("MultiLineString", jo.get("type").toString());
    assertEquals("31300", jo.get("srid").toString());
    assertEquals("2", jo.get("precision").toString());
View Full Code Here

Examples of com.vividsolutions.jts.geom.LineString

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

Examples of com.vividsolutions.jts.geom.LineString

    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

Examples of com.vividsolutions.jts.geom.LineString

    //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

Examples of com.vividsolutions.jts.geom.LineString

    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

Examples of com.vividsolutions.jts.geom.LineString

  }
 
  @Test
  public void testGetBoundsIntersectsFiltered() throws Exception {
    GeometryFactory factory = new GeometryFactory();
    LineString equator = factory.createLineString(new Coordinate[] { new Coordinate(0, 0),
        new Coordinate(-180, 180) });
    Filter filter = filterService.createIntersectsFilter(equator,beanLayer.getLayerInfo().getFeatureInfo().getGeometryType().getName());
    Envelope bounds = layerService.getBounds(LAYER_ID,
        geoService.getCrs2(beanLayer.getLayerInfo().getCrs()), filter);
    Assert.assertEquals(0, bounds.getMinX(), ALLOWANCE);
View Full Code Here

Examples of com.vividsolutions.jts.geom.LineString

          List<Coordinate> coords = new ArrayList<Coordinate>();
          coords.add(new Coordinate(0, 0));
          coords.add(new Coordinate(0.75 * w, 0.25 * h));
          coords.add(new Coordinate(0.25 * w, 0.75 * h));
          coords.add(new Coordinate(w, h));
          LineString linestring = geometryFactory.createLineString(
              coords.toArray(new Coordinate[coords.size()]));
          line = new LiteShape2(linestring, null, null, false);
        }
        return line;
      } else if (symbolizer instanceof PolygonSymbolizer) {
View Full Code Here

Examples of com.vividsolutions.jts.geom.LineString

      for (int i = 0; i < mpoint.getNumGeometries(); i++) {
        drawGeometry(mpoint.getGeometryN(i), symbol);
      }
    } else if (g instanceof Polygon) {
      Polygon poly = (Polygon) g;
      LineString shell = poly.getExteriorRing();
      int nHoles = poly.getNumInteriorRing();
      drawPathContent(shell.getCoordinates());
      for (int j = 0; j < nHoles; j++) {
        drawPathContent(poly.getInteriorRingN(j).getCoordinates());
      }
      template.closePathEoFillStroke();
    } else if (g instanceof LineString) {
      LineString line = (LineString) g;
      drawPathContent(line.getCoordinates());
      template.stroke();
    } else if (g instanceof Point) {
      Point point = (Point) g;
      drawPoint(point.getCoordinate(), symbol);
      template.fillStroke();
View Full Code Here

Examples of com.vividsolutions.jts.geom.LineString

  public void testLineString() throws MarshallException, GeomajasException {
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(10000.0), 31300);
    CoordinateArraySequence coords = new CoordinateArraySequence(new Coordinate[] { new Coordinate(12.0, 34.23),
        new Coordinate(12.000, 54.555), new Coordinate(-0.01, 0.0) });
    LineString p = new LineString(coords, factory);
    JSONObject jtsJson = (JSONObject) jtsSerializer.marshall(null, p);
    Geometry dto = converter.toDto(p);
    JSONObject dtoJson = (JSONObject) dtoSerializer.marshall(null, dto);
    Assert.assertEquals(jtsJson.toString(), dtoJson.toString());
  }
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.