Search in sources :

Example 1 with GeometricShapeFactory

use of com.revolsys.geometry.util.GeometricShapeFactory in project com.revolsys.open by revolsys.

the class JTSFunctions method newS.

private static Geometry newS(final Geometry g) {
    final GeometryFactory gf = FunctionsUtil.getFactoryOrDefault(g);
    final double centreX = WIDTH - S_RADIUS;
    final Point[] top = new Point[] { new PointDoubleXY(WIDTH, HEIGHT), new PointDoubleXY(centreX, HEIGHT) };
    final Point[] bottom = new Point[] { new PointDoubleXY(centreX, 0), new PointDoubleXY(WIDTH - 2 * S_RADIUS, 0) };
    final GeometricShapeFactory gsf = new GeometricShapeFactory(gf);
    gsf.setCentre(new PointDoubleXY(centreX, HEIGHT - S_RADIUS));
    gsf.setSize(2 * S_RADIUS);
    gsf.setNumPoints(10);
    final LineString arcTop = gsf.newArc(0.5 * Math.PI, Math.PI);
    final GeometricShapeFactory gsf2 = new GeometricShapeFactory(gf);
    gsf2.setCentre(new PointDoubleXY(centreX, S_RADIUS));
    gsf2.setSize(2 * S_RADIUS);
    gsf2.setNumPoints(10);
    final LineString arcBottom = gsf2.newArc(1.5 * Math.PI, Math.PI).reverse();
    final PointList coordList = new PointList();
    coordList.add(top, false);
    coordList.add(CoordinatesListUtil.getPointArray(arcTop), false, 1, arcTop.getVertexCount() - 1);
    coordList.add(new PointDoubleXY(centreX, HEIGHT / 2));
    coordList.add(CoordinatesListUtil.getPointArray(arcBottom), false, 1, arcBottom.getVertexCount() - 1);
    coordList.add(bottom, false);
    return gf.lineString(coordList.toPointArray());
}
Also used : PointList(com.revolsys.geometry.model.PointList) GeometryFactory(com.revolsys.geometry.model.GeometryFactory) GeometricShapeFactory(com.revolsys.geometry.util.GeometricShapeFactory) LineString(com.revolsys.geometry.model.LineString) Point(com.revolsys.geometry.model.Point) PointDoubleXY(com.revolsys.geometry.model.impl.PointDoubleXY)

Example 2 with GeometricShapeFactory

use of com.revolsys.geometry.util.GeometricShapeFactory in project com.revolsys.open by revolsys.

the class PreparedPolygonIntersectsStressTest method newCircle.

Geometry newCircle(final Point origin, final double size, final int nPts) {
    final GeometricShapeFactory gsf = new GeometricShapeFactory();
    gsf.setCentre(origin);
    gsf.setSize(size);
    gsf.setNumPoints(nPts);
    final Geometry circle = gsf.newCircle();
    // Geometry g = gRect.getExteriorRing();
    return circle;
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) GeometricShapeFactory(com.revolsys.geometry.util.GeometricShapeFactory)

Example 3 with GeometricShapeFactory

use of com.revolsys.geometry.util.GeometricShapeFactory in project com.revolsys.open by revolsys.

the class StressTestHarness method newTestCircle.

Geometry newTestCircle(final Point base, final double size, final int nPts) {
    final GeometricShapeFactory gsf = new GeometricShapeFactory();
    gsf.setCentre(base);
    gsf.setSize(size);
    gsf.setNumPoints(nPts);
    final Geometry circle = gsf.newCircle();
    // System.out.println(circle);
    return circle;
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) GeometricShapeFactory(com.revolsys.geometry.util.GeometricShapeFactory)

Example 4 with GeometricShapeFactory

use of com.revolsys.geometry.util.GeometricShapeFactory in project com.revolsys.open by revolsys.

the class PreparedPolygonIntersectsPerfTest method newCircle.

Geometry newCircle(final Point origin, final double size, final int nPts) {
    final GeometricShapeFactory gsf = new GeometricShapeFactory();
    gsf.setCentre(origin);
    gsf.setSize(size);
    gsf.setNumPoints(nPts);
    final Geometry circle = gsf.newCircle();
    // Geometry g = gRect.getExteriorRing();
    return circle;
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) GeometricShapeFactory(com.revolsys.geometry.util.GeometricShapeFactory)

Example 5 with GeometricShapeFactory

use of com.revolsys.geometry.util.GeometricShapeFactory in project com.revolsys.open by revolsys.

the class RectangleIntersectsPerfTest method newRectangle.

Geometry newRectangle(final Point origin, final double size) {
    final GeometricShapeFactory gsf = new GeometricShapeFactory();
    gsf.setCentre(origin);
    gsf.setSize(size);
    gsf.setNumPoints(4);
    final Geometry g = gsf.newRectangle();
    // Geometry g = gRect.getExteriorRing();
    return g;
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) GeometricShapeFactory(com.revolsys.geometry.util.GeometricShapeFactory)

Aggregations

GeometricShapeFactory (com.revolsys.geometry.util.GeometricShapeFactory)15 Geometry (com.revolsys.geometry.model.Geometry)13 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)4 LineString (com.revolsys.geometry.model.LineString)3 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)2 Point (com.revolsys.geometry.model.Point)2 PointList (com.revolsys.geometry.model.PointList)2 Polygon (com.revolsys.geometry.model.Polygon)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1