Search in sources :

Example 11 with GeometricShapeFactory

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

the class StressTestHarness 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 12 with GeometricShapeFactory

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

the class TestDataBuilder method newCircle.

public Geometry newCircle(final int nPts) {
    final GeometricShapeFactory gsf = new GeometricShapeFactory();
    gsf.setCentre(this.origin);
    gsf.setSize(this.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 13 with GeometricShapeFactory

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

the class TestDataBuilder method newLine.

Geometry newLine(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.getBoundary();
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) GeometricShapeFactory(com.revolsys.geometry.util.GeometricShapeFactory)

Example 14 with GeometricShapeFactory

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

the class PolygonBufferStressTest method test.

public void test() {
    final String geomStr;
    final GeometricShapeFactory shapeFact = new GeometricShapeFactory(geometryFactory);
    final Geometry g = getSampleGeometry();
    // Geometry g = GeometricShapeFactory.createArc(geometryFactory, 0, 0,
    // 200.0, 0.0, 6.0,
    // 100);
    // Geometry circle = GeometricShapeFactory.createCircle(geometryFactory, 0,
    // 0, 200,
    // 100);
    // Geometry g = circle;
    // Geometry sq = GeometricShapeFactory.createBox(geometryFactory, 0, 0, 1,
    // 120);
    // Geometry g = sq.difference(circle);
    // Geometry handle = GeometricShapeFactory.createRectangle(geometryFactory,
    // 0, 0, 400,
    // 20, 1);
    // Geometry g = circle.union(handle);
    // System.out.println(g);
    test(g);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) GeometricShapeFactory(com.revolsys.geometry.util.GeometricShapeFactory)

Example 15 with GeometricShapeFactory

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

the class JTSFunctions method newJ.

private static Geometry newJ(final Geometry g) {
    final GeometryFactory gf = FunctionsUtil.getFactoryOrDefault(g);
    final Point[] jTop = new Point[] { new PointDoubleXY(0, HEIGHT), new PointDoubleXY(J_WIDTH, HEIGHT), new PointDoubleXY(J_WIDTH, J_RADIUS) };
    final Point[] jBottom = new Point[] { new PointDoubleXY(J_WIDTH - J_RADIUS, 0), new PointDoubleXY(0, 0) };
    final GeometricShapeFactory gsf = new GeometricShapeFactory(gf);
    gsf.setBase(new PointDoubleXY(J_WIDTH - 2 * J_RADIUS, 0));
    gsf.setSize(2 * J_RADIUS);
    gsf.setNumPoints(10);
    final LineString jArc = gsf.newArc(1.5 * Math.PI, 0.5 * Math.PI);
    final PointList coordList = new PointList();
    coordList.add(jTop, false);
    coordList.add(CoordinatesListUtil.getPointArray(jArc.reverse()), false, 1, jArc.getVertexCount() - 1);
    coordList.add(jBottom, 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)

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