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

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

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

Geometry.getPrecisionModel介绍

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

代码示例

代码示例来源:origin: com.vividsolutions/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: com.vividsolutions/jts

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

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

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

代码示例来源:origin: com.vividsolutions/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());
 appendGeometryTaggedText(geometry, 0, writer);
}

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

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

代码示例来源:origin: com.vividsolutions/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: com.vividsolutions/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: org.geotools/gt-render

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

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

precisionModel = g.getPrecisionModel();

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

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: com.vividsolutions/jts-core

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

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

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

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

/**
 *  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: com.vividsolutions/jts-core

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

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

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: com.vividsolutions/jts-core

/**
 * 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: DataSystemsLab/GeoSpark

/**
 * Instantiates a new circle.
 *
 * @param centerGeometry the center geometry
 * @param givenRadius the given radius
 */
public Circle(Geometry centerGeometry, Double givenRadius)
{
  super(new GeometryFactory(centerGeometry.getPrecisionModel()));
  this.centerGeometry = centerGeometry;
  Envelope centerGeometryMBR = this.centerGeometry.getEnvelopeInternal();
  this.centerPoint = new Coordinate((centerGeometryMBR.getMinX() + centerGeometryMBR.getMaxX()) / 2.0,
      (centerGeometryMBR.getMinY() + centerGeometryMBR.getMaxY()) / 2.0);
  // Get the internal radius of the object. We need to make sure that the circle at least should be the minimum circumscribed circle
  double width = centerGeometryMBR.getMaxX() - centerGeometryMBR.getMinX();
  double length = centerGeometryMBR.getMaxY() - centerGeometryMBR.getMinY();
  double centerGeometryInternalRadius = Math.sqrt(width * width + length * length) / 2;
  this.radius = givenRadius > centerGeometryInternalRadius ? givenRadius : centerGeometryInternalRadius;
  this.MBR = new Envelope(this.centerPoint.x - this.radius, this.centerPoint.x + this.radius, this.centerPoint.y - this.radius, this.centerPoint.y + this.radius);
  this.setUserData(centerGeometry.getUserData());
}

代码示例来源:origin: org.datasyslab/geospark

/**
 * Instantiates a new circle.
 *
 * @param centerGeometry the center geometry
 * @param givenRadius the given radius
 */
public Circle(Geometry centerGeometry, Double givenRadius)
{
  super(new GeometryFactory(centerGeometry.getPrecisionModel()));
  this.centerGeometry = centerGeometry;
  Envelope centerGeometryMBR = this.centerGeometry.getEnvelopeInternal();
  this.centerPoint = new Coordinate((centerGeometryMBR.getMinX() + centerGeometryMBR.getMaxX()) / 2.0,
      (centerGeometryMBR.getMinY() + centerGeometryMBR.getMaxY()) / 2.0);
  // Get the internal radius of the object. We need to make sure that the circle at least should be the minimum circumscribed circle
  double width = centerGeometryMBR.getMaxX() - centerGeometryMBR.getMinX();
  double length = centerGeometryMBR.getMaxY() - centerGeometryMBR.getMinY();
  double centerGeometryInternalRadius = Math.sqrt(width * width + length * length) / 2;
  this.radius = givenRadius > centerGeometryInternalRadius ? givenRadius : centerGeometryInternalRadius;
  this.MBR = new Envelope(this.centerPoint.x - this.radius, this.centerPoint.x + this.radius, this.centerPoint.y - this.radius, this.centerPoint.y + this.radius);
  this.setUserData(centerGeometry.getUserData());
}

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

precisionModel = g.getPrecisionModel();

代码示例来源:origin: org.geomajas.project/geomajas-project-geometry-jts

PrecisionModel precisionmodel = geometry.getPrecisionModel();
if (!precisionmodel.isFloating()) {
  precision = (int) Math.log10(precisionmodel.getScale());

相关文章