本文整理了Java中org.locationtech.jts.geom.Geometry.normalize()
方法的一些代码示例,展示了Geometry.normalize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.normalize()
方法的具体详情如下:
包路径:org.locationtech.jts.geom.Geometry
类名称:Geometry
方法名:normalize
[英]Converts this Geometry
to normal form (or canonical form ). Normal form is a unique representation for Geometry
s. It can be used to test whether two Geometry
s are equal in a way that is independent of the ordering of the coordinates within them. Normal form equality is a stronger condition than topological equality, but weaker than pointwise equality. The definitions for normal form use the standard lexicographical ordering for coordinates. "Sorted in order of coordinates" means the obvious extension of this ordering to sequences of coordinates.
NOTE that this method mutates the value of this geometry in-place. If this is not safe and/or wanted, the geometry should be cloned prior to normalization.
[中]将此Geometry
转换为正常形式(或规范形式)。范式是Geometry
s的唯一表示形式。它可用于测试两个Geometry
s是否相等,其方式与它们内部坐标的顺序无关。正规形式等式是比拓扑等式更强的条件,但比逐点等式弱。标准形式的定义使用坐标的标准词典顺序。“按坐标顺序排序”是指这种排序对坐标顺序的明显扩展。
请注意,此方法会原地更改此几何图形的值。如果这不安全和/或不需要,则应在标准化之前克隆几何体。
代码示例来源:origin: geotools/geotools
public void normalize() {
geometry.normalize();
}
代码示例来源:origin: geotools/geotools
geometry.normalize();
代码示例来源:origin: orbisgis/h2gis
/**
* Converts this Geometry to normal form (canonical form).
*
* @param geometry
* @return
*/
public static Geometry normalize(Geometry geometry) {
if(geometry == null){
return null;
}
geometry.normalize();
return geometry;
}
}
代码示例来源:origin: locationtech/jts
public void normalize() {
for (int i = 0; i < geometries.length; i++) {
geometries[i].normalize();
}
Arrays.sort(geometries);
}
代码示例来源:origin: locationtech/jts
public static Geometry normalize(Geometry g)
{
Geometry gNorm = (Geometry) g.clone();
gNorm.normalize();
return gNorm;
}
代码示例来源:origin: locationtech/geogig
Geometry normalizeIfNeeded(Geometry value) {
if (value instanceof Polygon) {
value.normalize();
} else if (value instanceof MultiPolygon
|| GeometryCollection.class.equals(value.getClass())) {// ignore
// multipoint/linestring
normalize((GeometryCollection) value);
}
return value;
}
代码示例来源:origin: locationtech/jts
/**
* Creates a new Geometry which is a normalized
* copy of this Geometry.
*
* @return a normalized copy of this geometry.
* @see #normalize()
*/
public Geometry norm()
{
Geometry copy = copy();
copy.normalize();
return copy;
}
代码示例来源:origin: locationtech/jts
public boolean match(Geometry a, Geometry b)
{
Geometry aClone = (Geometry)a.clone();
Geometry bClone =(Geometry) b.clone();
aClone.normalize();
bClone.normalize();
return aClone.equalsExact(bClone, tolerance);
}
代码示例来源:origin: locationtech/jts
public boolean equals(Result other, double tolerance) {
if (!(other instanceof GeometryResult)) {
return false;
}
GeometryResult otherGeometryResult = (GeometryResult) other;
Geometry otherGeometry = otherGeometryResult.geometry;
Geometry thisGeometryClone = (Geometry)geometry.clone();
Geometry otherGeometryClone =(Geometry) otherGeometry.clone();
thisGeometryClone.normalize();
otherGeometryClone.normalize();
return thisGeometryClone.equalsExact(otherGeometryClone, tolerance);
}
代码示例来源:origin: locationtech/jts
void assertEqualsExact(Geometry g1, Geometry g2, String msg) {
Geometry g1Clone = (Geometry) g1.clone();
Geometry g2Clone = (Geometry) g2.clone();
g1Clone.normalize();
g2Clone.normalize();
assertTrue(g1Clone.equalsExact(g2Clone), msg);
}
代码示例来源:origin: locationtech/jts
public static Geometry normalize(Geometry g)
{
Geometry g2 = (Geometry) g.copy();
g2.normalize();
return g2;
}
}
代码示例来源:origin: org.jaitools/jt-utils
PRECISION.makePrecise(cc1);
cloned.normalize();
} else {
geomFactory = FLOAT_PRECISION_FACTORY;
FLOAT_PRECISION.makePrecise(cc1);
cloned.normalize();
代码示例来源:origin: geosolutions-it/jai-ext
PRECISION.makePrecise(cc1);
cloned.normalize();
} else {
geomFactory = FLOAT_PRECISION_FACTORY;
FLOAT_PRECISION.makePrecise(cc1);
cloned.normalize();
代码示例来源:origin: it.geosolutions.jaiext.vectorbin/jt-vectorbin
PRECISION.makePrecise(cc1);
cloned.normalize();
} else {
geomFactory = FLOAT_PRECISION_FACTORY;
FLOAT_PRECISION.makePrecise(cc1);
cloned.normalize();
代码示例来源:origin: locationtech/jts
public void testNormalizePackedCoordinateSequence() throws Exception {
GeometryFactory pcsFactory = new GeometryFactory(PackedCoordinateSequenceFactory.DOUBLE_FACTORY);
WKTReader pcsReader = new WKTReader(pcsFactory);
Geometry geom = pcsReader.read("LINESTRING (100 100, 0 0)");
geom.normalize();
// force PackedCoordinateSequence to be copied with empty coordinate cache
Geometry clone = (Geometry) geom.copy();
assertEqualsExact(geom, clone);
}
代码示例来源:origin: locationtech/jts
public void testEquals10() throws Exception {
WKTReader reader = new WKTReader(new GeometryFactory(new PrecisionModel(1), 0));
Geometry l1 = reader.read("POLYGON((1732328800 519578384, 1732026179 519976285, 1731627364 519674014, 1731929984 519276112, 1732328800 519578384))");
Geometry l2 = reader.read("POLYGON((1731627364 519674014, 1731929984 519276112, 1732328800 519578384, 1732026179 519976285, 1731627364 519674014))");
l1.normalize();
l2.normalize();
assertTrue(l1.equalsExact(l2));
}
代码示例来源:origin: locationtech/jts
void runDelaunay(String sitesWKT, boolean computeTriangles, String expectedWKT)
throws ParseException
{
Geometry sites = reader.read(sitesWKT);
DelaunayTriangulationBuilder builder = new DelaunayTriangulationBuilder();
builder.setSites(sites);
Geometry result = null;
if (computeTriangles) {
result = builder.getTriangles(geomFact);
}
else {
result = builder.getEdges(geomFact);
}
//System.out.println(result);
Geometry expected = reader.read(expectedWKT);
result.normalize();
expected.normalize();
assertTrue(expected.equalsExact(result, COMPARISON_TOLERANCE));
}
}
代码示例来源:origin: locationtech/jts
private void runBoundaryTest(String wkt, BoundaryNodeRule bnRule, String wktExpected)
throws ParseException
{
Geometry g = rdr.read(wkt);
Geometry expected = rdr.read(wktExpected);
BoundaryOp op = new BoundaryOp(g, bnRule);
Geometry boundary = op.getBoundary();
boundary.normalize();
// System.out.println("Computed Boundary = " + boundary);
assertTrue(boundary.equalsExact(expected));
}
代码示例来源:origin: locationtech/jts
void runVoronoi(String sitesWKT, boolean computeTriangles, String expectedWKT)
throws ParseException
{
Geometry sites = reader.read(sitesWKT);
DelaunayTriangulationBuilder builder = new DelaunayTriangulationBuilder();
builder.setSites(sites);
QuadEdgeSubdivision subdiv = builder.getSubdivision();
GeometryFactory geomFact = new GeometryFactory();
Geometry result = null;
if (computeTriangles) {
result = subdiv.getVoronoiDiagram(geomFact);
}
else {
//result = builder.getEdges(geomFact);
}
//System.out.println(result);
Geometry expectedEdges = reader.read(expectedWKT);
result.normalize();
expectedEdges.normalize();
assertTrue(expectedEdges.equalsExact(result, COMPARISON_TOLERANCE));
}
}
代码示例来源:origin: locationtech/jts
void runDelaunay(String sitesWKT, String constraintsWKT, boolean computeTriangles, String expectedWKT)
throws ParseException
{
Geometry sites = reader.read(sitesWKT);
Geometry constraints = reader.read(constraintsWKT);
ConformingDelaunayTriangulationBuilder builder = new ConformingDelaunayTriangulationBuilder();
builder.setSites(sites);
builder.setConstraints(constraints);
GeometryFactory geomFact = new GeometryFactory();
Geometry result = null;
if (computeTriangles) {
result = builder.getTriangles(geomFact);
}
else {
result = builder.getEdges(geomFact);
}
//System.out.println(result);
Geometry expectedEdges = reader.read(expectedWKT);
result.normalize();
expectedEdges.normalize();
assertTrue(expectedEdges.equalsExact(result, COMPARISON_TOLERANCE));
}
}
内容来源于网络,如有侵权,请联系作者删除!