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

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

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

Geometry.geometryChanged介绍

[英]Notifies this geometry that its coordinates have been changed by an external party (for example, via a CoordinateFilter). When this method is called the geometry will flush and/or update any derived information it has cached (such as its Envelope ). The operation is applied to all component Geometries.
[中]通知此几何体其坐标已被外部方更改(例如,通过CoordinateFilter)。调用此方法时,几何体将刷新和/或更新其缓存的任何派生信息(例如其封套)。该操作将应用于所有零部件几何图形。

代码示例

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

  1. public void geometryChanged() {
  2. geometry.geometryChanged();
  3. }

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

  1. /**
  2. * Decimate a geometry (reducing the number of vertices) for incoming buffering
  3. *
  4. * @param geometry
  5. * @return
  6. */
  7. public static Geometry decimate(Geometry geometry) {
  8. Coordinate[] coordinates = geometry.getCoordinates();
  9. if (coordinates.length <= Utils.COORDS_DECIMATION_THRESHOLD) {
  10. return geometry;
  11. }
  12. Geometry g2 = LiteCoordinateSequence.cloneGeometry(geometry, 2);
  13. Decimator decimator =
  14. new Decimator(
  15. DEFAULT_LINESTRING_DECIMATION_SPAN, DEFAULT_LINESTRING_DECIMATION_SPAN);
  16. decimator.decimate(g2);
  17. g2.geometryChanged();
  18. return g2;
  19. }

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

  1. stipplePoint.geometryChanged();
  2. LiteShape2 stippleShape;
  3. try {

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

  1. this.geometry =
  2. decimator.decimateTransformGeneralize(this.geometry, this.mathTransform);
  3. this.geometry.geometryChanged();
  4. } else {
  5. && geometry != null) {
  6. new Decimator(mathTransform.inverse()).decimate(this.geometry);
  7. this.geometry.geometryChanged();
  8. this.geometry.geometryChanged();

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

  1. final Geometry wrapped = geometry.copy();
  2. wrapped.apply(new WrappingCoordinateFilter(radius, radius * 2, mt, northEast));
  3. wrapped.geometryChanged();
  4. offseted.geometryChanged();
  5. geomType = accumulate(geoms, offseted, geomType);

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

  1. newGeom.geometryChanged();
  2. return newGeom;
  3. } else {

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

  1. } catch (Exception e) {
  2. Geometry g = representativeGeom.getGeometry();
  3. g.geometryChanged();
  4. Envelope ePoly = g.getEnvelopeInternal();
  5. Envelope eglyph =

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

  1. geom.geometryChanged();
  2. geom.geometryChanged();
  3. shape = new LiteShape2(geom, null, null, false, false);

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

  1. private static void transformGeometry(Geometry geometry) {
  2. if (geometry == null) {
  3. return;
  4. }
  5. if (geometry instanceof GeometryCollection) {
  6. GeometryCollection collection = (GeometryCollection) geometry;
  7. for (int i = 0; i < collection.getNumGeometries(); i++) {
  8. transformGeometry(collection.getGeometryN(i));
  9. }
  10. } else if (geometry instanceof Polygon) {
  11. Polygon polygon = (Polygon) geometry;
  12. transformGeometry(polygon.getExteriorRing());
  13. for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
  14. transformGeometry(polygon.getInteriorRingN(i));
  15. }
  16. } else if (geometry instanceof LineString) {
  17. CoordinateSequence cs = ((LineString) geometry).getCoordinateSequence();
  18. for (int i = 0; i < cs.size(); i++) {
  19. cs.setOrdinate(i, 0, (int) (cs.getOrdinate(i, 0) + 0.5d));
  20. cs.setOrdinate(i, 1, (int) (cs.getOrdinate(i, 1) + 0.5d));
  21. }
  22. }
  23. geometry.geometryChanged();
  24. }

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

  1. /**
  2. * Adds the common coordinate bits back into a Geometry.
  3. * The coordinates of the Geometry are changed.
  4. *
  5. * @param geom the Geometry to which to add the common coordinate bits
  6. */
  7. public void addCommonBits(Geometry geom)
  8. {
  9. Translater trans = new Translater(commonCoord);
  10. geom.apply(trans);
  11. geom.geometryChanged();
  12. }

代码示例来源:origin: uk.os.vt/vt

  1. public static Geometry toMercator(Geometry geometry) {
  2. Geometry clone = geometry.copy();
  3. clone.apply(new CoordinateFilter() {
  4. @Override
  5. public void filter(Coordinate coord) {
  6. coord.setCoordinate(new Coordinate(lon2x(coord.x), lat2y(coord.y), coord.z));
  7. }
  8. });
  9. clone.geometryChanged();
  10. return clone;
  11. }

代码示例来源:origin: org.n52.arctic-sea/shetland

  1. /**
  2. * Switches the coordinates of a JTS Geometry.
  3. *
  4. * @param <G>
  5. * the geometry type
  6. * @param geometry
  7. * Geometry to switch coordinates.
  8. * @return Geometry with switched coordinates
  9. */
  10. public static <G extends Geometry> G switchCoordinateAxisOrder(G geometry) {
  11. if (geometry == null) {
  12. return null;
  13. }
  14. @SuppressWarnings("unchecked")
  15. G geom = (G) geometry.copy();
  16. geom.apply(COORDINATE_SWITCHING_FILTER);
  17. geom.geometryChanged();
  18. return geom;
  19. }

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

  1. /**
  2. * Removes the common coordinate bits from a Geometry.
  3. * The coordinates of the Geometry are changed.
  4. *
  5. * @param geom the Geometry from which to remove the common coordinate bits
  6. * @return the shifted Geometry
  7. */
  8. public Geometry removeCommonBits(Geometry geom)
  9. {
  10. if (commonCoord.x == 0.0 && commonCoord.y == 0.0)
  11. return geom;
  12. Coordinate invCoord = new Coordinate(commonCoord);
  13. invCoord.x = -invCoord.x;
  14. invCoord.y = -invCoord.y;
  15. Translater trans = new Translater(invCoord);
  16. geom.apply(trans);
  17. geom.geometryChanged();
  18. return geom;
  19. }

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

  1. if (op != null) {
  2. Geometry outPutGeom = geom.copy();
  3. outPutGeom.geometryChanged();
  4. outPutGeom.apply(new CRSTransformFilter(op));
  5. outPutGeom.setSRID(codeEpsg);
  6. op = CoordinateOperationFactory.getMostPrecise(ops);
  7. Geometry outPutGeom = (Geometry) geom.copy();
  8. outPutGeom.geometryChanged();
  9. outPutGeom.apply(new CRSTransformFilter(op));
  10. copPool.put(epsg, op);

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

  1. public void testInvalidateEnvelope() throws Exception {
  2. Geometry g = reader.read("POLYGON ((0 0, 0 50, 50 50, 50 0, 0 0))");
  3. assertEquals(new Envelope(0, 50, 0, 50), g.getEnvelopeInternal());
  4. g.apply(new CoordinateFilter() {
  5. public void filter(Coordinate coord) {
  6. coord.x += 1;
  7. coord.y += 1;
  8. }
  9. });
  10. assertEquals(new Envelope(0, 50, 0, 50), g.getEnvelopeInternal());
  11. g.geometryChanged();
  12. assertEquals(new Envelope(1, 51, 1, 51), g.getEnvelopeInternal());
  13. }

相关文章