private void GetSegments(GridLine2D gridLine2D, CurveArray allCurves,
List<SegmentLine2D> skippedSegments, List<GraphicsPath> segPaths,
int gridLineIndex)
{
int segIndex = -1;
// convert the segments from Curve format to SegmentLine2D format (from 3D to 2D)
foreach (Curve curve in allCurves)
{
// store the index of the segment in the grid line
segIndex++;
Autodesk.Revit.DB.XYZ point1 = curve.get_EndPoint(0);
Autodesk.Revit.DB.XYZ point2 = curve.get_EndPoint(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);
// add the segment data
SegmentLine2D segLine2D = new SegmentLine2D();
segLine2D.StartPoint = new System.Drawing.Point((int)v1.X, (int)v1.Y);
segLine2D.EndPoint = new System.Drawing.Point((int)v2.X, (int)v2.Y);
// if the segment is contained in the skipped list, set the Removed flag to true; otherwise false
segLine2D.Removed = IsSegLineContained(skippedSegments, segLine2D);
// if the segment is in a U grid line, set it true; otherwise false
segLine2D.IsUSegment = gridLine2D.IsUGridLine;
// the index of the parent grid line in the grid line list
segLine2D.GridLineIndex = gridLineIndex;
// the index of the segment in its parent grid line
segLine2D.SegmentIndex = segIndex;
if (true == segLine2D.Removed)
{
gridLine2D.RemovedNumber++;
}
gridLine2D.Segments.Add(segLine2D);
// store the mapped graphics path
GraphicsPath path = new GraphicsPath();
path.AddLine(segLine2D.StartPoint, segLine2D.EndPoint);
segPaths.Add(path);
}
}