final Envelope candidate = geometry.getEnvelope(); if (candidate != null) { final CoordinateReferenceSystem sourceCRS =
public DirectPosition getRepresentativePoint() { // Return the representative point of the first primitive in this aggregate Iterator<? extends Primitive> elementIter = getElements().iterator(); return ((Geometry)elementIter.next()).getRepresentativePoint(); }
/** * The actual working method of the operation. * @param a Geometry object * @param b Geometry Object * @return a boolean indicating whether the result matched the expectation */ public boolean doOperation(final Geometry a, final Geometry b) { Boolean expected = (Boolean)expectedResult; Geometry geom1 = setGeomArg(arg1, a, b); Geometry geom2 = setGeomArg(arg2, a, b); Boolean result = Boolean.valueOf( geom1.contains(geom2) ); return result == expected; } }
while (iter.hasNext()) { Geometry prim = iter.next(); if (prim.getDimension(null) == maxD) { cp.add(new PointImpl(prim.getCentroid()));
/** * Union the various elements together and return the result. */ public Boundary getBoundary() { Boundary bounds = null; for( Geometry geometry : getElements() ){ Boundary boundary = geometry.getBoundary(); if (boundary != null) { if (bounds == null) { bounds = boundary; } else { bounds.union(boundary); } } } return bounds; }
/** * Calculates the centroid of object A * @param a Geometry object * @param b Geometry Object (not used) * @return a boolean indicating whether the result matched the expectation */ public boolean doOperation(final Geometry a, final Geometry b) { Geometry geom1 = setGeomArg(arg1, a, b); DirectPosition result = geom1.getCentroid(); return compareDirectPositionResult(result); } }
public int getDimension(DirectPosition point) { if (point != null) { return point.getDimension(); } else { // return the largest dimension of all the contained elements in this collection int maxD = 0; for( Geometry geometry : getElements() ){ maxD = Math.max( maxD, geometry.getDimension( null )); } return maxD; } } }
/** * The actual working method of the operation. * @param a Geometry object * @param b Geometry Object * @return a boolean indicating whether the result matched the expectation */ public boolean doOperation(final Geometry a, final Geometry b) { Boolean expected = (Boolean)expectedResult; Geometry geom1 = setGeomArg(arg1, a, b); Geometry geom2 = setGeomArg(arg2, a, b); Boolean result = Boolean.valueOf( geom1.intersects(geom2) ); return result == expected; } }
/** * Calculates the convex hull of object A * @param a Geometry object * @param b Geometry Object (not used) * @return a boolean indicating whether the result matched the expectation */ public boolean doOperation(final Geometry a, final Geometry b) { Geometry geom1 = setGeomArg(arg1, a, b); TransfiniteSet result = geom1.getConvexHull(); return compareTransfiniteSetResult(result); } }
/** * performs the intersection on the two arguments * @param a Geometry object * @param b Geometry Object * @return a boolean indicating whether the result matched the expectation */ public boolean doOperation(final Geometry a, final Geometry b) { Geometry geom1 = setGeomArg(arg1, a, b); Geometry geom2 = setGeomArg(arg2, a, b); TransfiniteSet result = geom1.intersection(geom2); return compareTransfiniteSetResult(result); } }
/** * Calculates the difference of objects A and B (A - B) * @param a Geometry object * @param b Geometry object * @return a boolean indicating whether the result matched the expectation */ public boolean doOperation(final Geometry a, final Geometry b) { Geometry geom1 = setGeomArg(arg1, a, b); Geometry geom2 = setGeomArg(arg2, a, b); TransfiniteSet result = geom1.difference(geom2); return compareTransfiniteSetResult(result); } }
/** * Calculates the boundary of object A * @param a Geometry object * @param b Geometry Object (not used) * @return a boolean indicating whether the result matched the expectation */ public boolean doOperation(final Geometry a, final Geometry b) { Geometry geom1 = setGeomArg(arg1, a, b); TransfiniteSet result = geom1.getBoundary(); return compareTransfiniteSetResult(result); } }
@Override public Object visit(Intersects filter, Object data) { Envelope2D envelope = (Envelope2D) data; Geometry polygon= ((Geometry)((Literal)filter.getExpression2()).getValue()); org.opengis.geometry.Geometry polygon2 = JTSUtils.jtsToGo1(polygon, envelope.getCoordinateReferenceSystem()); envelope.setBounds(new Envelope2D(polygon2.getEnvelope())); return super.visit(filter, data); }
/** * Calculates a representative point for object A * @param a Geometry object * @param b Geometry Object (not used) * @return a boolean indicating whether the result matched the expectation */ public boolean doOperation(final Geometry a, final Geometry b) { Geometry geom1 = setGeomArg(arg1, a, b); DirectPosition result = geom1.getRepresentativePoint(); return compareDirectPositionResult(result); } }