com.vividsolutions.jts.geom.Polygon.isRectangle()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(113)

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

Polygon.isRectangle介绍

[英]Tests if a valid polygon is simple. This method always returns true, since a valid polygon is always simple
[中]测试有效多边形是否简单。此方法始终返回true,因为有效多边形总是简单的

代码示例

代码示例来源:origin: org.geotools/gt-render

public boolean isRectangle() {
  return polygon.isRectangle();
}

代码示例来源:origin: com.vividsolutions/jts-ora

/**
 * Tests if a <code>polygon</code> can be written aa a RECTANGLE.
 * Rectangles are only supported without a SRID!
 *
 * @param polygon
 * @return <code>true</code> if polygon is SRID==NULL and a rectangle
 */
private boolean isWriteAsRectangle(Polygon polygon) {
 if (! isOptimizeRectangle) return false;
 if (lrsDim(polygon) != 0) {
   // cannot support LRS on a rectangle
   return false;
 }
 return polygon.isRectangle();
}

代码示例来源:origin: com.spatial4j/spatial4j

@Override
protected Shape makeShapeFromCoords(String type, List coords) {
 GeometryFactory gf = ctx.getGeometryFactory();
 switch(type) {
  case "Polygon":
   Polygon polygon = createPolygon(gf, coords);
   if (polygon.isRectangle()) {
    return ctx.makeRectFromRectangularPoly(polygon);
   } else {
    return ctx.makeShapeFromGeometry(polygon);
   }
   
  case "MultiPoint":
   return ctx.makeShapeFromGeometry(createMultiPoint(gf, coords));
 
  case "MultiLineString":
   return ctx.makeShapeFromGeometry(createMultiLineString(gf, coords));
   
  case "MultiPolygon":
   return ctx.makeShapeFromGeometry(createMultiPolygon(gf, coords));
 }
 return null;
}

代码示例来源:origin: harbby/presto-connectors

@Override
protected Shape makeShapeFromCoords(String type, List coords) {
 GeometryFactory gf = ctx.getGeometryFactory();
 switch(type) {
  case "Polygon":
   Polygon polygon = createPolygon(gf, coords);
   if (polygon.isRectangle()) {
    return ctx.makeRectFromRectangularPoly(polygon);
   } else {
    return ctx.makeShapeFromGeometry(polygon);
   }
   
  case "MultiPoint":
   return ctx.makeShapeFromGeometry(createMultiPoint(gf, coords));
 
  case "MultiLineString":
   return ctx.makeShapeFromGeometry(createMultiLineString(gf, coords));
   
  case "MultiPolygon":
   return ctx.makeShapeFromGeometry(createMultiPolygon(gf, coords));
 }
 return null;
}

相关文章