本文整理汇总了Java中com.vividsolutions.jts.geom.LinearRing.getEnvelopeInternal方法的典型用法代码示例。如果您正苦于以下问题:Java LinearRing.getEnvelopeInternal方法的具体用法?Java LinearRing.getEnvelopeInternal怎么用?Java LinearRing.getEnvelopeInternal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vividsolutions.jts.geom.LinearRing
的用法示例。
在下文中一共展示了LinearRing.getEnvelopeInternal方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: containsPoint
import com.vividsolutions.jts.geom.LinearRing; //导入方法依赖的package包/类
/**
* This method will cause the ring to be computed.
* It will also check any holes, if they have been assigned.
*/
public boolean containsPoint(Coordinate p) {
LinearRing shell = this.getLinearRing();
Envelope env = shell.getEnvelopeInternal();
if (!env.contains(p)) {
return false;
}
if (!CGAlgorithms.isPointInRing(p, shell.getCoordinates())) {
return false;
}
for (Object hole1 : holes) {
EdgeRing hole = (EdgeRing) hole1;
if (hole.containsPoint(p)) {
return false;
}
}
return true;
}
示例2: findEdgeRingContaining
import com.vividsolutions.jts.geom.LinearRing; //导入方法依赖的package包/类
/**
* Find the innermost enclosing shell EdgeRing containing the argument EdgeRing, if any.
* The innermost enclosing ring is the <i>smallest</i> enclosing ring.
* The algorithm used depends on the fact that:
* <br>
* ring A contains ring B iff envelope(ring A) contains envelope(ring B)
* <br>
* This routine is only safe to use if the chosen point of the hole
* is known to be properly contained in a shell
* (which is guaranteed to be the case if the hole does not touch its shell)
*
* @return containing EdgeRing, if there is one
* or null if no containing EdgeRing is found
*/
public static EdgeRing findEdgeRingContaining(EdgeRing testEr, List shellList) {
LinearRing testRing = testEr.getRing();
Envelope testEnv = testRing.getEnvelopeInternal();
Coordinate testPt = testRing.getCoordinateN(0);
EdgeRing minShell = null;
Envelope minShellEnv = null;
for (Object aShellList : shellList) {
EdgeRing tryShell = (EdgeRing) aShellList;
LinearRing tryShellRing = tryShell.getRing();
Envelope tryShellEnv = tryShellRing.getEnvelopeInternal();
// the hole envelope cannot equal the shell envelope
// (also guards against testing rings against themselves)
if (tryShellEnv.equals(testEnv)) {
continue;
}
// hole must be contained in shell
if (!tryShellEnv.contains(testEnv)) {
continue;
}
testPt = CoordinateArrays.ptNotInList(testRing.getCoordinates(), tryShellRing.getCoordinates());
boolean isContained = false;
if (CGAlgorithms.isPointInRing(testPt, tryShellRing.getCoordinates())) {
isContained = true;
}
// check if this new containing ring is smaller than the current minimum ring
if (isContained) {
if (minShell == null
|| minShellEnv.contains(tryShellEnv)) {
minShell = tryShell;
minShellEnv = minShell.getRing().getEnvelopeInternal();
}
}
}
return minShell;
}
示例3: buildIndex
import com.vividsolutions.jts.geom.LinearRing; //导入方法依赖的package包/类
private void buildIndex() {
this.index = new STRtree();
for (Object ring1 : rings) {
LinearRing ring = (LinearRing) ring1;
Envelope env = ring.getEnvelopeInternal();
this.index.insert(env, ring);
}
}
示例4: buildQuadtree
import com.vividsolutions.jts.geom.LinearRing; //导入方法依赖的package包/类
private void buildQuadtree() {
this.quadtree = new Quadtree();
for (Object ring1 : rings) {
LinearRing ring = (LinearRing) ring1;
Envelope env = ring.getEnvelopeInternal();
this.quadtree.insert(env, ring);
}
}
示例5: buildIndex
import com.vividsolutions.jts.geom.LinearRing; //导入方法依赖的package包/类
private void buildIndex() {
this.sweepLine = new SweepLineIndex();
for (Object ring1 : rings) {
LinearRing ring = (LinearRing) ring1;
Envelope env = ring.getEnvelopeInternal();
SweepLineInterval sweepInt = new SweepLineInterval(env.getMinX(), env.getMaxX(), ring);
this.sweepLine.add(sweepInt);
}
}
示例6: findEdgeRingContaining
import com.vividsolutions.jts.geom.LinearRing; //导入方法依赖的package包/类
/**
* Find the innermost enclosing shell EdgeRing containing the argument EdgeRing, if any.
* The innermost enclosing ring is the <i>smallest</i> enclosing ring.
* The algorithm used depends on the fact that:
* <br>
* ring A contains ring B iff envelope(ring A) contains envelope(ring B)
* <br>
* This routine is only safe to use if the chosen point of the hole
* is known to be properly contained in a shell
* (which is guaranteed to be the case if the hole does not touch its shell)
*
* @return containing EdgeRing, if there is one
* or null if no containing EdgeRing is found
*/
private EdgeRing findEdgeRingContaining(EdgeRing testEr, List shellList) {
LinearRing testRing = testEr.getLinearRing();
Envelope testEnv = testRing.getEnvelopeInternal();
Coordinate testPt = testRing.getCoordinateN(0);
EdgeRing minShell = null;
Envelope minEnv = null;
for (Object aShellList : shellList) {
EdgeRing tryShell = (EdgeRing) aShellList;
LinearRing tryRing = tryShell.getLinearRing();
Envelope tryEnv = tryRing.getEnvelopeInternal();
if (minShell != null) {
minEnv = minShell.getLinearRing().getEnvelopeInternal();
}
boolean isContained = false;
if (tryEnv.contains(testEnv)
&& CGAlgorithms.isPointInRing(testPt, tryRing.getCoordinates())) {
isContained = true;
}
// check if this new containing ring is smaller than the current minimum ring
if (isContained) {
if (minShell == null
|| minEnv.contains(tryEnv)) {
minShell = tryShell;
}
}
}
return minShell;
}
示例7: isErodedCompletely
import com.vividsolutions.jts.geom.LinearRing; //导入方法依赖的package包/类
/**
* The ringCoord is assumed to contain no repeated points.
* It may be degenerate (i.e. contain only 1, 2, or 3 points).
* In this case it has no area, and hence has a minimum diameter of 0.
*
* @param ringCoord
* @param offsetDistance
* @return
*/
private boolean isErodedCompletely(LinearRing ring, double bufferDistance) {
Coordinate[] ringCoord = ring.getCoordinates();
double minDiam = 0.0;
// degenerate ring has no area
if (ringCoord.length < 4) {
return bufferDistance < 0;
}
// important test to eliminate inverted triangle bug
// also optimizes erosion test for triangles
if (ringCoord.length == 4) {
return this.isTriangleErodedCompletely(ringCoord, bufferDistance);
}
// if envelope is narrower than twice the buffer distance, ring is eroded
Envelope env = ring.getEnvelopeInternal();
double envMinDimension = Math.min(env.getHeight(), env.getWidth());
return bufferDistance < 0.0
&& 2 * Math.abs(bufferDistance) > envMinDimension;
/**
* The following is a heuristic test to determine whether an
* inside buffer will be eroded completely.
* It is based on the fact that the minimum diameter of the ring pointset
* provides an upper bound on the buffer distance which would erode the
* ring.
* If the buffer distance is less than the minimum diameter, the ring
* may still be eroded, but this will be determined by
* a full topological computation.
*
*/
//System.out.println(ring);
/* MD 7 Feb 2005 - there's an unknown bug in the MD code, so disable this for now
MinimumDiameter md = new MinimumDiameter(ring);
minDiam = md.getLength();
//System.out.println(md.getDiameter());
return minDiam < 2 * Math.abs(bufferDistance);
*/
}