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"); }
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(); }
public CrosshairGraphic() { base.Graphics.Add(_line1 = new LinePrimitive()); base.Graphics.Add(_line2 = new LinePrimitive()); base.Graphics.Add(_line3 = new LinePrimitive()); base.Graphics.Add(_line4 = new LinePrimitive()); this.Color = Color.LimeGreen; }
private void OnCloneComplete() { foreach (var graphic in Graphics) { if (_baseLine == null && graphic is LinePrimitive && graphic.Name == _baseLineName) _baseLine = (LinePrimitive)graphic; if (graphic is LinePrimitive && graphic.Name == _tickLineName) _ticklines.Add((LinePrimitive)graphic); } _isDirty = true; }
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; }
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; }
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"); }
/// <summary> /// Formats the scale's minor ticks. /// </summary> /// <param name="tickLine">A reference to the <see cref="LinePrimitive"/> that is the tick.</param> /// <param name="point">The point along the base line segment where the tick begins.</param> /// <param name="unitNormal">A unit normal vector that is perpendicular to the base line segment.</param> protected virtual void FormatMinorTick(LinePrimitive tickLine, PointF point, SizeF unitNormal) { float length = this.MinorTickLength; if (this.IsMirrored) length = -length; tickLine.Point1 = point; tickLine.Point2 = new PointF(point.X + length * unitNormal.Width, point.Y + length * unitNormal.Height); tickLine.Color = Color.White; }
/// <summary> /// Draws a <see cref="LinePrimitive"/>. /// </summary> protected override void DrawLinePrimitive(LinePrimitive line) { InternalDrawLinePrimitive(line); }
/// <summary> /// Draws a <see cref="LinePrimitive"/>. Must be overridden and implemented. /// </summary> protected abstract void DrawLinePrimitive(LinePrimitive line);
private void OnCloneComplete() { _baseLine = Graphics.OfType<LinePrimitive>().FirstOrDefault(g => g.Name == _baseLineName); _isDirty = true; }
/// <summary> /// Draws a <see cref="LinePrimitive"/>. /// </summary> protected override void DrawLinePrimitive(LinePrimitive line) { DrawLinePrimitive(Surface.FinalBuffer, _pen, line, Dpi); }
/// <summary> /// Constructs a <see cref="ScaleGraphic"/>. /// </summary> public ScaleGraphic() { Graphics.Add(_baseLine = new LinePrimitive{ Name = _baseLineName }); _isDirty = false; }
/// <summary> /// Allocates sufficient tick <see cref="LinePrimitive"/>s, adding new objects and disposing extra objects as necessary. /// </summary> /// <param name="tickCount">The number of tick <see cref="LinePrimitive"/>s to allocate.</param> /// <returns></returns> protected IList<LinePrimitive> AllocateTicks(int tickCount) { LinePrimitive tick; while (_ticklines.Count < tickCount) { tick = new LinePrimitive {Name = _tickLineName }; _ticklines.Add(tick); base.Graphics.Add(tick); } while (_ticklines.Count > tickCount) { tick = _ticklines[0]; _ticklines.RemoveAt(0); base.Graphics.Remove(tick); tick.Dispose(); } return _ticklines.AsReadOnly(); }
public ReferenceLineGraphic() { base.Graphics.Add(_text = new InvariantTextPrimitive()); base.Graphics.Add(_line = new LinePrimitive()); _text.BoundingBoxChanged += OnTextBoundingBoxChanged; }
/// <summary> /// Formats the scale's base line segment. /// </summary> /// <param name="baseLine">A reference to the <see cref="LinePrimitive"/> that is the base line segment.</param> /// <param name="endpoint1">One endpoint where the base line segment should be drawn.</param> /// <param name="endpoint2">The other endpoint where the base line segment should be drawn.</param> protected virtual void FormatBaseLine(LinePrimitive baseLine, PointF endpoint1, PointF endpoint2) { baseLine.Point1 = endpoint1; baseLine.Point2 = endpoint2; baseLine.Color = Color.White; }
private void Initialize() { if (_shaft == null) { base.Graphics.Add(_shaft = new LinePrimitive()); } if (_crosshair == null) { base.Graphics.Add(_crosshair = new InvariantCrosshairGraphic()); _crosshair.Visible = _showCrosshair; } _shaft.Point1Changed += OnShaftPoint1Changed; _shaft.Point2Changed += OnShaftPoint2Changed; }