public RectanglePropertiesViewModel(ElementRectangle elementRectangle)
 {
     Title = "Свойства фигуры: Прямоугольник";
     ImagePropertiesViewModel = new ImagePropertiesViewModel();
     _elementRectangle = elementRectangle;
     CopyProperties();
 }
Beispiel #2
0
 public override ElementBase Clone()
 {
     ElementRectangle elementBase = new ElementRectangle()
     {
         BackgroundColor = BackgroundColor,
         BorderColor = BorderColor,
         BorderThickness = BorderThickness
     };
     if (BackgroundPixels != null)
         elementBase.BackgroundPixels = (byte[])BackgroundPixels.Clone();
     Copy(elementBase);
     return elementBase;
 }
Beispiel #3
0
		public override ElementBase Clone()
		{
			ElementRectangle elementBase = new ElementRectangle();
			Copy(elementBase);
			return elementBase;
		}
		void AddPictire(Plan plan, surfacesSurfaceLayerElementsElement innerElement, ref int pictureIndex)
		{
			try
			{
				if (innerElement.picture == null)
					return;

				foreach (var innerPicture in innerElement.picture)
				{
					if (string.IsNullOrEmpty(innerPicture.idx))
						innerPicture.idx = pictureIndex++.ToString();

					var picturesDirectory = GetPicturesDirectory();
					if (picturesDirectory == null)
						continue;
					var directoryInfo = new DirectoryInfo(picturesDirectory + "\\Sample" + innerPicture.idx + "." + innerPicture.ext);
					if (File.Exists(directoryInfo.FullName) == false)
						continue;

					if (innerPicture.ext == "emf")
					{
						var metafile = new Metafile(directoryInfo.FullName);
						innerPicture.ext = "bmp";
						directoryInfo = new DirectoryInfo(picturesDirectory + "\\Sample" + innerPicture.idx + "." + innerPicture.ext);
						metafile.Save(directoryInfo.FullName, ImageFormat.Bmp);
						metafile.Dispose();
					}

					var guid = ServiceFactoryBase.ContentService.AddContent(directoryInfo.FullName);
					var elementRectanglePicture = new ElementRectangle()
					{
						Left = Parse(innerElement.rect[0].left),
						Top = Parse(innerElement.rect[0].top),
						Height = Parse(innerElement.rect[0].bottom) - Parse(innerElement.rect[0].top),
						Width = Parse(innerElement.rect[0].right) - Parse(innerElement.rect[0].left),
					};

					if ((elementRectanglePicture.Left == 0) && (elementRectanglePicture.Top == 0) && (elementRectanglePicture.Width == plan.Width) && (elementRectanglePicture.Height == plan.Height))
					{
						plan.BackgroundImageSource = guid;
						plan.BackgroundSourceName = directoryInfo.FullName;
					}
					else
					{
						elementRectanglePicture.BackgroundImageSource = guid;
						elementRectanglePicture.BackgroundSourceName = directoryInfo.FullName;
						plan.ElementRectangles.Add(elementRectanglePicture);
					}
				}
			}
			catch (Exception e)
			{
				Logger.Error(e, "ConfigurationConverter.AddPictire");
			}
		}
		void AddRectangle(Plan plan, surfacesSurfaceLayerElementsElement innerElement)
		{
			try
			{
				var elementRectangle = new ElementRectangle()
				{
					Left = Parse(innerElement.rect[0].left),
					Top = Parse(innerElement.rect[0].top),
					Height = Parse(innerElement.rect[0].bottom) - Parse(innerElement.rect[0].top),
					Width = Parse(innerElement.rect[0].right) - Parse(innerElement.rect[0].left)
				};
				plan.ElementRectangles.Add(elementRectangle);
			}
			catch (Exception e)
			{
				Logger.Error(e, "ConfigurationConverter.AddRectangle");
			}
		}
 void AddRectangle(Plan plan, surfacesSurfaceLayerElementsElement innerElement)
 {
     var elementRectangle = new ElementRectangle()
     {
         Left = Parse(innerElement.rect[0].left),
         Top = Parse(innerElement.rect[0].top),
         Height = Parse(innerElement.rect[0].bottom) - Parse(innerElement.rect[0].top),
         Width = Parse(innerElement.rect[0].right) - Parse(innerElement.rect[0].left)
     };
     plan.ElementRectangles.Add(elementRectangle);
 }
        void AddPictire(Plan plan, surfacesSurfaceLayerElementsElement innerElement, ref int pictureIndex)
        {
            foreach (var innerPicture in innerElement.picture)
            {
                if (string.IsNullOrEmpty(innerPicture.idx))
                    innerPicture.idx = pictureIndex++.ToString();

                var directoryInfo = new DirectoryInfo(Environment.CurrentDirectory + "\\Pictures\\Sample" + innerPicture.idx + "." + innerPicture.ext);
                if (File.Exists(directoryInfo.FullName) == false)
                    continue;

                if (innerPicture.ext == "emf")
                {
                    var metafile = new Metafile(directoryInfo.FullName);
                    innerPicture.ext = "bmp";
                    directoryInfo = new DirectoryInfo(Environment.CurrentDirectory + "\\Pictures\\Sample" + innerPicture.idx + "." + innerPicture.ext);
                    metafile.Save(directoryInfo.FullName, ImageFormat.Bmp);
                    metafile.Dispose();
                }

                byte[] backgroundPixels = File.ReadAllBytes(directoryInfo.FullName);

                var elementRectanglePicture = new ElementRectangle()
                {
                    Left = Parse(innerElement.rect[0].left),
                    Top = Parse(innerElement.rect[0].top),
                    Height = Parse(innerElement.rect[0].bottom) - Parse(innerElement.rect[0].top),
                    Width = Parse(innerElement.rect[0].right) - Parse(innerElement.rect[0].left),
                    BackgroundPixels = backgroundPixels
                };

                if ((elementRectanglePicture.Left == 0) && (elementRectanglePicture.Top == 0) && (elementRectanglePicture.Width == plan.Width) && (elementRectanglePicture.Height == plan.Height))
                {
                    plan.BackgroundPixels = elementRectanglePicture.BackgroundPixels;
                }
                else
                {
                    plan.ElementRectangles.Add(elementRectanglePicture);
                }
            }
        }