예제 #1
0
		public DesignerItemBase(ElementBase element)
			: base(element)
		{
			_contextMenu = null;
			ShowPropertiesCommand = new RelayCommand(OnShowProperties);
			DeleteCommand = new RelayCommand(OnDelete);
		}
예제 #2
0
 public DesignerItemRectangle(ElementBase element)
     : base(element)
 {
     ResizeChrome = new ResizeChromeRectangle(this);
     if (Element is ElementRectangle)
     {
         Title = "Прямоугольник";
         Group = LayerGroupService.ElementAlias;
     }
     else if (Element is ElementEllipse)
     {
         Title = "Эллипс";
         Group = LayerGroupService.ElementAlias;
     }
     else if (Element is ElementTextBlock)
     {
         Title = "Надпись";
         Group = LayerGroupService.ElementAlias;
     }
     else if (Element is ElementSubPlan)
     {
         Title = Helper.GetSubPlanTitle((ElementSubPlan)Element);
         Group = LayerGroupService.SubPlanAlias;
     }
 }
예제 #3
0
 public static void SetStyle(Shape shape, ElementBase element)
 {
     shape.Fill = new SolidColorBrush(element.BackgroundColor);
     shape.Stroke = new SolidColorBrush(element.BorderColor);
     shape.StrokeThickness = element.BorderThickness;
     if (element.BackgroundPixels != null)
         shape.Fill = PainterHelper.CreateBrush(element.BackgroundPixels);
 }
예제 #4
0
		public static PointCollection GetRealPoints(ElementBase element)
		{
			if (element is ElementBaseShape)
				return ((ElementBaseShape)element).Points;
			else if (element is ElementBaseRectangle)
				return GetPoints(element.GetRectangle());
			return new PointCollection();
		}
예제 #5
0
		public static IPainter Create(ElementBase element)
		{
			Type type = element.GetType();
			if (element is IPrimitive)
				return (IPainter)Activator.CreateInstance(_painters[((IPrimitive)element).Primitive], element);
			var args = new PainterFactoryEventArgs(element);
			EventService.EventAggregator.GetEvent<PainterFactoryEvent>().Publish(args);
			return args.Painter ?? new DefaultPainter(element);
		}
예제 #6
0
		public static PointCollection GetPoints(ElementBase element)
		{
			return
				element is ElementBaseShape ?
					Normalize(element.GetRectangle().TopLeft, ((ElementBaseShape)element).Points, element.BorderThickness) :
				element is ElementBaseRectangle ?
					Normalize(element.GetRectangle(), element.BorderThickness) :
					new PointCollection();
		}
예제 #7
0
		public DesignerItemSubPlan(ElementBase element)
			: base(element)
		{
			if (Element is ElementSubPlan)
			{
				Title = Helper.GetSubPlanTitle((ElementSubPlan)Element);
				Group = Helper.SubPlanAlias;
			}
		}
예제 #8
0
		public PresenterItem(ElementBase element)
			: base(element)
		{
			Cursor = null;
			ShowBorderOnMouseOver = false;
			IsEnabled = true;
			IsPoint = false;
			IsVisibleLayout = true;
		}
예제 #9
0
 public DesignerItemBase(ElementBase element)
     : base(element)
 {
     ShowPropertiesCommand = new RelayCommand(OnShowProperties);
     DeleteCommand = new RelayCommand(OnDelete);
     MouseDoubleClick += (s, e) => ShowPropertiesCommand.Execute(null);
     CreateContextMenu();
     IsVisibleLayout = true;
     IsSelectableLayout = true;
 }
예제 #10
0
		protected override void RemoveElement(ElementBase elementBase)
		{
			if (elementBase is ElementRectangle)
				PassCardTemplate.ElementRectangles.Remove(elementBase as ElementRectangle);
			else if (elementBase is ElementEllipse)
				PassCardTemplate.ElementEllipses.Remove(elementBase as ElementEllipse);
			else if (elementBase is ElementPolygon)
				PassCardTemplate.ElementPolygons.Remove(elementBase as ElementPolygon);
			else if (elementBase is ElementPolyline)
				PassCardTemplate.ElementPolylines.Remove(elementBase as ElementPolyline);
			else if (elementBase is ElementTextBlock)
				PassCardTemplate.ElementTextBlocks.Remove(elementBase as ElementTextBlock);
		}
예제 #11
0
		public virtual void Copy(ElementBase element)
		{
			element.UID = UID;
			element.BorderColor = BorderColor;
			element.BorderThickness = BorderThickness;
			element.BackgroundColor = BackgroundColor;
			element.BackgroundImageSource = BackgroundImageSource;
			element.BackgroundSourceName = BackgroundSourceName;
			element.IsVectorImage = IsVectorImage;
			element.ZIndex = ZIndex;
			element.IsLocked = IsLocked;
			element.IsHidden = IsHidden;
		}
예제 #12
0
		public override void Copy(ElementBase element)
		{
			base.Copy(element);
			var elementTextBlock = (ElementTextBlock)element;
			elementTextBlock.Text = Text;
			elementTextBlock.ForegroundColor = ForegroundColor;
			elementTextBlock.FontSize = FontSize;
			elementTextBlock.FontFamilyName = FontFamilyName;
			elementTextBlock.Stretch = Stretch;
			elementTextBlock.TextAlignment = TextAlignment;
			elementTextBlock.FontBold = FontBold;
			elementTextBlock.FontItalic = FontItalic;
		}
예제 #13
0
		protected override DesignerItem AddElement(ElementBase elementBase)
		{
			if (elementBase is ElementRectangle)
				PassCardTemplate.ElementRectangles.Add(elementBase as ElementRectangle);
			else if (elementBase is ElementEllipse)
				PassCardTemplate.ElementEllipses.Add(elementBase as ElementEllipse);
			else if (elementBase is ElementPolygon)
				PassCardTemplate.ElementPolygons.Add(elementBase as ElementPolygon);
			else if (elementBase is ElementPolyline)
				PassCardTemplate.ElementPolylines.Add(elementBase as ElementPolyline);
			else if (elementBase is ElementTextBlock)
				PassCardTemplate.ElementTextBlocks.Add(elementBase as ElementTextBlock);
			return Create(elementBase);
		}
예제 #14
0
 public DesignerItemShape(ElementBase element)
     : base(element)
 {
     ResizeChrome = new ResizeChromeShape(this);
     if (Element is ElementPolygon)
     {
         Title = "Многоугольник";
         Group = LayerGroupService.ElementAlias;
     }
     else if (Element is ElementPolyline)
     {
         Title = "Линия";
         Group = LayerGroupService.ElementAlias;
     }
 }
예제 #15
0
		protected override void RemoveElement(ElementBase elementBase)
		{
			if (elementBase is ElementRectangle)
				Plan.ElementRectangles.Remove(elementBase as ElementRectangle);
			else if (elementBase is ElementEllipse)
				Plan.ElementEllipses.Remove(elementBase as ElementEllipse);
			else if (elementBase is ElementPolygon)
				Plan.ElementPolygons.Remove(elementBase as ElementPolygon);
			else if (elementBase is ElementPolyline)
				Plan.ElementPolylines.Remove(elementBase as ElementPolyline);
			else if (elementBase is ElementTextBlock)
				Plan.ElementTextBlocks.Remove(elementBase as ElementTextBlock);
			else if (elementBase is ElementSubPlan)
				Plan.ElementSubPlans.Remove(elementBase as ElementSubPlan);
			else
				((PlanDesignerViewModel)PlanDesignerViewModel).PlansViewModel.ElementRemoved(elementBase);
		}
예제 #16
0
		protected override DesignerItem AddElement(ElementBase elementBase)
		{
			if (elementBase is ElementRectangle)
				Plan.ElementRectangles.Add(elementBase as ElementRectangle);
			else if (elementBase is ElementEllipse)
				Plan.ElementEllipses.Add(elementBase as ElementEllipse);
			else if (elementBase is ElementPolygon)
				Plan.ElementPolygons.Add(elementBase as ElementPolygon);
			else if (elementBase is ElementPolyline)
				Plan.ElementPolylines.Add(elementBase as ElementPolyline);
			else if (elementBase is ElementTextBlock)
				Plan.ElementTextBlocks.Add(elementBase as ElementTextBlock);
			else if (elementBase is ElementSubPlan)
				Plan.ElementSubPlans.Add(elementBase as ElementSubPlan);
			else
				((PlanDesignerViewModel)PlanDesignerViewModel).PlansViewModel.ElementAdded(elementBase);

			return Create(elementBase);
		}
예제 #17
0
		public DesignerItemRectangle(ElementBase element)
			: base(element)
		{
			SetResizeChrome(new ResizeChromeRectangle(this));
			if (Element is ElementRectangle)
			{
				Title = "Прямоугольник";
				Group = LayerGroupService.ElementAlias;
			}
			else if (Element is ElementEllipse)
			{
				Title = "Эллипс";
				Group = LayerGroupService.ElementAlias;
			}
			else if (Element is ElementTextBlock)
			{
				Title = "Надпись";
				Group = LayerGroupService.ElementAlias;
			}
		}
예제 #18
0
 public FrameworkElement Draw(ElementBase element)
 {
     IElementTextBlock elementText = (IElementTextBlock)element;
     var textBlock = new Label()
     {
         Content = elementText.Text,
         Background = new SolidColorBrush(element.BackgroundColor),
         Foreground = new SolidColorBrush(elementText.ForegroundColor),
         BorderBrush = new SolidColorBrush(element.BorderColor),
         BorderThickness = new Thickness(element.BorderThickness),
         FontSize = elementText.FontSize,
         FontFamily = new FontFamily(elementText.FontFamilyName),
     };
     FrameworkElement frameworkElement = elementText.Stretch ?
         new Viewbox()
         {
             Stretch = Stretch.Fill,
             Child = textBlock
         } : (FrameworkElement)textBlock;
     return frameworkElement;
 }
예제 #19
0
		public static DesignerItem Create(ElementBase element)
		{
			var args = new DesignerItemFactoryEventArgs(element);
			ServiceFactoryBase.Events.GetEvent<DesignerItemFactoryEvent>().Publish(args);
			if (args.DesignerItem == null)
				switch (element.Type)
				{
					case ElementType.Point:
						args.DesignerItem = new DesignerItemPoint(element);
						break;
					case ElementType.Rectangle:
						args.DesignerItem = new DesignerItemRectangle(element);
						break;
					case ElementType.Polygon:
					case ElementType.Polyline:
						args.DesignerItem = new DesignerItemShape(element);
						break;
				}
			if (args.DesignerItem == null)
				args.DesignerItem = new DesignerItemBase(element);
			return args.DesignerItem;
		}
예제 #20
0
		public override void Copy(ElementBase element)
		{
			base.Copy(element);
			((ElementBasePoint)element).Left = Left;
			((ElementBasePoint)element).Top = Top;
		}
예제 #21
0
		public PolylinePainter(ElementBase element)
			: base(element)
		{
		}
예제 #22
0
 public DesignerItemPoint(ElementBase element)
     : base(element)
 {
     ResizeChrome = new ResizeChromePoint(this);
 }
예제 #23
0
		public override void Copy(ElementBase element)
		{
			base.Copy(element);
			CopyZone((IElementZone)element);
		}
예제 #24
0
		public MonitorSubPlanPresenterItem(ElementBase element)
			: base(element)
		{
			;
		}
예제 #25
0
		private void OnElementSelected(ElementBase element)
		{
			//if (!_isSelectedEvent)
			{
				//_isSelectedEvent = true;
				Select(element.UID);
				//_isSelectedEvent = false;
			}
		}
예제 #26
0
		public CommonDesignerItem(ElementBase element)
		{
			IsBusy = false;
			ResetElement(element);
			ResetIsEnabled();
		}
		public override void Copy(ElementBase element)
		{
			base.Copy(element);
			((ElementRectangleXDirection)element).DirectionUID = DirectionUID;
		}
예제 #28
0
		public virtual void ResetElement(ElementBase element)
		{
			Element = element;
		}
예제 #29
0
		public override void Copy(ElementBase element)
		{
			base.Copy(element);
			((ElementBaseRectangle)element).Height = Height;
			((ElementBaseRectangle)element).Width = Width;
		}
예제 #30
0
		public override void Copy(ElementBase element)
		{
			base.Copy(element);
			((ElementSubPlan)element).PlanUID = PlanUID;
			((ElementSubPlan)element).Caption = Caption;
		}