本文整理了Java中com.vividsolutions.jts.geom.Geometry.apply()
方法的一些代码示例,展示了Geometry.apply()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.apply()
方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Geometry
类名称:Geometry
方法名:apply
[英]Performs an operation with or on this Geometry
's coordinates. If this method modifies any coordinate values, #geometryChanged must be called to update the geometry state. Note that you cannot use this method to modify this Geometry if its underlying CoordinateSequence's #get method returns a copy of the Coordinate, rather than the actual Coordinate stored (if it even stores Coordinate objects at all).
[中]使用或在此Geometry
的坐标上执行操作。如果此方法修改任何坐标值,则必须调用#geometryChanged来更新几何体状态。请注意,如果基础CoordinateSequence的#get方法返回坐标的副本,而不是存储的实际坐标(如果它甚至存储坐标对象),则无法使用此方法修改此几何体。
代码示例来源: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
/**
* Notifies this geometry that its coordinates have been changed by an external
* party (for example, via a {@link CoordinateFilter}).
* When this method is called the geometry will flush
* and/or update any derived information it has cached (such as its {@link Envelope} ).
* The operation is applied to all component Geometries.
*/
public void geometryChanged() {
apply(geometryChangedFilter);
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Add a {@link Geometry} to the edges to be polygonized.
* May be called multiple times.
* Any dimension of Geometry may be added;
* the constituent linework will be extracted and used
*
* @param g a {@link Geometry} with linework to be polygonized
*/
public void add(Geometry g)
{
g.apply(lineStringAdder);
}
代码示例来源:origin: com.vividsolutions/jts
public void apply(CoordinateFilter filter) {
for (int i = 0; i < geometries.length; i++) {
geometries[i].apply(filter);
}
}
代码示例来源:origin: osmandapp/Osmand
nextTransformGeom.apply(RoundingFilter.INSTANCE);
代码示例来源:origin: com.vividsolutions/jts
private void compute()
{
if (minClearancePts != null) return;
minClearancePts = new Coordinate[2];
minClearance = Double.MAX_VALUE;
inputGeom.apply(new VertexCoordinateFilter());
}
代码示例来源:origin: com.vividsolutions/jts
public void apply(GeometryFilter filter) {
filter.filter(this);
for (int i = 0; i < geometries.length; i++) {
geometries[i].apply(filter);
}
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Returns a list containing a point from each Polygon, LineString, and Point
* found inside the specified geometry. Thus, if the specified geometry is
* not a GeometryCollection, an empty list will be returned. The elements of the list
* are {@link com.vividsolutions.jts.operation.distance.GeometryLocation}s.
*/
public static List getLocations(Geometry geom)
{
List locations = new ArrayList();
geom.apply(new ConnectedElementLocationFilter(locations));
return locations;
}
代码示例来源:origin: com.vividsolutions/jts
private List extractLines(Collection geoms)
{
List lines = new ArrayList();
LinearComponentExtracter lce = new LinearComponentExtracter(lines);
for (Iterator it = geoms.iterator(); it.hasNext(); ) {
Geometry geom = (Geometry) it.next();
geom.apply(lce);
}
return lines;
}
代码示例来源:origin: com.vividsolutions/jts
public void apply(GeometryComponentFilter filter) {
filter.filter(this);
for (int i = 0; i < geometries.length; i++) {
geometries[i].apply(filter);
}
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Returns a list containing a Coordinate from each Polygon, LineString, and Point
* found inside the specified geometry. Thus, if the specified geometry is
* not a GeometryCollection, an empty list will be returned.
*/
public static List getCoordinates(Geometry geom)
{
List pts = new ArrayList();
geom.apply(new ConnectedElementPointFilter(pts));
return pts;
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Adds the common coordinate bits back into a Geometry.
* The coordinates of the Geometry are changed.
*
* @param geom the Geometry to which to add the common coordinate bits
*/
public void addCommonBits(Geometry geom)
{
Translater trans = new Translater(commonCoord);
geom.apply(trans);
geom.geometryChanged();
}
代码示例来源:origin: com.vividsolutions/jts
private static Coordinate[] extractCoordinates(Geometry geom)
{
UniqueCoordinateArrayFilter filter = new UniqueCoordinateArrayFilter();
geom.apply(filter);
return filter.getCoordinates();
}
代码示例来源:origin: com.vividsolutions/jts
public static boolean hasSegment(Geometry geom, Coordinate p0, Coordinate p1)
{
SegmentFindingFilter filter = new SegmentFindingFilter(p0, p1);
geom.apply(filter);
return filter.hasSegment();
}
代码示例来源:origin: com.vividsolutions/jts
protected Geometry rotate(Geometry geom)
{
if (rotationAngle != 0.0) {
AffineTransformation trans = AffineTransformation.rotationInstance(rotationAngle,
dim.getCentre().x, dim.getCentre().y);
geom.apply(trans);
}
return geom;
}
代码示例来源:origin: com.vividsolutions/jts
public void apply(CoordinateSequenceFilter filter) {
if (geometries.length == 0)
return;
for (int i = 0; i < geometries.length; i++) {
geometries[i].apply(filter);
if (filter.isDone()) {
break;
}
}
if (filter.isGeometryChanged())
geometryChanged();
}
代码示例来源:origin: com.vividsolutions/jts
private void computeMaxVertexDistance(Geometry curve)
{
MaxPointDistanceFilter distFilter = new MaxPointDistanceFilter(inputGeom);
curve.apply(distFilter);
maxPtDist.setMaximum(distFilter.getMaxPointDistance());
}
代码示例来源:origin: com.vividsolutions/jts
private void computeMaxMidpointDistance(Geometry curve)
{
MaxMidpointDistanceFilter distFilter = new MaxMidpointDistanceFilter(inputGeom);
curve.apply(distFilter);
maxPtDist.setMaximum(distFilter.getMaxPointDistance());
}
代码示例来源:origin: com.vividsolutions/jts
private void computeOrientedDistance(Geometry discreteGeom, Geometry geom, PointPairDistance ptDist)
{
MaxPointDistanceFilter distFilter = new MaxPointDistanceFilter(geom);
discreteGeom.apply(distFilter);
ptDist.setMaximum(distFilter.getMaxPointDistance());
if (densifyFrac > 0) {
MaxDensifiedByFractionDistanceFilter fracFilter = new MaxDensifiedByFractionDistanceFilter(geom, densifyFrac);
discreteGeom.apply(fracFilter);
ptDist.setMaximum(fracFilter.getMaxPointDistance());
}
}
代码示例来源:origin: com.vividsolutions/jts
public Geometry getResultGeometry()
{
// empty input produces an empty result
if (inputGeom.isEmpty()) return (Geometry) inputGeom.clone();
linestringMap = new HashMap();
inputGeom.apply(new LineStringMapBuilderFilter());
lineSimplifier.simplify(linestringMap.values());
Geometry result = (new LineStringTransformer()).transform(inputGeom);
return result;
}
内容来源于网络,如有侵权,请联系作者删除!