/// <summary> /// Cloning constructor. /// </summary> /// <param name="source">The source object from which to clone.</param> /// <param name="context">The cloning context object.</param> protected ShowAnglesToolGraphic(ShowAnglesToolGraphic source, ICloningContext context) : base() { context.CloneFields(source, this); _endPoints = new PointsList(source._endPoints, this); }
public override void OnDrawing() { base.OnDrawing(); if (!_isDirty) return; IOverlayGraphicsProvider overlayGraphicsProvider = this.ParentPresentationImage as IOverlayGraphicsProvider; if (overlayGraphicsProvider == null) return; IList<ShowAnglesToolGraphic> freeAngleGraphics = CollectionUtils.Cast<ShowAnglesToolGraphic>(this.Graphics); if (this.Visible && _selectedLine != null && _selectedLine.Points.Count == 2) { _selectedLine.CoordinateSystem = CoordinateSystem.Source; try { foreach (IGraphic otherLineGraphic in overlayGraphicsProvider.OverlayGraphics) { IPointsGraphic otherLine = GetLine(otherLineGraphic); if (otherLine != null && !ReferenceEquals(otherLine, _selectedLine) && otherLine.Points.Count == 2) { ShowAnglesToolGraphic showAnglesToolGraphic; if (freeAngleGraphics.Count > 0) freeAngleGraphics.Remove(showAnglesToolGraphic = freeAngleGraphics[0]); else this.Graphics.Add(showAnglesToolGraphic = new ShowAnglesToolGraphic()); showAnglesToolGraphic.CoordinateSystem = otherLine.CoordinateSystem = CoordinateSystem.Source; try { showAnglesToolGraphic.SetEndpoints(_selectedLine.Points[0], _selectedLine.Points[1], otherLine.Points[0], otherLine.Points[1]); } finally { showAnglesToolGraphic.ResetCoordinateSystem(); otherLine.ResetCoordinateSystem(); } } } } finally { _selectedLine.ResetCoordinateSystem(); } } foreach (IGraphic freeAngleGraphic in freeAngleGraphics) { this.Graphics.Remove(freeAngleGraphic); freeAngleGraphic.Dispose(); } }
public override void OnDrawing() { base.OnDrawing(); if (!_isDirty) { return; } IOverlayGraphicsProvider overlayGraphicsProvider = this.ParentPresentationImage as IOverlayGraphicsProvider; if (overlayGraphicsProvider == null) { return; } IList <ShowAnglesToolGraphic> freeAngleGraphics = CollectionUtils.Cast <ShowAnglesToolGraphic>(this.Graphics); if (this.Visible && _selectedLine != null && _selectedLine.Points.Count == 2) { _selectedLine.CoordinateSystem = CoordinateSystem.Source; try { foreach (IGraphic otherLineGraphic in overlayGraphicsProvider.OverlayGraphics) { IPointsGraphic otherLine = GetLine(otherLineGraphic); if (otherLine != null && !ReferenceEquals(otherLine, _selectedLine) && otherLine.Points.Count == 2) { ShowAnglesToolGraphic showAnglesToolGraphic; if (freeAngleGraphics.Count > 0) { freeAngleGraphics.Remove(showAnglesToolGraphic = freeAngleGraphics[0]); } else { this.Graphics.Add(showAnglesToolGraphic = new ShowAnglesToolGraphic()); } showAnglesToolGraphic.CoordinateSystem = otherLine.CoordinateSystem = CoordinateSystem.Source; try { showAnglesToolGraphic.SetEndpoints(_selectedLine.Points[0], _selectedLine.Points[1], otherLine.Points[0], otherLine.Points[1]); } finally { showAnglesToolGraphic.ResetCoordinateSystem(); otherLine.ResetCoordinateSystem(); } } } } finally { _selectedLine.ResetCoordinateSystem(); } } foreach (IGraphic freeAngleGraphic in freeAngleGraphics) { this.Graphics.Remove(freeAngleGraphic); freeAngleGraphic.Dispose(); } }