From 9878a1e10c53c4dd6e6c14a1df21f53dd3739e16 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 21 Aug 2020 19:55:52 +0100 Subject: [PATCH] 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. --- pcbnew/class_drawsegment.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index 95c438daeb..c0b33fbda8 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -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() ) );