From d4c811fc8baa9b9a35fcbab424f3e2831de1469f Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 17 Apr 2010 18:30:25 +0200 Subject: [PATCH] minor enhancement (mainly for Cvpcb) --- pcbnew/class_board.cpp | 29 +++++++---------------------- pcbnew/class_module.cpp | 18 ++++++++---------- 2 files changed, 15 insertions(+), 32 deletions(-) diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index e09c1e8460..bf1f3de229 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -791,34 +791,19 @@ bool BOARD::ComputeBoundaryBox() } } - /* Analise footprints */ + /* Analyze footprints */ for( MODULE* module = m_Modules; module; module = module->Next() ) { hasItems = TRUE; - xmin = MIN( xmin, ( module->m_Pos.x - + module->m_BoundaryBox.GetX() ) ); - ymin = MIN( ymin, ( module->m_Pos.y - + module->m_BoundaryBox.GetY() ) ); - xmax = MAX( xmax, module->m_Pos.x - + module->m_BoundaryBox.GetRight() ); - ymax = MAX( ymax, - module->m_Pos.y + module->m_BoundaryBox.GetBottom() ); - - - for( D_PAD* pt_pad = module->m_Pads; pt_pad; pt_pad = pt_pad->Next() ) - { - const wxPoint& pos = pt_pad->GetPosition(); - - d = pt_pad->m_Rayon; - xmin = MIN( xmin, pos.x - d ); - ymin = MIN( ymin, pos.y - d ); - xmax = MAX( xmax, pos.x + d ); - ymax = MAX( ymax, pos.y + d ); - } + EDA_Rect box = module->GetBoundingBox(); + xmin = MIN( xmin, box.GetX() ); + ymin = MIN( ymin, box.GetY() ); + xmax = MAX( xmax, box.GetRight() ); + ymax = MAX( ymax, box.GetBottom() ); } - /* Analise track and zones */ + /* Analize track and zones */ for( TRACK* track = m_Track; track; track = track->Next() ) { d = ( track->m_Width / 2 ) + 1; diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 50348586f4..6a10256d2b 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -623,11 +623,10 @@ int MODULE::ReadDescr( FILE* File, int* LineNum ) /* Update the bounding rectangle of the module * - * The rectangle is the rectangle with the contours and - * Pads. - * The rectangle is calculated: - * For East 0 - * Coord in on / anchor position + * The bounding box includes outlines and pads, but not the fields. + * The rectangle is: + * for orientation 0 + * coordinates relative to the module anchor. */ void MODULE::Set_Rectangle_Encadrement() { @@ -702,10 +701,9 @@ void MODULE::Set_Rectangle_Encadrement() } -/* Equivalent to Module:: Set_Rectangle_Encadrement() coord but real: - * Updating the rectangle real module PCB cad in ord - * Entree: pointer module - * The rectangle is the rectangle with the contours and pads. +/* Equivalent to Module::Set_Rectangle_Encadrement() but in board coordinates: + * Updates the module bounding box on the board + * The rectangle is the rectangle with outlines and pads, but not the fields * Also updates the surface (.M_Surface) module. */ void MODULE::SetRectangleExinscrit() @@ -785,7 +783,7 @@ void MODULE::SetRectangleExinscrit() /** * Function GetBoundingBox - * returns the full bounding box of this Footprint, including texts + * returns the full bounding box of this Footprint, including fields * Mainly used to redraw the screen area occupied by the footprint */ EDA_Rect MODULE::GetBoundingBox()