示例#1
0
文件: MSTLSlice.cs 项目: AdilGM/2DCAD
        public MSTLSlice(List <MContourStructure> contours)
            : this()
        {
            NumberOfContours = contours.Count;

            MarkGeometryPoint lastPoint = null;

            foreach (var contourStructure in contours)
            {
                var(lines, minLineLength, perimeter) = GeometricArithmeticModule.GetLinesAndStatistics(
                    contourStructure.ToPoints()
                    );

                ContourLines.AddRange(
                    lines
                    );

                if (minLineLength < MinVectorLength)
                {
                    MinVectorLength = minLineLength;
                }

                _totalContourMarkDistance += perimeter;
                NumberOfJoints            += (lines.Count - 1);

                if (lines.Count > 0)
                {
                    if (lastPoint != null)
                    {
                        // measure and track the jump distance between the last contour and this
                        _totalContourJumpDistance += GeometricArithmeticModule.ABSMeasure(lastPoint, lines[0].StartPoint);
                    }

                    lastPoint = lines[0].StartPoint;
                }
            }

            _contourQuadTree = new ContourQuadTree(ContourLines);
            Extents          = GeometricArithmeticModule.CalculateExtents(ContourLines);
        }