Esempio n. 1
0
        /// <summary>
        /// Compute the overall ON location for the list of EdgeStubs.
        /// (This is essentially equivalent to computing the self-overlay of a single Geometry)
        /// edgeStubs can be either on the boundary (e.g. Polygon edge)
        /// OR in the interior (e.g. segment of a LineString)
        /// of their parent Geometry.
        /// In addition, GeometryCollections use the <see cref="IBoundaryNodeRule"/> to determine
        /// whether a segment is on the boundary or not.
        /// Finally, in GeometryCollections it can occur that an edge is both
        /// on the boundary and in the interior (e.g. a LineString segment lying on
        /// top of a Polygon edge.) In this case the Boundary is given precedence.
        /// These observations result in the following rules for computing the ON location:
        ///  if there are an odd number of Bdy edges, the attribute is Bdy
        ///  if there are an even number >= 2 of Bdy edges, the attribute is Int
        ///  if there are any Int edges, the attribute is Int
        ///  otherwise, the attribute is Null.
        /// </summary>
        /// <param name="geomIndex"></param>
        /// <param name="boundaryNodeRule"></param>
        private void ComputeLabelOn(int geomIndex, IBoundaryNodeRule boundaryNodeRule)
        {
            // compute the On location value
            int      boundaryCount = 0;
            bool     foundInterior = false;
            Location loc;

            foreach (EdgeEnd e in _edgeEnds)
            {
                loc = e.Label.GetLocation(geomIndex);
                if (loc == Location.Boundary)
                {
                    boundaryCount++;
                }
                if (loc == Location.Interior)
                {
                    foundInterior = true;
                }
            }

            loc = Location.Null;
            if (foundInterior)
            {
                loc = Location.Interior;
            }
            if (boundaryCount > 0)
            {
                loc = GeometryGraph.DetermineBoundary(boundaryNodeRule, boundaryCount);
            }
            Label.SetLocation(geomIndex, loc);
        }
        /// <summary>
        /// Compute the overall ON location for the list of EdgeStubs.
        /// (This is essentially equivalent to computing the self-overlay of a single Geometry)
        /// edgeStubs can be either on the boundary (eg Polygon edge)
        /// OR in the interior (e.g. segment of a LineString)
        /// of their parent Geometry.
        /// In addition, GeometryCollections use the mod-2 rule to determine
        /// whether a segment is on the boundary or not.
        /// Finally, in GeometryCollections it can still occur that an edge is both
        /// on the boundary and in the interior (e.g. a LineString segment lying on
        /// top of a Polygon edge.) In this case as usual the Boundary is given precendence.
        /// These observations result in the following rules for computing the ON location:
        ///  if there are an odd number of Bdy edges, the attribute is Bdy
        ///  if there are an even number >= 2 of Bdy edges, the attribute is Int
        ///  if there are any Int edges, the attribute is Int
        ///  otherwise, the attribute is Null.
        /// </summary>
        /// <param name="geomIndex"></param>
        private void ComputeLabelOn(int geomIndex)
        {
            // compute the On location value
            int       boundaryCount = 0;
            bool      foundInterior = false;
            Locations loc           = Locations.Null;

            for (IEnumerator it = GetEnumerator(); it.MoveNext();)
            {
                EdgeEnd e = (EdgeEnd)it.Current;
                loc = e.Label.GetLocation(geomIndex);
                if (loc == Locations.Boundary)
                {
                    boundaryCount++;
                }
                if (loc == Locations.Interior)
                {
                    foundInterior = true;
                }
            }

            loc = Locations.Null;
            if (foundInterior)
            {
                loc = Locations.Interior;
            }
            if (boundaryCount > 0)
            {
                loc = GeometryGraph.DetermineBoundary(boundaryCount);
            }
            label.SetLocation(geomIndex, loc);
        }
Esempio n. 3
0
        /// <summary>
        /// Compute the overall ON location for the list of EdgeEndBundle.
        /// </summary>
        /// <remarks>
        /// This is essentially equivalent to computing the self-overlay of
        /// a single Geometry.
        /// <para>
        /// EdgeEndBundle can be either on the boundary (eg Polygon edge)
        /// OR in the interior (e.g. segment of a LineString)
        /// of their parent Geometry.
        /// In addition, GeometryCollections use the mod-2 rule to determine
        /// whether a segment is on the boundary or not.
        /// Finally, in GeometryCollections it can still occur that an edge is both
        /// on the boundary and in the interior (e.g. a LineString segment lying on
        /// top of a Polygon edge.) In this case as usual the Boundary is given precendence.
        /// </para>
        /// These observations result in the following rules for computing the ON location:
        /// <list type="bullet">
        /// <item>
        /// <description>
        /// if there are an odd number of boundary edges, the attribute is boundary.
        /// </description>
        /// </item>
        /// <item>
        /// <description>
        /// if there are an even number >= 2 of boundary edges, the attribute is interior.
        /// </description>
        /// </item>
        /// <item>
        /// <description>
        /// if there are any interior edges, the attribute is interior.
        /// </description>
        /// </item>
        /// <item>
        /// <description>
        /// otherwise, the attribute is NULL.
        /// </description>
        /// </item>
        /// </list>
        /// </remarks>
        private void ComputeLabelOn(int geomIndex)
        {
            // compute the ON location value
            int  boundaryCount = 0;
            bool foundInterior = false;

            for (IEnumerator it = Iterator(); it.MoveNext();)
            {
                EdgeEnd e   = (EdgeEnd)it.Current;
                int     loc = e.Label.GetLocation(geomIndex);
                if (loc == LocationType.Boundary)
                {
                    boundaryCount++;
                }
                if (loc == LocationType.Interior)
                {
                    foundInterior = true;
                }
            }
            int loc2 = LocationType.None;

            if (foundInterior)
            {
                loc2 = LocationType.Interior;
            }
            if (boundaryCount > 0)
            {
                loc2 = GeometryGraph.DetermineBoundary(boundaryCount);
            }
            m_objLabel.SetLocation(geomIndex, loc2);
        }
Esempio n. 4
0
        }         // public override void ComputeLabel()

        /// <summary>
        /// Compute the overall ON location for the list of EdgeStubs.
        /// </summary>
        /// <remarks>
        /// (This is essentially equivalent to computing the self-overlay of a single Geometry)
        /// edgeStubs can be either on the boundary (eg Polygon edge)
        /// OR in the interior (e.g. segment of a LineString)of their parent Geometry.
        /// In addition, GeometryCollections use the mod-2 rule to determine
        /// whether a segment is on the boundary or not.
        ///	Finally, in GeometryCollections it can still occur that an edge is both
        /// on the boundary and in the interior (e.g. a LineString segment lying on
        /// top of a Polygon edge.) In this case as usual the Boundary is given precendence.
        /// These observations result in the following rules for computing the ON location:
        /// <list type="bullet">
        /// <item><term>if there are an odd number of Bdy edges, the attribute is Bdy</term></item>
        /// <item><term>if there are an even number >= 2 of Bdy edges, the attribute is Int</term></item>
        /// <item><term>if there are any Int edges, the attribute is Int</term></item>
        /// <item><term>otherwise, the attribute is NULL.</term></item>
        /// </list>
        /// </remarks>
        /// <param name="geomIndex"></param>
        private void ComputeLabelOn(int geomIndex)
        {
            // compute the ON location value
            int  boundaryCount = 0;
            bool foundInterior = false;
            int  loc;

            foreach (object obj in _edgeEnds)
            {
                EdgeEnd e = (EdgeEnd)obj;
                loc = e.Label.GetLocation(geomIndex);
                if (loc == Location.Boundary)
                {
                    boundaryCount++;
                }
                if (loc == Location.Interior)
                {
                    foundInterior = true;
                }
            }             // foreach ( object obj in _edgeEnds )

            loc = Location.Null;
            if (foundInterior)
            {
                loc = Location.Interior;
            }
            if (boundaryCount > 0)
            {
                loc = GeometryGraph.DetermineBoundary(boundaryCount);
            }
            _label.SetLocation(geomIndex, loc);
        }         // private void ComputeLabelOn(int geomIndex)