本文整理匯總了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);
*/
}