本文整理了Java中com.vividsolutions.jts.geom.Geometry.equals()
方法的一些代码示例,展示了Geometry.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.equals()
方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Geometry
类名称:Geometry
方法名:equals
[英]Tests whether this geometry is topologically equal to the argument geometry.
This method is included for backward compatibility reasons. It has been superseded by the #equalsTopo(Geometry) method, which has been named to clearly denote its functionality.
This method should NOT be confused with the method #equals(Object), which implements an exact equality comparison.
[中]测试此几何图形在拓扑上是否等于参数几何图形。
出于向后兼容性的原因,包含此方法。它已被#equalsTopo(几何)方法取代,该方法的命名是为了清楚地表示其功能。
此方法不应与#equals(Object)方法混淆,后者实现精确的相等比较。
代码示例来源:origin: opentripplanner/OpenTripPlanner
/**
* 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;
}
代码示例来源:origin: org.n52.epos/epos-pattern-util
/**
* @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);
}
代码示例来源:origin: ryantxu/spatial-solr-sandbox
@Override
public boolean matches(Geometry geo) {
return geo.equals(queryGeo);
}
}
代码示例来源:origin: org.orbisgis/h2spatial
/**
* 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);
}
}
代码示例来源:origin: org.geotools/gt-render
public boolean equals(Object obj) {
return geometry.equals(obj);
}
代码示例来源:origin: org.orbisgis/h2gis-functions
/**
* 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);
}
}
代码示例来源:origin: org.orbisgis/h2gis
/**
* 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);
}
}
代码示例来源:origin: deegree/deegree3
@Override
public boolean equals( Geometry geometry ) {
JTSGeometryPair jtsGeoms = JTSGeometryPair.createCompatiblePair( this, geometry );
return jtsGeoms.first.equals( jtsGeoms.second );
}
代码示例来源:origin: org.datasyslab/geospark
@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);
}
代码示例来源:origin: DataSystemsLab/GeoSpark
@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);
}
代码示例来源:origin: BaseXdb/basex
@Override
public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
return Bln.get(checkGeo(0, qc).equals(checkGeo(1, qc)));
}
}
代码示例来源:origin: org.geotools/gt2-main
/**
* Compares two geometries for equality.
*/
protected void assertEquals(Geometry expected, Geometry actual) {
if (expected == actual) {
return;
}
assertNotNull(expected);
assertNotNull(actual);
assertTrue(expected.equals(actual));
}
代码示例来源:origin: org.geotools/gt2-main
/**
* 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));
}
代码示例来源:origin: org.geotools/gt-process-feature
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);
}
代码示例来源:origin: mapplus/spatial_statistics_for_geotools_udig
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);
}
代码示例来源:origin: org.orbisgis/h2gis-functions
/**
* 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();
}
代码示例来源:origin: org.geotools/gt2-main
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;
}
代码示例来源:origin: org.n52.shetland/shetland
@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);
}
代码示例来源:origin: org.n52.shetland/shetland
private boolean checkSamplingGeometry(ObservationMergeIndicator indicator, OmObservation observation) {
return !indicator.isSamplingGeometry()
|| (isSetSpatialFilteringProfileParameter() && observation.isSetSpatialFilteringProfileParameter()
&& getSpatialFilteringProfileParameter().getValue().getValue()
.equals(observation.getSpatialFilteringProfileParameter().getValue().getValue()));
}
代码示例来源:origin: org.geoserver.script/gs-script-core
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)));
}
内容来源于网络,如有侵权,请联系作者删除!