當前位置: 首頁>>代碼示例>>Java>>正文


Java LinearRing.getCoordinateN方法代碼示例

本文整理匯總了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;
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:53,代碼來源:EdgeRing.java

示例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);
    }
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:12,代碼來源:IsValidOp.java

示例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;
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:44,代碼來源:PolygonBuilder.java


注:本文中的com.vividsolutions.jts.geom.LinearRing.getCoordinateN方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。