예제 #1
0
 /// <summary>
 /// Update the IM with the contribution for the EdgeStubs around the node.
 /// </summary>
 /// <param name="im"></param>
 public void UpdateIM(IntersectionMatrix im)
 {
     for (IEnumerator it = GetEnumerator(); it.MoveNext(); )
     {
         EdgeEndBundle esb = (EdgeEndBundle) it.Current;
         esb.UpdateIM(im);
     }
 }
예제 #2
0
 /// <summary>
 /// Adds one matrix to another.
 /// Addition is defined by taking the maximum dimension value of each position
 /// in the summand matrices.
 /// </summary>
 /// <param name="im">The matrix to add.</param>
 public void Add(IntersectionMatrix im)
 {
     for (int i = 0; i < 3; i++)
     {
         for (int j = 0; j < 3; j++)
         {
             SetAtLeast((Locations)i, (Locations)j, im.Get((Locations)i, (Locations)j));
         }
     }
 }
예제 #3
0
 /// <summary>
 /// Creates an <see cref="IntersectionMatrix" /> with the same elements as
 /// <c>other</c>.
 /// </summary>
 /// <param name="other">An <see cref="IntersectionMatrix" /> to copy.</param>
 public IntersectionMatrix(IntersectionMatrix other) : this()
 {
     matrix[(int)Locations.Interior, (int)Locations.Interior] = other.matrix[(int)Locations.Interior, (int)Locations.Interior];
     matrix[(int)Locations.Interior, (int)Locations.Boundary] = other.matrix[(int)Locations.Interior, (int)Locations.Boundary];
     matrix[(int)Locations.Interior, (int)Locations.Exterior] = other.matrix[(int)Locations.Interior, (int)Locations.Exterior];
     matrix[(int)Locations.Boundary, (int)Locations.Interior] = other.matrix[(int)Locations.Boundary, (int)Locations.Interior];
     matrix[(int)Locations.Boundary, (int)Locations.Boundary] = other.matrix[(int)Locations.Boundary, (int)Locations.Boundary];
     matrix[(int)Locations.Boundary, (int)Locations.Exterior] = other.matrix[(int)Locations.Boundary, (int)Locations.Exterior];
     matrix[(int)Locations.Exterior, (int)Locations.Interior] = other.matrix[(int)Locations.Exterior, (int)Locations.Interior];
     matrix[(int)Locations.Exterior, (int)Locations.Boundary] = other.matrix[(int)Locations.Exterior, (int)Locations.Boundary];
     matrix[(int)Locations.Exterior, (int)Locations.Exterior] = other.matrix[(int)Locations.Exterior, (int)Locations.Exterior];
 }
예제 #4
0
 /// <summary> 
 /// Creates an <see cref="IntersectionMatrix" /> with the same elements as
 /// <c>other</c>.
 /// </summary>
 /// <param name="other">An <see cref="IntersectionMatrix" /> to copy.</param>         
 public IntersectionMatrix(IntersectionMatrix other)
     : this()
 {
     matrix[(int) Locations.Interior, (int)Locations.Interior] = other.matrix[(int) Locations.Interior, (int) Locations.Interior];
     matrix[(int) Locations.Interior, (int)Locations.Boundary] = other.matrix[(int) Locations.Interior, (int) Locations.Boundary];
     matrix[(int) Locations.Interior, (int)Locations.Exterior] = other.matrix[(int) Locations.Interior, (int) Locations.Exterior];
     matrix[(int) Locations.Boundary, (int)Locations.Interior] = other.matrix[(int) Locations.Boundary, (int) Locations.Interior];
     matrix[(int) Locations.Boundary, (int)Locations.Boundary] = other.matrix[(int) Locations.Boundary, (int) Locations.Boundary];
     matrix[(int) Locations.Boundary, (int)Locations.Exterior] = other.matrix[(int) Locations.Boundary, (int) Locations.Exterior];
     matrix[(int) Locations.Exterior, (int)Locations.Interior] = other.matrix[(int) Locations.Exterior, (int) Locations.Interior];
     matrix[(int) Locations.Exterior, (int)Locations.Boundary] = other.matrix[(int) Locations.Exterior, (int) Locations.Boundary];
     matrix[(int) Locations.Exterior, (int)Locations.Exterior] = other.matrix[(int) Locations.Exterior, (int) Locations.Exterior];
 }
예제 #5
0
 /// <summary> 
 /// Adds one matrix to another.
 /// Addition is defined by taking the maximum dimension value of each position
 /// in the summand matrices.
 /// </summary>
 /// <param name="im">The matrix to add.</param>        
 public void Add(IntersectionMatrix im)
 {
     for (int i = 0; i < 3; i++)
         for (int j = 0; j < 3; j++)
             SetAtLeast((Locations) i, (Locations) j, im.Get((Locations) i, (Locations) j));
 }
예제 #6
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        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(Locations.Exterior, Locations.Exterior, Dimensions.Surface);

            // if the Geometries don't overlap there is nothing to do
            if (!arg[0].Geometry.EnvelopeInternal.Intersects(arg[1].Geometry.EnvelopeInternal))
            {
                ComputeDisjointIM(im);
                return im;
            }
            arg[0].ComputeSelfNodes(li, false);
            arg[1].ComputeSelfNodes(li, false);

            // compute intersections between edges of the two input geometries
            SegmentIntersector intersector = arg[0].ComputeEdgeIntersections(arg[1], li, false);
            ComputeIntersectionNodes(0);
            ComputeIntersectionNodes(1);

            /*
             * Copy the labelling for the nodes in the parent Geometries.  These override
             * any labels determined by intersections between the geometries.
             */
            CopyNodesAndLabels(0);
            CopyNodesAndLabels(1);

            // complete the labelling for any nodes which only have a label for a single point
            LabelIsolatedNodes();

            // If a proper intersection was found, we can set a lower bound on the IM.
            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();
            IList ee0 = eeBuilder.ComputeEdgeEnds(arg[0].GetEdgeEnumerator());
            InsertEdgeEnds(ee0);
            IList ee1 = eeBuilder.ComputeEdgeEnds(arg[1].GetEdgeEnumerator());
            InsertEdgeEnds(ee1);

            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 point.
             * 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.
             */
            LabelIsolatedEdges(0, 1);
            LabelIsolatedEdges(1, 0);

            // update the IM from all components
            UpdateIM(im);
            return im;
        }
예제 #7
0
파일: Edge.cs 프로젝트: izambakci/tf-net
 /// <summary>
 /// Update the IM with the contribution for this component.
 /// A component only contributes if it has a labelling for both parent geometries.
 /// </summary>
 /// <param name="im"></param>
 public override void ComputeIM(IntersectionMatrix im)
 {
     UpdateIM(label, im);
 }
예제 #8
0
 /// <summary>
 /// Returns true if each of the actual dimension symbols satisfies the
 /// corresponding required dimension symbol.
 /// </summary>
 /// <param name="actualDimensionSymbols">
 /// Nine dimension symbols to validate.
 /// Possible values are <c>T, F, * , 0, 1, 2</c>.
 /// </param>
 /// <param name="requiredDimensionSymbols">
 /// Nine dimension symbols to validate
 /// against. Possible values are <c>T, F, * , 0, 1, 2</c>.
 /// </param>
 /// <returns>
 /// <c>true</c> if each of the required dimension
 /// symbols encompass the corresponding actual dimension symbol.
 /// </returns>
 public static bool Matches(string actualDimensionSymbols, string requiredDimensionSymbols)
 {
     IntersectionMatrix m = new IntersectionMatrix(actualDimensionSymbols);
     return m.Matches(requiredDimensionSymbols);
 }
예제 #9
0
        /// <summary>
        /// Returns true if each of the actual dimension symbols satisfies the
        /// corresponding required dimension symbol.
        /// </summary>
        /// <param name="actualDimensionSymbols">
        /// Nine dimension symbols to validate.
        /// Possible values are <c>T, F, * , 0, 1, 2</c>.
        /// </param>
        /// <param name="requiredDimensionSymbols">
        /// Nine dimension symbols to validate
        /// against. Possible values are <c>T, F, * , 0, 1, 2</c>.
        /// </param>
        /// <returns>
        /// <c>true</c> if each of the required dimension
        /// symbols encompass the corresponding actual dimension symbol.
        /// </returns>
        public static bool Matches(string actualDimensionSymbols, string requiredDimensionSymbols)
        {
            IntersectionMatrix m = new IntersectionMatrix(actualDimensionSymbols);

            return(m.Matches(requiredDimensionSymbols));
        }
예제 #10
0
 /// <summary>
 /// Update the IM with the contribution for this component.
 /// A component only contributes if it has a labelling for both parent geometries.
 /// </summary>
 public override void ComputeIM(IntersectionMatrix im)
 {
     im.SetAtLeastIfValid(label.GetLocation(0), label.GetLocation(1), Dimensions.Point);
 }
예제 #11
0
파일: Edge.cs 프로젝트: izambakci/tf-net
 /// <summary> 
 /// Updates an IM from the label for an edge.
 /// Handles edges from both L and A geometries.
 /// </summary>
 /// <param name="im"></param>
 /// <param name="label"></param>
 public static void UpdateIM(Label label, IntersectionMatrix im)
 {
     im.SetAtLeastIfValid(label.GetLocation(0, Positions.On), label.GetLocation(1, Positions.On), Dimensions.Curve);
     if (label.IsArea())
     {
         im.SetAtLeastIfValid(label.GetLocation(0, Positions.Left), label.GetLocation(1, Positions.Left), Dimensions.Surface);
         im.SetAtLeastIfValid(label.GetLocation(0, Positions.Right), label.GetLocation(1, Positions.Right), Dimensions.Surface);
     }
 }
예제 #12
0
 /// <summary>
 /// Update the IM with the contribution for this component.
 /// A component only contributes if it has a labelling for both parent geometries.
 /// </summary>
 /// <param name="im"></param>
 public void UpdateIM(IntersectionMatrix im)
 {
     Assert.IsTrue(label.GeometryCount >= 2, "found partial label");
     ComputeIM(im);
 }
예제 #13
0
파일: Node.cs 프로젝트: izambakci/tf-net
 /// <summary>
 /// Basic nodes do not compute IMs.
 /// </summary>
 /// <param name="im"></param>
 public override void ComputeIM(IntersectionMatrix im)
 {
 }
예제 #14
0
 /// <summary>
 /// Update the IM with the sum of the IMs for each component.
 /// </summary>
 /// <param name="im"></param>
 private void UpdateIM(IntersectionMatrix im)
 {
     for (IEnumerator ei = isolatedEdges.GetEnumerator(); ei.MoveNext(); )
     {
         Edge e = (Edge)ei.Current;
         e.UpdateIM(im);
     }
     for (IEnumerator ni = nodes.GetEnumerator(); ni.MoveNext(); )
     {
         RelateNode node = (RelateNode)ni.Current;
         node.UpdateIM(im);
         node.UpdateIMFromEdges(im);
     }
 }
예제 #15
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="intersector"></param>
        /// <param name="im"></param>
        private void ComputeProperIntersectionIM(SegmentIntersector intersector, IntersectionMatrix im)
        {
            // If a proper intersection is found, we can set a lower bound on the IM.
            Dimensions dimA = arg[0].Geometry.Dimension;
            Dimensions dimB = arg[1].Geometry.Dimension;
            bool hasProper = intersector.HasProperIntersection;
            bool 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 == Dimensions.Surface && dimB == Dimensions.Surface)
            {
                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 == Dimensions.Surface && dimB == Dimensions.Curve)
            {
                if (hasProper)
                    im.SetAtLeast("FFF0FFFF2");
                if (hasProperInterior)
                    im.SetAtLeast("1FFFFF1FF");
            }

            else if (dimA == Dimensions.Curve && dimB == Dimensions.Surface)
            {
                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 point to
               have a proper intersection on one segment that is also a boundary point of another segment.
            */
            else if (dimA == Dimensions.Curve && dimB == Dimensions.Curve)
            {
                if (hasProperInterior)
                    im.SetAtLeast("0FFFFFFFF");
            }
        }
예제 #16
0
 /// <summary>
 /// If the Geometries are disjoint, we need to enter their dimension and
 /// boundary dimension in the Ext rows in the IM
 /// </summary>
 /// <param name="im"></param>
 private void ComputeDisjointIM(IntersectionMatrix im)
 {
     IGeometry ga = arg[0].Geometry;
     if (!ga.IsEmpty)
     {
         im.Set(Locations.Interior, Locations.Exterior, ga.Dimension);
         im.Set(Locations.Boundary, Locations.Exterior, ga.BoundaryDimension);
     }
     IGeometry gb = arg[1].Geometry;
     if (!gb.IsEmpty)
     {
         im.Set(Locations.Exterior, Locations.Interior, gb.Dimension);
         im.Set(Locations.Exterior, Locations.Boundary, gb.BoundaryDimension);
     }
 }
예제 #17
0
 /// <summary>
 /// Update the IM with the contribution for the EdgeEnds incident on this node.
 /// </summary>
 /// <param name="im"></param>
 public void UpdateIMFromEdges(IntersectionMatrix im)
 {
     ((EdgeEndBundleStar) edges).UpdateIM(im);
 }
예제 #18
0
 /// <summary>
 /// Compute the contribution to an IM for this component.
 /// </summary>
 public abstract void ComputeIM(IntersectionMatrix im);
예제 #19
0
 /// <summary>
 /// Update the IM with the contribution for the computed label for the EdgeStubs.
 /// </summary>
 /// <param name="im"></param>
 public void UpdateIM(IntersectionMatrix im)
 {
     Edge.UpdateIM(label, im);
 }