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


Java Envelope.contains方法代码示例

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


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

示例1: checkEnvelope

import com.vividsolutions.jts.geom.Envelope; //导入方法依赖的package包/类
private void checkEnvelope() {
    if (this.distance < 0.0) {
        return;
    }

    double padding = this.distance * MAX_ENV_DIFF_FRAC;
    if (padding == 0.0) {
        padding = 0.001;
    }

    Envelope expectedEnv = new Envelope(this.input.getEnvelopeInternal());
    expectedEnv.expandBy(this.distance);

    Envelope bufEnv = new Envelope(this.result.getEnvelopeInternal());
    bufEnv.expandBy(padding);

    if (!bufEnv.contains(expectedEnv)) {
        this.isValid = false;
        this.errorMsg = "Buffer envelope is incorrect";
        this.errorIndicator = this.input.getFactory().toGeometry(bufEnv);
    }
    this.report("Envelope");
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:24,代码来源:BufferResultValidator.java

示例2: clipGeometryCollection

import com.vividsolutions.jts.geom.Envelope; //导入方法依赖的package包/类
private static Geometry clipGeometryCollection(Geometry geom, Envelope clipEnv) {
    Geometry clipPoly = geom.getFactory().toGeometry(clipEnv);
    List clipped = new ArrayList();
    for (int i = 0; i < geom.getNumGeometries(); i++) {
        Geometry g = geom.getGeometryN(i);
        Geometry result = null;
        // don't clip unless necessary
        if (clipEnv.contains(g.getEnvelopeInternal())) {
            result = g;
        } else if (clipEnv.intersects(g.getEnvelopeInternal())) {
            result = clipPoly.intersection(g);
            // keep vertex key info
            result.setUserData(g.getUserData());
        }

        if (result != null && !result.isEmpty()) {
            clipped.add(result);
        }
    }
    return geom.getFactory().createGeometryCollection(GeometryFactory.toGeometryArray(clipped));
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:22,代码来源:VoronoiDiagramBuilder.java

示例3: containsPoint

import com.vividsolutions.jts.geom.Envelope; //导入方法依赖的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;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:23,代码来源:EdgeRing.java

示例4: visit

import com.vividsolutions.jts.geom.Envelope; //导入方法依赖的package包/类
@Override
protected void visit(Geometry geom) {
    // if test geometry is not polygonal this check is not needed
    if (!(geom instanceof Polygon)) {
        return;
    }

    // skip if envelopes do not intersect
    Envelope elementEnv = geom.getEnvelopeInternal();
    if (!this.rectEnv.intersects(elementEnv)) {
        return;
    }

    // test each corner of rectangle for inclusion
    Coordinate rectPt = new Coordinate();
    for (int i = 0; i < 4; i++) {
        this.rectSeq.getCoordinate(i, rectPt);
        if (!elementEnv.contains(rectPt)) {
            continue;
        }
        // check rect point in poly (rect is known not to touch polygon at this
        // point)
        if (SimplePointInAreaLocator.containsPointInPolygon(rectPt,
                (Polygon) geom)) {
            this.containsPoint = true;
            return;
        }
    }
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:30,代码来源:RectangleIntersects.java

示例5: findEdgeRingContaining

import com.vividsolutions.jts.geom.Envelope; //导入方法依赖的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

示例6: findEdgeRingContaining

import com.vividsolutions.jts.geom.Envelope; //导入方法依赖的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

示例7: queryNode

import com.vividsolutions.jts.geom.Envelope; //导入方法依赖的package包/类
private void queryNode(KdNode currentNode, KdNode bottomNode,
                       Envelope queryEnv, boolean odd, List result) {
    if (currentNode == bottomNode) {
        return;
    }

    double min;
    double max;
    double discriminant;
    if (odd) {
        min = queryEnv.getMinX();
        max = queryEnv.getMaxX();
        discriminant = currentNode.getX();
    } else {
        min = queryEnv.getMinY();
        max = queryEnv.getMaxY();
        discriminant = currentNode.getY();
    }
    boolean searchLeft = min < discriminant;
    boolean searchRight = discriminant <= max;

    if (searchLeft) {
        this.queryNode(currentNode.getLeft(), bottomNode, queryEnv, !odd, result);
    }
    if (queryEnv.contains(currentNode.getCoordinate())) {
        result.add(currentNode);
    }
    if (searchRight) {
        this.queryNode(currentNode.getRight(), bottomNode, queryEnv, !odd, result);
    }
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:32,代码来源:KdTree.java

示例8: isInSegmentEnvelopes

import com.vividsolutions.jts.geom.Envelope; //导入方法依赖的package包/类
/**
 * Test whether a point lies in the envelopes of both input segments.
 * A correctly computed intersection point should return <code>true</code>
 * for this test.
 * Since this test is for debugging purposes only, no attempt is
 * made to optimize the envelope test.
 *
 * @return <code>true</code> if the input point lies within both input segment envelopes
 */
private boolean isInSegmentEnvelopes(Coordinate intPt) {
    Envelope env0 = new Envelope(this.inputLines[0][0], this.inputLines[0][1]);
    Envelope env1 = new Envelope(this.inputLines[1][0], this.inputLines[1][1]);
    return env0.contains(intPt) && env1.contains(intPt);
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:15,代码来源:RobustLineIntersector.java


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