Examples of createPolygon()


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

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

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

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

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

      LinearRing exteriorRing = (LinearRing) toInternal(geometry.getGeometries()[0]);
      LinearRing[] interiorRings = new LinearRing[geometry.getGeometries().length - 1];
      for (int i = 0; i < interiorRings.length; i++) {
        interiorRings[i] = (LinearRing) toInternal(geometry.getGeometries()[i + 1]);
      }
      jts = factory.createPolygon(exteriorRing, interiorRings);
    } else if (Geometry.MULTI_POINT.equals(geometryType)) {
      Point[] points = new Point[geometry.getGeometries().length];
      jts = factory.createMultiPoint((Point[]) convertGeometries(geometry, points));
    } else if (Geometry.MULTI_LINE_STRING.equals(geometryType)) {
      LineString[] lineStrings = new LineString[geometry.getGeometries().length];
View Full Code Here

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

  @Before
  public void setupBeans() throws LayerException {
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING), 4329);
    LinearRing shell = factory.createLinearRing(new Coordinate[] { new Coordinate(0, 0), new Coordinate(1, 0),
        new Coordinate(1, 1), new Coordinate(0, 1), new Coordinate(0, 0), });
    Polygon p = factory.createPolygon(shell, null);
    MultiPolygon expected = factory.createMultiPolygon(new Polygon[] { p });
    CustomBean cb = new CustomBean();
    cb.setId(1);
    cb.setGeometry(expected);
    cb.setName("testbean");
View Full Code Here

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

  @Test
  public void readGeometry() throws LayerException {
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326);
    LinearRing shell = factory.createLinearRing(new Coordinate[] { new Coordinate(0, 0), new Coordinate(1, 0),
        new Coordinate(1, 1), new Coordinate(0, 1), new Coordinate(0, 0), });
    Polygon p = factory.createPolygon(shell, null);
    MultiPolygon expected = factory.createMultiPolygon(new Polygon[] { p });
    Assert.assertTrue(((CustomBean) layer.read("1")).getGeometry().equalsExact(expected));
  }

  public void readAttributes() throws LayerException {
View Full Code Here

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

  public void readGeometry() throws LayerException {
    Object bean = layer.read("1");
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326);
    LinearRing shell = factory.createLinearRing(new Coordinate[] { new Coordinate(0, 0), new Coordinate(1, 0),
        new Coordinate(1, 1), new Coordinate(0, 1), new Coordinate(0, 0), });
    Polygon p = factory.createPolygon(shell, null);
    MultiPolygon expected =factory.createMultiPolygon(new Polygon[]{p});
    Geometry g = layer.getFeatureModel().getGeometry(bean);
    Assert.assertTrue(expected.equalsExact(g, 0.00001));
  }
View Full Code Here

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

      }
    }
    GeometryFactory factory = new GeometryFactory();
    EMPTY_GEOMETRIES.put(Point.class, factory.createPoint((Coordinate) null));
    EMPTY_GEOMETRIES.put(LineString.class, factory.createLineString((Coordinate[]) null));
    EMPTY_GEOMETRIES.put(Polygon.class, factory.createPolygon(null, null));
    EMPTY_GEOMETRIES.put(MultiPoint.class, factory.createMultiPoint((Coordinate[]) null));
    EMPTY_GEOMETRIES.put(MultiLineString.class, factory.createMultiLineString((LineString[]) null)); // cast needed!
    EMPTY_GEOMETRIES.put(MultiPolygon.class, factory.createMultiPolygon((Polygon[]) null)); // cast needed!
    EMPTY_GEOMETRIES.put(Geometry.class, factory.createGeometryCollection(null));
  }
View Full Code Here

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

            v[1].getCoordinate(),
            v[2].getCoordinate(),
            v[0].getCoordinate()};
        GeometryFactory fact = new GeometryFactory();
        LinearRing ring = fact.createLinearRing(ringPts);
        Polygon tri = fact.createPolygon(ring, null);
        return tri;
    }

    public static Geometry toPolygon(QuadEdge[] e) {
        Coordinate[] ringPts = new Coordinate[]{
View Full Code Here

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

            e[1].orig().getCoordinate(),
            e[2].orig().getCoordinate(),
            e[0].orig().getCoordinate()};
        GeometryFactory fact = new GeometryFactory();
        LinearRing ring = fact.createLinearRing(ringPts);
        Polygon tri = fact.createPolygon(ring, null);
        return tri;
    }

    /**
     * Finds the next index around the triangle. Index may be an edge or vertex index.
View Full Code Here

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

            }
            currentHoles.add(hole);
        }
        GeometryFactory factory = new GeometryFactory();
        LinearRing[] holes = currentHoles.toArray(new LinearRing[currentHoles.size()]);
        return factory.createPolygon(shell, holes);
    }

    /**
     * Creates a GeometryCollection if the schemaDeclaredType is a subclass of GeometryCollection.
     * Otherwise it will just return the first of the list, or null if we are removing content.
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.