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


Java SegmentIntersector类代码示例

本文整理汇总了Java中com.vividsolutions.jts.geomgraph.index.SegmentIntersector的典型用法代码示例。如果您正苦于以下问题:Java SegmentIntersector类的具体用法?Java SegmentIntersector怎么用?Java SegmentIntersector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SegmentIntersector类属于com.vividsolutions.jts.geomgraph.index包,在下文中一共展示了SegmentIntersector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isNodeConsistentArea

import com.vividsolutions.jts.geomgraph.index.SegmentIntersector; //导入依赖的package包/类
/**
 * Check all nodes to see if their labels are consistent with area topology.
 *
 * @return <code>true</code> if this area has a consistent node labelling
 */
public boolean isNodeConsistentArea() {
    /**
     * To fully check validity, it is necessary to
     * compute ALL intersections, including self-intersections within a single edge.
     */
    SegmentIntersector intersector = this.geomGraph.computeSelfNodes(this.li, true);
    if (intersector.hasProperIntersection()) {
        this.invalidPoint = intersector.getProperIntersectionPoint();
        return false;
    }

    this.nodeGraph.build(this.geomGraph);

    return this.isNodeEdgeAreaLabelsConsistent();
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:21,代码来源:ConsistentAreaTester.java

示例2: isSimpleLinearGeometry

import com.vividsolutions.jts.geomgraph.index.SegmentIntersector; //导入依赖的package包/类
private boolean isSimpleLinearGeometry(Geometry geom) {
    if (geom.isEmpty()) {
        return true;
    }
    GeometryGraph graph = new GeometryGraph(0, geom);
    LineIntersector li = new RobustLineIntersector();
    SegmentIntersector si = graph.computeSelfNodes(li, true);
    // if no self-intersection, must be simple
    if (!si.hasIntersection()) {
        return true;
    }
    if (si.hasProperIntersection()) {
        this.nonSimpleLocation = si.getProperIntersectionPoint();
        return false;
    }
    if (this.hasNonEndpointIntersection(graph)) {
        return false;
    }
    if (this.isClosedEndpointsInInterior) {
        if (this.hasClosedEndpointIntersection(graph)) {
            return false;
        }
    }
    return true;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:26,代码来源:IsSimpleOp.java

示例3: computeSelfNodes

import com.vividsolutions.jts.geomgraph.index.SegmentIntersector; //导入依赖的package包/类
/**
     * Compute self-nodes, taking advantage of the Geometry type to
     * minimize the number of intersection tests.  (E.g. rings are
     * not tested for self-intersection, since they are assumed to be valid).
     *
     * @param li the LineIntersector to use
     * @param computeRingSelfNodes if <false>, intersection checks are optimized to not test rings for self-intersection
     * @return the SegmentIntersector used, containing information about the intersections found
     */
    public SegmentIntersector computeSelfNodes(LineIntersector li, boolean computeRingSelfNodes) {
        SegmentIntersector si = new SegmentIntersector(li, true, false);
        EdgeSetIntersector esi = this.createEdgeSetIntersector();
        // optimized test for Polygons and Rings
        if (!computeRingSelfNodes
                && (this.parentGeom instanceof LinearRing
                || this.parentGeom instanceof Polygon
                || this.parentGeom instanceof MultiPolygon)) {
            esi.computeIntersections(this.edges, si, false);
        } else {
            esi.computeIntersections(this.edges, si, true);
        }
//System.out.println("SegmentIntersector # tests = " + si.numTests);
        this.addSelfIntersectionNodes(this.argIndex);
        return si;
    }
 
开发者ID:gegy1000,项目名称:Earth,代码行数:26,代码来源:GeometryGraph.java

示例4: computeEdgeIntersections

import com.vividsolutions.jts.geomgraph.index.SegmentIntersector; //导入依赖的package包/类
public SegmentIntersector computeEdgeIntersections(
            GeometryGraph g,
            LineIntersector li,
            boolean includeProper) {
        SegmentIntersector si = new SegmentIntersector(li, includeProper, true);
        si.setBoundaryNodes(this.getBoundaryNodes(), g.getBoundaryNodes());

        EdgeSetIntersector esi = this.createEdgeSetIntersector();
        esi.computeIntersections(this.edges, g.edges, si);
/*
for (Iterator i = g.edges.iterator(); i.hasNext();) {
Edge e = (Edge) i.next();
Debug.print(e.getEdgeIntersectionList());
}
*/
        return si;
    }
 
开发者ID:gegy1000,项目名称:Earth,代码行数:18,代码来源:GeometryGraph.java

示例5: isNodeConsistentArea

import com.vividsolutions.jts.geomgraph.index.SegmentIntersector; //导入依赖的package包/类
/**
 * Check all nodes to see if their labels are consistent with area topology.
 *
 * @return <code>true</code> if this area has a consistent node labelling
 */
public boolean isNodeConsistentArea() {
    /**
     * To fully check validity, it is necessary to
     * compute ALL intersections, including self-intersections within a single edge.
     */
    SegmentIntersector intersector = geomGraph.computeSelfNodes(li, true);
    if (intersector.hasProperIntersection()) {
        invalidPoint = intersector.getProperIntersectionPoint();
        return false;
    }

    nodeGraph.build(geomGraph);

    return isNodeEdgeAreaLabelsConsistent();
}
 
开发者ID:Semantive,项目名称:jts,代码行数:21,代码来源:ConsistentAreaTester.java

示例6: isSimpleLinearGeometry

import com.vividsolutions.jts.geomgraph.index.SegmentIntersector; //导入依赖的package包/类
private boolean isSimpleLinearGeometry(Geometry geom) {
    if (geom.isEmpty()) return true;
    GeometryGraph graph = new GeometryGraph(0, geom);
    LineIntersector li = new RobustLineIntersector();
    SegmentIntersector si = graph.computeSelfNodes(li, true);
    // if no self-intersection, must be simple
    if (!si.hasIntersection()) return true;
    if (si.hasProperIntersection()) {
        nonSimpleLocation = si.getProperIntersectionPoint();
        return false;
    }
    if (hasNonEndpointIntersection(graph)) return false;
    if (isClosedEndpointsInInterior) {
        if (hasClosedEndpointIntersection(graph)) return false;
    }
    return true;
}
 
开发者ID:Semantive,项目名称:jts,代码行数:18,代码来源:IsSimpleOp.java

示例7: computeSelfNodes

import com.vividsolutions.jts.geomgraph.index.SegmentIntersector; //导入依赖的package包/类
/**
     * Compute self-nodes, taking advantage of the Geometry type to
     * minimize the number of intersection tests.  (E.g. rings are
     * not tested for self-intersection, since they are assumed to be valid).
     *
     * @param li                   the LineIntersector to use
     * @param computeRingSelfNodes if <false>, intersection checks are optimized to not test rings for self-intersection
     * @return the SegmentIntersector used, containing information about the intersections found
     */
    public SegmentIntersector computeSelfNodes(LineIntersector li, boolean computeRingSelfNodes) {
        SegmentIntersector si = new SegmentIntersector(li, true, false);
        EdgeSetIntersector esi = createEdgeSetIntersector();
        // optimized test for Polygons and Rings
        if (!computeRingSelfNodes
                && (parentGeom instanceof LinearRing
                || parentGeom instanceof Polygon
                || parentGeom instanceof MultiPolygon)) {
            esi.computeIntersections(edges, si, false);
        } else {
            esi.computeIntersections(edges, si, true);
        }
//System.out.println("SegmentIntersector # tests = " + si.numTests);
        addSelfIntersectionNodes(argIndex);
        return si;
    }
 
开发者ID:Semantive,项目名称:jts,代码行数:26,代码来源:GeometryGraph.java

示例8: computeEdgeIntersections

import com.vividsolutions.jts.geomgraph.index.SegmentIntersector; //导入依赖的package包/类
public SegmentIntersector computeEdgeIntersections(
            GeometryGraph g,
            LineIntersector li,
            boolean includeProper) {
        SegmentIntersector si = new SegmentIntersector(li, includeProper, true);
        si.setBoundaryNodes(this.getBoundaryNodes(), g.getBoundaryNodes());

        EdgeSetIntersector esi = createEdgeSetIntersector();
        esi.computeIntersections(edges, g.edges, si);
/*
for (Iterator i = g.edges.iterator(); i.hasNext();) {
Edge e = (Edge) i.next();
Debug.print(e.getEdgeIntersectionList());
}
*/
        return si;
    }
 
开发者ID:Semantive,项目名称:jts,代码行数:18,代码来源:GeometryGraph.java

示例9: isNodeConsistentArea

import com.vividsolutions.jts.geomgraph.index.SegmentIntersector; //导入依赖的package包/类
/**
 * Check all nodes to see if their labels are consistent with area topology.
 *
 * @return <code>true</code> if this area has a consistent node labelling
 */
public boolean isNodeConsistentArea()
{
  /**
   * To fully check validity, it is necessary to
   * compute ALL intersections, including self-intersections within a single edge.
   */
  SegmentIntersector intersector = geomGraph.computeSelfNodes(li, true);
  if (intersector.hasProperIntersection()) {
    invalidPoint = intersector.getProperIntersectionPoint();
    return false;
  }

  nodeGraph.build(geomGraph);

  return isNodeEdgeAreaLabelsConsistent();
}
 
开发者ID:GitHubDroid,项目名称:geodroid_master_update,代码行数:22,代码来源:ConsistentAreaTester.java

示例10: isSimpleLinearGeometry

import com.vividsolutions.jts.geomgraph.index.SegmentIntersector; //导入依赖的package包/类
private boolean isSimpleLinearGeometry(Geometry geom)
{
  if (geom.isEmpty()) return true;
  GeometryGraph graph = new GeometryGraph(0, geom);
  LineIntersector li = new RobustLineIntersector();
  SegmentIntersector si = graph.computeSelfNodes(li, true);
  // if no self-intersection, must be simple
  if (! si.hasIntersection()) return true;
  if (si.hasProperIntersection()) {
    nonSimpleLocation = si.getProperIntersectionPoint();
    return false;
  }
  if (hasNonEndpointIntersection(graph)) return false;
  if (isClosedEndpointsInInterior) {
    if (hasClosedEndpointIntersection(graph)) return false;
  }
  return true;
}
 
开发者ID:GitHubDroid,项目名称:geodroid_master_update,代码行数:19,代码来源:IsSimpleOp.java

示例11: getNodedEdges

import com.vividsolutions.jts.geomgraph.index.SegmentIntersector; //导入依赖的package包/类
public List getNodedEdges() {
        EdgeSetIntersector esi = new SimpleMCSweepLineIntersector();
        SegmentIntersector si = new SegmentIntersector(this.li, true, false);
        esi.computeIntersections(this.inputEdges, si, true);
//Debug.println("has proper int = " + si.hasProperIntersection());

        List splitEdges = new ArrayList();
        for (Object inputEdge : inputEdges) {
            Edge e = (Edge) inputEdge;
            e.getEdgeIntersectionList().addSplitEdges(splitEdges);
        }
        return splitEdges;
    }
 
开发者ID:gegy1000,项目名称:Earth,代码行数:14,代码来源:EdgeSetNoder.java

示例12: fullClosedLine

import com.vividsolutions.jts.geomgraph.index.SegmentIntersector; //导入依赖的package包/类
LineString fullClosedLine(List<LineString> lines) {
    List<Coordinate> tail = new ArrayList<>();

    boolean found;
    do {
        found = false;
        for (int i = 0; i < lines.size(); i++) {
            if (addToClosed(tail, lines.get(i))) {
                lines.remove(i);
                i--;
                found = true;
            }
        }
    } while (found);

    LineString s = GeometryHelper.createLine(tail);
    if (!s.isClosed()) {
        throw new RuntimeException("Non-closed line starts from " + tail.get(0) + " ends to "
                + tail.get(tail.size() - 1));
    }
    if (!s.isSimple()) {
        GeometryGraph graph = new GeometryGraph(0, s);
        LineIntersector li = new RobustLineIntersector();
        SegmentIntersector si = graph.computeSelfNodes(li, true);
        if (si.hasProperInteriorIntersection()) {
            throw new RuntimeException("Self-intersection for " + relation.getObjectCode()
                    + " near point " + si.getProperIntersectionPoint());
        }else {
            throw new RuntimeException("Self-intersected line: " + s);
        }
    }
    return s;
}
 
开发者ID:alex73,项目名称:OSMemory,代码行数:34,代码来源:ExtendedRelation.java

示例13: getNodedEdges

import com.vividsolutions.jts.geomgraph.index.SegmentIntersector; //导入依赖的package包/类
public List getNodedEdges() {
        EdgeSetIntersector esi = new SimpleMCSweepLineIntersector();
        SegmentIntersector si = new SegmentIntersector(li, true, false);
        esi.computeIntersections(inputEdges, si, true);
//Debug.println("has proper int = " + si.hasProperIntersection());

        List splitEdges = new ArrayList();
        for (Iterator i = inputEdges.iterator(); i.hasNext(); ) {
            Edge e = (Edge) i.next();
            e.getEdgeIntersectionList().addSplitEdges(splitEdges);
        }
        return splitEdges;
    }
 
开发者ID:Semantive,项目名称:jts,代码行数:14,代码来源:EdgeSetNoder.java

示例14: computeIM

import com.vividsolutions.jts.geomgraph.index.SegmentIntersector; //导入依赖的package包/类
public IntersectionMatrix computeIM() {
        IntersectionMatrix im = new IntersectionMatrix();
        // since Geometries are finite and embedded in a 2-D space, the EE element must always be 2
        im.set(Location.EXTERIOR, Location.EXTERIOR, 2);

        // if the Geometries don't overlap there is nothing to do
        if (!this.arg[0].getGeometry().getEnvelopeInternal().intersects(
                this.arg[1].getGeometry().getEnvelopeInternal())) {
            this.computeDisjointIM(im);
            return im;
        }
        this.arg[0].computeSelfNodes(this.li, false);
        this.arg[1].computeSelfNodes(this.li, false);

        // compute intersections between edges of the two input geometries
        SegmentIntersector intersector = this.arg[0].computeEdgeIntersections(this.arg[1], this.li, false);
//System.out.println("computeIM: # segment intersection tests: " + intersector.numTests);
        this.computeIntersectionNodes(0);
        this.computeIntersectionNodes(1);
        /**
         * Copy the labelling for the nodes in the parent Geometries.  These override
         * any labels determined by intersections between the geometries.
         */
        this.copyNodesAndLabels(0);
        this.copyNodesAndLabels(1);

        // complete the labelling for any nodes which only have a label for a single geometry
//Debug.addWatch(nodes.find(new Coordinate(110, 200)));
//Debug.printWatch();
        this.labelIsolatedNodes();
//Debug.printWatch();

        // If a proper intersection was found, we can set a lower bound on the IM.
        this.computeProperIntersectionIM(intersector, im);

        /**
         * Now process improper intersections
         * (eg where one or other of the geometries has a vertex at the intersection point)
         * We need to compute the edge graph at all nodes to determine the IM.
         */

        // build EdgeEnds for all intersections
        EdgeEndBuilder eeBuilder = new EdgeEndBuilder();
        List ee0 = eeBuilder.computeEdgeEnds(this.arg[0].getEdgeIterator());
        this.insertEdgeEnds(ee0);
        List ee1 = eeBuilder.computeEdgeEnds(this.arg[1].getEdgeIterator());
        this.insertEdgeEnds(ee1);

//Debug.println("==== NodeList ===");
//Debug.print(nodes);

        this.labelNodeEdges();

        /**
         * Compute the labeling for isolated components
         * <br>
         * Isolated components are components that do not touch any other components in the graph.
         * They can be identified by the fact that they will
         * contain labels containing ONLY a single element, the one for their parent geometry.
         * We only need to check components contained in the input graphs, since
         * isolated components will not have been replaced by new components formed by intersections.
         */
//debugPrintln("Graph A isolated edges - ");
        this.labelIsolatedEdges(0, 1);
//debugPrintln("Graph B isolated edges - ");
        this.labelIsolatedEdges(1, 0);

        // update the IM from all components
        this.updateIM(im);
        return im;
    }
 
开发者ID:gegy1000,项目名称:Earth,代码行数:72,代码来源:RelateComputer.java

示例15: computeProperIntersectionIM

import com.vividsolutions.jts.geomgraph.index.SegmentIntersector; //导入依赖的package包/类
private void computeProperIntersectionIM(SegmentIntersector intersector, IntersectionMatrix im) {
    // If a proper intersection is found, we can set a lower bound on the IM.
    int dimA = this.arg[0].getGeometry().getDimension();
    int dimB = this.arg[1].getGeometry().getDimension();
    boolean hasProper = intersector.hasProperIntersection();
    boolean hasProperInterior = intersector.hasProperInteriorIntersection();

    // For Geometry's of dim 0 there can never be proper intersections.

    /**
     * If edge segments of Areas properly intersect, the areas must properly overlap.
     */
    if (dimA == 2 && dimB == 2) {
        if (hasProper) {
            im.setAtLeast("212101212");
        }
    }
    /**
     * If an Line segment properly intersects an edge segment of an Area,
     * it follows that the Interior of the Line intersects the Boundary of the Area.
     * If the intersection is a proper <i>interior</i> intersection, then
     * there is an Interior-Interior intersection too.
     * Note that it does not follow that the Interior of the Line intersects the Exterior
     * of the Area, since there may be another Area component which contains the rest of the Line.
     */
    else if (dimA == 2 && dimB == 1) {
        if (hasProper) {
            im.setAtLeast("FFF0FFFF2");
        }
        if (hasProperInterior) {
            im.setAtLeast("1FFFFF1FF");
        }
    } else if (dimA == 1 && dimB == 2) {
        if (hasProper) {
            im.setAtLeast("F0FFFFFF2");
        }
        if (hasProperInterior) {
            im.setAtLeast("1F1FFFFFF");
        }
    }
/* If edges of LineStrings properly intersect *in an interior point*, all
    we can deduce is that
    the interiors intersect.  (We can NOT deduce that the exteriors intersect,
    since some other segments in the geometries might cover the points in the
    neighbourhood of the intersection.)
    It is important that the point be known to be an interior point of
    both Geometries, since it is possible in a self-intersecting geometry to
    have a proper intersection on one segment that is also a boundary point of another segment.
*/
    else if (dimA == 1 && dimB == 1) {
        if (hasProperInterior) {
            im.setAtLeast("0FFFFFFFF");
        }
    }
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:56,代码来源:RelateComputer.java


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