Container layer.
Наследование: XSelectable
Пример #1
0
 /// <summary>
 /// Initialize new instance of <see cref="CubicBezierSelection"/> class.
 /// </summary>
 /// <param name="layer">The selection shapes layer.</param>
 /// <param name="shape">The selected shape.</param>
 /// <param name="style">The selection shapes style.</param>
 /// <param name="point">The selection point shape.</param>
 public CubicBezierSelection(XLayer layer, ICubicBezier shape, ShapeStyle style, BaseShape point)
 {
     _layer = layer;
     _cubicBezier = shape;
     _style = style;
     _point = point;
 }
Пример #2
0
 /// <summary>
 /// Initialize new instance of <see cref="TextSelection"/> class.
 /// </summary>
 /// <param name="layer">The selection shapes layer.</param>
 /// <param name="shape">The selected shape.</param>
 /// <param name="style">The selection shapes style.</param>
 /// <param name="point">The selection point shape.</param>
 public TextSelection(XLayer layer, XText shape, ShapeStyle style, BaseShape point)
 {
     _layer = layer;
     _text = shape;
     _style = style;
     _point = point;
 }
Пример #3
0
 /// <summary>
 /// Initialize new instance of <see cref="EllipseSelection"/> class.
 /// </summary>
 /// <param name="layer">The selection shapes layer.</param>
 /// <param name="shape">The selected shape.</param>
 /// <param name="style">The selection shapes style.</param>
 /// <param name="point">The selection point shape.</param>
 public EllipseSelection(XLayer layer, XEllipse shape, ShapeStyle style, BaseShape point)
 {
     _layer = layer;
     _ellipse = shape;
     _style = style;
     _point = point;
 }
Пример #4
0
 /// <summary>
 /// Initialize new instance of <see cref="QuadraticBezierSelection"/> class.
 /// </summary>
 /// <param name="layer">The selection shapes layer.</param>
 /// <param name="shape">The selected shape.</param>
 /// <param name="style">The selection shapes style.</param>
 /// <param name="point">The selection point shape.</param>
 public QuadraticBezierSelection(XLayer layer, IQuadraticBezier shape, ShapeStyle style, BaseShape point)
 {
     _layer = layer;
     _quadraticBezier = shape;
     _style = style;
     _point = point;
 }
Пример #5
0
 /// <summary>
 /// Initialize new instance of <see cref="ImageSelection"/> class.
 /// </summary>
 /// <param name="layer">The selection shapes layer.</param>
 /// <param name="shape">The selected shape.</param>
 /// <param name="style">The selection shapes style.</param>
 /// <param name="point">The selection point shape.</param>
 public ImageSelection(XLayer layer, XImage shape, ShapeStyle style, BaseShape point)
 {
     _layer = layer;
     _image = shape;
     _style = style;
     _point = point;
 }
Пример #6
0
 /// <summary>
 /// Initialize new instance of <see cref="LineSelection"/> class.
 /// </summary>
 /// <param name="layer">The selection shapes layer.</param>
 /// <param name="shape">The selected shape.</param>
 /// <param name="style">The selection shapes style.</param>
 /// <param name="point">The selection point shape.</param>
 public LineSelection(XLayer layer, ILine shape, ShapeStyle style, BaseShape point)
 {
     _layer = layer;
     _line = shape;
     _style = style;
     _point = point;
 }
Пример #7
0
 /// <summary>
 /// Initialize new instance of <see cref="PointSelection"/> class.
 /// </summary>
 /// <param name="layer">The selection shapes layer.</param>
 /// <param name="shape">The selected shape.</param>
 /// <param name="style">The selection shapes style.</param>
 /// <param name="point">The selection point shape.</param>
 public PointSelection(XLayer layer, XPoint shape, ShapeStyle style, BaseShape point)
 {
     _layer = layer;
     _shape = shape;
     _style = style;
     _point = point;
 }
Пример #8
0
 /// <summary>
 /// Initialize new instance of <see cref="PathSelection"/> class.
 /// </summary>
 /// <param name="layer">The selection shapes layer.</param>
 /// <param name="shape">The selected shape.</param>
 /// <param name="style">The selection shapes style.</param>
 /// <param name="point">The selection point shape.</param>
 public PathSelection(XLayer layer, XPath shape, ShapeStyle style, BaseShape point)
 {
     _layer = layer;
     _path = shape;
     _style = style;
     _point = point;
 }
Пример #9
0
 /// <summary>
 /// Initialize new instance of <see cref="RectangleSelection"/> class.
 /// </summary>
 /// <param name="layer">The selection shapes layer.</param>
 /// <param name="shape">The selected shape.</param>
 /// <param name="style">The selection shapes style.</param>
 /// <param name="point">The selection point shape.</param>
 public RectangleSelection(XLayer layer, XRectangle shape, ShapeStyle style, BaseShape point)
 {
     _layer = layer;
     _rectangle = shape;
     _style = style;
     _point = point;
 }
Пример #10
0
 /// <summary>
 /// Initialize new instance of <see cref="ArcSelection"/> class.
 /// </summary>
 /// <param name="layer">The selection shapes layer.</param>
 /// <param name="shape">The selected shape.</param>
 /// <param name="style">The selection shapes style.</param>
 /// <param name="point">The selection point shape.</param>
 public ArcSelection(XLayer layer, IArc shape, ShapeStyle style, BaseShape point)
 {
     _layer = layer;
     _arc = shape;
     _style = style;
     _point = point;
 }
Пример #11
0
 /// <summary>
 /// Draws a <see cref="XLayer"/> using drawing context.
 /// </summary>
 /// <param name="dc">The native drawing context.</param>
 /// <param name="layer">The <see cref="XLayer"/> object.</param>
 /// <param name="dx">The X coordinate offset.</param>
 /// <param name="dy">The Y coordinate offset.</param>
 /// <param name="db">The properties database.</param>
 /// <param name="r">The data record.</param>
 public virtual void Draw(object dc, XLayer layer, double dx, double dy, ImmutableArray<XProperty> db, XRecord r)
 {
     foreach (var shape in layer.Shapes)
     {
         if (shape.State.Flags.HasFlag(State.DrawShapeState.Flags))
         {
             shape.Draw(dc, this, dx, dy, db, r);
         }
     }
 }
Пример #12
0
        /// <summary>
        /// Creates a new <see cref="XContainer"/> page instance.
        /// </summary>
        /// <param name="name">The page name.</param>
        /// <returns>The new instance of the <see cref="XContainer"/>.</returns>
        public static XContainer CreatePage(string name = "Page")
        {
            var page = new XContainer()
            {
                Name = name
            };

            var builder = page.Layers.ToBuilder();

            builder.Add(XLayer.Create("Layer1", page));
            builder.Add(XLayer.Create("Layer2", page));
            builder.Add(XLayer.Create("Layer3", page));
            page.Layers = builder.ToImmutable();

            page.CurrentLayer = page.Layers.FirstOrDefault();
            page.WorkingLayer = XLayer.Create("Working", page);
            page.HelperLayer  = XLayer.Create("Helper", page);

            return(page);
        }
Пример #13
0
        /// <summary>
        /// Creates a new <see cref="XContainer"/> template instance.
        /// </summary>
        /// <param name="name">The template name.</param>
        /// <param name="width">The template width.</param>
        /// <param name="height">The template height.</param>
        /// <returns>The new instance of the <see cref="XContainer"/>.</returns>
        public static XContainer CreateTemplate(string name = "Template", double width = 840, double height = 600)
        {
            var template = new XContainer()
            {
                Name = name
            };

            template.Background = ArgbColor.Create(0x00, 0xFF, 0xFF, 0xFF);
            template.Width      = width;
            template.Height     = height;

            var builder = template.Layers.ToBuilder();

            builder.Add(XLayer.Create("TemplateLayer1", template));
            builder.Add(XLayer.Create("TemplateLayer2", template));
            builder.Add(XLayer.Create("TemplateLayer3", template));
            template.Layers = builder.ToImmutable();

            template.CurrentLayer = template.Layers.FirstOrDefault();
            template.WorkingLayer = XLayer.Create("TemplateWorking", template);
            template.HelperLayer  = XLayer.Create("TemplateHelper", template);

            return(template);
        }
Пример #14
0
 public void Shapes_Not_Null()
 {
     var target = new XLayer();
     Assert.NotNull(target.Shapes);
 }
Пример #15
0
 public void Inherits_From_Selectable()
 {
     var target = new XLayer();
     Assert.True(target is XSelectable);
 }
Пример #16
0
        private void Remove(XLayer layer)
        {
            if (layer == null)
                return;

            layer.PropertyChanged -= ObserveLayer;

            if (layer.Shapes != null)
            {
                Remove(layer.Shapes);
            }

            layer.InvalidateLayer -= ObserveInvalidateLayer;
        }
Пример #17
0
        private void Add(XLayer layer)
        {
            if (layer == null)
                return;

            layer.PropertyChanged += ObserveLayer;

            if (layer.Shapes != null)
            {
                Add(layer.Shapes);
            }

            layer.InvalidateLayer += ObserveInvalidateLayer;
        }
Пример #18
0
 /// <summary>
 /// Set current layer.
 /// </summary>
 /// <param name="layer">The layer instance.</param>
 public void SetCurrentLayer(XLayer layer)
 {
     CurrentLayer = layer;
 }
Пример #19
0
 /// <summary>
 /// Set current layer.
 /// </summary>
 /// <param name="layer">The layer instance.</param>
 public void SetCurrentLayer(XLayer layer)
 {
     CurrentLayer = layer;
 }
Пример #20
0
 private void DeInitialize()
 {
     if (_layer != null)
     {
         _layer.InvalidateLayer -= Invalidate;
         _layer = default(XLayer);
     }
 }
Пример #21
0
        private void Initialize()
        {
            if (_layer != null)
            {
                DeInitialize();
            }

            var layer = DataContext as XLayer;
            if (layer != null)
            {
                _layer = layer;
                _layer.InvalidateLayer += Invalidate;
            }
        }