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

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

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

Geometry.getFactory介绍

[英]Gets the factory which contains the context in which this geometry was created.
[中]获取包含创建此几何体的上下文的工厂。

代码示例

代码示例来源:origin: opentripplanner/OpenTripPlanner

/**
 * Create a new concave hull construction for the input {@link Geometry}.
 * 
 * @param geometry
 * @param threshold
 */
public ConcaveHull(Geometry geometry, double threshold) {
  this.geometries = transformIntoPointGeometryCollection(geometry);
  this.threshold = threshold;
  this.geomFactory = geometry.getFactory();
}

代码示例来源:origin: opentripplanner/OpenTripPlanner

private Geometry removeDuplicatePoints(Geometry routeGeometry) {
  List<Coordinate> coords = new ArrayList<Coordinate>();
  Coordinate last = null;
  for (Coordinate c : routeGeometry.getCoordinates()) {
    if (!c.equals(last)) {
      last = c;
      coords.add(c);
    }
  }
  if (coords.size() < 2) {
    return null;
  }
  Coordinate[] coordArray = new Coordinate[coords.size()];
  return routeGeometry.getFactory().createLineString(coords.toArray(coordArray));
}

代码示例来源:origin: opentripplanner/OpenTripPlanner

/**
 * Transform into GeometryCollection.
 * 
 * @param geom
 *         input geometry
 * @return
 *         a geometry collection
 */
private static GeometryCollection transformIntoPointGeometryCollection(Geometry geom) {
  UniqueCoordinateArrayFilter filter = new UniqueCoordinateArrayFilter();
  geom.apply(filter);
  Coordinate[] coord = filter.getCoordinates();
  
  Geometry[] geometries = new Geometry[coord.length];
  for (int i = 0 ; i < coord.length ; i++) {
    Coordinate[] c = new Coordinate[] { coord[i] };
    CoordinateArraySequence cs = new CoordinateArraySequence(c);
    geometries[i] = new Point(cs, geom.getFactory());
  }
  
  return new GeometryCollection(geometries, geom.getFactory());
}

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

public BoundaryOp(Geometry geom, BoundaryNodeRule bnRule)
{
 this.geom = geom;
 geomFact = geom.getFactory();
 this.bnRule = bnRule;
}

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

/**
 * Extracts the GeometryFactory used by the geometries in a collection
 * 
 * @param geoms
 * @return a GeometryFactory
 */
public static GeometryFactory extractFactory(Collection geoms) {
  if (geoms.isEmpty())
    return null;
  return ((Geometry) geoms.iterator().next()).getFactory();
}

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

public InteriorPointArea(Geometry g)
{
 factory = g.getFactory();
 add(g);
}
public Coordinate getInteriorPoint()

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

/**
 * Create a new convex hull construction for the input {@link Geometry}.
 */
public ConvexHull(Geometry geometry)
{
 this(extractCoordinates(geometry), geometry.getFactory());
}
/**

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

public void filter(Geometry geom)
{
  if (isForcedToLineString && geom instanceof LinearRing) {
    LineString line = geom.getFactory().createLineString( ((LinearRing) geom).getCoordinateSequence());
    lines.add(line);
    return;
  }
  // if not being forced, and this is a linear component
  if (geom instanceof LineString) 
    lines.add(geom);
  
  // else this is not a linear component, so skip it
}

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

private Geometry bufferUnion(List geoms)
{
  GeometryFactory factory = ((Geometry) geoms.get(0)).getFactory();
  Geometry gColl = factory.buildGeometry(geoms);
  Geometry unionAll = gColl.buffer(0.0);
 return unionAll;
}

代码示例来源: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

public static void unionUsingBuffer(Geometry[] geom)
{
 GeometryFactory fact = geom[0].getFactory();
 Geometry geomColl = fact.createGeometryCollection(geom);
 Geometry union = geomColl.buffer(0.0);
 System.out.println(union);
}

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

/**
 * Gets the segment forming the base of the minimum diameter
 *
 * @return the segment forming the base of the minimum diameter
 */
public LineString getSupportingSegment()
{
 computeMinimumDiameter();
 return inputGeom.getFactory().createLineString(new Coordinate[] { minBaseSeg.p0, minBaseSeg.p1 } );
}

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

private Geometry bufferUnion(Geometry g0, Geometry g1)
{
  GeometryFactory factory = g0.getFactory();
  Geometry gColl = factory.createGeometryCollection(new Geometry[] { g0, g1 } );
  Geometry unionAll = gColl.buffer(0.0);
 return unionAll;
}

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

private Geometry getPolygonLines(Geometry g)
{
  List lines = new ArrayList();
  LinearComponentExtracter lineExtracter = new LinearComponentExtracter(lines);
  List polys = PolygonExtracter.getPolygons(g);
  for (Iterator i = polys.iterator(); i.hasNext(); ) {
    Polygon poly = (Polygon) i.next();
    poly.apply(lineExtracter);
  }
  return g.getFactory().buildGeometry(lines);
}

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

public LineString getLine()
{
 compute();
 return inputGeom.getFactory().createLineString(minClearancePts);
}

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

public UnionInteracting(Geometry g0, Geometry g1)
{
  this.g0 = g0;
  this.g1 = g1;
  geomFactory = g0.getFactory();
  interacts0 = new boolean[g0.getNumGeometries()];
  interacts1 = new boolean[g1.getNumGeometries()];
}

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

public OverlayOp(Geometry g0, Geometry g1) {
 super(g0, g1);
 graph = new PlanarGraph(new OverlayNodeFactory());
 /**
  * Use factory of primary geometry.
  * Note that this does NOT handle mixed-precision arguments
  * where the second arg has greater precision than the first.
  */
 geomFact = g0.getFactory();
}

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

public Geometry reduce(Geometry geom)
{
 GeometryEditor geomEdit;
 if (changePrecisionModel) {
  GeometryFactory newFactory = new GeometryFactory(newPrecisionModel, geom.getFactory().getSRID());
  geomEdit = new GeometryEditor(newFactory);
 }
 else
  // don't change geometry factory
  geomEdit = new GeometryEditor();
 return geomEdit.edit(geom, new PrecisionReducerCoordinateOperation());
}

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

private void computeGeometry()
{
 bufferOriginalPrecision();
 if (resultGeometry != null) return;
 PrecisionModel argPM = argGeom.getFactory().getPrecisionModel();
 if (argPM.getType() == PrecisionModel.FIXED)
  bufferFixedPrecision(argPM);
 else
  bufferReducedPrecision();
}

相关文章