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

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

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

Geometry.getPrecisionModel介绍

[英]Returns the PrecisionModel used by the Geometry.
[中]返回Geometry使用的PrecisionModel

代码示例

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

  1. public PrecisionModel getPrecisionModel() {
  2. return geometry.getPrecisionModel();
  3. }

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

  1. /**
  2. * Converts a <code>Geometry</code> to its Well-known Text representation.
  3. *
  4. * @param geometry a <code>Geometry</code> to process
  5. */
  6. private void writeFormatted(Geometry geometry, boolean useFormatting, Writer writer)
  7. throws IOException {
  8. this.useFormatting = useFormatting;
  9. formatter = createFormatter(geometry.getPrecisionModel());
  10. appendGeometryTaggedText(geometry, 0, writer);
  11. }

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

  1. public GeometryGraphOperation(Geometry g0, Geometry g1, BoundaryNodeRule boundaryNodeRule)
  2. {
  3. // use the most precise model for the result
  4. if (g0.getPrecisionModel().compareTo(g1.getPrecisionModel()) >= 0)
  5. setComputationPrecision(g0.getPrecisionModel());
  6. else
  7. setComputationPrecision(g1.getPrecisionModel());
  8. arg = new GeometryGraph[2];
  9. arg[0] = new GeometryGraph(0, g0, boundaryNodeRule);
  10. arg[1] = new GeometryGraph(1, g1, boundaryNodeRule);
  11. }

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

  1. public GeometryGraphOperation(Geometry g0) {
  2. setComputationPrecision(g0.getPrecisionModel());
  3. arg = new GeometryGraph[1];
  4. arg[0] = new GeometryGraph(0, g0);;
  5. }

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

  1. /**
  2. * Converts a <code>Geometry</code> to its Well-known Text representation.
  3. *
  4. *@param geometry a <code>Geometry</code> to process
  5. */
  6. private void writeFormatted(Geometry geometry, boolean useFormatting, Writer writer)
  7. throws IOException
  8. {
  9. this.useFormatting = useFormatting;
  10. formatter = createFormatter(geometry.getPrecisionModel());
  11. //writer.write("<g>\n");
  12. appendGeometryTaggedText(geometry, 0, writer);
  13. //writer.write("</g>\n");
  14. }

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

  1. /**
  2. * Converts a <code>Geometry</code> to its Well-known Text representation.
  3. *
  4. *@param geometry a <code>Geometry</code> to process
  5. */
  6. private void writeFormatted(Geometry geometry, boolean useFormatting, Writer writer,
  7. PrecisionModel precisionModel)
  8. throws IOException
  9. {
  10. // ensure we have a precision model
  11. if (precisionModel == null)
  12. precisionModel = geometry.getPrecisionModel();
  13. // create the formatter
  14. DecimalFormat formatter = createFormatter(precisionModel);
  15. // append the WKT
  16. appendGeometryTaggedText(geometry, useFormatting, writer, formatter);
  17. }

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

  1. protected CoordinateSequence transformCoordinates(
  2. CoordinateSequence coords, Geometry parent) {
  3. Coordinate[] inputPts = coords.toCoordinateArray();
  4. Coordinate[] newPts = Densifier
  5. .densifyPoints(inputPts, distanceTolerance, parent.getPrecisionModel());
  6. // prevent creation of invalid linestrings
  7. if (parent instanceof LineString && newPts.length == 1) {
  8. newPts = new Coordinate[0];
  9. }
  10. return factory.getCoordinateSequenceFactory().create(newPts);
  11. }

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

  1. private Point createPointFromInternalCoord(Coordinate coord, Geometry exemplar)
  2. {
  3. exemplar.getPrecisionModel().makePrecise(coord);
  4. return exemplar.getFactory().createPoint(coord);
  5. }

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

  1. public static Point createPointFromInternalCoord(Coordinate coord, Geometry exemplar)
  2. {
  3. exemplar.getPrecisionModel().makePrecise(coord);
  4. return exemplar.getFactory().createPoint(coord);
  5. }

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

  1. /**
  2. * Estimates the snap tolerance for a Geometry, taking into account its precision model.
  3. *
  4. * @param g a Geometry
  5. * @return the estimated snap tolerance
  6. */
  7. public static double computeOverlaySnapTolerance(Geometry g)
  8. {
  9. double snapTolerance = computeSizeBasedSnapTolerance(g);
  10. /**
  11. * Overlay is carried out in the precision model
  12. * of the two inputs.
  13. * If this precision model is of type FIXED, then the snap tolerance
  14. * must reflect the precision grid size.
  15. * Specifically, the snap tolerance should be at least
  16. * the distance from a corner of a precision grid cell
  17. * to the centre point of the cell.
  18. */
  19. PrecisionModel pm = g.getPrecisionModel();
  20. if (pm.getType() == PrecisionModel.FIXED) {
  21. double fixedSnapTol = (1 / pm.getScale()) * 2 / 1.415;
  22. if (fixedSnapTol > snapTolerance)
  23. snapTolerance = fixedSnapTol;
  24. }
  25. return snapTolerance;
  26. }

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

  1. precisionModel = g.getPrecisionModel();

相关文章