org.locationtech.jts.geom.Geometry.reverse()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(202)

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

Geometry.reverse介绍

[英]Computes a new geometry which has all component coordinate sequences in reverse order (opposite orientation) to this one.
[中]计算一个新几何图形,该几何图形的所有零部件坐标序列与此几何图形的顺序相反(方向相反)。

代码示例

代码示例来源:origin: geotools/geotools

  1. public Geometry reverse() {
  2. return geometry.reverse();
  3. }

代码示例来源:origin: locationtech/jts

  1. public static Geometry reverse(Geometry g) { return g.reverse(); }
  2. public static Geometry normalize(Geometry g)

代码示例来源:origin: orbisgis/h2gis

  1. /**
  2. * Returns the geometry with vertex order reversed.
  3. *
  4. * @param geometry Geometry
  5. * @return geometry with vertex order reversed
  6. */
  7. public static Geometry reverse(Geometry geometry) {
  8. if (geometry == null) {
  9. return null;
  10. }
  11. if (geometry instanceof MultiPoint) {
  12. return reverseMultiPoint((MultiPoint) geometry);
  13. }
  14. return geometry.reverse();
  15. }

代码示例来源:origin: locationtech/jts

  1. public Geometry reverse() {
  2. Polygon poly = (Polygon) copy();
  3. poly.shell = (LinearRing) shell.copy().reverse();
  4. poly.holes = new LinearRing[holes.length];
  5. for (int i = 0; i < holes.length; i++) {
  6. poly.holes[i] = (LinearRing) holes[i].copy().reverse();
  7. }
  8. return poly;// return the clone
  9. }
  10. }

代码示例来源:origin: locationtech/jts

  1. /**
  2. * Creates a {@link MultiLineString} in the reverse
  3. * order to this object.
  4. * Both the order of the component LineStrings
  5. * and the order of their coordinate sequences
  6. * are reversed.
  7. *
  8. * @return a {@link MultiLineString} in the reverse order
  9. */
  10. public Geometry reverse()
  11. {
  12. int nLines = geometries.length;
  13. LineString[] revLines = new LineString[nLines];
  14. for (int i = 0; i < geometries.length; i++) {
  15. revLines[nLines - 1 - i] = (LineString)geometries[i].reverse();
  16. }
  17. return getFactory().createMultiLineString(revLines);
  18. }

代码示例来源:origin: locationtech/jts

  1. /**
  2. * Creates a {@link MultiPolygon} with
  3. * every component reversed.
  4. * The order of the components in the collection are not reversed.
  5. *
  6. * @return a MultiPolygon in the reverse order
  7. */
  8. public Geometry reverse()
  9. {
  10. int n = geometries.length;
  11. Polygon[] revGeoms = new Polygon[n];
  12. for (int i = 0; i < geometries.length; i++) {
  13. revGeoms[i] = (Polygon) geometries[i].reverse();
  14. }
  15. return getFactory().createMultiPolygon(revGeoms);
  16. }

代码示例来源:origin: locationtech/jts

  1. /**
  2. * Creates a {@link GeometryCollection} with
  3. * every component reversed.
  4. * The order of the components in the collection are not reversed.
  5. *
  6. * @return a {@link GeometryCollection} in the reverse order
  7. */
  8. public Geometry reverse()
  9. {
  10. int n = geometries.length;
  11. Geometry[] revGeoms = new Geometry[n];
  12. for (int i = 0; i < geometries.length; i++) {
  13. revGeoms[i] = geometries[i].reverse();
  14. }
  15. return getFactory().createGeometryCollection(revGeoms);
  16. }
  17. }

代码示例来源:origin: orbisgis/h2gis

  1. /**
  2. * Returns the MultiPoint with vertex order reversed. We do our own
  3. * implementation here because JTS does not handle it.
  4. *
  5. * @param mp MultiPoint
  6. * @return MultiPoint with vertex order reversed
  7. */
  8. public static Geometry reverseMultiPoint(MultiPoint mp) {
  9. int nPoints = mp.getNumGeometries();
  10. Point[] revPoints = new Point[nPoints];
  11. for (int i = 0; i < nPoints; i++) {
  12. revPoints[nPoints - 1 - i] = (Point) mp.getGeometryN(i).reverse();
  13. }
  14. return mp.getFactory().createMultiPoint(revPoints);
  15. }
  16. }

代码示例来源:origin: locationtech/jts

  1. void runAll(List geoms, double dist)
  2. {
  3. Stopwatch sw = new Stopwatch();
  4. //System.out.println("Geom count = " + geoms.size() + " distance = " + dist);
  5. int count = 0;
  6. for (Iterator i = geoms.iterator(); i.hasNext(); ) {
  7. Geometry g = (Geometry) i.next();
  8. runBuffer(g, dist);
  9. runBuffer(g.reverse(), dist);
  10. //System.out.print(".");
  11. count++;
  12. if (count > MAX_FEATURE) return;
  13. }
  14. //System.out.println(" " + sw.getTimeString());
  15. }
  16. void runBuffer(Geometry g, double dist)

相关文章