More EDA_RECT expungification, and an attempt to fix the python test.

This commit is contained in:
Jeff Young 2022-08-31 13:56:58 +01:00
parent f17a865593
commit ebe9617e77
14 changed files with 25 additions and 34 deletions

View File

@ -378,7 +378,7 @@ void DIALOG_PIN_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
SYMBOL_EDIT_FRAME* symbolEditor = (SYMBOL_EDIT_FRAME*) GetParent();
// Calculate a suitable scale to fit the available draw area
EDA_RECT bBox = m_dummyPin->GetBoundingBox( true, true, false );
BOX2I bBox = m_dummyPin->GetBoundingBox( true, true, false );
double xscale = (double) dc_size.x / bBox.GetWidth();
double yscale = (double) dc_size.y / bBox.GetHeight();
double scale = std::min( xscale, yscale );

View File

@ -1107,9 +1107,7 @@ void LIB_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
const BOX2I LIB_PIN::ViewBBox() const
{
EDA_RECT bbox = GetBoundingBox( false, true, true );
return BOX2I( bbox.GetOrigin(), bbox.GetSize() );
return GetBoundingBox( false, true, true );
}

View File

@ -33,7 +33,6 @@
#include <vector>
#include <multivector.h>
class EDA_RECT;
class LINE_READER;
class OUTPUTFORMATTER;
class SYMBOL_LIB;

View File

@ -156,7 +156,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh
SCH_SHEET* sheet = sheetPair.second;
// Calculate the new sheet size.
EDA_RECT sheetBoundingBox;
BOX2I sheetBoundingBox;
for( SCH_ITEM* item : sheet->GetScreen()->Items() )
{

View File

@ -407,7 +407,7 @@ BITMAPS SCH_TEXT::GetMenuImage() const
bool SCH_TEXT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{
EDA_RECT bBox = GetBoundingBox();
BOX2I bBox = GetBoundingBox();
bBox.Inflate( aAccuracy );
return bBox.Contains( aPosition );
}

View File

@ -299,7 +299,7 @@ wxString SCH_TEXTBOX::GetShownText( int aDepth ) const
bool SCH_TEXTBOX::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{
EDA_RECT rect = GetBoundingBox();
BOX2I rect = GetBoundingBox();
rect.Inflate( aAccuracy );

View File

@ -1241,9 +1241,7 @@ const BOX2I SYMBOL_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) con
}
else
{
EDA_RECT boundingBox = m_symbol->Flatten()->GetUnitBoundingBox( m_unit, m_convert );
return BOX2I( boundingBox.GetOrigin(), VECTOR2I( boundingBox.GetWidth(),
boundingBox.GetHeight() ) );
return m_symbol->Flatten()->GetUnitBoundingBox( m_unit, m_convert );
}
}

View File

@ -937,14 +937,12 @@ const BOX2I SYMBOL_VIEWER_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) c
}
else
{
std::shared_ptr< LIB_SYMBOL > tmp;
tmp = ( symbol->IsAlias() ) ? symbol->GetParent().lock() : symbol->SharedPtr();
std::shared_ptr<LIB_SYMBOL> tmp = symbol->IsAlias() ? symbol->GetParent().lock()
: symbol->SharedPtr();
wxCHECK( tmp, BOX2I( VECTOR2I( -200, -200 ), VECTOR2I( 400, 400 ) ) );
EDA_RECT bbox = tmp->GetUnitBoundingBox( m_unit, m_convert );
return BOX2I( bbox.GetOrigin(), VECTOR2I( bbox.GetWidth(), bbox.GetHeight() ) );
return tmp->GetUnitBoundingBox( m_unit, m_convert );
}
}

View File

@ -1299,7 +1299,7 @@ bool EE_SELECTION_TOOL::selectMultiple()
}
}
EDA_RECT selectionRect( area.GetOrigin(), wxSize( width, height ) );
BOX2I selectionRect( area.GetOrigin(), VECTOR2I( width, height ) );
selectionRect.Normalize();
bool anyAdded = false;
@ -1495,11 +1495,12 @@ int EE_SELECTION_TOOL::ClearSelection( const TOOL_EVENT& aEvent )
}
void EE_SELECTION_TOOL::ZoomFitCrossProbeBBox( EDA_RECT bbox )
void EE_SELECTION_TOOL::ZoomFitCrossProbeBBox( const BOX2I& aBBox )
{
if( bbox.GetWidth() == 0 )
if( aBBox.GetWidth() == 0 )
return;
BOX2I bbox = aBBox;
bbox.Normalize();
VECTOR2I bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize();

View File

@ -74,7 +74,7 @@ public:
void OnIdle( wxIdleEvent& aEvent );
///< Zoom the screen to fit the bounding box for cross probing/selection sync.
void ZoomFitCrossProbeBBox( EDA_RECT bbox );
void ZoomFitCrossProbeBBox( const BOX2I& aBBox );
/**
* @return the set of currently selected items.

View File

@ -350,7 +350,7 @@ void GERBVIEW_PAINTER::draw( /*const*/ GERBER_DRAW_ITEM* aItem, int aLayer )
#if 0 // Bbox arc Debugging only
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
EDA_RECT box = aItem->GetBoundingBox();
BOX2I box = aItem->GetBoundingBox();
m_gal->SetLineWidth( 5 );
m_gal->SetStrokeColor( COLOR4D(0.9, 0.9, 0, 0.4) );
// box coordinates are already in AB position.

View File

@ -28,7 +28,6 @@
#include <vector>
#include <core/kicad_algo.h>
#include <eda_item.h> // SEARCH_RESULT
#include <eda_rect.h>
class EDA_ITEM;
@ -213,8 +212,6 @@ public:
void SetRefPos( const VECTOR2I& aRefPos ) { m_refPos = aRefPos; }
const EDA_RECT& GetBoundingBox() const { return m_refBox; }
/**
* Count the number of items matching \a aType.
*
@ -247,7 +244,6 @@ protected:
INSPECTOR_FUNC m_inspector;
VECTOR2I m_refPos; // Reference pos used to generate the collection.
EDA_RECT m_refBox; // Selection rect used to generate the collection.
};
#endif // COLLECTOR_H

View File

@ -1636,14 +1636,15 @@ void PCB_SELECTION_TOOL::zoomFitSelection()
}
void PCB_SELECTION_TOOL::ZoomFitCrossProbeBBox( EDA_RECT bbox )
void PCB_SELECTION_TOOL::ZoomFitCrossProbeBBox( const BOX2I& aBBox )
{
// Should recalculate the view to zoom in on the bbox.
auto view = getView();
KIGFX::VIEW* view = getView();
if( bbox.GetWidth() == 0 )
if( aBBox.GetWidth() == 0 )
return;
BOX2I bbox = aBBox;
bbox.Normalize();
//#define DEFAULT_PCBNEW_CODE // Un-comment for normal full zoom KiCad algorithm

View File

@ -160,7 +160,7 @@ public:
void zoomFitSelection();
///< Zoom the screen to fit the bounding box for cross probing/selection sync.
void ZoomFitCrossProbeBBox( EDA_RECT bbox );
void ZoomFitCrossProbeBBox( const BOX2I& bbox );
/**
* Enter the group at the head of the current selection.