当前位置: 首页>>代码示例>>Java>>正文


Java LinearRing.getCoordinates方法代码示例

本文整理汇总了Java中com.vividsolutions.jts.geom.LinearRing.getCoordinates方法的典型用法代码示例。如果您正苦于以下问题:Java LinearRing.getCoordinates方法的具体用法?Java LinearRing.getCoordinates怎么用?Java LinearRing.getCoordinates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vividsolutions.jts.geom.LinearRing的用法示例。


在下文中一共展示了LinearRing.getCoordinates方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkShellInsideHole

import com.vividsolutions.jts.geom.LinearRing; //导入方法依赖的package包/类
/**
 * This routine checks to see if a shell is properly contained in a hole.
 * It assumes that the edges of the shell and hole do not
 * properly intersect.
 *
 * @return <code>null</code> if the shell is properly contained, or
 * a Coordinate which is not inside the hole if it is not
 */
private Coordinate checkShellInsideHole(LinearRing shell, LinearRing hole, GeometryGraph graph) {
    Coordinate[] shellPts = shell.getCoordinates();
    Coordinate[] holePts = hole.getCoordinates();
    // TODO: improve performance of this - by sorting pointlists for instance?
    Coordinate shellPt = findPtNotNode(shellPts, hole, graph);
    // if point is on shell but not hole, check that the shell is inside the hole
    if (shellPt != null) {
        boolean insideHole = CGAlgorithms.isPointInRing(shellPt, holePts);
        if (!insideHole) {
            return shellPt;
        }
    }
    Coordinate holePt = findPtNotNode(holePts, shell, graph);
    // if point is on hole but not shell, check that the hole is outside the shell
    if (holePt != null) {
        boolean insideShell = CGAlgorithms.isPointInRing(holePt, shellPts);
        if (insideShell) {
            return holePt;
        }
        return null;
    }
    Assert.shouldNeverReachHere("points in shell and hole appear to be equal");
    return null;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:33,代码来源:IsValidOp.java

示例2: isNonNested

import com.vividsolutions.jts.geom.LinearRing; //导入方法依赖的package包/类
public boolean isNonNested() {
    for (int i = 0; i < this.rings.size(); i++) {
        LinearRing innerRing = (LinearRing) this.rings.get(i);
        Coordinate[] innerRingPts = innerRing.getCoordinates();

        for (Object ring : rings) {
            LinearRing searchRing = (LinearRing) ring;
            Coordinate[] searchRingPts = searchRing.getCoordinates();

            if (innerRing == searchRing) {
                continue;
            }

            if (!innerRing.getEnvelopeInternal().intersects(searchRing.getEnvelopeInternal())) {
                continue;
            }

            Coordinate innerRingPt = IsValidOp.findPtNotNode(innerRingPts, searchRing, this.graph);
            Assert.isTrue(innerRingPt != null, "Unable to find a ring point not a node of the search ring");
            //Coordinate innerRingPt = innerRingPts[0];

            boolean isInside = CGAlgorithms.isPointInRing(innerRingPt, searchRingPts);
            if (isInside) {
                this.nestedPt = innerRingPt;
                return false;
            }
        }
    }
    return true;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:31,代码来源:SimpleNestedRingTester.java

示例3: isNonNested

import com.vividsolutions.jts.geom.LinearRing; //导入方法依赖的package包/类
public boolean isNonNested() {
        this.buildQuadtree();

        for (Object ring : rings) {
            LinearRing innerRing = (LinearRing) ring;
            Coordinate[] innerRingPts = innerRing.getCoordinates();

            List results = this.quadtree.query(innerRing.getEnvelopeInternal());
//System.out.println(results.size());
            for (Object result : results) {
                LinearRing searchRing = (LinearRing) result;
                Coordinate[] searchRingPts = searchRing.getCoordinates();

                if (innerRing == searchRing) {
                    continue;
                }

                if (!innerRing.getEnvelopeInternal().intersects(searchRing.getEnvelopeInternal())) {
                    continue;
                }

                Coordinate innerRingPt = IsValidOp.findPtNotNode(innerRingPts, searchRing, this.graph);
                Assert.isTrue(innerRingPt != null, "Unable to find a ring point not a node of the search ring");
                //Coordinate innerRingPt = innerRingPts[0];

                boolean isInside = CGAlgorithms.isPointInRing(innerRingPt, searchRingPts);
                if (isInside) {
                    this.nestedPt = innerRingPt;
                    return false;
                }
            }
        }
        return true;
    }
 
开发者ID:gegy1000,项目名称:Earth,代码行数:35,代码来源:QuadtreeNestedRingTester.java

示例4: 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);
    */
    }
 
开发者ID:gegy1000,项目名称:Earth,代码行数:49,代码来源:OffsetCurveSetBuilder.java

示例5: isNonNested

import com.vividsolutions.jts.geom.LinearRing; //导入方法依赖的package包/类
public boolean isNonNested() {
        this.buildIndex();

        for (Object ring : rings) {
            LinearRing innerRing = (LinearRing) ring;
            Coordinate[] innerRingPts = innerRing.getCoordinates();

            List results = this.index.query(innerRing.getEnvelopeInternal());
//System.out.println(results.size());
            for (Object result : results) {
                LinearRing searchRing = (LinearRing) result;
                Coordinate[] searchRingPts = searchRing.getCoordinates();

                if (innerRing == searchRing) {
                    continue;
                }

                if (!innerRing.getEnvelopeInternal().intersects(searchRing.getEnvelopeInternal())) {
                    continue;
                }

                Coordinate innerRingPt = IsValidOp.findPtNotNode(innerRingPts, searchRing, this.graph);

                /**
                 * If no non-node pts can be found, this means
                 * that the searchRing touches ALL of the innerRing vertices.
                 * This indicates an invalid polygon, since either
                 * the two holes create a disconnected interior,
                 * or they touch in an infinite number of points
                 * (i.e. along a line segment).
                 * Both of these cases are caught by other tests,
                 * so it is safe to simply skip this situation here.
                 */
                if (innerRingPt == null) {
                    continue;
                }

                boolean isInside = CGAlgorithms.isPointInRing(innerRingPt, searchRingPts);
                if (isInside) {
                    this.nestedPt = innerRingPt;
                    return false;
                }
            }
        }
        return true;
    }
 
开发者ID:gegy1000,项目名称:Earth,代码行数:47,代码来源:IndexedNestedRingTester.java

示例6: checkShellNotNested

import com.vividsolutions.jts.geom.LinearRing; //导入方法依赖的package包/类
/**
 * Check if a shell is incorrectly nested within a polygon.  This is the case
 * if the shell is inside the polygon shell, but not inside a polygon hole.
 * (If the shell is inside a polygon hole, the nesting is valid.)
 * <p>
 * The algorithm used relies on the fact that the rings must be properly contained.
 * E.g. they cannot partially overlap (this has been previously checked by
 * <code>checkRelateConsistency</code> )
 */
private void checkShellNotNested(LinearRing shell, Polygon p, GeometryGraph graph) {
    Coordinate[] shellPts = shell.getCoordinates();
    // test if shell is inside polygon shell
    LinearRing polyShell = (LinearRing) p.getExteriorRing();
    Coordinate[] polyPts = polyShell.getCoordinates();
    Coordinate shellPt = findPtNotNode(shellPts, polyShell, graph);
    // if no point could be found, we can assume that the shell is outside the polygon
    if (shellPt == null) {
        return;
    }
    boolean insidePolyShell = CGAlgorithms.isPointInRing(shellPt, polyPts);
    if (!insidePolyShell) {
        return;
    }

    // if no holes, this is an error!
    if (p.getNumInteriorRing() <= 0) {
        this.validErr = new TopologyValidationError(
                TopologyValidationError.NESTED_SHELLS,
                shellPt);
        return;
    }

    /**
     * Check if the shell is inside one of the holes.
     * This is the case if one of the calls to checkShellInsideHole
     * returns a null coordinate.
     * Otherwise, the shell is not properly contained in a hole, which is an error.
     */
    Coordinate badNestedPt = null;
    for (int i = 0; i < p.getNumInteriorRing(); i++) {
        LinearRing hole = (LinearRing) p.getInteriorRingN(i);
        badNestedPt = this.checkShellInsideHole(shell, hole, graph);
        if (badNestedPt == null) {
            return;
        }
    }
    this.validErr = new TopologyValidationError(
            TopologyValidationError.NESTED_SHELLS,
            badNestedPt);
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:51,代码来源:IsValidOp.java

示例7: SimplePointInRing

import com.vividsolutions.jts.geom.LinearRing; //导入方法依赖的package包/类
public SimplePointInRing(LinearRing ring) {
    this.pts = ring.getCoordinates();
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:4,代码来源:SimplePointInRing.java


注:本文中的com.vividsolutions.jts.geom.LinearRing.getCoordinates方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。