/// <summary> /// Returns the bounding rectangle. /// </summary> /// <param name="Rect">Rectangle to recieve the result.</param> public void GetBoundingRect(C2DRect Rect) { Rect.Set(_Rim.BoundingRect); for (var i = 0; i < _Holes.Count; i++) { Rect.ExpandToInclude(_Holes[i].BoundingRect); } }
/// <summary> /// Gets the parameters required to draw an arc. /// </summary> private void GetArcParameters(C2DArc Arc, C2DRect Rect, ref int nStartAngle, ref int nSweepAngle) { C2DPoint Centre = Arc.GetCircleCentre(); Rect.Set(Centre.x - Arc.Radius, Centre.y + Arc.Radius, Centre.x + Arc.Radius, Centre.y - Arc.Radius); ScaleAndOffSet(Rect.TopLeft); ScaleAndOffSet(Rect.BottomRight); ScaleAndOffSet(Centre); // CR 19-1-09 C2DPoint bottomRightTemp = new C2DPoint(Rect.BottomRight); // to make valid // CR 11-3-09 Rect.BottomRight.Set(Rect.TopLeft); // to make valid // CR 11-3-09 Rect.ExpandToInclude(bottomRightTemp); // to make valid // CR 11-3-09 C2DPoint pt1 = Arc.Line.GetPointFrom(); C2DPoint pt2 = Arc.Line.GetPointTo(); this.ScaleAndOffSet(pt1); this.ScaleAndOffSet(pt2); C2DVector vec1 = new C2DVector(Centre, pt1); C2DVector vec2 = new C2DVector(Centre, pt2); C2DVector vecx = new C2DVector(100, 0); // x - axis double dStartAngle = vecx.AngleToLeft(vec1) * Constants.conDegreesPerRadian; double dSweepAngle = 0; bool bAlreadyFlipped = Scale.x * Scale.y < 0; if (Arc.ArcOnRight ^ bAlreadyFlipped) { dSweepAngle = vec1.AngleToLeft(vec2) * Constants.conDegreesPerRadian; } else { dSweepAngle = -vec1.AngleToRight(vec2) * Constants.conDegreesPerRadian; } nStartAngle = (int)dStartAngle; if (nStartAngle == 360) { nStartAngle = 0; } nSweepAngle = (int)dSweepAngle; }
/// <summary> /// Gets the bounding rectangle. /// </summary> /// <param name="Rect">Ouput. The Rect.</param> public void GetBoundingRect(C2DRect Rect) { if (Count == 0) { Rect.Clear(); return; } else { Rect.Set(this[0]); for (int i = 1; i < Count; i++) { Rect.ExpandToInclude(this[i]); } } }
/// <summary> /// Returns the bounding rectangle. /// </summary> /// <param name="Rect">Output. The bounding rectangle.</param> public override void GetBoundingRect( C2DRect Rect) { Rect.Set(point); Rect.ExpandToInclude(GetPointTo()); }
/// <summary> /// Returns the bounding rect. /// </summary> /// <param name="Rect">Output. The bounding rectangle.</param> public override void GetBoundingRect(C2DRect Rect) { Rect.Set(P1); Rect.ExpandToInclude(P2); Rect.ExpandToInclude(P3); }
/// <summary> /// Returns the bounding rectangle. /// </summary> /// <param name="Rect">Rectangle to recieve the result.</param> public void GetBoundingRect(C2DRect Rect) { Rect.Set(_Rim.BoundingRect); for (int i = 0; i < _Holes.Count; i++) { Rect.ExpandToInclude( _Holes[i].BoundingRect); } }
/// <summary> /// Returns the bounding rectangle. /// </summary> /// <param name="Rect">Output. The bounding rectangle.</param> public override void GetBoundingRect(C2DRect Rect) { Rect.Set(point); Rect.ExpandToInclude(GetPointTo()); }
/// <summary> /// Gets the parameters required to draw an arc. /// </summary> private void GetArcParameters(C2DArc Arc, C2DRect Rect, ref int nStartAngle, ref int nSweepAngle) { C2DPoint Centre = Arc.GetCircleCentre(); Rect.Set(Centre.x - Arc.Radius, Centre.y + Arc.Radius, Centre.x + Arc.Radius, Centre.y - Arc.Radius); ScaleAndOffSet(Rect.TopLeft); ScaleAndOffSet(Rect.BottomRight); ScaleAndOffSet(Centre); // CR 19-1-09 C2DPoint bottomRightTemp = new C2DPoint(Rect.BottomRight); // to make valid // CR 11-3-09 Rect.BottomRight.Set(Rect.TopLeft); // to make valid // CR 11-3-09 Rect.ExpandToInclude(bottomRightTemp); // to make valid // CR 11-3-09 C2DPoint pt1 = Arc.Line.GetPointFrom(); C2DPoint pt2 = Arc.Line.GetPointTo(); this.ScaleAndOffSet(pt1); this.ScaleAndOffSet(pt2); C2DVector vec1 = new C2DVector(Centre, pt1); C2DVector vec2 = new C2DVector(Centre, pt2); C2DVector vecx = new C2DVector(100, 0); // x - axis double dStartAngle = vecx.AngleToLeft(vec1) * Constants.conDegreesPerRadian; double dSweepAngle = 0; bool bAlreadyFlipped = Scale.x * Scale.y < 0; if (Arc.ArcOnRight ^ bAlreadyFlipped) dSweepAngle = vec1.AngleToLeft(vec2) * Constants.conDegreesPerRadian; else dSweepAngle = -vec1.AngleToRight(vec2) * Constants.conDegreesPerRadian; nStartAngle = (int)dStartAngle; if (nStartAngle == 360) nStartAngle = 0; nSweepAngle = (int)dSweepAngle; }