org.locationtech.jts.geom.Geometry.equalsNorm()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(169)

本文整理了Java中org.locationtech.jts.geom.Geometry.equalsNorm()方法的一些代码示例,展示了Geometry.equalsNorm()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.equalsNorm()方法的具体详情如下:
包路径:org.locationtech.jts.geom.Geometry
类名称:Geometry
方法名:equalsNorm

Geometry.equalsNorm介绍

[英]Tests whether two geometries are exactly equal in their normalized forms. This is a convenience method which creates normalized versions of both geometries before computing #equalsExact(Geometry).

This method is relatively expensive to compute. For maximum performance, the client should instead perform normalization on the individual geometries at an appropriate point during processing.
[中]测试两个几何体的规格化形式是否完全相等。这是一种方便的方法,可以在计算#equalsExact(几何体)之前创建两种几何体的规范化版本。
这种方法的计算成本相对较高。为了获得最佳性能,客户机应该在处理过程中的适当点对各个几何图形执行标准化。

代码示例

代码示例来源:origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-queryalgebra-geosparql

public boolean equals(Shape s1, Shape s2) {
  return shapeFactory.getGeometryFrom(s1).equalsNorm(shapeFactory.getGeometryFrom(s2));
}

代码示例来源:origin: locationtech/jts

void checkExpectedEnvelopeGeometry(String wktInput, String wktEnvGeomExpected)
  throws ParseException
{
  Geometry input = reader.read(wktInput);
  Geometry envGeomExpected = reader.read(wktEnvGeomExpected);
  
  Envelope env = input.getEnvelopeInternal();
  Geometry envGeomActual = geometryFactory.toGeometry(env);
  boolean isEqual = envGeomActual.equalsNorm(envGeomExpected);
  assertTrue(isEqual);
}

代码示例来源:origin: locationtech/jts

private void runLineSequencer(String[] inputWKT, String expectedWKT)
  throws ParseException
{
 List inputGeoms = fromWKT(inputWKT);
 LineSequencer sequencer = new LineSequencer();
 sequencer.add(inputGeoms);
 boolean isCorrect = false;
 if (! sequencer.isSequenceable()) {
  assertTrue(expectedWKT == null);
 }
 else {
  Geometry expected = rdr.read(expectedWKT);
  Geometry result = sequencer.getSequencedLineStrings();
  boolean isOK = expected.equalsNorm(result);
  if (! isOK) {
   System.out.println("ERROR - Expected: " + expected);
   System.out.println("          Actual: " + result);
  }
  assertTrue(isOK);
  boolean isSequenced = LineSequencer.isSequenced(result);
  assertTrue(isSequenced);
 }
}

相关文章