Esempio n. 1
0
 public abstract void SetEdgeRing( DirectedEdge de, EdgeRing er );
Esempio n. 2
0
		public override void SetEdgeRing( DirectedEdge de, EdgeRing er )
		{
			de.EdgeRing = er;
		}
Esempio n. 3
0
		} // private void PlaceFreeHoles( ArrayList freeHoleList )

		/// <summary>
		/// Find the innermost enclosing shell EdgeRing containing the argument EdgeRing, if any.
		/// The innermost enclosing ring is the <i>smallest</i> enclosing ring.</summary>
		/// <remarks>
		/// <para>The algorithm used depends on the fact that:
		/// 
		///  ring A contains ring B iff envelope(ring A) contains envelope(ring B)
		/// </para>
		/// <para>This routine is only safe to use if the chosen point of the hole
		/// is known to be properly contained in a shell
		/// (which is guaranteed to be the case if the hole does not touch its shell)</para>
		/// </remarks>
		/// <param name="testEr"></param>
		/// <returns>
		/// Containing EdgeRing, if there is one
		/// Null if no containing EdgeRing is found
		/// </returns>
		private EdgeRing FindEdgeRingContaining( EdgeRing testEr )
		{
			LinearRing testRing = testEr.GetLinearRing();
			Envelope testEnv = testRing.GetEnvelopeInternal();
			Coordinate testPt = testRing.GetCoordinateN(0);

			EdgeRing minShell = null;
			Envelope minEnv = null;
			foreach ( object obj in _shellList )
			{
				EdgeRing tryShell = (EdgeRing) obj;
				LinearRing tryRing = tryShell.GetLinearRing();
				Envelope tryEnv = tryRing.GetEnvelopeInternal();
				if ( minShell != null )
				{
					minEnv = minShell.GetLinearRing().GetEnvelopeInternal();
				}
				bool isContained = false;
				if ( tryEnv.Contains( testEnv )
					&& _cga.IsPointInRing( testPt, tryRing.GetCoordinates() ) )
				{
					isContained = true;
				}

				// check if this new containing ring is smaller than the current minimum ring
				if ( isContained ) 
				{
					if ( minShell == null
						|| minEnv.Contains( tryEnv ) ) 
					{
						minShell = tryShell;
					}
				}
			} // foreach ( object obj in _shellList )
			return minShell;
		} // private EdgeRing FindEdgeRingContaining( EdgeRing testEr )
Esempio n. 4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="ring"></param>
 public void AddHole(EdgeRing ring)
 {
     _holes.Add(ring);
 }
Esempio n. 5
0
		} // private EdgeRing FindShell( ArrayList minEdgeRings )

		/// <summary>
		/// This method assigns the holes for a Polygon (formed from a list of
		/// MinimalEdgeRings) to its shell.
		/// Determining the holes for a MinimalEdgeRing polygon serves two purposes:
		/// <ul>
		/// <li>it is faster than using a point-in-polygon check later on.</li>
		/// <li>it ensures correctness, since if the PIP test was used the point
		/// chosen might lie on the shell, which might return an incorrect result from the
		/// PIP test</li>
		/// </ul>
		/// </summary>
		/// <param name="shell"></param>
		/// <param name="minEdgeRings"></param>
		private void PlacePolygonHoles( EdgeRing shell, ArrayList minEdgeRings )
		{
			foreach ( object obj in minEdgeRings )
			{
				MinimalEdgeRing er = (MinimalEdgeRing) obj;
				if ( er.IsHole ) 
				{
					er.Shell = shell;
				}
			} // foreach ( object obj in minEdgeRings )
		} // private void PlacePolygonHoles( EdgeRing shell, ArrayList minEdgeRings )
Esempio n. 6
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="er"></param>
        public void LinkMinimalDirectedEdges(EdgeRing er)
        {
            // find first area edge (if any) to start linking at
            DirectedEdge firstOut = null;
            DirectedEdge incoming = null;
            int state = ScanningForIncoming;

            // link edges in CW order
            for ( int i = _resultAreaEdgeList.Count - 1; i >= 0; i-- )
            {
                DirectedEdge nextOut = (DirectedEdge)_resultAreaEdgeList[i];
                DirectedEdge nextIn = nextOut.Sym;

                // record first outgoing edge, in order to link the last incoming edge
                if ( firstOut == null && nextOut.EdgeRing == er)
                {
                    firstOut = nextOut;
                }

                switch ( state )
                {
                    case ScanningForIncoming:
                        if ( nextIn.EdgeRing != er) continue;
                        incoming = nextIn;
                        state = LinkingToOutGoing;
                        break;
                    case LinkingToOutGoing:
                        if ( nextOut.EdgeRing != er) continue;
                        incoming.NextMin = nextOut;
                        state = ScanningForIncoming;
                        break;
                } // switch ( state )
            } // for ( int i = _resultAreaEdgeList.Count - 1; i >= 0; i-- )

            //Trace.WriteLine( ToString() );

            if ( state == LinkingToOutGoing )
            {
                Trace.Assert( firstOut != null, "found null for first outgoing dirEdge");
                Trace.Assert( firstOut.EdgeRing == er, "unable to link last incoming dirEdge");
                incoming.NextMin = firstOut;
            } // if ( state == LinkingToOutGoing )
        }
Esempio n. 7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="er"></param>
 /// <returns></returns>
 public int GetOutgoingDegree( EdgeRing er )
 {
     int degree = 0;
     foreach ( DirectedEdge de in Edges() )
     {
         if ( de.EdgeRing == er)
         {
             degree++;
         }
     }
     return degree;
 }
Esempio n. 8
0
 abstract public void SetEdgeRing(DirectedEdge de, EdgeRing er);
Esempio n. 9
0
        }         // public LinearRing GetLinearRing()

        /// <summary>
        ///
        /// </summary>
        /// <param name="ring"></param>
        public void AddHole(EdgeRing ring)
        {
            _holes.Add(ring);
        }         // public void AddHole(EdgeRing ring)