本文整理汇总了Java中com.vividsolutions.jts.geom.LinearRing.getCoordinateN方法的典型用法代码示例。如果您正苦于以下问题:Java LinearRing.getCoordinateN方法的具体用法?Java LinearRing.getCoordinateN怎么用?Java LinearRing.getCoordinateN使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vividsolutions.jts.geom.LinearRing
的用法示例。
在下文中一共展示了LinearRing.getCoordinateN方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: checkClosedRing
import com.vividsolutions.jts.geom.LinearRing; //导入方法依赖的package包/类
private void checkClosedRing(LinearRing ring) {
if (!ring.isClosed()) {
Coordinate pt = null;
if (ring.getNumPoints() >= 1) {
pt = ring.getCoordinateN(0);
}
this.validErr = new TopologyValidationError(
TopologyValidationError.RING_NOT_CLOSED,
pt);
}
}
示例3: 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;
}