本文整理了Java中com.vividsolutions.jts.geom.Polygon.isValid()
方法的一些代码示例,展示了Polygon.isValid()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Polygon.isValid()
方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Polygon
类名称:Polygon
方法名:isValid
暂无
代码示例来源:origin: org.geotools/gt-render
public boolean isValid() {
return polygon.isValid();
}
代码示例来源:origin: kiselev-dv/gazetteer
private Polygon getOriginalGeometry(JSONObject obj) {
JSONObject meta = obj.getJSONObject(GeoJsonWriter.META);
JSONObject fullGeometry = meta.optJSONObject(GeoJsonWriter.FULL_GEOMETRY);
if(fullGeometry != null && "Polygon".equals(fullGeometry.optString("type"))) {
Polygon polygon = GeoJsonWriter.getPolygonGeometry(fullGeometry.getJSONArray("coordinates"));
if(polygon.isValid()) {
return polygon;
}
}
return null;
}
代码示例来源:origin: org.geotools/gt-jts-wrapper
public boolean isValid() {
com.vividsolutions.jts.geom.Polygon poly = (com.vividsolutions.jts.geom.Polygon)
this.getJTSGeometry();
return poly.isValid();
}
}
代码示例来源:origin: org.geotools/gt2-jts-wrapper
public boolean isValid() {
com.vividsolutions.jts.geom.Polygon poly = (com.vividsolutions.jts.geom.Polygon)
this.getJTSGeometry();
return poly.isValid();
}
}
代码示例来源:origin: org.orbisgis/h2gis
/**
* Create and collect shadow polygons.
*
* @param shadows
* @param coordinates
* @param shadow
* @param factory
*/
private static void createShadowPolygons(Collection<Polygon> shadows, Coordinate[] coordinates, double[] shadow, GeometryFactory factory) {
for (int i = 1; i < coordinates.length; i++) {
Coordinate startCoord = coordinates[i - 1];
Coordinate endCoord = coordinates[i];
Coordinate nextEnd = moveCoordinate(endCoord, shadow);
Coordinate nextStart = moveCoordinate(startCoord, shadow);
Polygon polygon = factory.createPolygon(new Coordinate[]{startCoord,
endCoord, nextEnd,
nextStart, startCoord});
if (polygon.isValid()) {
shadows.add(polygon);
}
}
}
}
代码示例来源:origin: kiselev-dv/gazetteer
centroid = geom.getCentroid();
Polygon p = factory.createPolygon(geom);
if(p.isValid()) {
meta.put("fullGeometry", GeoJsonWriter.geometryToJSON(p));
代码示例来源:origin: org.orbisgis/h2gis-functions
/**
* Create and collect shadow polygons.
*
* @param shadows
* @param coordinates
* @param shadow
* @param factory
*/
private static void createShadowPolygons(Collection<Polygon> shadows, Coordinate[] coordinates, double[] shadow, GeometryFactory factory) {
for (int i = 1; i < coordinates.length; i++) {
Coordinate startCoord = coordinates[i - 1];
Coordinate endCoord = coordinates[i];
Coordinate nextEnd = moveCoordinate(endCoord, shadow);
Coordinate nextStart = moveCoordinate(startCoord, shadow);
Polygon polygon = factory.createPolygon(new Coordinate[]{startCoord,
endCoord, nextEnd,
nextStart, startCoord});
if (polygon.isValid()) {
shadows.add(polygon);
}
}
}
}
代码示例来源:origin: kiselev-dv/gazetteer
private void joinStreets2Addresses() {
for (JSONObject strtJSON : street2bndries.keySet()) {
LineString ls = GeoJsonWriter.getLineStringGeometry(
strtJSON.getJSONObject("geometry").getJSONArray("coordinates"));
@SuppressWarnings("deprecation")
Geometry buffer = ls.buffer(STREET_BUFFER_DISTANCE, 2, BufferOp.CAP_ROUND);
if(buffer instanceof Polygon) {
many2ManyJoin(strtJSON, (Polygon) buffer, addr2streets, addrPointsIndex);
}
else if(buffer instanceof MultiPolygon) {
for(int i = 0; i < buffer.getNumGeometries(); i++) {
Polygon p = (Polygon) buffer.getGeometryN(i);
if(p.isValid()) {
many2ManyJoin(strtJSON, p, addr2streets, addrPointsIndex);
}
}
}
}
}
代码示例来源:origin: org.orbisgis/mapeditor
@Override
public void transitionTo_Done(MapContext vc, ToolManager tm)
throws FinishedAutomatonException, TransitionException {
points = ToolUtilities.removeDuplicated(points);
if (points.size() < 3) {
throw new TransitionException(
i18n.tr("Polygons must have more than two points"));
}
List<Coordinate> tempPoints = new ArrayList<Coordinate>(points);
double firstX = points.get(0).x;
double firstY = points.get(0).y;
tempPoints.add(newCoordinate(firstX, firstY, vc));
Coordinate[] polygonCoordinates = tempPoints.toArray(new Coordinate[tempPoints.size()]);
com.vividsolutions.jts.geom.Polygon pol = gf.createPolygon(gf.createLinearRing(polygonCoordinates), new LinearRing[0]);
if (!pol.isValid()) {
throw new TransitionException(
i18n.tr("Invalid polygon"));
}
polygonDone(pol, vc, tm);
transition(Code.INIT);
}
代码示例来源:origin: kiselev-dv/gazetteer
centroid = geom.getCentroid();
Polygon p = factory.createPolygon(geom);
if(p.isValid()) {
meta.put(GeoJsonWriter.FULL_GEOMETRY, GeoJsonWriter.geometryToJSON(p));
代码示例来源:origin: kiselev-dv/gazetteer
if(!polygon.isEmpty() && polygon.isValid()) {
for(String ppId : (List<String>)cityesIndex.query(polygon.getEnvelopeInternal())) {
JSONObject pp = getCityById(ppId);
代码示例来源:origin: kiselev-dv/gazetteer
Polygon p = (Polygon) (multiPolygon.getGeometryN(i));
if (!p.isValid()) {
p = (Polygon) p.buffer(0.0);
if(p.isValid()) {
stripe(p, polygons);
代码示例来源:origin: osmlab/atlas
if (!polygon.isValid())
代码示例来源:origin: kiselev-dv/gazetteer
if (difference.isValid()) {
r = difference;
代码示例来源:origin: org.orbisgis/h2gis-functions
if (!geom.isValid()) {
throw new SQLException("Geometry not valid");
代码示例来源:origin: org.orbisgis/h2gis
if (!geom.isValid()) {
throw new SQLException("Geometry not valid");
代码示例来源:origin: org.orbisgis/orbisgis-core
if (!ret.isValid()) {
throw new TopologyException(I18N.tr("Geometry is not valid"));
if (!ret.isValid()) {
throw new TopologyException(I18N.tr("Geometry is not valid"));
内容来源于网络,如有侵权,请联系作者删除!