More EDA_RECT expungification, and an attempt to fix the python test.
This commit is contained in:
parent
f17a865593
commit
ebe9617e77
|
@ -378,10 +378,10 @@ void DIALOG_PIN_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
|
||||||
SYMBOL_EDIT_FRAME* symbolEditor = (SYMBOL_EDIT_FRAME*) GetParent();
|
SYMBOL_EDIT_FRAME* symbolEditor = (SYMBOL_EDIT_FRAME*) GetParent();
|
||||||
|
|
||||||
// Calculate a suitable scale to fit the available draw area
|
// 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 xscale = (double) dc_size.x / bBox.GetWidth();
|
||||||
double yscale = (double) dc_size.y / bBox.GetHeight();
|
double yscale = (double) dc_size.y / bBox.GetHeight();
|
||||||
double scale = std::min( xscale, yscale );
|
double scale = std::min( xscale, yscale );
|
||||||
|
|
||||||
// Give a 7% margin (each side) and limit to no more than 100% zoom
|
// Give a 7% margin (each side) and limit to no more than 100% zoom
|
||||||
scale = std::min( scale * 0.85, 1.0 );
|
scale = std::min( scale * 0.85, 1.0 );
|
||||||
|
|
|
@ -1107,9 +1107,7 @@ void LIB_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
|
||||||
|
|
||||||
const BOX2I LIB_PIN::ViewBBox() const
|
const BOX2I LIB_PIN::ViewBBox() const
|
||||||
{
|
{
|
||||||
EDA_RECT bbox = GetBoundingBox( false, true, true );
|
return GetBoundingBox( false, true, true );
|
||||||
|
|
||||||
return BOX2I( bbox.GetOrigin(), bbox.GetSize() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <multivector.h>
|
#include <multivector.h>
|
||||||
|
|
||||||
class EDA_RECT;
|
|
||||||
class LINE_READER;
|
class LINE_READER;
|
||||||
class OUTPUTFORMATTER;
|
class OUTPUTFORMATTER;
|
||||||
class SYMBOL_LIB;
|
class SYMBOL_LIB;
|
||||||
|
|
|
@ -156,7 +156,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh
|
||||||
SCH_SHEET* sheet = sheetPair.second;
|
SCH_SHEET* sheet = sheetPair.second;
|
||||||
|
|
||||||
// Calculate the new sheet size.
|
// Calculate the new sheet size.
|
||||||
EDA_RECT sheetBoundingBox;
|
BOX2I sheetBoundingBox;
|
||||||
|
|
||||||
for( SCH_ITEM* item : sheet->GetScreen()->Items() )
|
for( SCH_ITEM* item : sheet->GetScreen()->Items() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -407,7 +407,7 @@ BITMAPS SCH_TEXT::GetMenuImage() const
|
||||||
|
|
||||||
bool SCH_TEXT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
bool SCH_TEXT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
EDA_RECT bBox = GetBoundingBox();
|
BOX2I bBox = GetBoundingBox();
|
||||||
bBox.Inflate( aAccuracy );
|
bBox.Inflate( aAccuracy );
|
||||||
return bBox.Contains( aPosition );
|
return bBox.Contains( aPosition );
|
||||||
}
|
}
|
||||||
|
|
|
@ -299,7 +299,7 @@ wxString SCH_TEXTBOX::GetShownText( int aDepth ) const
|
||||||
|
|
||||||
bool SCH_TEXTBOX::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
bool SCH_TEXTBOX::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
EDA_RECT rect = GetBoundingBox();
|
BOX2I rect = GetBoundingBox();
|
||||||
|
|
||||||
rect.Inflate( aAccuracy );
|
rect.Inflate( aAccuracy );
|
||||||
|
|
||||||
|
|
|
@ -1241,9 +1241,7 @@ const BOX2I SYMBOL_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) con
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EDA_RECT boundingBox = m_symbol->Flatten()->GetUnitBoundingBox( m_unit, m_convert );
|
return m_symbol->Flatten()->GetUnitBoundingBox( m_unit, m_convert );
|
||||||
return BOX2I( boundingBox.GetOrigin(), VECTOR2I( boundingBox.GetWidth(),
|
|
||||||
boundingBox.GetHeight() ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -933,18 +933,16 @@ const BOX2I SYMBOL_VIEWER_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) c
|
||||||
|
|
||||||
if( !symbol )
|
if( !symbol )
|
||||||
{
|
{
|
||||||
return BOX2I( VECTOR2I(-200, -200), VECTOR2I( 400, 400 ) );
|
return BOX2I( VECTOR2I( -200, -200 ), VECTOR2I( 400, 400 ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::shared_ptr< LIB_SYMBOL > tmp;
|
std::shared_ptr<LIB_SYMBOL> tmp = symbol->IsAlias() ? symbol->GetParent().lock()
|
||||||
|
: symbol->SharedPtr();
|
||||||
|
|
||||||
tmp = ( symbol->IsAlias() ) ? symbol->GetParent().lock() : symbol->SharedPtr();
|
wxCHECK( tmp, BOX2I( VECTOR2I( -200, -200 ), VECTOR2I( 400, 400 ) ) );
|
||||||
|
|
||||||
wxCHECK( tmp, BOX2I( VECTOR2I(-200, -200), VECTOR2I( 400, 400 ) ) );
|
return tmp->GetUnitBoundingBox( m_unit, m_convert );
|
||||||
|
|
||||||
EDA_RECT bbox = tmp->GetUnitBoundingBox( m_unit, m_convert );
|
|
||||||
return BOX2I( bbox.GetOrigin(), VECTOR2I( bbox.GetWidth(), bbox.GetHeight() ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
selectionRect.Normalize();
|
||||||
|
|
||||||
bool anyAdded = false;
|
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;
|
return;
|
||||||
|
|
||||||
|
BOX2I bbox = aBBox;
|
||||||
bbox.Normalize();
|
bbox.Normalize();
|
||||||
|
|
||||||
VECTOR2I bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize();
|
VECTOR2I bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize();
|
||||||
|
|
|
@ -74,7 +74,7 @@ public:
|
||||||
void OnIdle( wxIdleEvent& aEvent );
|
void OnIdle( wxIdleEvent& aEvent );
|
||||||
|
|
||||||
///< Zoom the screen to fit the bounding box for cross probing/selection sync.
|
///< 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.
|
* @return the set of currently selected items.
|
||||||
|
|
|
@ -350,7 +350,7 @@ void GERBVIEW_PAINTER::draw( /*const*/ GERBER_DRAW_ITEM* aItem, int aLayer )
|
||||||
#if 0 // Bbox arc Debugging only
|
#if 0 // Bbox arc Debugging only
|
||||||
m_gal->SetIsFill( false );
|
m_gal->SetIsFill( false );
|
||||||
m_gal->SetIsStroke( true );
|
m_gal->SetIsStroke( true );
|
||||||
EDA_RECT box = aItem->GetBoundingBox();
|
BOX2I box = aItem->GetBoundingBox();
|
||||||
m_gal->SetLineWidth( 5 );
|
m_gal->SetLineWidth( 5 );
|
||||||
m_gal->SetStrokeColor( COLOR4D(0.9, 0.9, 0, 0.4) );
|
m_gal->SetStrokeColor( COLOR4D(0.9, 0.9, 0, 0.4) );
|
||||||
// box coordinates are already in AB position.
|
// box coordinates are already in AB position.
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <core/kicad_algo.h>
|
#include <core/kicad_algo.h>
|
||||||
#include <eda_item.h> // SEARCH_RESULT
|
#include <eda_item.h> // SEARCH_RESULT
|
||||||
#include <eda_rect.h>
|
|
||||||
|
|
||||||
|
|
||||||
class EDA_ITEM;
|
class EDA_ITEM;
|
||||||
|
@ -213,8 +212,6 @@ public:
|
||||||
|
|
||||||
void SetRefPos( const VECTOR2I& aRefPos ) { m_refPos = aRefPos; }
|
void SetRefPos( const VECTOR2I& aRefPos ) { m_refPos = aRefPos; }
|
||||||
|
|
||||||
const EDA_RECT& GetBoundingBox() const { return m_refBox; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Count the number of items matching \a aType.
|
* Count the number of items matching \a aType.
|
||||||
*
|
*
|
||||||
|
@ -247,7 +244,6 @@ protected:
|
||||||
INSPECTOR_FUNC m_inspector;
|
INSPECTOR_FUNC m_inspector;
|
||||||
|
|
||||||
VECTOR2I m_refPos; // Reference pos used to generate the collection.
|
VECTOR2I m_refPos; // Reference pos used to generate the collection.
|
||||||
EDA_RECT m_refBox; // Selection rect used to generate the collection.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COLLECTOR_H
|
#endif // COLLECTOR_H
|
||||||
|
|
|
@ -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.
|
// 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;
|
return;
|
||||||
|
|
||||||
|
BOX2I bbox = aBBox;
|
||||||
bbox.Normalize();
|
bbox.Normalize();
|
||||||
|
|
||||||
//#define DEFAULT_PCBNEW_CODE // Un-comment for normal full zoom KiCad algorithm
|
//#define DEFAULT_PCBNEW_CODE // Un-comment for normal full zoom KiCad algorithm
|
||||||
|
|
|
@ -160,7 +160,7 @@ public:
|
||||||
void zoomFitSelection();
|
void zoomFitSelection();
|
||||||
|
|
||||||
///< Zoom the screen to fit the bounding box for cross probing/selection sync.
|
///< 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.
|
* Enter the group at the head of the current selection.
|
||||||
|
|
Loading…
Reference in New Issue