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;
}
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);
}
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;
}
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());
}
}
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());
}
Aggregations