Пример #1
0
 /// <summary>
 /// Creates a new <c>Polygon</c> without any islands, and with undefined insertion point.
 /// </summary>
 /// <param name="rm">The metrics for this polygon</param>
 /// <param name="edge">The boundaries that define the outer perimeter of the polygon</param>
 internal Polygon(RingMetrics rm, List <Face> edge)
     : base(rm, edge)
 {
     Debug.Assert(rm.SignedArea > 0.0);
     m_Islands = null;
     m_Labels  = null;
 }
Пример #2
0
 /// <summary>
 /// Creates a new <c>Polygon</c> without any islands, and with undefined insertion point.
 /// </summary>
 /// <param name="rm">The metrics for this polygon</param>
 /// <param name="edge">The boundaries that define the outer perimeter of the polygon</param>
 internal Polygon(RingMetrics rm, List<Face> edge)
     : base(rm, edge)
 {
     Debug.Assert(rm.SignedArea > 0.0);
     m_Islands = null;
     m_Labels = null;
 }
Пример #3
0
        /// <summary>
        /// Constructor used by <c>Ring.Create</c>.
        /// </summary>
        /// <param name="edge">The dividers that define the perimeter of the ring</param>
        protected Ring(RingMetrics metrics, List <Face> edge)
            : base(metrics)
        {
            m_Edge = new IDivider[edge.Count];
            m_Flag = 0;

            for (int i = 0; i < m_Edge.Length; i++)
            {
                Face     face = edge[i];
                IDivider d    = face.Divider;

                // Check for a divider that's already marked as being totally built.
                if (Topology.IsBuilt(d))
                {
                    throw new Exception("Polygon - Wrong build status for component divider");
                }

                // Remember the divider and update polygon geometry
                m_Edge[i] = d;

                if (face.IsLeft)
                {
                    d.Left = this;
                }
                else
                {
                    d.Right = this;
                }
            }
        }
Пример #4
0
        /// <summary>
        /// Creates a new <c>Ring</c> that's either a <see cref="Polygon"/> or an <see cref="Island"/>.
        /// </summary>
        /// <param name="edge">The faces that define the perimeter of the ring</param>
        internal static Ring Create(List <Face> edge)
        {
            RingMetrics rm = new RingMetrics(edge);

            if (rm.SignedArea <= 0.0)
            {
                return(new Island(rm, edge));
            }
            else
            {
                return(new Polygon(rm, edge));
            }
        }
Пример #5
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="copy">The metrics to (shallow) copy</param>
 protected RingMetrics(RingMetrics copy)
 {
     m_Area = copy.m_Area;
     m_Window = copy.m_Window;
 }
Пример #6
0
 /// <summary>
 /// Creates a new <c>Island</c> polygon.
 /// </summary>
 /// <param name="rm">The metrics for this island</param>
 /// <param name="edge">The boundaries that define the exterior edge of the island,
 /// arranged in a (counter?)-clockwise cycle.</param>
 internal Island(RingMetrics rm, List <Face> edge)
     : base(rm, edge)
 {
     Debug.Assert(rm.SignedArea <= 0.0);
     m_Container = null;
 }
Пример #7
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="copy">The metrics to (shallow) copy</param>
 protected RingMetrics(RingMetrics copy)
 {
     m_Area   = copy.m_Area;
     m_Window = copy.m_Window;
 }
Пример #8
0
 /// <summary>
 /// Creates a new <c>Island</c> polygon.
 /// </summary>
 /// <param name="rm">The metrics for this island</param>
 /// <param name="edge">The boundaries that define the exterior edge of the island,
 /// arranged in a (counter?)-clockwise cycle.</param>
 internal Island(RingMetrics rm, List<Face> edge)
     : base(rm, edge)
 {
     Debug.Assert(rm.SignedArea <= 0.0);
     m_Container = null;
 }