private boolean preppedEvaluate(PreparedGeometry prepped, Geometry other) { Envelope envLeft = prepped.getGeometry().getEnvelopeInternal(); Envelope envRight = other.getEnvelopeInternal(); if (envRight.intersects(envLeft)) { return prepped.intersects(other); } else { return false; } // Note that this is a pretty permissive logic // if the type has somehow been mis-set (can't happen externally) // then true is returned in all cases }
@Override public boolean evaluateInternal(Geometry left, Geometry right) { switch (literals) { case BOTH: return cacheValue; case RIGHT: { // if the right contains left then left is within right return rightPreppedGeom.contains(left); } case LEFT: { // since within does not have an optimization with prepared geometries // there is nothing to be gained in this case so use the normal check return basicEvaluate(leftPreppedGeom.getGeometry(), right); } default: { return basicEvaluate(left, right); } } }
if (representativeGeom.getGeometry() instanceof Point) { return 1.0; if (representativeGeom.getGeometry() instanceof LineString) { return 1.0; if (representativeGeom.getGeometry() instanceof Polygon) { Rectangle2D glyphBounds = painter.getFullLabelBounds(); try { Geometry g = representativeGeom.getGeometry(); g.geometryChanged(); Envelope ePoly = g.getEnvelopeInternal();
< painter.getLabel().getGoodnessOfFit()) { if (textStyle.flipRotation(pg.getGeometry())) { tempTransform.setTransform(original); setupPointTransform(tempTransform, centroid, textStyle, painter); || goodnessOfFit(painter, tempTransform, pg) < painter.getLabel().getGoodnessOfFit()) { textStyle.flipRotation(pg.getGeometry()); return false;
/** * Returns the ROI as a JTS {@code Geometry}. * * @return the geometry */ public Geometry getAsGeometry() { return theGeom.getGeometry(); }
/** * Returns the ROI as a JTS {@code Geometry}. * * @return the geometry */ public Geometry getAsGeometry() { return theGeom.getGeometry(); }
@Override public boolean compare( final Geometry dataGeometry, final PreparedGeometry constraintGeometry) { // This method is same as Geometry.equalsTopo which is // computationally expensive. // See equalsExact for quick structural equality return constraintGeometry.getGeometry().equals(dataGeometry); }
public GeometryImage(final PreparedGeometry preparedGeometry) { super(); this.preparedGeometry = preparedGeometry; geometryBinary = GeometryUtils.geometryToBinary(preparedGeometry.getGeometry(), null); }
/** * Gets a new {@link Shape} representing this ROI. * * @return the shape */ @Override public Shape getAsShape() { return new LiteShape(theGeom.getGeometry()); }
/** * Gets a new {@link Shape} representing this ROI. * * @return the shape */ @Override public Shape getAsShape() { return new LiteShape(theGeom.getGeometry()); }
/** * Gets a new {@link Shape} representing this ROI. * * @return the shape */ @Override public Shape getAsShape() { return new LiteShape(theGeom.getGeometry()); }
private void checkContainsProperly(PreparedGeometry pg, Geometry g2) { boolean pgResult = pg.containsProperly(g2); boolean expected = containsProperly(pg.getGeometry(), g2); if (pgResult != expected) throw new IllegalStateException("PreparedGeometry.containsProperly result does not match expected"); // System.out.println("Results match!"); }
private void checkIntersects(PreparedGeometry pg, Geometry g2) { boolean pgResult = pg.intersects(g2); boolean expected = pg.getGeometry().intersects(g2); if (pgResult != expected) { // pg.intersects(g2); throw new IllegalStateException("PreparedGeometry.intersects result does not match expected"); } // System.out.println("Results match!"); }
private void checkContains(PreparedGeometry pg, Geometry g2) { boolean pgResult = pg.contains(g2); boolean expected = pg.getGeometry().contains(g2); if (pgResult != expected) throw new IllegalStateException("PreparedGeometry.contains result does not match expected"); // System.out.println("Results match!"); }
private void checkCovers(PreparedGeometry pg, Geometry g2) { boolean pgResult = pg.covers(g2); boolean expected = pg.getGeometry().covers(g2); if (pgResult != expected) throw new IllegalStateException("PreparedGeometry.covers result does not match expected"); // System.out.println("Results match!"); }
/** * Gets the enclosing double-precision rectangle of this ROI. * * @return a new rectangle */ @Override public Rectangle2D getBounds2D() { Envelope env = theGeom.getGeometry().getEnvelopeInternal(); return new Rectangle2D.Double(env.getMinX(), env.getMinY(), env.getWidth(), env.getHeight()); }
/** * Gets the enclosing double-precision rectangle of this ROI. * * @return a new rectangle */ @Override public Rectangle2D getBounds2D() { Envelope env = theGeom.getGeometry().getEnvelopeInternal(); return new Rectangle2D.Double(env.getMinX(), env.getMinY(), env.getWidth(), env.getHeight()); }
/** * Gets the enclosing rectangle of this ROI. * * @return a new rectangle */ @Override public Rectangle getBounds() { Envelope env = theGeom.getGeometry().getEnvelopeInternal(); return new Rectangle((int)env.getMinX(), (int)env.getMinY(), (int)env.getWidth(), (int)env.getHeight()); }
/** * Gets the enclosing rectangle of this ROI. * * @return a new rectangle */ @Override public Rectangle getBounds() { Envelope env = theGeom.getGeometry().getEnvelopeInternal(); return new Rectangle((int)env.getMinX(), (int)env.getMinY(), (int)env.getWidth(), (int)env.getHeight()); }
/** * Gets the enclosing rectangle of this ROI. * * @return a new rectangle */ @Override public Rectangle getBounds() { Envelope env = theGeom.getGeometry().getEnvelopeInternal(); return new Rectangle((int)env.getMinX(), (int)env.getMinY(), (int)env.getWidth(), (int)env.getHeight()); }