private DimensionsStructure RotateNew(DimensionsStructure parentRotation, int attachedToSide) { DimensionsStructure newRotation; switch (attachedToSide) { case 1: { newRotation = parentRotation.Right; } break; case 3: { newRotation = parentRotation.Left; } break; case 0: { newRotation = parentRotation.Reverse; } break; default: { newRotation = parentRotation; } break; } return(newRotation); }
private RectangleF[] createRectangles(PanelsContainer c) { PanelItem p = c.panels; List <RectangleF> rectangles = new List <RectangleF>(); /*Create root panel*/ int rootX = (int)c.pw.rootX; int rootY = (int)c.pw.rootY; Point rootPoint = new Point(rootX, rootY); /*Create root rotation*/ DimensionsStructure dimension = new DimensionsStructure(); dp = new DrawdPanel(); dp.CurrentRootPoint = rootPoint; dp.Rotation = dimension; dp.width = (int)p.panelWidth; dp.height = (int)p.panelHeight; dp.CalculateCoordinates(); dwdList = new List <DrawdPanel>(); dwdList.Add(dp); GetAll(p.AttachedPanels, dp, ref dwdList); foreach (DrawdPanel drawitem in dwdList) { rectangles.Add(drawitem.createRectangle()); } return(rectangles.ToArray()); }
private void GetAll(List <PanelItem> pl, DrawdPanel parent, ref List <DrawdPanel> drawdPanels) { foreach (PanelItem p in pl) { DimensionsStructure parentRotation = parent.Rotation; int r = p.attachedToSide; DrawdPanel tmp = CreateDrawPanel(p, parent, r); drawdPanels.Add(tmp); if (p.AttachedPanels != null) { GetAll(p.AttachedPanels, tmp, ref drawdPanels); } } }
//init for root panel private void Inint() { Value = 2; Left = new DimensionsStructure(3); Right = new DimensionsStructure(1); Reverse = new DimensionsStructure(0); Left.Left = Reverse; Left.Right = this; Left.Reverse = Right; Right.Left = this; Right.Right = Reverse; Right.Reverse = Left; Reverse.Right = Left; Reverse.Left = Right; Reverse.Reverse = this; }