Exemple #1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="x1"></param>
 /// <param name="y1"></param>
 /// <param name="x2"></param>
 /// <param name="y2"></param>
 /// <param name="x3"></param>
 /// <param name="y3"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="isStroked"></param>
 /// <param name="isFilled"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XQBezier Create(
     double x1, double y1,
     double x2, double y2,
     double x3, double y3,
     ShapeStyle style,
     BaseShape point,
     bool isStroked = true,
     bool isFilled = false,
     string name = "")
 {
     return new XQBezier()
     {
         Name = name,
         Style = style,
         IsStroked = isStroked,
         IsFilled = isFilled,
         Data = new Data()
         {
             Bindings = ImmutableArray.Create<ShapeBinding>(),
             Properties = ImmutableArray.Create<ShapeProperty>()
         },
         Point1 = XPoint.Create(x1, y1, point),
         Point2 = XPoint.Create(x2, y2, point),
         Point3 = XPoint.Create(x3, y3, point)
     };
 }
Exemple #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="x1"></param>
 /// <param name="y1"></param>
 /// <param name="x2"></param>
 /// <param name="y2"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="isStroked"></param>
 /// <param name="isFilled"></param>
 /// <param name="text"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XEllipse Create(
     double x1, double y1,
     double x2, double y2,
     ShapeStyle style,
     BaseShape point,
     bool isStroked = true,
     bool isFilled = false,
     string text = null,
     string name = "")
 {
     return new XEllipse()
     {
         Name = name,
         Style = style,
         IsStroked = isStroked,
         IsFilled = isFilled,
         Data = new Data()
         {
             Bindings = ImmutableArray.Create<ShapeBinding>(),
             Properties = ImmutableArray.Create<ShapeProperty>()
         },
         TopLeft = XPoint.Create(x1, y1, point),
         BottomRight = XPoint.Create(x2, y2, point),
         Text = text,
     };
 }
Exemple #3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="isStroked"></param>
 /// <param name="isFilled"></param>
 /// <param name="text"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XEllipse Create(
     double x, double y,
     ShapeStyle style,
     BaseShape point,
     bool isStroked = true,
     bool isFilled = false,
     string text = null,
     string name = "")
 {
     return Create(x, y, x, y, style, point, isStroked, isFilled, text, name);
 }
Exemple #4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="name"></param>
 /// <param name="style"></param>
 /// <param name="geometry"></param>
 /// <param name="isStroked"></param>
 /// <param name="isFilled"></param>
 /// <returns></returns>
 public static XPath Create(
     string name,
     ShapeStyle style,
     XPathGeometry geometry,
     bool isStroked = true,
     bool isFilled = true)
 {
     return new XPath()
     {
         Name = name,
         Style = style,
         IsStroked = isStroked,
         IsFilled = isFilled,
         Data = new Data()
         {
             Bindings = ImmutableArray.Create<ShapeBinding>(),
             Properties = ImmutableArray.Create<ShapeProperty>()
         },
         Geometry = geometry
     };
 }
Exemple #5
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="start"></param>
 /// <param name="end"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="isStroked"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XLine Create(
     XPoint start,
     XPoint end,
     ShapeStyle style,
     BaseShape point,
     bool isStroked = true,
     string name = "")
 {
     return new XLine()
     {
         Name = name,
         Style = style,
         IsStroked = isStroked,
         IsFilled = false,
         Data = new Data()
         {
             Bindings = ImmutableArray.Create<ShapeBinding>(),
             Properties = ImmutableArray.Create<ShapeProperty>()
         },
         Start = start,
         End = end
     };
 }
Exemple #6
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pss"></param>
        /// <returns></returns>
        public static BaseShape CrossPointShape(ShapeStyle pss)
        {
            var g = XGroup.Create("PointShape");

            var builder = g.Shapes.ToBuilder();
            builder.Add(XLine.Create(-4, 0, 4, 0, pss, null));
            builder.Add(XLine.Create(0, -4, 0, 4, pss, null));
            g.Shapes = builder.ToImmutable();

            return g;
        }
Exemple #7
0
 /// <summary>
 /// 
 /// </summary>
 public override void ToStateOne()
 {
     _style = _editor.Project.Options.HelperStyle;
     _ellipse = XEllipse.Create(0, 0, _style, null);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_ellipse);
     _p1HelperPoint = XPoint.Create(0, 0, _editor.Project.Options.PointShape);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_p1HelperPoint);
     _p2HelperPoint = XPoint.Create(0, 0, _editor.Project.Options.PointShape);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_p2HelperPoint);
     _centerHelperPoint = XPoint.Create(0, 0, _editor.Project.Options.PointShape);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_centerHelperPoint);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="x1"></param>
 /// <param name="y1"></param>
 /// <param name="x2"></param>
 /// <param name="y2"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="isStroked"></param>
 /// <param name="isFilled"></param>
 /// <param name="text"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XRectangle Create(
     double x1, double y1,
     double x2, double y2,
     ShapeStyle style,
     BaseShape point,
     bool isStroked = true,
     bool isFilled = false,
     string text = null,
     string name = "")
 {
     return new XRectangle()
     {
         Name = name,
         Style = style,
         IsStroked = isStroked,
         IsFilled = isFilled,
         Data = new Data()
         {
             Bindings = ImmutableArray.Create<ShapeBinding>(),
             Properties = ImmutableArray.Create<ShapeProperty>()
         },
         TopLeft = XPoint.Create(x1, y1, point),
         BottomRight = XPoint.Create(x2, y2, point),
         Text = text,
         IsGrid = false,
         OffsetX = 30.0,
         OffsetY = 30.0,
         CellWidth = 30.0,
         CellHeight = 30.0
     };
 }
 private void ToStateOneLine()
 {
     _style = _editor.Project.Options.HelperStyle;
     _lineStartHelperPoint = XPoint.Create(0, 0, _editor.Project.Options.PointShape);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_lineStartHelperPoint);
     _lineEndHelperPoint = XPoint.Create(0, 0, _editor.Project.Options.PointShape);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_lineEndHelperPoint);
 }
Exemple #10
0
        private void RemoveQBezierHelpers()
        {
            if (_qbezierLine12 != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_qbezierLine12);
                _qbezierLine12 = null;
            }

            if (_qbezierLine32 != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_qbezierLine32);
                _qbezierLine32 = null;
            }

            if (_qbezierHelperPoint1 != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_qbezierHelperPoint1);
                _qbezierHelperPoint1 = null;
            }

            if (_qbezierHelperPoint2 != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_qbezierHelperPoint2);
                _qbezierHelperPoint2 = null;
            }

            if (_qbezierHelperPoint3 != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_qbezierHelperPoint3);
                _qbezierHelperPoint3 = null;
            }

            _style = null;
        }
Exemple #11
0
        private void RemoveLineHelpers()
        {
            if (_lineStartHelperPoint != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_lineStartHelperPoint);
                _lineStartHelperPoint = null;
            }

            if (_lineEndHelperPoint != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_lineEndHelperPoint);
                _lineEndHelperPoint = null;
            }

            _style = null;
        }
Exemple #12
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="pss"></param>
 /// <returns></returns>
 public static BaseShape RectanglePointShape(ShapeStyle pss)
 {
     return XRectangle.Create(-4, -4, 4, 4, pss, null, true, false);
 }
Exemple #13
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="pss"></param>
 /// <returns></returns>
 public static BaseShape FilledRectanglePointShape(ShapeStyle pss)
 {
     return XRectangle.Create(-3, -3, 3, 3, pss, null, true, true);
 }
Exemple #14
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="pss"></param>
 /// <returns></returns>
 public static BaseShape FilledEllipsePointShape(ShapeStyle pss)
 {
     return XEllipse.Create(-3, -3, 3, 3, pss, null, true, true);
 }
Exemple #15
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="pss"></param>
 /// <returns></returns>
 public static BaseShape EllipsePointShape(ShapeStyle pss)
 {
     return XEllipse.Create(-2, -2, 2, 2, pss, null, true, false);
 }
 /// <summary>
 /// 
 /// </summary>
 public override void ToStateTwo()
 {
     _style = _editor.Project.Options.HelperStyle;
     _line12 = XLine.Create(0, 0, _style, null);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_line12);
     _line32 = XLine.Create(0, 0, _style, null);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_line32);
     _helperPoint2 = XPoint.Create(0, 0, _editor.Project.Options.PointShape);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_helperPoint2);
 }
Exemple #17
0
 private void ToStateOneQBezier()
 {
     _style = _editor.Project.Options.HelperStyle;
     _qbezierHelperPoint1 = XPoint.Create(0, 0, _editor.Project.Options.PointShape);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_qbezierHelperPoint1);
     _qbezierHelperPoint3 = XPoint.Create(0, 0, _editor.Project.Options.PointShape);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_qbezierHelperPoint3);
 }
Exemple #18
0
 private void ToStateTwoQBezier()
 {
     _style = _editor.Project.Options.HelperStyle;
     _qbezierLine12 = XLine.Create(0, 0, _style, null);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_qbezierLine12);
     _qbezierLine32 = XLine.Create(0, 0, _style, null);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_qbezierLine32);
     _qbezierHelperPoint2 = XPoint.Create(0, 0, _editor.Project.Options.PointShape);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_qbezierHelperPoint2);
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="style"></param>
        /// <param name="rect"></param>
        /// <param name="ft"></param>
        /// <returns></returns>
        private static Point GetTextOrigin(ShapeStyle style, ref Rect rect, FormattedText ft)
        {
            double ox, oy;

            switch (style.TextStyle.TextHAlignment)
            {
                case TextHAlignment.Left:
                    ox = rect.TopLeft.X;
                    break;
                case TextHAlignment.Right:
                    ox = rect.Right - ft.Width;
                    break;
                case TextHAlignment.Center:
                default:
                    ox = (rect.Left + rect.Width / 2.0) - (ft.Width / 2.0);
                    break;
            }

            switch (style.TextStyle.TextVAlignment)
            {
                case TextVAlignment.Top:
                    oy = rect.TopLeft.Y;
                    break;
                case TextVAlignment.Bottom:
                    oy = rect.Bottom - ft.Height;
                    break;
                case TextVAlignment.Center:
                default:
                    oy = (rect.Bottom - rect.Height / 2.0) - (ft.Height / 2.0);
                    break;
            }

            return new Point(ox, oy);
        }
Exemple #20
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <param name="sa"></param>
        /// <param name="sr"></param>
        /// <param name="sg"></param>
        /// <param name="sb"></param>
        /// <param name="fa"></param>
        /// <param name="fr"></param>
        /// <param name="fg"></param>
        /// <param name="fb"></param>
        /// <param name="thickness"></param>
        /// <param name="textStyle"></param>
        /// <param name="lineStyle"></param>
        /// <param name="startArrowStyle"></param>
        /// <param name="endArrowStyle"></param>
        /// <param name="lineCap"></param>
        /// <param name="dashes"></param>
        /// <param name="dashOffset"></param>
        /// <returns></returns>
        public static ShapeStyle Create(
            string name = "",
            byte sa = 0xFF, byte sr = 0x00, byte sg = 0x00, byte sb = 0x00,
            byte fa = 0xFF, byte fr = 0x00, byte fg = 0x00, byte fb = 0x00,
            double thickness = 2.0,
            TextStyle textStyle = null,
            LineStyle lineStyle = null,
            ArrowStyle startArrowStyle = null,
            ArrowStyle endArrowStyle = null,
            LineCap lineCap = LineCap.Round,
            string dashes = default(string),
            double dashOffset = 0.0)
        {
            var style = new ShapeStyle()
            {
                Name = name,
                Stroke = ArgbColor.Create(sa, sr, sg, sb),
                Fill = ArgbColor.Create(fa, fr, fg, fb),
                Thickness = thickness,
                LineCap = lineCap,
                Dashes = dashes,
                DashOffset = dashOffset,
                LineStyle = lineStyle ?? LineStyle.Create("Line"),
                TextStyle = textStyle ?? TextStyle.Create("Text")
            };

            style.StartArrowStyle = startArrowStyle ?? ArrowStyle.Create("Start", style);
            style.EndArrowStyle = endArrowStyle ?? ArrowStyle.Create("End", style);

            return style;
        }
Exemple #21
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="isStroked"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XLine Create(
     double x, double y,
     ShapeStyle style,
     BaseShape point,
     bool isStroked = true,
     string name = "")
 {
     return Create(x, y, x, y, style, point, isStroked, name);
 }
Exemple #22
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="style"></param>
        public void Add(ShapeStyle style)
        {
            if (style == null)
                return;

            style.PropertyChanged += StyleObserver;

            if (style.Stroke != null)
            {
                style.Stroke.PropertyChanged += StyleObserver;
            }

            if (style.Fill != null)
            {
                style.Fill.PropertyChanged += StyleObserver;
            }

            if (style.LineStyle != null)
            {
                style.LineStyle.PropertyChanged += StyleObserver;

                if (style.LineStyle.FixedLength != null)
                {
                    style.LineStyle.FixedLength.PropertyChanged += StyleObserver;
                }
            }

            if (style.StartArrowStyle != null)
            {
                style.StartArrowStyle.PropertyChanged += StyleObserver;

                if (style.StartArrowStyle.Stroke != null)
                {
                    style.StartArrowStyle.Stroke.PropertyChanged += StyleObserver;
                }

                if (style.StartArrowStyle.Fill != null)
                {
                    style.StartArrowStyle.Fill.PropertyChanged += StyleObserver;
                }
            }

            if (style.EndArrowStyle != null)
            {
                style.EndArrowStyle.PropertyChanged += StyleObserver;

                if (style.EndArrowStyle.Stroke != null)
                {
                    style.EndArrowStyle.Stroke.PropertyChanged += StyleObserver;
                }

                if (style.EndArrowStyle.Fill != null)
                {
                    style.EndArrowStyle.Fill.PropertyChanged += StyleObserver;
                }
            }

            if (style.TextStyle != null)
            {
                style.TextStyle.PropertyChanged += StyleObserver;

                if (style.TextStyle.FontStyle != null)
                {
                    style.TextStyle.FontStyle.PropertyChanged += StyleObserver;
                }
            }

            Verbose("Add Style: " + style.Name);
        }
Exemple #23
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="x1"></param>
 /// <param name="y1"></param>
 /// <param name="x2"></param>
 /// <param name="y2"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="isStroked"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XLine Create(
     double x1, double y1,
     double x2, double y2,
     ShapeStyle style,
     BaseShape point,
     bool isStroked = true,
     string name = "")
 {
     return new XLine()
     {
         Name = name,
         Style = style,
         IsStroked = isStroked,
         IsFilled = false,
         Data = new Data()
         {
             Bindings = ImmutableArray.Create<ShapeBinding>(),
             Properties = ImmutableArray.Create<ShapeProperty>()
         },
         Start = XPoint.Create(x1, y1, point),
         End = XPoint.Create(x2, y2, point)
     };
 }
Exemple #24
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="topLeft"></param>
 /// <param name="bottomRight"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="path"></param>
 /// <param name="isStroked"></param>
 /// <param name="isFilled"></param>
 /// <param name="text"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XImage Create(
     XPoint topLeft,
     XPoint bottomRight,
     ShapeStyle style,
     BaseShape point,
     string path,
     bool isStroked = false,
     bool isFilled = false,
     string text = null,
     string name = "")
 {
     return new XImage()
     {
         Name = name,
         Style = style,
         IsStroked = isStroked,
         IsFilled = isFilled,
         Data = new Data()
         {
             Bindings = ImmutableArray.Create<ShapeBinding>(),
             Properties = ImmutableArray.Create<ShapeProperty>()
         },
         TopLeft = topLeft,
         BottomRight = bottomRight,
         Path = path,
         Text = text
     };
 }
Exemple #25
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="isStroked"></param>
 /// <param name="isFilled"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XQBezier Create(
     double x, double y,
     ShapeStyle style,
     BaseShape point,
     bool isStroked = true,
     bool isFilled = false,
     string name = "")
 {
     return Create(x, y, x, y, x, y, style, point, isStroked, isFilled, name);
 }
        /// <summary>
        /// 
        /// </summary>
        public override void Remove()
        {
            if (_line12 != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_line12);
                _line12 = null;
            }

            if (_line32 != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_line32);
                _line32 = null;
            }

            if (_helperPoint1 != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_helperPoint1);
                _helperPoint1 = null;
            }

            if (_helperPoint2 != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_helperPoint2);
                _helperPoint2 = null;
            }

            if (_helperPoint3 != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_helperPoint3);
                _helperPoint3 = null;
            }

            _style = null;
        }
Exemple #27
0
        /// <summary>
        /// 
        /// </summary>
        public override void Remove()
        {
            if (_ellipse != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_ellipse);
                _ellipse = null;
            }

            if (_startLine != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_startLine);
                _startLine = null;
            }

            if (_endLine != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_endLine);
                _endLine = null;
            }

            if (_p1HelperPoint != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_p1HelperPoint);
                _p1HelperPoint = null;
            }

            if (_p2HelperPoint != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_p2HelperPoint);
                _p2HelperPoint = null;
            }

            if (_centerHelperPoint != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_centerHelperPoint);
                _centerHelperPoint = null;
            }

            if (_startHelperPoint != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_startHelperPoint);
                _startHelperPoint = null;
            }

            if (_endHelperPoint != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_endHelperPoint);
                _endHelperPoint = null;
            }

            _style = null;
        }
 /// <summary>
 /// 
 /// </summary>
 public override void ToStateOne()
 {
     _style = _editor.Project.Options.HelperStyle;
     _helperPoint1 = XPoint.Create(0, 0, _editor.Project.Options.PointShape);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_helperPoint1);
     _helperPoint3 = XPoint.Create(0, 0, _editor.Project.Options.PointShape);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_helperPoint3);
 }
Exemple #29
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="point1"></param>
 /// <param name="point2"></param>
 /// <param name="point3"></param>
 /// <param name="point4"></param>
 /// <param name="style"></param>
 /// <param name="point"></param>
 /// <param name="isStroked"></param>
 /// <param name="isFilled"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public static XArc Create(
     XPoint point1,
     XPoint point2,
     XPoint point3,
     XPoint point4,
     ShapeStyle style,
     BaseShape point,
     bool isStroked = true,
     bool isFilled = false,
     string name = "")
 {
     return new XArc()
     {
         Name = name,
         Style = style,
         IsStroked = isStroked,
         IsFilled = isFilled,
         Data = new Data()
         {
             Bindings = ImmutableArray.Create<ShapeBinding>(),
             Properties = ImmutableArray.Create<ShapeProperty>()
         },
         Point1 = point1,
         Point2 = point2,
         Point3 = point3,
         Point4 = point4
     };
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="style"></param>
 /// <param name="x"></param>
 /// <param name="y"></param>
 public void Drop(ShapeStyle style, double x, double y)
 {
     try
     {
         if (_editor.Renderers[0].State.SelectedShape != null)
         {
             // TODO: Add history snapshot.
             _editor.Renderers[0].State.SelectedShape.Style = style;
         }
         else if (_editor.Renderers[0].State.SelectedShapes != null && _editor.Renderers[0].State.SelectedShapes.Count > 0)
         {
             // TODO: Add history snapshot.
             foreach (var shape in _editor.Renderers[0].State.SelectedShapes)
             {
                 shape.Style = style;
             }
         }
         else
         {
             var container = _editor.Project.CurrentContainer;
             if (container != null)
             {
                 var result = ShapeBounds.HitTest(container, new Vector2(x, y), _editor.Project.Options.HitTreshold);
                 if (result != null)
                 {
                     // Add history snapshot.
                     result.Style = style;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         if (_editor.Log != null)
         {
             _editor.Log.LogError("{0}{1}{2}",
                 ex.Message,
                 Environment.NewLine,
                 ex.StackTrace);
         }
     }
 }