示例#1
0
        private void loadPolylinesToBoxes()
        {
            List <LwPolyline> polylines = new List <LwPolyline>();

            polylines.AddRange(dxf.LwPolylines);
            polylines.AddRange(getAllPolylines(dxf.Inserts));
            //polylines.AddRange(getAllPolylinesFromBlocks(dxf.Blocks));


            //every Polyline from DXF turns into a box (ColoBox)
            foreach (LwPolyline pl in polylines)
            {
                ColoBox box = new ColoBox(pl.Layer.Name, direction);
                boxes.Add(box);
                foreach (var v in pl.Vertexes)
                {
                    box.AddPoint(v.Location.X, v.Location.Y);
                }
            }

            foreach (Spline sp in dxf.Splines)
            {
                ColoBox box = new ColoBox(sp.Layer.Name, direction);
                boxes.Add(box);
                foreach (var v in sp.ControlPoints)
                {
                    box.AddPoint(v.Location.X, v.Location.Y);
                }
            }
        }
示例#2
0
        public ColoBox Clone()
        {
            ColoBox ret = new ColoBox(direction);

            foreach (Point v in Points)
            {
                ret.AddPoint(v.X, v.Y);
            }

            return(ret);
        }
示例#3
0
        public static ColoBox GetBiggestBox(List <ColoBox> staticObjects)
        {
            double  area = -1;
            ColoBox ret  = null;

            foreach (ColoBox b in staticObjects)
            {
                if (b.Area > area)
                {
                    area = b.Area;
                    ret  = b;
                }
            }

            return(ret);
        }
示例#4
0
        internal void SetBoundingBox(List <ColoBox> staticBoxes)
        {
            boundingBox = GetBiggestBox(staticBoxes);
            DXFPoc.Model.LocationStatemachine.Machine locationMachine = new LocationStatemachine.Machine(coldAisle, spaceAfterObstacle, boundingBox);
            this.locationMachine           = locationMachine;
            this.locationMachine.direction = DirectionController;

            borderVerifier = new BorderVerifier(staticBoxes, locationMachine);
            locationMachine.BorderVerifier = borderVerifier;

            //if (borderVerifier.IsRotating)
            //{
            //    double angle = borderVerifier.Angle;
            //    foreach (ColoBox cb in staticBoxes)
            //    {
            //        cb.Rotate(angle);
            //    }
            //}

            //borderVerifier = new BorderVerifier(staticBoxes, locationMachine);
        }
示例#5
0
        private void loadGraphicsObject(List <ColoBox> staticObjects, LayoutManager manager, List <ColoBox> boxes2relo)
        {
            foreach (ColoBox box in boxes)
            {
                if (staticLayers.Contains(box.Layer))// == "wals")
                {
                    //manager = new LayoutManager(box);
                    staticObjects.Add(box);
                    continue;
                }

                if (box.Layer == "racks")
                {
                    ColoBox cloned = box.Clone();
                    if (manager != null)
                    {
                        cloned.LayoutManager = manager;
                    }

                    boxes2relo.Add(cloned);
                }
            }
        }