Search in sources :

Example 16 with Geometry

use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.

the class SnapIfNeededOverlayOp method getResultGeometry.

public Geometry getResultGeometry(final int opCode) {
    Geometry result = null;
    boolean isSuccess = false;
    RuntimeException savedException = null;
    try {
        // try basic operation with input geometries
        result = OverlayOp.overlayOp(this.geometry1, this.geometry2, opCode);
        final boolean isValid = true;
        // OverlayOp.INTERSECTION, result);
        if (isValid) {
            isSuccess = true;
        }
    } catch (final RuntimeException ex) {
        savedException = ex;
    // ignore this exception, since the operation will be rerun
    // System.out.println(ex.getMessage());
    // ex.printStackTrace();
    // System.out.println(ex.getMessage());
    // System.out.println("Geom 0: " + geometry1);
    // System.out.println("Geom 1: " + geometry2);
    }
    if (!isSuccess) {
        try {
            result = SnapOverlayOp.overlayOp(this.geometry1, this.geometry2, opCode);
        } catch (final RuntimeException ex) {
            throw savedException;
        }
    }
    return result;
}
Also used : Geometry(com.revolsys.geometry.model.Geometry)

Example 17 with Geometry

use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.

the class SnapOverlayOp method getResultGeometry.

public Geometry getResultGeometry(final int opCode) {
    // Geometry[] selfSnapGeom = new Geometry[] { selfSnap(geom[0]),
    // selfSnap(geom[1])};
    final Geometry[] prepGeom = snap(this.geom);
    final Geometry result = OverlayOp.overlayOp(prepGeom[0], prepGeom[1], opCode);
    return prepareResult(result);
}
Also used : Geometry(com.revolsys.geometry.model.Geometry)

Example 18 with Geometry

use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.

the class SnapOverlayOp method removeCommonBits.

private Geometry[] removeCommonBits(final Geometry[] geom) {
    this.cbr = new CommonBitsRemover();
    this.cbr.add(geom[0]);
    this.cbr.add(geom[1]);
    final Geometry[] remGeom = new Geometry[2];
    remGeom[0] = this.cbr.removeCommonBits(geom[0].clone());
    remGeom[1] = this.cbr.removeCommonBits(geom[1].clone());
    return remGeom;
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) CommonBitsRemover(com.revolsys.geometry.precision.CommonBitsRemover)

Example 19 with Geometry

use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.

the class RelateComputer method computeDisjointIM.

/**
 * If the Geometries are disjoint, we need to enter their dimension and
 * boundary dimension in the Ext rows in the IM
 */
private void computeDisjointIM(final IntersectionMatrix im) {
    final Geometry ga = this.arg[0].getGeometry();
    if (!ga.isEmpty()) {
        im.set(Location.INTERIOR, Location.EXTERIOR, ga.getDimension());
        im.set(Location.BOUNDARY, Location.EXTERIOR, ga.getBoundaryDimension());
    }
    final Geometry gb = this.arg[1].getGeometry();
    if (!gb.isEmpty()) {
        im.set(Location.EXTERIOR, Location.INTERIOR, gb.getDimension());
        im.set(Location.EXTERIOR, Location.BOUNDARY, gb.getBoundaryDimension());
    }
}
Also used : Geometry(com.revolsys.geometry.model.Geometry)

Example 20 with Geometry

use of com.revolsys.geometry.model.Geometry in project com.revolsys.open by revolsys.

the class RelateComputer method labelIsolatedNode.

/**
 * Label an isolated node with its relationship to the target geometry.
 */
private void labelIsolatedNode(final Node n, final int targetIndex) {
    final Geometry geometry = this.arg[targetIndex].getGeometry();
    final double x = n.getX();
    final double y = n.getY();
    final Location loc = this.ptLocator.locate(geometry, x, y);
    n.getLabel().setAllLocations(targetIndex, loc);
// debugPrintln(n.getLabel());
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) Location(com.revolsys.geometry.model.Location)

Aggregations

Geometry (com.revolsys.geometry.model.Geometry)488 Point (com.revolsys.geometry.model.Point)140 LineString (com.revolsys.geometry.model.LineString)87 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)75 ArrayList (java.util.ArrayList)70 BoundingBox (com.revolsys.geometry.model.BoundingBox)39 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)39 Polygon (com.revolsys.geometry.model.Polygon)34 List (java.util.List)33 Record (com.revolsys.record.Record)32 Iterator (java.util.Iterator)20 RecordDefinition (com.revolsys.record.schema.RecordDefinition)18 LinearRing (com.revolsys.geometry.model.LinearRing)16 Vertex (com.revolsys.geometry.model.vertex.Vertex)16 LayerRecord (com.revolsys.swing.map.layer.record.LayerRecord)14 LineSegment (com.revolsys.geometry.model.segment.LineSegment)13 GeometricShapeFactory (com.revolsys.geometry.util.GeometricShapeFactory)13 FieldDefinition (com.revolsys.record.schema.FieldDefinition)12 DataType (com.revolsys.datatype.DataType)10 IOException (java.io.IOException)10