Пример #1
0
        private bool IsSimpleLinearGeometry(IGeometry geom)
        {
            if (geom.IsEmpty)
            {
                return(true);
            }

            var graph = new GeometryGraph(0, geom);
            var li    = new RobustLineIntersector();
            var si    = graph.ComputeSelfNodes(li, true);

            // if no self-intersection, must be simple
            if (!si.HasIntersection)
            {
                return(true);
            }
            if (si.HasProperIntersection)
            {
                _nonSimpleLocation = si.ProperIntersectionPoint;
                return(false);
            }
            if (HasNonEndpointIntersection(graph))
            {
                return(false);
            }
            if (_isClosedEndpointsInInterior)
            {
                if (HasClosedEndpointIntersection(graph))
                {
                    return(false);
                }
            }
            return(true);
        }
Пример #2
0
        private bool IsSimpleLinearGeometry(MultiLineString 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())
            {
                return(false);
            }
            if (HasNonEndpointIntersection(graph))
            {
                return(false);
            }
            if (HasClosedEndpointIntersection(graph))
            {
                return(false);
            }

            return(true);
        }
Пример #3
0
        /// <summary> Checks validity of a LinearRing.</summary>
        private void CheckValid(LinearRing g)
        {
            CheckInvalidCoordinates(g.Coordinates);
            if (validErr != null)
            {
                return;
            }

            CheckClosedRing(g);
            if (validErr != null)
            {
                return;
            }

            GeometryGraph graph = new GeometryGraph(0, g);

            CheckTooFewPoints(graph);

            if (validErr != null)
            {
                return;
            }

            LineIntersector li = new RobustLineIntersector();

            graph.ComputeSelfNodes(li, true);
            CheckNoSelfIntersectingRings(graph);
        }
Пример #4
0
        /// <summary>
        /// Checks validity of a LinearRing.
        /// </summary>
        /// <param name="g"></param>
        private void CheckValidRing(ILinearRing g)
        {
            CheckClosedRing(g);
            if (_validErr != null)
            {
                return;
            }
            GeometryGraph   graph = new GeometryGraph(0, g);
            LineIntersector li    = new RobustLineIntersector();

            graph.ComputeSelfNodes(li, true);
            CheckNoSelfIntersectingRings(graph);
        }
Пример #5
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public bool IsNodeConsistentArea()
        {
            SegmentIntersector intersector = _geomGraph.ComputeSelfNodes(_li);

            if (intersector.HasProperIntersection)
            {
                _invalidPoint = intersector.ProperIntersectionPoint;
                return(false);
            }

            _nodeGraph.Build(_geomGraph);

            return(IsNodeEdgeAreaLabelsConsistent());
        }
Пример #6
0
        /// <summary>
        /// Check all nodes to see if their labels are consistent with
        /// area topology.
        /// </summary>
        /// <returns>
        /// <c>true</c> if this area has a consistent node labelling
        /// </returns>
        public bool 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.ProperIntersectionPoint;
                return(false);
            }

            nodeGraph.Build(geomGraph);

            return(IsNodeEdgeAreaLabelsConsistent());
        }
Пример #7
0
        /**
         * Use a GeometryGraph to node the created edges,
         * and create split edges between the nodes
         */
        private ArrayList NodeEdges(ArrayList edges)
        {
            // intersect edges again to ensure they are noded correctly
            GeometryGraph graph = new GeometryGraph(0, _geomFact.PrecisionModel, 0);

            //for (Iterator i = edges.iterator(); i.hasNext(); )
            foreach (object obj in edges)
            {
                Edge e = (Edge)obj;
                graph.AddEdge(e);
            }
            SegmentIntersector si = graph.ComputeSelfNodes(_li);

            /*
             * if (si.hasProperIntersection())
             * Debug.println("proper intersection found");
             * else
             * Debug.println("no proper intersection found");
             */
            ArrayList newEdges = new ArrayList();

            graph.ComputeSplitEdges(newEdges);
            return(newEdges);
        }