Exemple #1
0
        private void OnCloneComplete()
        {
            _shaft     = CollectionUtils.SelectFirst(base.Graphics, delegate(IGraphic graphic) { return(graphic is LinePrimitive); }) as LinePrimitive;
            _arrowhead = CollectionUtils.SelectFirst(base.Graphics, delegate(IGraphic graphic) { return(graphic is InvariantArrowheadGraphic); }) as InvariantArrowheadGraphic;

            Initialize();
        }
        private void OnPointsItemAdded(object sender, IndexEventArgs e)
        {
            if (_points.Count >= 2)
            {
                LinePrimitive line = new LinePrimitive();
                line.Color            = _color;
                line.LineStyle        = _lineStyle;
                line.CoordinateSystem = this.CoordinateSystem;
                try
                {
                    if (e.Index == _points.Count - 1)
                    {
                        _lines.Graphics.Add(line);
                        line.Point1 = _points[e.Index - 1];
                        line.Point2 = _points[e.Index];
                    }
                    else
                    {
                        _lines.Graphics.Insert(e.Index, line);
                        line.Point1 = _points[e.Index];
                        line.Point2 = _points[e.Index + 1];

                        if (e.Index > 0)
                        {
                            ((LinePrimitive)_lines.Graphics[e.Index - 1]).Point2 = _points[e.Index];
                        }
                    }
                }
                finally
                {
                    line.ResetCoordinateSystem();
                }
            }
            base.NotifyVisualStateChanged("Points");
        }
Exemple #3
0
        private void Initialize()
        {
            if (_shaft == null)
            {
                base.Graphics.Add(_shaft = new LinePrimitive());
            }

            if (_arrowhead == null)
            {
                base.Graphics.Add(_arrowhead = new InvariantArrowheadGraphic());
                _arrowhead.Visible           = _showArrowhead;
            }

            _shaft.Point1Changed += OnShaftPoint1Changed;
            _shaft.Point2Changed += OnShaftPoint2Changed;
        }