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

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

本文整理了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

public PrecisionModel getPrecisionModel() {
  return geometry.getPrecisionModel();
}

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

/**
 * Converts a <code>Geometry</code> to its Well-known Text representation.
 *
 * @param geometry a <code>Geometry</code> to process
 */
private void writeFormatted(Geometry geometry, boolean useFormatting, Writer writer)
    throws IOException {
  this.useFormatting = useFormatting;
  formatter = createFormatter(geometry.getPrecisionModel());
  appendGeometryTaggedText(geometry, 0, writer);
}

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

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

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

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

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

/**
 *  Converts a <code>Geometry</code> to its Well-known Text representation.
 *
 *@param  geometry  a <code>Geometry</code> to process
 */
private void writeFormatted(Geometry geometry, boolean useFormatting, Writer writer)
 throws IOException
{
 this.useFormatting = useFormatting;
 formatter = createFormatter(geometry.getPrecisionModel());
 //writer.write("<g>\n");
 appendGeometryTaggedText(geometry, 0, writer);
 //writer.write("</g>\n");
}

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

/**
 *  Converts a <code>Geometry</code> to its Well-known Text representation.
 *
 *@param  geometry  a <code>Geometry</code> to process
 */
private void writeFormatted(Geometry geometry, boolean useFormatting, Writer writer,
              PrecisionModel precisionModel)
 throws IOException
{
 // ensure we have a precision model
 if (precisionModel == null)
  precisionModel = geometry.getPrecisionModel();
 // create the formatter
 DecimalFormat formatter = createFormatter(precisionModel);
 // append the WKT
 appendGeometryTaggedText(geometry, useFormatting, writer, formatter);
}

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

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

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

private Point createPointFromInternalCoord(Coordinate coord, Geometry exemplar)
{
 exemplar.getPrecisionModel().makePrecise(coord);
 return exemplar.getFactory().createPoint(coord);
}

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

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

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

/**
 * Estimates the snap tolerance for a Geometry, taking into account its precision model.
 * 
 * @param g a Geometry
 * @return the estimated snap tolerance
 */
public static double computeOverlaySnapTolerance(Geometry g)
{
   double snapTolerance = computeSizeBasedSnapTolerance(g);
   
   /**
    * Overlay is carried out in the precision model 
    * of the two inputs.  
    * If this precision model is of type FIXED, then the snap tolerance
    * must reflect the precision grid size.  
    * Specifically, the snap tolerance should be at least 
    * the distance from a corner of a precision grid cell
    * to the centre point of the cell.  
    */
   PrecisionModel pm = g.getPrecisionModel();
   if (pm.getType() == PrecisionModel.FIXED) {
     double fixedSnapTol = (1 / pm.getScale()) * 2 / 1.415;
     if (fixedSnapTol > snapTolerance)
       snapTolerance = fixedSnapTol;
   }
   return snapTolerance;
}

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

precisionModel = g.getPrecisionModel();

相关文章