Add other (open) shapes to GetLength() calculation.

Since this is for trace length/propagation time, I'm not sure what
it would mean on a closed shape, so I left RECT and CIRCLE for now.
This commit is contained in:
Jeff Young 2020-08-21 19:55:52 +01:00
parent 80846dcbc7
commit 9878a1e10c
1 changed files with 10 additions and 0 deletions

View File

@ -89,6 +89,16 @@ double DRAWSEGMENT::GetLength() const
length = GetLineLength( GetStart(), GetEnd() );
break;
case S_POLYGON:
for( int ii = 0; ii < m_Poly.COutline( 0 ).SegmentCount(); ii++ )
length += m_Poly.COutline( 0 ).CSegment( ii ).Length();
break;
case S_ARC:
length = 2 * M_PI * GetRadius() * ( GetAngle() / 3600.0 );
break;
default:
wxASSERT_MSG( false, "DRAWSEGMENT::GetLength not implemented for shape"
+ ShowShape( GetShape() ) );