public PVMCell(PVMCell pvm, MainBlockViewModel mvm = null) : this(mvm ?? pvm.MyWindow, pvm.cadMy, pvm.X, pvm.Y, pvm.Rotation, pvm.rotLabel, pvm.type, 0, true) { ElementId = pvm.ElementId; X = pvm.X; Y = pvm.Y; Canvas.SetLeft(ParentEl, X); Canvas.SetTop(ParentEl, Y); this.type = pvm.type; myLink = pvm.myLink; WidthAllCell = pvm.WidthAllCell; if (type == AreaType.HighVoltage) { MyWindow.ICommonData.RUVN_SetCommonData(pvm._ruvnData); _ruvnData = pvm._ruvnData; } if (type == AreaType.LowVoltage) { MyWindow.ICommonData.RUNN_SetCommonData(pvm._runnData); _runnData = pvm._runnData; } idCell = pvm.idCell; }
public VMLink(VMLink prevVM) : this(prevVM.X, prevVM.Y, prevVM.NumbElem, prevVM.nameLink, prevVM.elemId, prevVM.Reverse) { }
public PVMCell(MainBlockViewModel vm, CellAreaData cad, double x, double y, Rotation rot = Rotation.D0, Rotation rtLabel = Rotation.D0, AreaType type = AreaType.Nan, int widthC = 0, bool redraw = false) { WidthAllCell = widthC; elementFloor = new List <int>(); this.type = type; var r = new Random(); Rotation = rot; var by = new byte[3]; r.NextBytes(by); idCell = Convert.ToInt32(by[0]); rotLabel = rtLabel; ParentEl = new CellAreaBlock(cad, rot, rtLabel, vm); Width = cad.Width; Height = cad.Height; elementFloor = (ParentEl as CellAreaBlock).GetElementFloor(); cadMy = cad; MyWindow = vm; X = x; Y = y; New_x = x; New_y = y; Canvas.SetLeft(ParentEl, x); Canvas.SetTop(ParentEl, y); if (type == AreaType.HighVoltage) { _ruvnData = MyWindow.ICommonData.RUVN_GetCommonData(); if (!redraw) { var link = vm.BaseDrawElements.ToList().FindAll(x1 => x1 is VMLink); var max = link.Max(y1 => (y1 as VMLink).NumbElem); max = (Convert.ToInt32(max) + 1).ToString(); myLink = new VMLink(this.X, this.Y, max, "РУВН", this.ElementId, true); vm.BaseDrawElements.Add(myLink); vm.DrawningFraemworkElements.Add(vm.BaseDrawElements.Last().ParentEl); } } if (type == AreaType.LowVoltage) { _runnData = MyWindow.ICommonData.RUNN_GetCommonData(); if (!redraw) { var link = vm.BaseDrawElements.ToList().FindAll(x1 => x1 is VMLink); var max = link.Max(y1 => (y1 as VMLink).NumbElem); max = (Convert.ToInt32(max) + 1).ToString(); myLink = new VMLink(this.X, this.Y, max, "РУНН", this.ElementId, true); vm.BaseDrawElements.Add(myLink); vm.DrawningFraemworkElements.Add(vm.BaseDrawElements.Last().ParentEl); } } vm.DrawningFraemworkElements.Add(ParentEl); ParentEl.MouseUp += ParentEl_MouseUp; ParentEl.MouseLeave += ParentEl_MouseLeave; ParentEl.MouseDown += ParentEl_MouseDown; //ParentEl.MouseMove += ParentEl_MouseMove; }