public DesignerItemBase(ElementBase element) : base(element) { _contextMenu = null; ShowPropertiesCommand = new RelayCommand(OnShowProperties); DeleteCommand = new RelayCommand(OnDelete); }
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; } }
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); }
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(); }
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); }
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(); }
public DesignerItemSubPlan(ElementBase element) : base(element) { if (Element is ElementSubPlan) { Title = Helper.GetSubPlanTitle((ElementSubPlan)Element); Group = Helper.SubPlanAlias; } }
public PresenterItem(ElementBase element) : base(element) { Cursor = null; ShowBorderOnMouseOver = false; IsEnabled = true; IsPoint = false; IsVisibleLayout = true; }
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; }
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); }
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; }
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; }
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); }
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; } }
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); }
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); }
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; } }
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; }
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; }
public override void Copy(ElementBase element) { base.Copy(element); ((ElementBasePoint)element).Left = Left; ((ElementBasePoint)element).Top = Top; }
public PolylinePainter(ElementBase element) : base(element) { }
public DesignerItemPoint(ElementBase element) : base(element) { ResizeChrome = new ResizeChromePoint(this); }
public override void Copy(ElementBase element) { base.Copy(element); CopyZone((IElementZone)element); }
public MonitorSubPlanPresenterItem(ElementBase element) : base(element) { ; }
private void OnElementSelected(ElementBase element) { //if (!_isSelectedEvent) { //_isSelectedEvent = true; Select(element.UID); //_isSelectedEvent = false; } }
public CommonDesignerItem(ElementBase element) { IsBusy = false; ResetElement(element); ResetIsEnabled(); }
public override void Copy(ElementBase element) { base.Copy(element); ((ElementRectangleXDirection)element).DirectionUID = DirectionUID; }
public virtual void ResetElement(ElementBase element) { Element = element; }
public override void Copy(ElementBase element) { base.Copy(element); ((ElementBaseRectangle)element).Height = Height; ((ElementBaseRectangle)element).Width = Width; }
public override void Copy(ElementBase element) { base.Copy(element); ((ElementSubPlan)element).PlanUID = PlanUID; ((ElementSubPlan)element).Caption = Caption; }