Ejemplo n.º 1
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 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
     });
 }
Ejemplo n.º 2
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="x4"></param>
 /// <param name="y4"></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(
     double x1, double y1,
     double x2, double y2,
     double x3, double y3,
     double x4, double y4,
     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 = XPoint.Create(x1, y1, point),
         Point2 = XPoint.Create(x2, y2, point),
         Point3 = XPoint.Create(x3, y3, point),
         Point4 = XPoint.Create(x4, y4, point)
     });
 }
Ejemplo n.º 3
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,
     });
 }
Ejemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 public override void ToStateOne()
 {
     _topLeftHelperPoint = XPoint.Create(0, 0, _editor.Project.Options.PointShape);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_topLeftHelperPoint);
     _bottomRightHelperPoint = XPoint.Create(0, 0, _editor.Project.Options.PointShape);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_bottomRightHelperPoint);
 }
Ejemplo n.º 5
0
 /// <summary>
 ///
 /// </summary>
 public override void ToStateOne()
 {
     _startHelperPoint = XPoint.Create(0, 0, _editor.Project.Options.PointShape);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_startHelperPoint);
     _endHelperPoint = XPoint.Create(0, 0, _editor.Project.Options.PointShape);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_endHelperPoint);
 }
Ejemplo n.º 6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        public override void LeftDown(double x, double y)
        {
            double sx = _editor.Project.Options.SnapToGrid ? Editor.Snap(x, _editor.Project.Options.SnapX) : x;
            double sy = _editor.Project.Options.SnapToGrid ? Editor.Snap(y, _editor.Project.Options.SnapY) : y;

            switch (_currentState)
            {
            case State.None:
            {
                _shape = XPoint.Create(sx, sy, _editor.Project.Options.PointShape);

                if (_editor.Project.Options.TryToConnect)
                {
                    if (!_editor.TryToSplitLine(x, y, _shape, true))
                    {
                        _editor.AddWithHistory(_shape);
                    }
                }
                else
                {
                    _editor.AddWithHistory(_shape);
                }
            }
            break;
            }
        }
Ejemplo n.º 7
0
 /// <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);
     _helperPoint2 = XPoint.Create(0, 0, _editor.Project.Options.PointShape);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_helperPoint2);
 }
Ejemplo n.º 8
0
 /// <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);
     _helperPoint4 = XPoint.Create(0, 0, _editor.Project.Options.PointShape);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_helperPoint4);
 }
Ejemplo n.º 9
0
 /// <summary>
 ///
 /// </summary>
 public override void ToStateThree()
 {
     _line43 = XLine.Create(0, 0, _style, null);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_line43);
     _line23 = XLine.Create(0, 0, _style, null);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_line23);
     _helperPoint3 = XPoint.Create(0, 0, _editor.Project.Options.PointShape);
     _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_helperPoint3);
 }
Ejemplo n.º 10
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);
 }
Ejemplo n.º 11
0
        /// <summary>
        ///
        /// </summary>
        public override void ToStateThree()
        {
            if (_ellipse != null)
            {
                _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Remove(_ellipse);
                _ellipse = null;
            }

            _endLine = XLine.Create(0, 0, _style, null);
            _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_endLine);
            _endHelperPoint = XPoint.Create(0, 0, _editor.Project.Options.PointShape);
            _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_endHelperPoint);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Creates a new instance of the XPoint class.
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="isStandalone"></param>
        /// <returns></returns>
        public XPoint Point(
            double x          = 30, double y = 30,
            bool isStandalone = false)
        {
            var point = XPoint.Create(
                x, y,
                Context.Editor.Project.Options.PointShape);

            if (isStandalone)
            {
                Context.Editor.AddWithHistory(point);
            }
            return(point);
        }
Ejemplo n.º 13
0
        /// <summary>
        ///
        /// </summary>
        public override void ToStateTwo()
        {
            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;
            }

            _startLine = XLine.Create(0, 0, _style, null);
            _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_startLine);
            _startHelperPoint = XPoint.Create(0, 0, _editor.Project.Options.PointShape);
            _editor.Project.CurrentContainer.HelperLayer.Shapes = _editor.Project.CurrentContainer.HelperLayer.Shapes.Add(_startHelperPoint);
        }
Ejemplo n.º 14
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)
     });
 }