Ejemplo n.º 1
0
 /// <summary>
 /// 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).
 /// </summary>
 /// <param name="li">The <c>LineIntersector</c> to use.</param>
 /// <param name="computeRingSelfNodes">If <c>false</c>, intersection checks are optimized to not test rings for self-intersection.</param>
 /// <returns>The SegmentIntersector used, containing information about the intersections found.</returns>
 public SegmentIntersector ComputeSelfNodes(LineIntersector li, bool computeRingSelfNodes)
 {
     SegmentIntersector si = new SegmentIntersector(li, true, false);
     EdgeSetIntersector esi = CreateEdgeSetIntersector();
     // optimized test for Polygons and Rings
     if (!computeRingSelfNodes &&
        (_parentGeom is ILinearRing || _parentGeom is IPolygon || _parentGeom is IMultiPolygon))
         esi.ComputeIntersections(Edges, si, false);
     else esi.ComputeIntersections(Edges, si, true);
     AddSelfIntersectionNodes(_argIndex);
     return si;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 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).
        /// </summary>
        /// <param name="li">The <c>LineIntersector</c> to use.</param>
        /// <param name="computeRingSelfNodes">If <c>false</c>, intersection checks are optimized to not test rings for self-intersection.</param>
        /// <returns>The SegmentIntersector used, containing information about the intersections found.</returns>
        public virtual SegmentIntersector ComputeSelfNodes(LineIntersector li, bool computeRingSelfNodes)
        {
            SegmentIntersector si  = new SegmentIntersector(li, true, false);
            EdgeSetIntersector esi = CreateEdgeSetIntersector();

            // optimized test for Polygons and Rings
            if (!computeRingSelfNodes &&
                (parentGeom is LinearRing || parentGeom is Polygon || parentGeom is MultiPolygon))
            {
                esi.ComputeIntersections(edges, si, false);
            }
            else
            {
                esi.ComputeIntersections(edges, si, true);
            }
            AddSelfIntersectionNodes(argIndex);
            return(si);
        }
Ejemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="g"></param>
 /// <param name="li"></param>
 /// <param name="includeProper"></param>
 /// <returns></returns>
 public SegmentIntersector ComputeEdgeIntersections(GeometryGraph g,
     LineIntersector li, bool includeProper)
 {
     SegmentIntersector si = new SegmentIntersector(li, includeProper, true);
     si.SetBoundaryNodes(BoundaryNodes, g.BoundaryNodes);
     EdgeSetIntersector esi = CreateEdgeSetIntersector();
     esi.ComputeIntersections(Edges, g.Edges, si);
     return si;
 }
Ejemplo n.º 4
0
        }         // public void AddPoint(Coordinate pt)

        /// <summary>
        ///
        /// </summary>
        /// <param name="li"></param>
        /// <returns></returns>
        public SegmentIntersector ComputeSelfNodes(LineIntersector li)
        {
            SegmentIntersector si = new SegmentIntersector(li, true, false);

            //EdgeSetIntersector esi = new MCQuadIntersector();
            _edgeSetIntersector.ComputeIntersections(_edges, si);
            //Trace.WriteLine( "SegmentIntersector # tests = " + si._numTests );
            AddSelfIntersectionNodes(_argIndex);
            return(si);
        }         // public SegmentIntersector computeSelfNodes(LineIntersector li)
Ejemplo n.º 5
0
        /// <summary>
        /// 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).
        /// </summary>
        /// <param name="li">the LineIntersector to use
        /// </param>
        /// <param name="computeRingSelfNodes">
        /// if false, intersection checks are optimized to not test rings
        /// for self-intersection
        /// </param>
        /// <returns>
        /// The SegmentIntersector used, containing information about the intersections found
        /// </returns>
        public SegmentIntersector ComputeSelfNodes(LineIntersector li, bool computeRingSelfNodes)
        {
            SegmentIntersector si  = new SegmentIntersector(li, true, false);
            EdgeSetIntersector esi = CreateEdgeSetIntersector();
            // optimized test for Polygons and Rings
            GeometryType geomType = parentGeom.GeometryType;

            if (!computeRingSelfNodes &&
                (geomType == GeometryType.LinearRing ||
                 geomType == GeometryType.Polygon ||
                 geomType == GeometryType.MultiPolygon))
            {
                esi.ComputeIntersections(edges, si, false);
            }
            else
            {
                esi.ComputeIntersections(edges, si, true);
            }

            AddSelfIntersectionNodes(argIndex);

            return(si);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 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).
        /// </summary >
        /// <param name="li">The <c>LineIntersector</c> to use</param>
        /// <param name="computeRingSelfNodes">If <value>false</value>, intersection checks are optimized to not test rings for self-intersection</param>
        /// <param name="isDoneIfProperInt">Short-circuit the intersection computation if a proper intersection is found</param>
        public SegmentIntersector ComputeSelfNodes(LineIntersector li, bool computeRingSelfNodes, bool isDoneIfProperInt)
        {
            SegmentIntersector si = new SegmentIntersector(li, true, false);

            si.IsDoneIfProperInt = isDoneIfProperInt;
            EdgeSetIntersector esi = CreateEdgeSetIntersector();
            // optimize intersection search for valid Polygons and LinearRings
            var isRings = _parentGeom is ILinearRing ||
                          _parentGeom is IPolygon ||
                          _parentGeom is IMultiPolygon;
            var computeAllSegments = computeRingSelfNodes || !isRings;

            esi.ComputeIntersections(Edges, si, computeAllSegments);

            //System.out.println("SegmentIntersector # tests = " + si.numTests);
            AddSelfIntersectionNodes(_argIndex);
            return(si);
        }