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); } } }
public ColoBox Clone() { ColoBox ret = new ColoBox(direction); foreach (Point v in Points) { ret.AddPoint(v.X, v.Y); } return(ret); }
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); }
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); }
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); } } }