Revit.SDK.Samples.CurtainWallGrid.CS.GridDrawing.GetBoundLines2D C# (CSharp) Метод

GetBoundLines2D() приватный Метод

get the boundary lines of the curtain grid
private GetBoundLines2D ( ) : void
Результат void
        private void GetBoundLines2D()
        {
            for (int i = 0; i < m_geometry.GridVertexesXYZ.Count; i += 1)
             {
            Autodesk.Revit.DB.XYZ point1, point2;

            // connect the last point with the first point as a boundary line
            if (i == m_geometry.GridVertexesXYZ.Count - 1)
            {
               point1 = m_geometry.GridVertexesXYZ[i];
               point2 = m_geometry.GridVertexesXYZ[0];
            }
            else
            {
               point1 = m_geometry.GridVertexesXYZ[i];
               point2 = m_geometry.GridVertexesXYZ[i + 1];
            }

            Vector4 v1 = new Vector4(point1);
            Vector4 v2 = new Vector4(point2);

            // transform from 3D point to 2D point
            v1 = m_coordinates.TransformMatrix.Transform(v1);
            v2 = m_coordinates.TransformMatrix.Transform(v2);

            // stores the bounding coordinate
            int v1X = (int)v1.X;
            int v1Y = (int)v1.Y;
            int v2X = (int)v2.X;
            int v2Y = (int)v2.Y;

            // obtain the min and max point
            m_minX = v1X;
            m_minY = v1Y;

            if (v1X > m_maxX)
            {
               m_maxX = v1X;
            }
            else if (v1X < m_minX)
            {
               m_minX = v1X;
            }

            if (v2X > m_maxX)
            {
               m_maxX = v2X;
            }
            else if (v2X < m_minX)
            {
               m_minX = v2X;
            }

            if (v1Y > m_maxY)
            {
               m_maxY = v1Y;
            }
            if (v1Y < m_minY)
            {
               m_minY = v1Y;
            }

            if (v2Y > m_maxY)
            {
               m_maxY = v2Y;
            }
            if (v2Y < m_minY)
            {
               m_minY = v2Y;
            }

            // create the boundary line
            GridLine2D line2D = new GridLine2D();
            line2D.StartPoint = new System.Drawing.Point((int)v1.X, (int)v1.Y);
            line2D.EndPoint = new System.Drawing.Point((int)v2.X, (int)v2.Y);
            m_boundLines2D.Add(line2D);

            // add the line to the mapped GraphicsPath list
            GraphicsPath path = new GraphicsPath();
            path.AddLine(line2D.StartPoint, line2D.EndPoint);
            m_boundPath.Add(path);
             }
        }