/** * Compare to another object. * * We can't use identity equality, because point features may be serialized and deserialized * and thus the same PointFeature may exist in memory more than once. For example, PointFeatures * are compared inside the conveyal/otpa-cluster project to figure out which origins have * returned from the compute cluster. */ public boolean equals (Object o) { if (o instanceof PointFeature) { PointFeature f = (PointFeature) o; return f.lat == this.lat && f.lon == this.lon && (f.geom == this.geom || f.geom != null && f.geom.equals(this.geom)) && (f.id == this.id || f.id != null && f.id.equals(this.id)) && this.properties.equals(f.properties); } return false; }
/** * @param geom first geometry * @param g second geometry * @return <code>true</code> if the first geometry equals the second */ public static boolean equals(Geometry geom, Geometry g) { if (geom == null || g == null) return false; return geom.equals(g); }
@Override public boolean matches(Geometry geo) { return geo.equals(queryGeo); } }
/** * Return true if Geometry A is equal to Geometry B * * @param a Geometry Geometry. * @param b Geometry instance * @return true if Geometry A is equal to Geometry B */ public static Boolean geomEquals(Geometry a, Geometry b) { if(a==null || b==null) { return null; } return a.equals(b); } }
public boolean equals(Object obj) { return geometry.equals(obj); }
/** * Return true if Geometry A is equal to Geometry B * * @param a Geometry Geometry. * @param b Geometry instance * @return true if Geometry A is equal to Geometry B */ public static Boolean geomEquals(Geometry a, Geometry b) { if(a==null || b==null) { return null; } return a.equals(b); } }
/** * Return true if Geometry A is equal to Geometry B * * @param a Geometry Geometry. * @param b Geometry instance * @return true if Geometry A is equal to Geometry B */ public static Boolean geomEquals(Geometry a, Geometry b) { if(a==null || b==null) { return null; } return a.equals(b); } }
@Override public boolean equals( Geometry geometry ) { JTSGeometryPair jtsGeoms = JTSGeometryPair.createCompatiblePair( this, geometry ); return jtsGeoms.first.equals( jtsGeoms.second ); }
@Override public boolean equalsExact(Geometry g, double tolerance) { String type1 = this.getGeometryType(); String type2 = ((Geometry) g).getGeometryType(); double radius1 = this.radius; double radius2 = ((Circle) g).radius; if (type1 != type2) { return false; } if (radius1 != radius2) { return false; } return this.centerGeometry.equals(((Circle) g).centerGeometry); }
@Override public boolean equalsExact(Geometry g, double tolerance) { String type1 = this.getGeometryType(); String type2 = ((Geometry) g).getGeometryType(); double radius1 = this.radius; double radius2 = ((Circle) g).radius; if (type1 != type2) { return false; } if (radius1 != radius2) { return false; } return this.centerGeometry.equals(((Circle) g).centerGeometry); }
@Override public Item item(final QueryContext qc, final InputInfo ii) throws QueryException { return Bln.get(checkGeo(0, qc).equals(checkGeo(1, qc))); } }
/** * Compares two geometries for equality. */ protected void assertEquals(Geometry expected, Geometry actual) { if (expected == actual) { return; } assertNotNull(expected); assertNotNull(actual); assertTrue(expected.equals(actual)); }
/** * Compares two geometries for equality. */ protected void assertEquals(String message, Geometry expected, Geometry actual) { if (expected == actual) { return; } assertNotNull(message, expected); assertNotNull(message, actual); assertTrue(message, expected.equals(actual)); }
public ClippingFeatureIterator(SimpleFeatureIterator delegate, Geometry clip, SimpleFeatureType schema) { this.delegate = delegate; // can we use the fast clipper? if(clip.getEnvelope().equals(clip)) { this.clipper = new GeometryClipper(clip.getEnvelopeInternal()); } else { this.clip = clip; } fb = new SimpleFeatureBuilder(schema); }
public ClipWithGeometryFeatureIterator(SimpleFeatureIterator delegate, Geometry clip, SimpleFeatureType schema) { this.delegate = delegate; // can we use the fast clipper? if (clip.getEnvelope().equals(clip)) { this.clipper = new GeometryClipper(clip.getEnvelopeInternal()); } else { this.clip = clip; } builder = new SimpleFeatureBuilder(schema); }
/** * Return the max distance * * @return */ public Double getDistance() { if (geomA == null || geomB == null) { return null; } if (geomA.isEmpty() || geomB.isEmpty()) { return 0.0; } if (geomA.equals(geomB)) { sameGeom = true; } if (maxDistanceFilter == null) { computeMaxDistance(); } return maxDistanceFilter.getDistance(); }
public boolean evaluate(Object feature) { if (feature instanceof Feature && !validate((Feature)feature)) return false; Geometry left = getLeftGeometry(feature); Geometry right = getRightGeometry(feature); Envelope envLeft = left.getEnvelopeInternal(); Envelope envRight = right.getEnvelopeInternal(); if (envRight.equals(envLeft)) return left.equals(right); else return false; }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ProfileLevel other = (ProfileLevel) obj; if ((getLevelStart() == null) ? (other.getLevelStart() != null) : !getLevelStart().equals(other.getLevelStart())) { return false; } if ((getLevelEnd() == null) ? (other.getLevelEnd() != null) : !getLevelEnd().equals(other.getLevelEnd())) { return false; } if ((getLocation() == null) ? (other.getLocation() != null) : !getLocation().equals(other.getLocation())) { return false; } return super.equals(obj); }
private boolean checkSamplingGeometry(ObservationMergeIndicator indicator, OmObservation observation) { return !indicator.isSamplingGeometry() || (isSetSpatialFilteringProfileParameter() && observation.isSetSpatialFilteringProfileParameter() && getSpatialFilteringProfileParameter().getValue().getValue() .equals(observation.getSpatialFilteringProfileParameter().getValue().getValue())); }
public void testRun() throws Exception { ScriptProcessFactory pf = new ScriptProcessFactory(scriptMgr); Name buffer = pf.getNames().iterator().next(); assertEquals(getNamespace(), buffer.getNamespaceURI()); assertEquals(getProcessName(), buffer.getLocalPart()); org.geotools.process.Process p = pf.create(buffer); Geometry g = new WKTReader().read("POINT(0 0)"); Map inputs = new HashMap(); inputs.put("geom", g); inputs.put("distance", 1); Map outputs = p.execute(inputs, null); Geometry h = (Geometry) outputs.get("result"); assertTrue(h.equals(g.buffer(1))); }