Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.GeometryFactory


    request.setCrs("EPSG:4326");
    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


    request.setLayerIds(new String[] {LAYER_ID});
    //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.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS);
    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

    request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS);
    request.setRatio(0.5f);
    request.setLayerIds(new String[] {LAYER_ID});

    // create a rectangle that overlaps 50 %
    GeometryFactory factory = new GeometryFactory();
    LinearRing half1 = factory.createLinearRing(new Coordinate[] {new Coordinate(0, 0), new Coordinate(1, 0),
        new Coordinate(1, 0.5), new Coordinate(0, 0.5), new Coordinate(0, 0)});
    Polygon polygon = factory.createPolygon(half1, null);
    request.setLocation(converter.toDto(polygon));

    // execute
    SearchByLocationResponse response = (SearchByLocationResponse) dispatcher.execute(
        SearchByLocationRequest.COMMAND, request, null, "en");
View Full Code Here

    request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS);
    request.setRatio(0.5f);
    request.setLayerIds(new String[] {LAYER_ID});

    // create a rectangle that overlaps 49 %
    GeometryFactory factory = new GeometryFactory();
    LinearRing half1 = factory.createLinearRing(new Coordinate[] {new Coordinate(0, 0), new Coordinate(1, 0),
        new Coordinate(1, 0.49), new Coordinate(0, 0.49), new Coordinate(0, 0)});
    Polygon polygon = factory.createPolygon(half1, null);
    request.setLocation(converter.toDto(polygon));

    // execute
    SearchByLocationResponse response = (SearchByLocationResponse) dispatcher.execute(
        SearchByLocationRequest.COMMAND, request, null, "en");
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) });
    }
View Full Code Here

      } else {
        partly = true;
         envelope = new Envelope(2, 4, 2, 4);
      }
      PrecisionModel precisionModel  = new PrecisionModel(PrecisionModel.FLOATING);
      GeometryFactory geometryFactory = new GeometryFactory(precisionModel, LAYER_SRID);
      geometry = geometryFactory.toGeometry(envelope);
    }
View Full Code Here

    if (null == biggestGeometry) {
      // build Geometry which covers biggest possible area
      Envelope maxBounds = new Envelope(-Double.MAX_VALUE, Double.MAX_VALUE,
          -Double.MAX_VALUE, Double.MAX_VALUE);
      PrecisionModel precisionModel = new PrecisionModel(PrecisionModel.FLOATING);
      GeometryFactory geometryFactory = new GeometryFactory(precisionModel, 0);
      biggestGeometry = geometryFactory.toGeometry(maxBounds);
    }
    return biggestGeometry;
  }
View Full Code Here

      BinarySpatialOpTypeInfo binary = (BinarySpatialOpTypeInfo) spatialOps;
      String propertyName = binary.getPropertyName().getValue();
      if (binary.ifGeometry()) {
        Geometry geometry = null;
        WKTWriter writer = new WKTWriter();
        GeometryFactory factory = new GeometryFactory();
        AbstractGeometryInfo geom = binary.getGeometry();
        geometry = toGeometry(factory, geom);
        String wkt = writer.write(geometry);
        if (binary instanceof ContainsInfo) {
          return "CONTAINS(" + propertyName + "," + wkt + ")";
        } else if (binary instanceof CrossesInfo) {
          return "CROSSES(" + propertyName + "," + wkt + ")";
        } else if (binary instanceof DisjointInfo) {
          return "DISJOINT(" + propertyName + "," + wkt + ")";
        } else if (binary instanceof EqualsInfo) {
          return "EQUALS(" + propertyName + "," + wkt + ")";
        } else if (binary instanceof IntersectsInfo) {
          return "INTERSECTS(" + propertyName + "," + wkt + ")";
        } else if (binary instanceof OverlapsInfo) {
          return "OVERLAPS(" + propertyName + "," + wkt + ")";
        } else if (binary instanceof TouchesInfo) {
          return "TOUCHES(" + propertyName + "," + wkt + ")";
        } else if (binary instanceof WithinInfo) {
          return "WITHIN(" + propertyName + "," + wkt + ")";
        }
      } else if (spatialOps instanceof DistanceBufferTypeInfo) {
        DistanceBufferTypeInfo distanceBuffer = (DistanceBufferTypeInfo) spatialOps;
        AbstractGeometryInfo geom = distanceBuffer.getGeometry();
        GeometryFactory factory = new GeometryFactory();
        Geometry geometry = toGeometry(factory, geom);
        WKTWriter writer = new WKTWriter();
        String wkt = writer.write(geometry);
        String units = distanceBuffer.getDistance().getUnits();
        String distance = distanceBuffer.getDistance().getValue();
View Full Code Here

      if (null == layer) {
        return null;
      }
      String area = layer.getVisibleArea();
      try {
        WKTReader wktReader = new WKTReader(new GeometryFactory(new PrecisionModel(), 0));
        return wktReader.read(area);
      } catch (ParseException pe) {
        throw new IllegalStateException("Could not parse geometry " + area, pe);
      }
    }
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.geom.GeometryFactory

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.