本文整理了Java中org.locationtech.jts.geom.Polygon.copy()
方法的一些代码示例,展示了Polygon.copy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Polygon.copy()
方法的具体详情如下:
包路径:org.locationtech.jts.geom.Polygon
类名称:Polygon
方法名:copy
暂无
代码示例来源:origin: locationtech/jts
/**
* Creates and returns a full copy of this {@link Polygon} object.
* (including all coordinates contained by it).
*
* @return a clone of this instance
* @deprecated
*/
public Object clone() {
return copy();
}
代码示例来源:origin: geotools/geotools
private double[] getTranslationFactors(Polygon reference, Polygon displaced) {
// compare the two envelopes
Envelope re = reference.getEnvelopeInternal();
Envelope de = displaced.getEnvelopeInternal();
double dw = Math.abs(re.getWidth() - de.getWidth());
double dh = Math.abs(re.getHeight() - de.getHeight());
if (dw > EPS * re.getWidth() || dh > EPS * re.getWidth()) {
// this was not just a translation
return null;
}
// compute the translation
double dx = de.getMinX() - re.getMinX();
double dy = de.getMinY() - re.getMinY();
Polygon cloned = (Polygon) displaced.copy();
cloned.apply(AffineTransformation.translationInstance(-dx, -dy));
if (1 - new HausdorffSimilarityMeasure().measure(cloned, reference) > EPS) {
return null;
} else {
return new double[] {dx, dy};
}
}
代码示例来源:origin: locationtech/jts
public Geometry reverse() {
Polygon poly = (Polygon) copy();
poly.shell = (LinearRing) shell.copy().reverse();
poly.holes = new LinearRing[holes.length];
for (int i = 0; i < holes.length; i++) {
poly.holes[i] = (LinearRing) holes[i].copy().reverse();
}
return poly;// return the clone
}
}
代码示例来源:origin: orbisgis/h2gis
/**
* Extract the roof of a polygon
*
* @param polygon
* @param height
* @return
*/
public static Polygon extractRoof(Polygon polygon, double height) {
GeometryFactory factory = polygon.getFactory();
Polygon roofP = (Polygon)polygon.copy();
roofP.apply(new TranslateCoordinateSequenceFilter(height));
final LinearRing shell = factory.createLinearRing(getCounterClockWise(roofP.getExteriorRing()).getCoordinates());
final int nbOfHoles = roofP.getNumInteriorRing();
final LinearRing[] holes = new LinearRing[nbOfHoles];
for (int i = 0; i < nbOfHoles; i++) {
holes[i] = factory.createLinearRing(getClockWise(
roofP.getInteriorRingN(i)).getCoordinates());
}
return factory.createPolygon(shell, holes);
}
内容来源于网络,如有侵权,请联系作者删除!