本文整理汇总了Java中com.vividsolutions.jts.operation.overlay.OverlayOp类的典型用法代码示例。如果您正苦于以下问题:Java OverlayOp类的具体用法?Java OverlayOp怎么用?Java OverlayOp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OverlayOp类属于com.vividsolutions.jts.operation.overlay包,在下文中一共展示了OverlayOp类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: intersection
import com.vividsolutions.jts.operation.overlay.OverlayOp; //导入依赖的package包/类
/**
* Computes a <code>Geometry</code> representing the point-set which is
* common to both this <code>Geometry</code> and the <code>other</code> Geometry.
* <p>
* The intersection of two geometries of different dimension produces a result
* geometry of dimension less than or equal to the minimum dimension of the input
* geometries.
* The result geometry may be a heterogenous {@link GeometryCollection}.
* If the result is empty, it is an atomic geometry
* with the dimension of the lowest input dimension.
* <p>
* Intersection of {@link GeometryCollection}s is supported
* only for homogeneous collection types.
* <p>
* Non-empty heterogeneous {@link GeometryCollection} arguments are not supported.
*
* @param other the <code>Geometry</code> with which to compute the intersection
* @return a Geometry representing the point-set common to the two <code>Geometry</code>s
* @throws TopologyException if a robustness error occurs
* @throws IllegalArgumentException if the argument is a non-empty heterogeneous <code>GeometryCollection</code>
*/
public Geometry intersection(Geometry other) {
/**
* TODO: MD - add optimization for P-A case using Point-In-Polygon
*/
// special case: if one input is empty ==> empty
if (this.isEmpty() || other.isEmpty()) {
return OverlayOp.createEmptyResult(OverlayOp.INTERSECTION, this, other, this.factory);
}
// compute for GCs
if (this.isGeometryCollection()) {
final Geometry g2 = other;
return GeometryCollectionMapper.map(
(GeometryCollection) this,
g -> g.intersection(g2));
}
// if (isGeometryCollection(other))
// return other.intersection(this);
this.checkNotGeometryCollection(this);
this.checkNotGeometryCollection(other);
return SnapIfNeededOverlayOp.overlayOp(this, other, OverlayOp.INTERSECTION);
}
开发者ID:gegy1000,项目名称:Earth,代码行数:45,代码来源:Geometry.java
示例2: symDifference
import com.vividsolutions.jts.operation.overlay.OverlayOp; //导入依赖的package包/类
/**
* Computes a <coe>Geometry </code> representing the closure of the point-set
* which is the union of the points in this <code>Geometry</code> which are not
* contained in the <code>other</code> Geometry,
* with the points in the <code>other</code> Geometry not contained in this
* <code>Geometry</code>.
* If the result is empty, it is an atomic geometry
* with the dimension of the highest input dimension.
* <p>
* Non-empty {@link GeometryCollection} arguments are not supported.
*
* @param other the <code>Geometry</code> with which to compute the symmetric
* difference
* @return a Geometry representing the point-set symmetric difference of this <code>Geometry</code>
* with <code>other</code>
* @throws TopologyException if a robustness error occurs
* @throws IllegalArgumentException if either input is a non-empty GeometryCollection
*/
public Geometry symDifference(Geometry other) {
// handle empty geometry cases
if (this.isEmpty() || other.isEmpty()) {
// both empty - check dimensions
if (this.isEmpty() && other.isEmpty()) {
return OverlayOp.createEmptyResult(OverlayOp.SYMDIFFERENCE, this, other, this.factory);
}
// special case: if either input is empty ==> result = other arg
if (this.isEmpty()) {
return (Geometry) other.clone();
}
if (other.isEmpty()) {
return (Geometry) this.clone();
}
}
this.checkNotGeometryCollection(this);
this.checkNotGeometryCollection(other);
return SnapIfNeededOverlayOp.overlayOp(this, other, OverlayOp.SYMDIFFERENCE);
}
开发者ID:gegy1000,项目名称:Earth,代码行数:40,代码来源:Geometry.java
示例3: isValidResult
import com.vividsolutions.jts.operation.overlay.OverlayOp; //导入依赖的package包/类
private boolean isValidResult(int overlayOp, int[] location) {
boolean expectedInterior = OverlayOp.isResultOfOp(location[0], location[1], overlayOp);
boolean resultInInterior = (location[2] == Location.INTERIOR);
// MD use simpler: boolean isValid = (expectedInterior == resultInInterior);
boolean isValid = expectedInterior == resultInInterior;
if (!isValid) {
this.reportResult(overlayOp, location, expectedInterior);
}
return isValid;
}
开发者ID:gegy1000,项目名称:Earth,代码行数:14,代码来源:OverlayResultValidator.java
示例4: isValidResult
import com.vividsolutions.jts.operation.overlay.OverlayOp; //导入依赖的package包/类
private boolean isValidResult(int overlayOp, int[] location) {
boolean expectedInterior = OverlayOp.isResultOfOp(location[0], location[1], overlayOp);
boolean resultInInterior = (location[2] == Location.INTERIOR);
// MD use simpler: boolean isValid = (expectedInterior == resultInInterior);
boolean isValid = !(expectedInterior ^ resultInInterior);
if (!isValid) reportResult(overlayOp, location, expectedInterior);
return isValid;
}
开发者ID:Semantive,项目名称:jts,代码行数:12,代码来源:OverlayResultValidator.java
示例5: intersection
import com.vividsolutions.jts.operation.overlay.OverlayOp; //导入依赖的package包/类
/**
* Computes a <code>Geometry</code> representing the point-set which is
* common to both this <code>Geometry</code> and the <code>other</code> Geometry.
* <p/>
* The intersection of two geometries of different dimension produces a result
* geometry of dimension less than or equal to the minimum dimension of the input
* geometries.
* The result geometry may be a heterogenous {@link GeometryCollection}.
* If the result is empty, it is an atomic geometry
* with the dimension of the lowest input dimension.
* <p/>
* Intersection of {@link GeometryCollection}s is supported
* only for homogeneous collection types.
* <p/>
* Non-empty heterogeneous {@link GeometryCollection} arguments are not supported.
*
* @param other the <code>Geometry</code> with which to compute the intersection
* @return a Geometry representing the point-set common to the two <code>Geometry</code>s
* @throws TopologyException if a robustness error occurs
* @throws IllegalArgumentException if the argument is a non-empty heterogeneous <code>GeometryCollection</code>
*/
public Geometry intersection(Geometry other) {
/**
* TODO: MD - add optimization for P-A case using Point-In-Polygon
*/
// special case: if one input is empty ==> empty
if (this.isEmpty() || other.isEmpty())
return OverlayOp.createEmptyResult(OverlayOp.INTERSECTION, this, other, factory);
// compute for GCs
if (this.isGeometryCollection()) {
final Geometry g2 = other;
return GeometryCollectionMapper.map(
(GeometryCollection) this,
new GeometryMapper.MapOp() {
public Geometry map(Geometry g) {
return g.intersection(g2);
}
});
}
// if (isGeometryCollection(other))
// return other.intersection(this);
checkNotGeometryCollection(this);
checkNotGeometryCollection(other);
return SnapIfNeededOverlayOp.overlayOp(this, other, OverlayOp.INTERSECTION);
}
开发者ID:Semantive,项目名称:jts,代码行数:48,代码来源:Geometry.java
示例6: isValidResult
import com.vividsolutions.jts.operation.overlay.OverlayOp; //导入依赖的package包/类
private boolean isValidResult(int overlayOp, int[] location)
{
boolean expectedInterior = OverlayOp.isResultOfOp(location[0], location[1], overlayOp);
boolean resultInInterior = (location[2] == Location.INTERIOR);
// MD use simpler: boolean isValid = (expectedInterior == resultInInterior);
boolean isValid = ! (expectedInterior ^ resultInInterior);
if (! isValid) reportResult(overlayOp, location, expectedInterior);
return isValid;
}
开发者ID:GitHubDroid,项目名称:geodroid_master_update,代码行数:13,代码来源:OverlayResultValidator.java
示例7: getResultGeometry
import com.vividsolutions.jts.operation.overlay.OverlayOp; //导入依赖的package包/类
public Geometry getResultGeometry(int opCode)
{
// Geometry[] selfSnapGeom = new Geometry[] { selfSnap(geom[0]), selfSnap(geom[1])};
Geometry[] prepGeom = snap(geom);
Geometry result = OverlayOp.overlayOp(prepGeom[0], prepGeom[1], opCode);
return prepareResult(result);
}
开发者ID:GitHubDroid,项目名称:geodroid_master_update,代码行数:8,代码来源:SnapOverlayOp.java
示例8: intersection
import com.vividsolutions.jts.operation.overlay.OverlayOp; //导入依赖的package包/类
/**
* Computes a <code>Geometry</code> representing the point-set which is
* common to both this <code>Geometry</code> and the <code>other</code> Geometry.
* <p>
* The intersection of two geometries of different dimension produces a result
* geometry of dimension less than or equal to the minimum dimension of the input
* geometries.
* The result geometry may be a heterogenous {@link GeometryCollection}.
* If the result is empty, it is an atomic geometry
* with the dimension of the lowest input dimension.
* <p>
* Intersection of {@link GeometryCollection}s is supported
* only for homogeneous collection types.
* <p>
* Non-empty heterogeneous {@link GeometryCollection} arguments are not supported.
*
* @param other the <code>Geometry</code> with which to compute the intersection
* @return a Geometry representing the point-set common to the two <code>Geometry</code>s
* @throws TopologyException if a robustness error occurs
* @throws IllegalArgumentException if the argument is a non-empty heterogeneous <code>GeometryCollection</code>
*/
public Geometry intersection(Geometry other)
{
/**
* TODO: MD - add optimization for P-A case using Point-In-Polygon
*/
// special case: if one input is empty ==> empty
if (this.isEmpty() || other.isEmpty())
return OverlayOp.createEmptyResult(OverlayOp.INTERSECTION, this, other, factory);
// compute for GCs
if (this.isGeometryCollection()) {
final Geometry g2 = other;
return GeometryCollectionMapper.map(
(GeometryCollection) this,
new GeometryMapper.MapOp() {
public Geometry map(Geometry g) {
return g.intersection(g2);
}
});
}
// if (isGeometryCollection(other))
// return other.intersection(this);
checkNotGeometryCollection(this);
checkNotGeometryCollection(other);
return SnapIfNeededOverlayOp.overlayOp(this, other, OverlayOp.INTERSECTION);
}
开发者ID:GitHubDroid,项目名称:geodroid_master_update,代码行数:49,代码来源:Geometry.java
示例9: getIntersection
import com.vividsolutions.jts.operation.overlay.OverlayOp; //导入依赖的package包/类
public List<String> getIntersection(final List<String> wktLayer1,
final List<String> wktLayer2) {
return getOverlay(wktLayer1, wktLayer2, OverlayOp.INTERSECTION);
}
开发者ID:geowe,项目名称:sig-seguimiento-vehiculos,代码行数:5,代码来源:JTSServiceImpl.java
示例10: getDifference
import com.vividsolutions.jts.operation.overlay.OverlayOp; //导入依赖的package包/类
public List<String> getDifference(final List<String> wktLayer1,
final List<String> wktLayer2) {
return getOverlay(wktLayer1, wktLayer2, OverlayOp.DIFFERENCE);
}
开发者ID:geowe,项目名称:sig-seguimiento-vehiculos,代码行数:5,代码来源:JTSServiceImpl.java
示例11: getSymDifference
import com.vividsolutions.jts.operation.overlay.OverlayOp; //导入依赖的package包/类
public List<String> getSymDifference(final List<String> wktLayer1,
final List<String> wktLayer2) {
return getOverlay(wktLayer1, wktLayer2, OverlayOp.SYMDIFFERENCE);
}
开发者ID:geowe,项目名称:sig-seguimiento-vehiculos,代码行数:5,代码来源:JTSServiceImpl.java
示例12: getOverlay
import com.vividsolutions.jts.operation.overlay.OverlayOp; //导入依赖的package包/类
public List<String> getOverlay(final Geometry layer1,
final Geometry layer2, final int op) {
final List<String> resultLayer = new ArrayList<String>();
Geometry geomContorno = null;
switch (op) {
case OverlayOp.INTERSECTION:
geomContorno = EnhancedPrecisionOp.intersection(
layer1.buffer(TOLERANCIA), layer2.buffer(TOLERANCIA));
break;
case OverlayOp.DIFFERENCE:
geomContorno = EnhancedPrecisionOp.difference(
layer1.buffer(TOLERANCIA), layer2.buffer(TOLERANCIA));
break;
case OverlayOp.SYMDIFFERENCE:
geomContorno = EnhancedPrecisionOp.symDifference(
layer1.buffer(TOLERANCIA), layer2.buffer(TOLERANCIA));
break;
default:
break;
}
if (geomContorno != null) {
if (geomContorno instanceof Polygon) {
resultLayer.add(geomContorno.toText());
} else if (geomContorno instanceof MultiPolygon) {
final MultiPolygon multiPolygon = (MultiPolygon) geomContorno;
for (int i = 0; i < multiPolygon.getNumGeometries(); i++) {
final Polygon pol = (Polygon) multiPolygon.getGeometryN(i);
resultLayer.add(pol.toText());
}
} else if (geomContorno instanceof GeometryCollection) {
final GeometryCollection gc = (GeometryCollection) geomContorno;
for (int i = 0; i < gc.getNumGeometries(); i++) {
final Geometry geom = gc.getGeometryN(i);
resultLayer.add(geom.toText());
}
}
}
return resultLayer;
}
开发者ID:geowe,项目名称:sig-seguimiento-vehiculos,代码行数:46,代码来源:TopologicalOverlay.java
示例13: intersection
import com.vividsolutions.jts.operation.overlay.OverlayOp; //导入依赖的package包/类
public static Geometry intersection(Geometry g0, Geometry g1) {
return overlayOp(g0, g1, OverlayOp.INTERSECTION);
}
开发者ID:gegy1000,项目名称:Earth,代码行数:4,代码来源:SnapIfNeededOverlayOp.java
示例14: union
import com.vividsolutions.jts.operation.overlay.OverlayOp; //导入依赖的package包/类
public static Geometry union(Geometry g0, Geometry g1) {
return overlayOp(g0, g1, OverlayOp.UNION);
}
开发者ID:gegy1000,项目名称:Earth,代码行数:4,代码来源:SnapIfNeededOverlayOp.java
示例15: difference
import com.vividsolutions.jts.operation.overlay.OverlayOp; //导入依赖的package包/类
public static Geometry difference(Geometry g0, Geometry g1) {
return overlayOp(g0, g1, OverlayOp.DIFFERENCE);
}
开发者ID:gegy1000,项目名称:Earth,代码行数:4,代码来源:SnapIfNeededOverlayOp.java
示例16: symDifference
import com.vividsolutions.jts.operation.overlay.OverlayOp; //导入依赖的package包/类
public static Geometry symDifference(Geometry g0, Geometry g1) {
return overlayOp(g0, g1, OverlayOp.SYMDIFFERENCE);
}
开发者ID:gegy1000,项目名称:Earth,代码行数:4,代码来源:SnapIfNeededOverlayOp.java
示例17: getResultGeometry
import com.vividsolutions.jts.operation.overlay.OverlayOp; //导入依赖的package包/类
public Geometry getResultGeometry(int opCode) {
// Geometry[] selfSnapGeom = new Geometry[] { selfSnap(geom[0]), selfSnap(geom[1])};
Geometry[] prepGeom = this.snap(this.geom);
Geometry result = OverlayOp.overlayOp(prepGeom[0], prepGeom[1], opCode);
return this.prepareResult(result);
}
开发者ID:gegy1000,项目名称:Earth,代码行数:7,代码来源:SnapOverlayOp.java
示例18: union
import com.vividsolutions.jts.operation.overlay.OverlayOp; //导入依赖的package包/类
/**
* Computes a <code>Geometry</code> representing the point-set
* which is contained in both this
* <code>Geometry</code> and the <code>other</code> Geometry.
* <p>
* The union of two geometries of different dimension produces a result
* geometry of dimension equal to the maximum dimension of the input
* geometries.
* The result geometry may be a heterogenous
* {@link GeometryCollection}.
* If the result is empty, it is an atomic geometry
* with the dimension of the highest input dimension.
* <p>
* Unioning {@link LineString}s has the effect of
* <b>noding</b> and <b>dissolving</b> the input linework. In this context
* "noding" means that there will be a node or endpoint in the result for
* every endpoint or line segment crossing in the input. "Dissolving" means
* that any duplicate (i.e. coincident) line segments or portions of line
* segments will be reduced to a single line segment in the result.
* If <b>merged</b> linework is required, the {@link LineMerger}
* class can be used.
* <p>
* Non-empty {@link GeometryCollection} arguments are not supported.
*
* @param other the <code>Geometry</code> with which to compute the union
* @return a point-set combining the points of this <code>Geometry</code> and the
* points of <code>other</code>
* @throws TopologyException if a robustness error occurs
* @throws IllegalArgumentException if either input is a non-empty GeometryCollection
* @see LineMerger
*/
public Geometry union(Geometry other) {
// handle empty geometry cases
if (this.isEmpty() || other.isEmpty()) {
if (this.isEmpty() && other.isEmpty()) {
return OverlayOp.createEmptyResult(OverlayOp.UNION, this, other, this.factory);
}
// special case: if either input is empty ==> other input
if (this.isEmpty()) {
return (Geometry) other.clone();
}
if (other.isEmpty()) {
return (Geometry) this.clone();
}
}
// TODO: optimize if envelopes of geometries do not intersect
this.checkNotGeometryCollection(this);
this.checkNotGeometryCollection(other);
return SnapIfNeededOverlayOp.overlayOp(this, other, OverlayOp.UNION);
}
开发者ID:gegy1000,项目名称:Earth,代码行数:54,代码来源:Geometry.java
示例19: getResultGeometry
import com.vividsolutions.jts.operation.overlay.OverlayOp; //导入依赖的package包/类
public Geometry getResultGeometry(int opCode) {
// Geometry[] selfSnapGeom = new Geometry[] { selfSnap(geom[0]), selfSnap(geom[1])};
Geometry[] prepGeom = snap(geom);
Geometry result = OverlayOp.overlayOp(prepGeom[0], prepGeom[1], opCode);
return prepareResult(result);
}
开发者ID:Semantive,项目名称:jts,代码行数:7,代码来源:SnapOverlayOp.java
示例20: union
import com.vividsolutions.jts.operation.overlay.OverlayOp; //导入依赖的package包/类
/**
* Computes a <code>Geometry</code> representing the point-set
* which is contained in both this
* <code>Geometry</code> and the <code>other</code> Geometry.
* <p/>
* The union of two geometries of different dimension produces a result
* geometry of dimension equal to the maximum dimension of the input
* geometries.
* The result geometry may be a heterogenous
* {@link GeometryCollection}.
* If the result is empty, it is an atomic geometry
* with the dimension of the highest input dimension.
* <p/>
* Unioning {@link LineString}s has the effect of
* <b>noding</b> and <b>dissolving</b> the input linework. In this context
* "noding" means that there will be a node or endpoint in the result for
* every endpoint or line segment crossing in the input. "Dissolving" means
* that any duplicate (i.e. coincident) line segments or portions of line
* segments will be reduced to a single line segment in the result.
* If <b>merged</b> linework is required, the {@link LineMerger}
* class can be used.
* <p/>
* Non-empty {@link GeometryCollection} arguments are not supported.
*
* @param other the <code>Geometry</code> with which to compute the union
* @return a point-set combining the points of this <code>Geometry</code> and the
* points of <code>other</code>
* @throws TopologyException if a robustness error occurs
* @throws IllegalArgumentException if either input is a non-empty GeometryCollection
* @see LineMerger
*/
public Geometry union(Geometry other) {
// handle empty geometry cases
if (this.isEmpty() || other.isEmpty()) {
if (this.isEmpty() && other.isEmpty())
return OverlayOp.createEmptyResult(OverlayOp.UNION, this, other, factory);
// special case: if either input is empty ==> other input
if (this.isEmpty()) return (Geometry) other.clone();
if (other.isEmpty()) return (Geometry) clone();
}
// TODO: optimize if envelopes of geometries do not intersect
checkNotGeometryCollection(this);
checkNotGeometryCollection(other);
return SnapIfNeededOverlayOp.overlayOp(this, other, OverlayOp.UNION);
}
开发者ID:Semantive,项目名称:jts,代码行数:49,代码来源:Geometry.java
注:本文中的com.vividsolutions.jts.operation.overlay.OverlayOp类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论