public VMSchemeElement(double width, double height, double x, double y, Rotation rot = 0, string name = "", byte[] doc = null)
 {
     this.Name = name;
     GetScheme(doc);
     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;
     ParentEl.Width           = width;
     MyImage                  = BitMapDisel;
     ParentEl.LayoutTransform = new RotateTransform((double)rot, 0.5, 0.5);
     UpdateCoord();
 }
 public VMInformTable(double x, double y, int width, int height, BitmapImage btmp, IViewModelInterface myWind, int typeTable, int idDoor)
 {
     IdDoor    = idDoor;
     TypeTable = (TypeInformTable)typeTable;
     MyWind    = myWind;
     Height    = height / Constants.MainScale;
     Width     = width / Constants.MainScale;
     X         = x;
     Y         = y;
     New_x     = x;
     New_y     = y;
     MyImage   = BitMapDisel = btmp;
     ParentEl  = new DeafultElement()
     {
         DataContext = this
     };
     Panel.SetZIndex(ParentEl, 10);
     Canvas.SetLeft(ParentEl, X);
     Canvas.SetTop(ParentEl, Y);
     ParentEl.Height     = height / Constants.MainScale;
     ParentEl.Width      = width / Constants.MainScale;
     ParentEl.MouseDown += ParentEl_MouseDown;
     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();
        }