public VMDefaultElement(double width, double height, double x, double y, string path, VMOwnNeedPanel vm, Rotation rot = 0, string nameElement = "", string nameDown = "", string nameCentr = "")
 {
     PathToImg           = path;
     X                   = x;
     Y                   = y;
     New_x               = x;
     New_y               = y;
     NameElementDef      = nameElement;
     NameElementDefDown  = nameDown;
     NameElementDefCentr = nameCentr;
     ParentEl            = new DeafultElement()
     {
         DataContext = this
     };
     Panel.SetZIndex(ParentEl, 1);
     Canvas.SetLeft(ParentEl, X);
     Canvas.SetTop(ParentEl, Y);
     Rotation        = rot;
     ParentEl.Height = height / Constants.MainScale;
     ParentEl.Width  = width / Constants.MainScale;
     GetScheme(AppDomain.CurrentDomain.BaseDirectory + @"\SVG\" + path);
     if ((Name != "") && (Name.IndexOf("Тр-р") > -1))
     {
         ParentEl.MouseDown  += ParentEl_MouseDown;
         ParentEl.MouseUp    += ParentEl_MouseUp;
         ParentEl.MouseMove  += ParentEl_MouseMove;
         ParentEl.MouseLeave += ParentEl_MouseLeave;
     }
     MyImage = BitMapDisel;
     vm.ListOwnNeeds.Add(ParentEl);
     ParentEl.LayoutTransform = new RotateTransform((double)rot, 0.5, 0.5);
     MyCanvas = (Canvas)VisualTreeHelper.GetParent(ParentEl);
     UpdateCoord();
 }
        public VMDefaultElement(int width, int height, double x, double y, MainBlockViewModel myWind, BitmapImage btmp, Rotation rot = 0, string name = "", int powerTrans = 0, int lidWall = 0)
        {
            if (btmp == null)
            {
                return;
            }
            //Path = path;
            PowerTrans      = powerTrans;
            IdParentElement = lidWall;
            Name            = name;
            MyWindow        = myWind;
            X        = x;
            Y        = y;
            New_x    = x;
            New_y    = y;
            ParentEl = new DeafultElement()
            {
                DataContext = this
            };
            Panel.SetZIndex(ParentEl, 1);
            Canvas.SetLeft(ParentEl, X);
            Canvas.SetTop(ParentEl, Y);
            Rotation        = rot;
            ParentEl.Height = height / Constants.MainScale;
            ParentEl.Width  = width / Constants.MainScale;

            MyImage = BitMapDisel = BitMapSel = btmp;
            ParentEl.LayoutTransform = new RotateTransform((double)rot, 0.5, 0.5);
            MyWindow.DrawningFraemworkElements.Add(ParentEl);
            MyCanvas = (Canvas)VisualTreeHelper.GetParent(ParentEl);
            UpdateCoord();
        }
 public VMDefaultElement(double width, double height, double x, double y, ImageSource image, VMOwnNeedPanel vm, Rotation rot = 0)
 {
     X        = x;
     Y        = y;
     New_x    = x;
     New_y    = y;
     ParentEl = new DeafultElement()
     {
         DataContext = this
     };
     Panel.SetZIndex(ParentEl, 1);
     Canvas.SetLeft(ParentEl, X);
     Canvas.SetTop(ParentEl, Y);
     Rotation        = rot;
     ParentEl.Height = height / Constants.MainScale;
     ParentEl.Width  = width / Constants.MainScale;
     MyImage         = image;
     vm.ListOwnNeeds.Add(ParentEl);
     ParentEl.LayoutTransform = new RotateTransform((double)rot, 0.5, 0.5);
     MyCanvas = (Canvas)VisualTreeHelper.GetParent(ParentEl);
     UpdateCoord();
 }
        public VMDefaultElement(double width, double height, double x, double y, MainBlockViewModel myWind, string path, Rotation rot = 0, string name = "", int powerTrans = 0, byte[] doc = null, int lidWall = 0)
        {
            if (path == null)
            {
                return;
            }
            PathToImg       = path;
            this.PowerTrans = powerTrans;
            IdParentElement = lidWall;
            this.Name       = name;
            MyWindow        = myWind;
            if (name == "Схема")
            {
                GetScheme(doc);
            }
            else
            {
                GetScheme(AppDomain.CurrentDomain.BaseDirectory + @"\SVG\" + path);
            }
            X        = x;
            Y        = y;
            New_x    = x;
            New_y    = y;
            ParentEl = new DeafultElement()
            {
                DataContext = this
            };
            Panel.SetZIndex(ParentEl, 1);
            Canvas.SetLeft(ParentEl, X);
            Canvas.SetTop(ParentEl, Y);
            Rotation            = rot;
            ParentEl.Height     = height / Constants.MainScale;
            ParentEl.Width      = width / Constants.MainScale;
            ParentEl.MouseDown += ParentEl_MouseDown2;
            if ((name != "") && (name.IndexOf("Тр-р") > -1))
            {
                ParentEl.MouseDown  += ParentEl_MouseDown;
                ParentEl.MouseUp    += ParentEl_MouseUp;
                ParentEl.MouseMove  += ParentEl_MouseMove;
                ParentEl.MouseLeave += ParentEl_MouseLeave;
            }
            ParentEl.MouseDown  += ParentEl_MouseDown;
            ParentEl.MouseUp    += ParentEl_MouseUp;
            ParentEl.MouseMove  += ParentEl_MouseMove;
            ParentEl.MouseLeave += ParentEl_MouseLeave;
            ReversZIndex();
            if (name == "polosa")
            {
                // ParentEl.MouseDown += ParentEl_MouseDown1; ;
                //ParentEl.MouseUp += ParentEl_MouseUp;
                //ParentEl.MouseMove += ParentEl_MouseMove;
                //ParentEl.MouseLeave += ParentEl_MouseLeave;
                Panel.SetZIndex(ParentEl, 6);
            }
            this.PathToImg = path;

            MyImage = BitMapDisel;
            ParentEl.LayoutTransform = new RotateTransform((double)rot, 0.5, 0.5);
            MyWindow.DrawningFraemworkElements.Add(ParentEl);
            MyCanvas = (Canvas)VisualTreeHelper.GetParent(ParentEl);
            UpdateCoord();
        }