Esempio n. 1
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 virtual void Add(IIntersectionMatrix im)
 {
     for (int i = 0; i < 3; i++)
     {
         for (int j = 0; j < 3; j++)
         {
             SetAtLeast((LocationType)i, (LocationType)j, im.Get((LocationType)i, (LocationType)j));
         }
     }
 }
Esempio n. 2
0
        void IIntersectionMatrix.Add(IIntersectionMatrix input)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    SetAtLeast(i, j, input.GetValue(i, j));
                }
            }
        }
Esempio n. 3
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(IIntersectionMatrix im)
        {
            IGeometry ga = _arg[0].Geometry;

            if (!ga.IsEmpty)
            {
                im.Set(LocationType.Interior, LocationType.Exterior, ga.Dimension);
                im.Set(LocationType.Boundary, LocationType.Exterior, ga.BoundaryDimension);
            }
            IGeometry gb = _arg[1].Geometry;

            if (!gb.IsEmpty)
            {
                im.Set(LocationType.Exterior, LocationType.Interior, gb.Dimension);
                im.Set(LocationType.Exterior, LocationType.Boundary, gb.BoundaryDimension);
            }
        }
Esempio n. 4
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 virtual void Add(IIntersectionMatrix im)
 {
     for (int i = 0; i < 3; i++)
         for (int j = 0; j < 3; j++)
             SetAtLeast((LocationType)i, (LocationType)j, im.Get((LocationType)i, (LocationType)j));
 }
Esempio n. 5
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(IIntersectionMatrix im)
 {
     IGeometry ga = _arg[0].Geometry;
     if (!ga.IsEmpty)
     {
         im.Set(LocationType.Interior, LocationType.Exterior, ga.Dimension);
         im.Set(LocationType.Boundary, LocationType.Exterior, ga.BoundaryDimension);
     }
     IGeometry gb = _arg[1].Geometry;
     if (!gb.IsEmpty)
     {
         im.Set(LocationType.Exterior, LocationType.Interior, gb.Dimension);
         im.Set(LocationType.Exterior, LocationType.Boundary, gb.BoundaryDimension);
     }
 }
Esempio n. 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="intersector"></param>
        /// <param name="im"></param>
        private void ComputeProperIntersectionIm(SegmentIntersector intersector, IIntersectionMatrix im)
        {
            // If a proper intersection is found, we can set a lower bound on the IM.
            DimensionType dimA = _arg[0].Geometry.Dimension;
            DimensionType 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 == DimensionType.Surface && dimB == DimensionType.Surface)
            {
                if (hasProper)
                {
                    im.SetAtLeast("212101212");
                }
            }
            else if (dimA == DimensionType.Surface && dimB == DimensionType.Curve)
            {
                /*
                * 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.
                * Notice 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.
                */
                if (hasProper)
                {
                    im.SetAtLeast("FFF0FFFF2");
                }
                if (hasProperInterior)
                {
                    im.SetAtLeast("1FFFFF1FF");
                }
            }
            else if (dimA == DimensionType.Curve && dimB == DimensionType.Surface)
            {
                if (hasProper)
                {
                    im.SetAtLeast("F0FFFFFF2");
                }
                if (hasProperInterior)
                {
                    im.SetAtLeast("1F1FFFFFF");
                }
            }
            else if (dimA == DimensionType.Curve && dimB == DimensionType.Curve)
            {
                /* 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.
               */

                if (hasProperInterior)
                {
                    im.SetAtLeast("0FFFFFFFF");
                }
            }
        }
Esempio n. 7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="intersector"></param>
        /// <param name="im"></param>
        private void ComputeProperIntersectionIm(SegmentIntersector intersector, IIntersectionMatrix im)
        {
            // If a proper intersection is found, we can set a lower bound on the IM.
            DimensionType dimA              = _arg[0].Geometry.Dimension;
            DimensionType 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 == DimensionType.Surface && dimB == DimensionType.Surface)
            {
                if (hasProper)
                {
                    im.SetAtLeast("212101212");
                }
            }
            else if (dimA == DimensionType.Surface && dimB == DimensionType.Curve)
            {
                /*
                 * 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.
                 * Notice 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.
                 */
                if (hasProper)
                {
                    im.SetAtLeast("FFF0FFFF2");
                }
                if (hasProperInterior)
                {
                    im.SetAtLeast("1FFFFF1FF");
                }
            }
            else if (dimA == DimensionType.Curve && dimB == DimensionType.Surface)
            {
                if (hasProper)
                {
                    im.SetAtLeast("F0FFFFFF2");
                }
                if (hasProperInterior)
                {
                    im.SetAtLeast("1F1FFFFFF");
                }
            }
            else if (dimA == DimensionType.Curve && dimB == DimensionType.Curve)
            {
                /* 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.
                 */

                if (hasProperInterior)
                {
                    im.SetAtLeast("0FFFFFFFF");
                }
            }
        }