Esempio n. 1
0
        internal static void Display(string path, List <AvoidElement> avoidElements, IEnumerable <ValueNode> winners)
        {
            if (avoidElements.Count() == 0)
            {
                return;
            }

            var lines             = avoidElements.Select(c => Line.CreateBound((c.MEPCurve.Location as LocationCurve).Curve.GetEndPoint(0), (c.MEPCurve.Location as LocationCurve).Curve.GetEndPoint(1))).ToList();
            var maxX              = (int)lines.Max(c => new XYZ[] { c.GetEndPoint(0), c.GetEndPoint(1) }.Max(b => b.X));
            var minX              = (int)lines.Min(c => new XYZ[] { c.GetEndPoint(0), c.GetEndPoint(1) }.Min(b => b.X));
            var maxY              = (int)lines.Max(c => new XYZ[] { c.GetEndPoint(0), c.GetEndPoint(1) }.Max(b => b.Y));
            var minY              = (int)lines.Min(c => new XYZ[] { c.GetEndPoint(0), c.GetEndPoint(1) }.Min(b => b.Y));
            var graphicsDisplayer = new GraphicsDisplayer(minX, maxX, minY, maxY);

            //显示 线
            graphicsDisplayer.DisplayLines(lines, new Pen(Brushes.Black), false, false);
            //显示 线的ID
            var lineIds     = avoidElements.Select(c => ((c.MEPCurve.Location as LocationCurve).Curve.GetEndPoint(0) + (c.MEPCurve.Location as LocationCurve).Curve.GetEndPoint(1)) / 2).ToList();
            var lineIdTexts = avoidElements.Select(c => c.MEPCurve.Id.IntegerValue.ToString()).ToList();

            graphicsDisplayer.DisplayPointText(lineIds, lineIdTexts, Brushes.DarkGreen);
            foreach (var avoidElement in avoidElements)
            {
                var elements = avoidElement.ConflictElements.Where(c => c.CompeteType == CompeteType.Winner);//!c.IsConnector&&
                //显示 碰撞点结果 分组
                var locations = elements.Select(c => c.ConflictLocation).ToList();
                var texts     = elements.Select(c => "W:" + c.AvoidEle.MEPCurve.Id.IntegerValue.ToString() + "-G:" + c.GroupId.ToString().Substring(0, 4)).ToList();
                graphicsDisplayer.DisplayPointText(locations, texts, Brushes.Red);
            }
            graphicsDisplayer.SaveTo(path);
        }
Esempio n. 2
0
        //public static void Display(string path, SeperatePoints lineSeperatePoints, List<LevelOutLines> outLinesCollection)
        //{
        //    var maxX = (int)outLinesCollection.Max(c => c.OutLines.Max(v => v.Points.Max(b => b.X)));
        //    var minX = (int)outLinesCollection.Min(c => c.OutLines.Min(v => v.Points.Min(b => b.X)));
        //    var maxY = (int)outLinesCollection.Max(c => c.OutLines.Max(v => v.Points.Max(b => b.Y)));
        //    var minY = (int)outLinesCollection.Min(c => c.OutLines.Min(v => v.Points.Min(b => b.Y)));
        //    var offSetX = -minX;
        //    var offSetY = -minY;
        //    GraphicsDisplayer = new GraphicsDisplayer(maxX - minX, maxY - minY, offSetX, offSetY);
        //    foreach (var levelOutLines in outLinesCollection)
        //        foreach (var outLine in levelOutLines.OutLines)
        //            Display(outLine);
        //    GraphicsDisplayer.DisplayClosedInterval(lineSeperatePoints.AdvancedPoints.Select(c => c.Point).ToList(), new Pen(Brushes.Red), true);
        //    var randomValue = new Random().Next(10);
        //    GraphicsDisplayer.DisplayPointsText(lineSeperatePoints.AdvancedPoints.Select(c => c.Point).ToList(), Brushes.Red, randomValue, randomValue);
        //    GraphicsDisplayer.SaveTo(path);
        //}

        //static void Display(OutLine outLine)
        //{
        //    var randomValue = new Random().Next(10);
        //    GraphicsDisplayer.DisplayClosedInterval(outLine.Points, null, false);
        //    if (outLine.Points.Count <= 6)
        //        GraphicsDisplayer.DisplayPointsText(outLine.Points, null, randomValue, randomValue);

        //    foreach (var subOutLine in outLine.SubOutLines)
        //        Display(subOutLine);
        //}
        #endregion

        #region 多管标注分析支持
        //internal static void Display(string path, List<PipeAndNodePoint> pipes)
        //{
        //    var maxX = (int)pipes.Max(c => new XYZ[] { (c.Pipe.Location as LocationCurve).Curve.GetEndPoint(0), (c.Pipe.Location as LocationCurve).Curve.GetEndPoint(1) }.Max(v => v.X));
        //    var minX = (int)pipes.Min(c => new XYZ[] { (c.Pipe.Location as LocationCurve).Curve.GetEndPoint(0), (c.Pipe.Location as LocationCurve).Curve.GetEndPoint(1) }.Min(v => v.X));
        //    var maxY = (int)pipes.Max(c => new XYZ[] { (c.Pipe.Location as LocationCurve).Curve.GetEndPoint(0), (c.Pipe.Location as LocationCurve).Curve.GetEndPoint(1) }.Max(v => v.Y));
        //    var minY = (int)pipes.Min(c => new XYZ[] { (c.Pipe.Location as LocationCurve).Curve.GetEndPoint(0), (c.Pipe.Location as LocationCurve).Curve.GetEndPoint(1) }.Min(v => v.Y));
        //    var offSetX = -minX;
        //    var offSetY = -minY;
        //    var GraphicsDisplayer = new GraphicsDisplayer(maxX - minX, maxY - minY, offSetX, offSetY);
        //    GraphicsDisplayer.DisplayLines(pipes.Select(c => (c.Pipe.Location as LocationCurve).Curve as Line).ToList(), new Pen(Brushes.Black), true, true);
        //    GraphicsDisplayer.DisplayPoints(pipes.Select(c => c.NodePoint).ToList(), new Pen(Brushes.Red), true);
        //    GraphicsDisplayer.SaveTo(path);
        //}
        #endregion

        #region 结构做法标注
        public static void Display(string path, List <Line> lines, List <XYZ> textLocations)
        {
            if (lines.Count() == 0)
            {
                return;
            }

            var uncross = new Pen(Brushes.LightGray);
            var cross   = new Pen(Brushes.Red);
            var self    = new Pen(Brushes.Black);
            var maxX    = (int)lines.Max(c => new XYZ[] { c.GetEndPoint(0), c.GetEndPoint(1) }.Max(b => b.X));
            var minX    = (int)lines.Min(c => new XYZ[] { c.GetEndPoint(0), c.GetEndPoint(1) }.Min(b => b.X));
            var maxY    = (int)lines.Max(c => new XYZ[] { c.GetEndPoint(0), c.GetEndPoint(1) }.Max(b => b.Y));
            var minY    = (int)lines.Min(c => new XYZ[] { c.GetEndPoint(0), c.GetEndPoint(1) }.Min(b => b.Y));

            minX--;
            minY--;
            maxX++;
            maxY++;
            var offSetX           = -minX;
            var offSetY           = -minY;
            var graphicsDisplayer = new GraphicsDisplayer(minX, maxX, minY, maxY);

            graphicsDisplayer.DisplayLines(lines, uncross, true, true);
            graphicsDisplayer.DisplayPoints(textLocations, Pens.Red, true);
            graphicsDisplayer.SaveTo(path);
        }
Esempio n. 3
0
        internal static void Display(string path, List <Face> faces)
        {
            List <Line> lines = new List <Line>();
            List <Edge> edges = new List <Edge>();

            foreach (var face in faces)
            {
                foreach (EdgeArray edgeLoop in face.EdgeLoops)
                {
                    var points = GetPoints(edgeLoop);
                    for (int i = 0; i < points.Count - 1; i++)
                    {
                        lines.Add(Line.CreateBound(points[i], points[i + 1]));
                    }
                    lines.Add(Line.CreateBound(points[points.Count - 1], points[0]));
                }
            }

            if (lines.Count() == 0)
            {
                return;
            }

            var uncross           = new Pen(Brushes.LightGray);
            var cross             = new Pen(Brushes.Red);
            var self              = new Pen(Brushes.Black);
            var maxX              = (int)lines.Max(c => new XYZ[] { c.GetEndPoint(0), c.GetEndPoint(1) }.Max(b => b.X));
            var minX              = (int)lines.Min(c => new XYZ[] { c.GetEndPoint(0), c.GetEndPoint(1) }.Min(b => b.X));
            var maxY              = (int)lines.Max(c => new XYZ[] { c.GetEndPoint(0), c.GetEndPoint(1) }.Max(b => b.Y));
            var minY              = (int)lines.Min(c => new XYZ[] { c.GetEndPoint(0), c.GetEndPoint(1) }.Min(b => b.Y));
            var offSetX           = -minX;
            var offSetY           = -minY;
            var graphicsDisplayer = new GraphicsDisplayer(minX, maxX, minY, maxY);

            graphicsDisplayer.DisplayLines(lines, uncross, false, true);
            graphicsDisplayer.SaveTo(path);
        }
Esempio n. 4
0
        public static void Display(string path, VLTriangle triangle, List <Line> pipeLines, List <Line> pipeCollisions, List <BoundingBoxXYZ> crossedBoundingBoxes, List <BoundingBoxXYZ> uncrossedBoundingBoxes)
        {
            if (pipeLines.Count() == 0)
            {
                return;
            }

            var uncross           = new Pen(Brushes.LightGray);
            var cross             = new Pen(Brushes.Red);
            var self              = new Pen(Brushes.Black);
            var maxX              = (int)pipeLines.Max(c => new XYZ[] { c.GetEndPoint(0), c.GetEndPoint(1) }.Max(b => b.X));
            var minX              = (int)pipeLines.Min(c => new XYZ[] { c.GetEndPoint(0), c.GetEndPoint(1) }.Min(b => b.X));
            var maxY              = (int)pipeLines.Max(c => new XYZ[] { c.GetEndPoint(0), c.GetEndPoint(1) }.Max(b => b.Y));
            var minY              = (int)pipeLines.Min(c => new XYZ[] { c.GetEndPoint(0), c.GetEndPoint(1) }.Min(b => b.Y));
            var offSetX           = -minX;
            var offSetY           = -minY;
            var graphicsDisplayer = new GraphicsDisplayer(minX, maxX, minY, maxY);
            int displayLength     = 10;

            graphicsDisplayer.DisplayLines(pipeLines.Where(c => c.Length >= displayLength).ToList(), uncross, false, true);
            graphicsDisplayer.DisplayLines(pipeLines.Where(c => c.Length < displayLength).ToList(), uncross, false, false);
            graphicsDisplayer.DisplayLines(pipeCollisions, cross, false, true);
            graphicsDisplayer.DisplayClosedInterval(new List <XYZ>()
            {
                triangle.A, triangle.B, triangle.C
            }, self, false, true);
            foreach (var boundingBox in crossedBoundingBoxes)
            {
                graphicsDisplayer.DisplayClosedInterval(GetPointsFromBoundingBox(boundingBox), cross, false, true);
            }
            foreach (var boundingBox in uncrossedBoundingBoxes)
            {
                graphicsDisplayer.DisplayClosedInterval(GetPointsFromBoundingBox(boundingBox), uncross, false, true);
            }
            graphicsDisplayer.SaveTo(path);
        }