double MODULE::PadCoverageRatio() const { double padArea = 0.0; double moduleArea = GetFootprintRect().GetArea(); for( D_PAD* pad = m_Pads; pad; pad = pad->Next() ) padArea += pad->GetBoundingBox().GetArea(); if( moduleArea == 0.0 ) return 1.0; double ratio = padArea / moduleArea; return std::min( ratio, 1.0 ); }
const EDA_RECT MODULE::GetBoundingBox() const { EDA_RECT area = GetFootprintRect(); // Calculate extended area including text fields area.Merge( m_Reference->GetBoundingBox() ); area.Merge( m_Value->GetBoundingBox() ); // Add the Clearance shape size: (shape around the pads when the // clearance is shown. Not optimized, but the draw cost is small // (perhaps smaller than optimization). int biggest_clearance = GetBoard()->GetBiggestClearanceValue(); area.Inflate( biggest_clearance ); return area; }
const BOX2I MODULE::ViewBBox() const { EDA_RECT fpRect = GetFootprintRect(); return BOX2I( VECTOR2I( fpRect.GetOrigin() ), VECTOR2I( fpRect.GetSize() ) ); }
void MODULE::CalculateBoundingBox() { m_BoundaryBox = GetFootprintRect(); m_Surface = std::abs( (double) m_BoundaryBox.GetWidth() * m_BoundaryBox.GetHeight() ); }