本文整理了Java中org.locationtech.jts.geom.Polygon.getNumInteriorRing()
方法的一些代码示例,展示了Polygon.getNumInteriorRing()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Polygon.getNumInteriorRing()
方法的具体详情如下:
包路径:org.locationtech.jts.geom.Polygon
类名称:Polygon
方法名:getNumInteriorRing
暂无
代码示例来源:origin: geotools/geotools
public static int numInteriorRing(Geometry arg0) {
if (!(arg0 instanceof Polygon)) return 0;
Polygon _this = (Polygon) arg0;
return _this.getNumInteriorRing();
}
代码示例来源:origin: geotools/geotools
public int getNumInteriorRing() {
return polygon.getNumInteriorRing();
}
代码示例来源:origin: prestodb/presto
Polygon polygon = (Polygon) geometry.getGeometryN(i);
if (polygon.getNumPoints() > 0) {
numParts += polygon.getNumInteriorRing() + 1;
currentPoint += polygon.getExteriorRing().getNumPoints();
int holesCount = polygon.getNumInteriorRing();
for (int holeIndex = 0; holeIndex < holesCount; holeIndex++) {
partIndexes[currentPart] = currentPoint;
代码示例来源:origin: geotools/geotools
public static Geometry interiorRingN(Geometry arg0, Integer arg1) {
if (!(arg0 instanceof Polygon) || arg1 == null) return null;
Polygon _this = (Polygon) arg0;
if (arg1 < 0 || arg1 >= _this.getNumInteriorRing()) return null;
return _this.getInteriorRingN(arg1);
}
代码示例来源:origin: geotools/geotools
public Object getProperty(Object object, QName name) throws Exception {
Polygon p = (Polygon) object;
if ("outerBoundaryIs".equals(name.getLocalPart())) {
return p.getExteriorRing();
} else if ("innerBoundaryIs".equals(name.getLocalPart())) {
if (p.getNumInteriorRing() > 0) {
LinearRing[] interior = new LinearRing[p.getNumInteriorRing()];
for (int i = 0; i < interior.length; i++) {
interior[i] = (LinearRing) p.getInteriorRingN(i);
}
return interior;
}
}
return null;
}
}
代码示例来源:origin: geotools/geotools
List toList(Polygon poly) {
ArrayList list = new ArrayList();
list.add(
new CoordinateSequenceEncoder(
poly.getExteriorRing().getCoordinateSequence(), scale));
for (int i = 0; i < poly.getNumInteriorRing(); i++) {
list.add(
new CoordinateSequenceEncoder(
poly.getInteriorRingN(i).getCoordinateSequence(), scale));
}
return list;
}
代码示例来源:origin: geotools/geotools
@DescribeProcess(
title = "Interior Ring Count",
description =
"Returns the total number of interior rings in a polygonal geometry. Points and lines return 0."
)
@DescribeResult(description = "Total number of interior rings")
public static int numInteriorRing(
@DescribeParameter(name = "geom", description = "Input geometry") Polygon polygon) {
return polygon.getNumInteriorRing();
}
代码示例来源:origin: locationtech/spatial4j
protected void write(Writer output, NumberFormat nf, Polygon p) throws IOException {
output.write('[');
write(output, nf, p.getExteriorRing().getCoordinateSequence());
for (int i = 0; i < p.getNumInteriorRing(); i++) {
output.append(',');
write(output, nf, p.getInteriorRingN(i).getCoordinateSequence());
}
output.write(']');
}
代码示例来源:origin: locationtech/spatial4j
protected void write(JsonGenerator gen, Polygon p) throws IOException {
gen.writeStartArray();
write(gen, p.getExteriorRing().getCoordinateSequence());
for (int i = 0; i < p.getNumInteriorRing(); i++) {
write(gen, p.getInteriorRingN(i).getCoordinateSequence());
}
gen.writeEndArray();
}
代码示例来源:origin: geotools/geotools
private static int getCurvilinearElementsCount(Polygon poly) {
int sum = getCurvilinearElementsCount(poly.getExteriorRing());
for (int i = 0; i < poly.getNumInteriorRing(); i++) {
sum += getCurvilinearElementsCount(poly.getInteriorRingN(i));
}
return sum;
}
代码示例来源:origin: geotools/geotools
private void writePolygon(Polygon poly, OutStream os) throws IOException {
writeByteOrder(os);
writeGeometryType(DB2WKBConstants.wkbPolygon2D, os);
writeInt(poly.getNumInteriorRing() + 1, os);
writeCoordinateSequence(poly.getExteriorRing().getCoordinateSequence(), true, os);
for (int i = 0; i < poly.getNumInteriorRing(); i++) {
writeCoordinateSequence(poly.getInteriorRingN(i).getCoordinateSequence(), true, os);
}
}
代码示例来源:origin: geotools/geotools
/**
* Returns the perimeter of a Polygon.
*
* @param polygon the Polygon for which the perimeter is calculated.
* @return The perimeter of the polygon.
*/
protected double getPerimeter(Polygon polygon) {
double perimeter = 0.0d;
LineString lineString = polygon.getExteriorRing();
perimeter += getPerimeter(lineString);
int numberOfHoles = polygon.getNumInteriorRing();
for (int i = 0; i < numberOfHoles; i++) {
perimeter += getPerimeter(polygon.getInteriorRingN(i));
}
return perimeter;
}
代码示例来源:origin: geotools/geotools
/**
* changes this to a new CSF -- more efficient than the JTS way
*
* @param geom
*/
private static final Geometry cloneGeometry(Polygon geom, int dimension) {
LinearRing lr = (LinearRing) cloneGeometry((LinearRing) geom.getExteriorRing(), dimension);
LinearRing[] rings = new LinearRing[geom.getNumInteriorRing()];
for (int t = 0; t < rings.length; t++) {
rings[t] = (LinearRing) cloneGeometry((LinearRing) geom.getInteriorRingN(t), dimension);
}
return geomFac.createPolygon(lr, rings);
}
代码示例来源:origin: mapsforge/mapsforge
static List<TDWay> wktPolygonToWays(String wktFile) {
Geometry geometry = readWKTFile(wktFile);
if (geometry == null || !(geometry instanceof Polygon)) {
return null;
}
Polygon polygon = (Polygon) geometry;
List<TDWay> ret = new ArrayList<>();
TDWay outer = fromLinestring(polygon.getExteriorRing(), true);
ret.add(outer);
for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
ret.add(fromLinestring(polygon.getInteriorRingN(i), false));
}
return ret;
}
代码示例来源:origin: geotools/geotools
/**
* @param polygon
* @throws TransformException
*/
public Polygon transformPolygon(Polygon polygon, GeometryFactory gf) throws TransformException {
LinearRing exterior = (LinearRing) transformLineString(polygon.getExteriorRing(), gf);
LinearRing[] interiors = new LinearRing[polygon.getNumInteriorRing()];
for (int i = 0; i < interiors.length; i++) {
interiors[i] = (LinearRing) transformLineString(polygon.getInteriorRingN(i), gf);
}
Polygon transformed = gf.createPolygon(exterior, interiors);
transformed.setUserData(polygon.getUserData());
return transformed;
}
}
代码示例来源:origin: locationtech/spatial4j
protected void write(Encoder output, Polygon p) throws IOException {
output.write(PolyshapeWriter.KEY_POLYGON);
write(output, p.getExteriorRing().getCoordinateSequence());
for (int i = 0; i < p.getNumInteriorRing(); i++) {
output.startRing();
write(output, p.getInteriorRingN(i).getCoordinateSequence());
}
}
代码示例来源:origin: geotools/geotools
@Override
public void encode(Polygon geometry, AttributesImpl atts, GMLWriter handler) throws Exception {
handler.startElement(polygon, atts);
handler.startElement(outerBoundary, null);
lre.encode(geometry.getExteriorRing(), null, handler);
handler.endElement(outerBoundary);
for (int i = 0; i < geometry.getNumInteriorRing(); i++) {
handler.startElement(innerBoundary, null);
lre.encode(geometry.getInteriorRingN(i), null, handler);
handler.endElement(innerBoundary);
}
handler.endElement(polygon);
}
}
代码示例来源:origin: geotools/geotools
@Override
public void encode(Polygon geometry, AttributesImpl atts, GMLWriter handler, String gmlId)
throws Exception {
atts = cloneWithGmlId(atts, gmlId);
handler.startElement(polygon, atts);
handler.startElement(exterior, null);
encodeRing(geometry.getExteriorRing(), handler, gmlId + ".1");
handler.endElement(exterior);
for (int i = 0; i < geometry.getNumInteriorRing(); i++) {
handler.startElement(interior, null);
encodeRing(geometry.getInteriorRingN(i), handler, gmlId + "." + (i + 2));
handler.endElement(interior);
}
handler.endElement(polygon);
}
代码示例来源:origin: geotools/geotools
public void testParse() throws Exception {
GML3MockData.surface(document, document);
MultiPolygon surface = (MultiPolygon) parse();
assertNotNull(surface);
assertEquals(1, surface.getNumGeometries());
Polygon p = (Polygon) surface.getGeometryN(0);
assertEquals(1, p.getNumInteriorRing());
}
}
代码示例来源:origin: geotools/geotools
List<?> toList(Polygon p) {
BasicDBList l = new BasicDBList();
if (!CGAlgorithms.isCCW(p.getExteriorRing().getCoordinates())) {
l.add(toList(p.getExteriorRing().reverse().getCoordinates()));
} else {
l.add(toList(p.getExteriorRing().getCoordinateSequence()));
}
for (int i = 0; i < p.getNumInteriorRing(); i++) {
l.add(toList(p.getInteriorRingN(i).getCoordinateSequence()));
}
return l;
}
}
内容来源于网络,如有侵权,请联系作者删除!