Move EDA_ITEM bounding boxes to BOX2I.
This commit is contained in:
parent
121fad63ab
commit
2dc6300501
|
@ -1,7 +1,3 @@
|
|||
/**
|
||||
* @file class_bitmap_base.cpp
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
|
@ -215,15 +211,14 @@ bool BITMAP_BASE::LoadData( LINE_READER& aLine, wxString& aErrorMsg )
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT BITMAP_BASE::GetBoundingBox() const
|
||||
const BOX2I BITMAP_BASE::GetBoundingBox() const
|
||||
{
|
||||
EDA_RECT rect;
|
||||
BOX2I bbox;
|
||||
VECTOR2I size = GetSize();
|
||||
|
||||
wxSize size = GetSize();
|
||||
bbox.Inflate( size.x / 2, size.y / 2 );
|
||||
|
||||
rect.Inflate( size.x / 2, size.y / 2 );
|
||||
|
||||
return rect;
|
||||
return bbox;
|
||||
}
|
||||
|
||||
|
||||
|
@ -233,7 +228,7 @@ void BITMAP_BASE::DrawBitmap( wxDC* aDC, const VECTOR2I& aPos )
|
|||
return;
|
||||
|
||||
VECTOR2I pos = aPos;
|
||||
wxSize size = GetSize();
|
||||
VECTOR2I size = GetSize();
|
||||
|
||||
// This fixes a bug in OSX that should be fixed in the 3.0.3 version or later.
|
||||
if( ( size.x == 0 ) || ( size.y == 0 ) )
|
||||
|
@ -292,7 +287,7 @@ void BITMAP_BASE::DrawBitmap( wxDC* aDC, const VECTOR2I& aPos )
|
|||
}
|
||||
|
||||
aDC->DestroyClippingRegion();
|
||||
aDC->SetClippingRegion( clipAreaPos, size );
|
||||
aDC->SetClippingRegion( clipAreaPos, wxSize( size.x, size.y ) );
|
||||
|
||||
if( GetGRForceBlackPenState() )
|
||||
{
|
||||
|
@ -316,9 +311,9 @@ void BITMAP_BASE::DrawBitmap( wxDC* aDC, const VECTOR2I& aPos )
|
|||
}
|
||||
|
||||
|
||||
wxSize BITMAP_BASE::GetSize() const
|
||||
VECTOR2I BITMAP_BASE::GetSize() const
|
||||
{
|
||||
wxSize size;
|
||||
VECTOR2I size;
|
||||
|
||||
if( m_bitmap )
|
||||
{
|
||||
|
|
|
@ -169,7 +169,7 @@ void DS_DRAW_ITEM_TEXT::PrintWsItem( const RENDER_SETTINGS* aSettings, const VEC
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT DS_DRAW_ITEM_TEXT::GetBoundingBox() const
|
||||
const BOX2I DS_DRAW_ITEM_TEXT::GetBoundingBox() const
|
||||
{
|
||||
return EDA_TEXT::GetTextBox();
|
||||
}
|
||||
|
@ -231,17 +231,9 @@ void DS_DRAW_ITEM_POLYPOLYGONS::SetPosition( const VECTOR2I& aPos )
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT DS_DRAW_ITEM_POLYPOLYGONS::GetBoundingBox() const
|
||||
const BOX2I DS_DRAW_ITEM_POLYPOLYGONS::GetBoundingBox() const
|
||||
{
|
||||
EDA_RECT rect;
|
||||
BOX2I box = m_Polygons.BBox();
|
||||
|
||||
rect.SetX( box.GetX() );
|
||||
rect.SetY( box.GetY() );
|
||||
rect.SetWidth( box.GetWidth() );
|
||||
rect.SetHeight( box.GetHeight() );
|
||||
|
||||
return rect;
|
||||
return m_Polygons.BBox();
|
||||
}
|
||||
|
||||
|
||||
|
@ -309,9 +301,9 @@ void DS_DRAW_ITEM_RECT::PrintWsItem( const RENDER_SETTINGS* aSettings, const VEC
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT DS_DRAW_ITEM_RECT::GetBoundingBox() const
|
||||
const BOX2I DS_DRAW_ITEM_RECT::GetBoundingBox() const
|
||||
{
|
||||
return EDA_RECT( GetStart(), wxSize( GetEnd().x - GetStart().x, GetEnd().y - GetStart().y ) );
|
||||
return BOX2I( GetStart(), GetEnd() - GetStart() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -407,9 +399,9 @@ void DS_DRAW_ITEM_LINE::PrintWsItem( const RENDER_SETTINGS* aSettings, const VEC
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT DS_DRAW_ITEM_LINE::GetBoundingBox() const
|
||||
const BOX2I DS_DRAW_ITEM_LINE::GetBoundingBox() const
|
||||
{
|
||||
return EDA_RECT( GetStart(), wxSize( GetEnd().x - GetStart().x, GetEnd().y - GetStart().y ) );
|
||||
return BOX2I( GetStart(), GetEnd() - GetStart() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -440,14 +432,14 @@ void DS_DRAW_ITEM_BITMAP::PrintWsItem( const RENDER_SETTINGS* aSettings, const V
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT DS_DRAW_ITEM_BITMAP::GetBoundingBox() const
|
||||
const BOX2I DS_DRAW_ITEM_BITMAP::GetBoundingBox() const
|
||||
{
|
||||
auto* bitmap = static_cast<const DS_DATA_ITEM_BITMAP*>( m_peer );
|
||||
wxSize bm_size = bitmap->m_ImageBitmap->GetSize();
|
||||
const DS_DATA_ITEM_BITMAP* bitmap = static_cast<const DS_DATA_ITEM_BITMAP*>( m_peer );
|
||||
VECTOR2I bm_size = bitmap->m_ImageBitmap->GetSize();
|
||||
BOX2I bbox;
|
||||
|
||||
EDA_RECT bbox;
|
||||
bbox.SetSize( bm_size );
|
||||
bbox.SetOrigin( m_pos.x - bm_size.x/2, m_pos.y - bm_size.y/2 );
|
||||
bbox.SetOrigin( m_pos.x - bm_size.x / 2, m_pos.y - bm_size.y / 2 );
|
||||
|
||||
return bbox;
|
||||
}
|
||||
|
@ -480,13 +472,14 @@ wxString DS_DRAW_ITEM_PAGE::GetSelectMenuText( EDA_UNITS aUnits ) const
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT DS_DRAW_ITEM_PAGE::GetBoundingBox() const
|
||||
const BOX2I DS_DRAW_ITEM_PAGE::GetBoundingBox() const
|
||||
{
|
||||
EDA_RECT dummy;
|
||||
BOX2I dummy;
|
||||
|
||||
// We want this graphic item always visible. So gives the max size to the
|
||||
// bounding box to avoid any clamping:
|
||||
dummy.SetSize( wxSize( std::numeric_limits<int>::max(), std::numeric_limits<int>::max() ) );
|
||||
dummy.SetMaximum();
|
||||
|
||||
return dummy;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,11 +72,11 @@ void EDA_ITEM::SetModified()
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT EDA_ITEM::GetBoundingBox() const
|
||||
const BOX2I EDA_ITEM::GetBoundingBox() const
|
||||
{
|
||||
// return a zero-sized box per default. derived classes should override
|
||||
// this
|
||||
return EDA_RECT( VECTOR2I( 0, 0 ), VECTOR2I( 0, 0 ) );
|
||||
return BOX2I( VECTOR2I( 0, 0 ), VECTOR2I( 0, 0 ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -255,9 +255,7 @@ EDA_ITEM& EDA_ITEM::operator=( const EDA_ITEM& aItem )
|
|||
const BOX2I EDA_ITEM::ViewBBox() const
|
||||
{
|
||||
// Basic fallback
|
||||
EDA_RECT bbox = GetBoundingBox();
|
||||
|
||||
return BOX2I( bbox.GetOrigin(), bbox.GetSize() );
|
||||
return GetBoundingBox();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ public:
|
|||
SIDE_AND_NPINS sideandpins = chooseSideForFields( aManual );
|
||||
SIDE field_side = sideandpins.side;
|
||||
VECTOR2I fbox_pos = fieldBoxPlacement( sideandpins );
|
||||
EDA_RECT field_box( fbox_pos, m_fbox_size );
|
||||
BOX2I field_box( fbox_pos, m_fbox_size );
|
||||
|
||||
if( aManual )
|
||||
forceWireSpacing = fitFieldsBetweenWires( &field_box, field_side );
|
||||
|
@ -190,7 +190,7 @@ protected:
|
|||
* Compute and return the size of the fields' bounding box.
|
||||
* @param aDynamic - if true, use dynamic spacing
|
||||
*/
|
||||
wxSize computeFBoxSize( bool aDynamic )
|
||||
VECTOR2I computeFBoxSize( bool aDynamic )
|
||||
{
|
||||
int max_field_width = 0;
|
||||
int total_height = 0;
|
||||
|
@ -210,9 +210,9 @@ protected:
|
|||
else
|
||||
field->SetTextAngle( ANGLE_HORIZONTAL );
|
||||
|
||||
EDA_RECT bbox = field->GetBoundingBox();
|
||||
int field_width = bbox.GetWidth();
|
||||
int field_height = bbox.GetHeight();
|
||||
BOX2I bbox = field->GetBoundingBox();
|
||||
int field_width = bbox.GetWidth();
|
||||
int field_height = bbox.GetHeight();
|
||||
|
||||
max_field_width = std::max( max_field_width, field_width );
|
||||
|
||||
|
@ -228,7 +228,7 @@ protected:
|
|||
total_height += field_height + FIELD_PADDING;
|
||||
}
|
||||
|
||||
return wxSize( max_field_width, total_height );
|
||||
return VECTOR2I( max_field_width, total_height );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -277,12 +277,12 @@ protected:
|
|||
{
|
||||
wxCHECK_RET( m_screen, "getPossibleCollisions() with null m_screen" );
|
||||
|
||||
EDA_RECT symbolBox = m_symbol->GetBodyAndPinsBoundingBox();
|
||||
BOX2I symbolBox = m_symbol->GetBodyAndPinsBoundingBox();
|
||||
std::vector<SIDE_AND_NPINS> sides = getPreferredSides();
|
||||
|
||||
for( SIDE_AND_NPINS& side : sides )
|
||||
{
|
||||
EDA_RECT box( fieldBoxPlacement( side ), m_fbox_size );
|
||||
BOX2I box( fieldBoxPlacement( side ), m_fbox_size );
|
||||
box.Merge( symbolBox );
|
||||
|
||||
for( SCH_ITEM* item : m_screen->Items().Overlapping( box ) )
|
||||
|
@ -308,13 +308,13 @@ protected:
|
|||
* Filter a list of possible colliders to include only those that actually collide
|
||||
* with a given rectangle. Returns the new vector.
|
||||
*/
|
||||
std::vector<SCH_ITEM*> filterCollisions( const EDA_RECT& aRect )
|
||||
std::vector<SCH_ITEM*> filterCollisions( const BOX2I& aRect )
|
||||
{
|
||||
std::vector<SCH_ITEM*> filtered;
|
||||
|
||||
for( SCH_ITEM* item : m_colliders )
|
||||
{
|
||||
EDA_RECT item_box;
|
||||
BOX2I item_box;
|
||||
|
||||
if( SCH_SYMBOL* item_comp = dynamic_cast<SCH_SYMBOL*>( item ) )
|
||||
item_box = item_comp->GetBodyAndPinsBoundingBox();
|
||||
|
@ -412,7 +412,7 @@ protected:
|
|||
sideandpins.side = side;
|
||||
sideandpins.pins = pinsOnSide( side );
|
||||
|
||||
EDA_RECT box( fieldBoxPlacement( sideandpins ), m_fbox_size );
|
||||
BOX2I box( fieldBoxPlacement( sideandpins ), m_fbox_size );
|
||||
|
||||
COLLISION collision = COLLIDE_NONE;
|
||||
|
||||
|
@ -540,8 +540,8 @@ protected:
|
|||
VECTOR2I fieldBoxPlacement( SIDE_AND_NPINS aFieldSideAndPins )
|
||||
{
|
||||
VECTOR2I fbox_center = m_symbol_bbox.Centre();
|
||||
int offs_x = ( m_symbol_bbox.GetWidth() + m_fbox_size.GetWidth() ) / 2;
|
||||
int offs_y = ( m_symbol_bbox.GetHeight() + m_fbox_size.GetHeight() ) / 2;
|
||||
int offs_x = ( m_symbol_bbox.GetWidth() + m_fbox_size.x ) / 2;
|
||||
int offs_y = ( m_symbol_bbox.GetHeight() + m_fbox_size.y ) / 2;
|
||||
|
||||
if( aFieldSideAndPins.side.x != 0 )
|
||||
offs_x += HPADDING;
|
||||
|
@ -551,13 +551,13 @@ protected:
|
|||
fbox_center.x += aFieldSideAndPins.side.x * offs_x;
|
||||
fbox_center.y += aFieldSideAndPins.side.y * offs_y;
|
||||
|
||||
int x = fbox_center.x - ( m_fbox_size.GetWidth() / 2 );
|
||||
int y = fbox_center.y - ( m_fbox_size.GetHeight() / 2 );
|
||||
int x = fbox_center.x - ( m_fbox_size.x / 2 );
|
||||
int y = fbox_center.y - ( m_fbox_size.y / 2 );
|
||||
|
||||
auto getPinsBox =
|
||||
[&]( const VECTOR2I& aSide )
|
||||
{
|
||||
EDA_RECT pinsBox;
|
||||
BOX2I pinsBox;
|
||||
|
||||
for( SCH_PIN* each_pin : m_symbol->GetPins() )
|
||||
{
|
||||
|
@ -581,7 +581,7 @@ protected:
|
|||
}
|
||||
else if( aFieldSideAndPins.side == SIDE_RIGHT || aFieldSideAndPins.side == SIDE_LEFT )
|
||||
{
|
||||
y = pinsBox.GetTop() - ( m_fbox_size.GetHeight() + ( VPADDING * 2 ) );
|
||||
y = pinsBox.GetTop() - ( m_fbox_size.y + ( VPADDING * 2 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -592,7 +592,7 @@ protected:
|
|||
* Shift a field box up or down a bit to make the fields fit between some wires.
|
||||
* Returns true if a shift was made.
|
||||
*/
|
||||
bool fitFieldsBetweenWires( EDA_RECT* aBox, SIDE aSide )
|
||||
bool fitFieldsBetweenWires( BOX2I* aBox, SIDE aSide )
|
||||
{
|
||||
if( aSide != SIDE_TOP && aSide != SIDE_BOTTOM )
|
||||
return false;
|
||||
|
@ -719,8 +719,8 @@ private:
|
|||
SCH_SYMBOL* m_symbol;
|
||||
std::vector<SCH_FIELD*> m_fields;
|
||||
std::vector<SCH_ITEM*> m_colliders;
|
||||
EDA_RECT m_symbol_bbox;
|
||||
wxSize m_fbox_size;
|
||||
BOX2I m_symbol_bbox;
|
||||
VECTOR2I m_fbox_size;
|
||||
bool m_allow_rejustify;
|
||||
bool m_align_to_grid;
|
||||
bool m_is_power_symbol;
|
||||
|
|
|
@ -80,17 +80,15 @@ void SCH_EDIT_FRAME::TestDanglingEnds()
|
|||
|
||||
bool SCH_EDIT_FRAME::TrimWire( const VECTOR2I& aStart, const VECTOR2I& aEnd )
|
||||
{
|
||||
SCH_SCREEN* screen = GetScreen();
|
||||
bool retval = false;
|
||||
if( aStart == aEnd )
|
||||
return false;
|
||||
|
||||
SCH_SCREEN* screen = GetScreen();
|
||||
std::vector<SCH_LINE*> wires;
|
||||
EDA_RECT bb( aStart, wxSize( 1, 1 ) );
|
||||
BOX2I bb( aStart );
|
||||
|
||||
bb.Merge( aEnd );
|
||||
|
||||
if( aStart == aEnd )
|
||||
return retval;
|
||||
|
||||
// We cannot modify the RTree while iterating, so push the possible
|
||||
// wires into a separate structure.
|
||||
for( EDA_ITEM* item : screen->Items().Overlapping( bb ) )
|
||||
|
@ -138,10 +136,10 @@ bool SCH_EDIT_FRAME::TrimWire( const VECTOR2I& aStart, const VECTOR2I& aEnd )
|
|||
SaveCopyInUndoList( screen, line, UNDO_REDO::DELETED, true );
|
||||
RemoveFromScreen( line, screen );
|
||||
|
||||
retval = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return retval;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString* aPath, const wx
|
|||
{
|
||||
if( crossProbingSettings.zoom_to_fit )
|
||||
{
|
||||
EDA_RECT bbox = symbol->GetBoundingBox();
|
||||
BOX2I bbox = symbol->GetBoundingBox();
|
||||
|
||||
m_toolMgr->GetTool<EE_SELECTION_TOOL>()->ZoomFitCrossProbeBBox( bbox );
|
||||
}
|
||||
|
|
|
@ -323,7 +323,7 @@ void LIB_FIELD::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
|
|||
orient = ANGLE_HORIZONTAL;
|
||||
}
|
||||
|
||||
EDA_RECT bbox = GetBoundingBox();
|
||||
BOX2I bbox = GetBoundingBox();
|
||||
bbox.RevertYAxis();
|
||||
|
||||
GR_TEXT_H_ALIGN_T hjustify = GR_TEXT_H_ALIGN_CENTER;
|
||||
|
@ -368,28 +368,28 @@ wxString LIB_FIELD::GetFullText( int unit ) const
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT LIB_FIELD::GetBoundingBox() const
|
||||
const BOX2I LIB_FIELD::GetBoundingBox() const
|
||||
{
|
||||
/* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when
|
||||
* calling GetTextBox() that works using top to bottom Y axis orientation.
|
||||
*/
|
||||
BOX2I rect = GetTextBox( -1, true );
|
||||
rect.RevertYAxis();
|
||||
BOX2I bbox = GetTextBox( -1, true );
|
||||
bbox.RevertYAxis();
|
||||
|
||||
// We are using now a bottom to top Y axis.
|
||||
VECTOR2I orig = rect.GetOrigin();
|
||||
VECTOR2I end = rect.GetEnd();
|
||||
VECTOR2I orig = bbox.GetOrigin();
|
||||
VECTOR2I end = bbox.GetEnd();
|
||||
|
||||
RotatePoint( orig, GetTextPos(), -GetTextAngle() );
|
||||
RotatePoint( end, GetTextPos(), -GetTextAngle() );
|
||||
|
||||
rect.SetOrigin( orig );
|
||||
rect.SetEnd( end );
|
||||
bbox.SetOrigin( orig );
|
||||
bbox.SetEnd( end );
|
||||
|
||||
// We are using now a top to bottom Y axis:
|
||||
rect.RevertYAxis();
|
||||
bbox.RevertYAxis();
|
||||
|
||||
return rect;
|
||||
return bbox;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ public:
|
|||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ public:
|
|||
/**
|
||||
* @return the boundary box for this, in library coordinates
|
||||
*/
|
||||
const EDA_RECT GetBoundingBox() const override { return EDA_ITEM::GetBoundingBox(); }
|
||||
const BOX2I GetBoundingBox() const override { return EDA_ITEM::GetBoundingBox(); }
|
||||
|
||||
/**
|
||||
* Display basic info (type, part and convert) about the current item in message panel.
|
||||
|
|
|
@ -141,7 +141,7 @@ LIB_PIN::LIB_PIN( LIB_SYMBOL* aParent, const wxString& aName, const wxString& aN
|
|||
|
||||
bool LIB_PIN::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
||||
{
|
||||
EDA_RECT rect = GetBoundingBox( false, true, m_flags & SHOW_ELEC_TYPE );
|
||||
BOX2I rect = GetBoundingBox( false, true, m_flags & SHOW_ELEC_TYPE );
|
||||
|
||||
return rect.Inflate( aAccuracy ).Contains( aPosition );
|
||||
}
|
||||
|
@ -1124,12 +1124,12 @@ void LIB_PIN::ViewGetLayers( int aLayers[], int& aCount ) const
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT LIB_PIN::GetBoundingBox( bool aIncludeInvisiblePins, bool aIncludeNameAndNumber,
|
||||
bool aIncludeElectricalType ) const
|
||||
const BOX2I LIB_PIN::GetBoundingBox( bool aIncludeInvisiblePins, bool aIncludeNameAndNumber,
|
||||
bool aIncludeElectricalType ) const
|
||||
{
|
||||
KIFONT::FONT* font = KIFONT::FONT::GetFont( Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>()->m_Appearance.default_font );
|
||||
|
||||
EDA_RECT bbox;
|
||||
BOX2I bbox;
|
||||
VECTOR2I begin;
|
||||
VECTOR2I end;
|
||||
int nameTextOffset = 0;
|
||||
|
|
|
@ -182,14 +182,14 @@ public:
|
|||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
/* Cannot use a default parameter here as it will not be compatible with the virtual. */
|
||||
const EDA_RECT GetBoundingBox() const override { return GetBoundingBox( false, true, false ); }
|
||||
const BOX2I GetBoundingBox() const override { return GetBoundingBox( false, true, false ); }
|
||||
|
||||
/**
|
||||
* @param aIncludeInvisibles - if false, do not include labels for invisible pins
|
||||
* in the calculation.
|
||||
*/
|
||||
const EDA_RECT GetBoundingBox( bool aIncludeInvisiblePins, bool aIncludeNameAndNumber,
|
||||
bool aIncludeElectricalType ) const;
|
||||
const BOX2I GetBoundingBox( bool aIncludeInvisiblePins, bool aIncludeNameAndNumber,
|
||||
bool aIncludeElectricalType ) const;
|
||||
|
||||
/**
|
||||
* Return whether this pin forms an implicit power connection: i.e., is hidden
|
||||
|
|
|
@ -413,13 +413,13 @@ void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT LIB_SHAPE::GetBoundingBox() const
|
||||
const BOX2I LIB_SHAPE::GetBoundingBox() const
|
||||
{
|
||||
BOX2I rect = getBoundingBox();
|
||||
BOX2I bbox = getBoundingBox();
|
||||
|
||||
rect.RevertYAxis();
|
||||
bbox.RevertYAxis();
|
||||
|
||||
return rect;
|
||||
return bbox;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
return m_stroke.GetPlotStyle();
|
||||
}
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
|
|
|
@ -863,10 +863,9 @@ bool LIB_SYMBOL::PinsConflictWith( const LIB_SYMBOL& aOtherPart, bool aTestNums,
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT LIB_SYMBOL::GetUnitBoundingBox( int aUnit, int aConvert ) const
|
||||
const BOX2I LIB_SYMBOL::GetUnitBoundingBox( int aUnit, int aConvert ) const
|
||||
{
|
||||
EDA_RECT bBox;
|
||||
bool initialized = false;
|
||||
BOX2I bBox; // Start with a fresh BOX2I so the Merge algorithm works
|
||||
|
||||
for( const LIB_ITEM& item : m_drawings )
|
||||
{
|
||||
|
@ -884,15 +883,7 @@ const EDA_RECT LIB_SYMBOL::GetUnitBoundingBox( int aUnit, int aConvert ) const
|
|||
if ( ( item.Type() == LIB_FIELD_T ) && !( ( LIB_FIELD& ) item ).IsVisible() )
|
||||
continue;
|
||||
|
||||
if( initialized )
|
||||
{
|
||||
bBox.Merge( item.GetBoundingBox() );
|
||||
}
|
||||
else
|
||||
{
|
||||
bBox = item.GetBoundingBox();
|
||||
initialized = true;
|
||||
}
|
||||
bBox.Merge( item.GetBoundingBox() );
|
||||
}
|
||||
|
||||
return bBox;
|
||||
|
|
|
@ -213,7 +213,7 @@ public:
|
|||
* if aConvert == 0 Convert is non used
|
||||
* Invisible fields are not taken in account
|
||||
**/
|
||||
const EDA_RECT GetUnitBoundingBox( int aUnit, int aConvert ) const;
|
||||
const BOX2I GetUnitBoundingBox( int aUnit, int aConvert ) const;
|
||||
|
||||
/**
|
||||
* Get the symbol bounding box excluding fields.
|
||||
|
@ -228,7 +228,7 @@ public:
|
|||
const BOX2I GetBodyBoundingBox( int aUnit, int aConvert, bool aIncludePins,
|
||||
bool aIncludePrivateItems ) const;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override
|
||||
const BOX2I GetBoundingBox() const override
|
||||
{
|
||||
return GetUnitBoundingBox( 0, 0 );
|
||||
}
|
||||
|
|
|
@ -270,17 +270,16 @@ void LIB_TEXT::Plot( PLOTTER* plotter, bool aBackground, const VECTOR2I& offset,
|
|||
if( aBackground )
|
||||
return;
|
||||
|
||||
EDA_RECT bBox = GetBoundingBox();
|
||||
BOX2I bBox = GetBoundingBox();
|
||||
// convert coordinates from draw Y axis to symbol_editor Y axis
|
||||
bBox.RevertYAxis();
|
||||
VECTOR2I txtpos = bBox.Centre();
|
||||
|
||||
// The text orientation may need to be flipped if the transformation matrix causes xy
|
||||
// axes to be flipped.
|
||||
int t1 = ( aTransform.x1 != 0 ) ^ ( GetTextAngle() != ANGLE_HORIZONTAL );
|
||||
int t1 = ( aTransform.x1 != 0 ) ^ ( GetTextAngle() != ANGLE_HORIZONTAL );
|
||||
VECTOR2I pos = aTransform.TransformCoordinate( txtpos ) + offset;
|
||||
|
||||
COLOR4D color = GetTextColor();
|
||||
COLOR4D color = GetTextColor();
|
||||
|
||||
if( !plotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
|
||||
color = plotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
|
||||
|
@ -345,7 +344,7 @@ void LIB_TEXT::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
|
|||
* to calculate so the more easily way is to use no justifications (centered text) and
|
||||
* use GetBoundingBox to know the text coordinate considered as centered
|
||||
*/
|
||||
EDA_RECT bBox = GetBoundingBox();
|
||||
BOX2I bBox = GetBoundingBox();
|
||||
|
||||
// convert coordinates from draw Y axis to symbol_editor Y axis:
|
||||
bBox.RevertYAxis();
|
||||
|
@ -395,28 +394,28 @@ void LIB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT LIB_TEXT::GetBoundingBox() const
|
||||
const BOX2I LIB_TEXT::GetBoundingBox() const
|
||||
{
|
||||
/* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when
|
||||
* calling GetTextBox() that works using top to bottom Y axis orientation.
|
||||
*/
|
||||
BOX2I rect = GetTextBox( -1, true );
|
||||
rect.RevertYAxis();
|
||||
BOX2I bbox = GetTextBox( -1, true );
|
||||
bbox.RevertYAxis();
|
||||
|
||||
// We are using now a bottom to top Y axis.
|
||||
VECTOR2I orig = rect.GetOrigin();
|
||||
VECTOR2I end = rect.GetEnd();
|
||||
VECTOR2I orig = bbox.GetOrigin();
|
||||
VECTOR2I end = bbox.GetEnd();
|
||||
|
||||
RotatePoint( orig, GetTextPos(), -GetTextAngle() );
|
||||
RotatePoint( end, GetTextPos(), -GetTextAngle() );
|
||||
|
||||
rect.SetOrigin( orig );
|
||||
rect.SetEnd( end );
|
||||
bbox.SetOrigin( orig );
|
||||
bbox.SetEnd( end );
|
||||
|
||||
// We are using now a top to bottom Y axis:
|
||||
rect.RevertYAxis();
|
||||
bbox.RevertYAxis();
|
||||
|
||||
return rect;
|
||||
return bbox;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ public:
|
|||
|
||||
KIFONT::FONT* GetDrawFont() const override;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
void BeginEdit( const VECTOR2I& aStartPoint ) override;
|
||||
void CalcEdit( const VECTOR2I& aPosition ) override;
|
||||
|
|
|
@ -286,7 +286,7 @@ bool LIB_TEXTBOX::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
|||
if( aAccuracy < Mils2iu( MINIMUM_SELECTION_DISTANCE ) )
|
||||
aAccuracy = Mils2iu( MINIMUM_SELECTION_DISTANCE );
|
||||
|
||||
EDA_RECT rect = GetBoundingBox();
|
||||
BOX2I rect = GetBoundingBox();
|
||||
|
||||
rect.Inflate( aAccuracy );
|
||||
|
||||
|
|
|
@ -104,13 +104,13 @@ void SCH_BITMAP::SwapData( SCH_ITEM* aItem )
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT SCH_BITMAP::GetBoundingBox() const
|
||||
const BOX2I SCH_BITMAP::GetBoundingBox() const
|
||||
{
|
||||
EDA_RECT rect = m_image->GetBoundingBox();
|
||||
BOX2I bbox = m_image->GetBoundingBox();
|
||||
|
||||
rect.Move( m_pos );
|
||||
bbox.Move( m_pos );
|
||||
|
||||
return rect;
|
||||
return bbox;
|
||||
}
|
||||
|
||||
|
||||
|
@ -122,7 +122,7 @@ void SCH_BITMAP::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffse
|
|||
}
|
||||
|
||||
|
||||
wxSize SCH_BITMAP::GetSize() const
|
||||
VECTOR2I SCH_BITMAP::GetSize() const
|
||||
{
|
||||
return m_image->GetSize();
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ void SCH_BITMAP::Show( int nestLevel, std::ostream& os ) const
|
|||
|
||||
bool SCH_BITMAP::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
||||
{
|
||||
EDA_RECT rect = GetBoundingBox();
|
||||
BOX2I rect = GetBoundingBox();
|
||||
|
||||
rect.Inflate( aAccuracy );
|
||||
|
||||
|
|
|
@ -86,9 +86,9 @@ public:
|
|||
/**
|
||||
* @return the actual size (in user units, not in pixels) of the image.
|
||||
*/
|
||||
wxSize GetSize() const;
|
||||
VECTOR2I GetSize() const;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
void SwapData( SCH_ITEM* aItem ) override;
|
||||
|
||||
|
|
|
@ -159,17 +159,15 @@ void SCH_BUS_ENTRY_BASE::ViewGetLayers( int aLayers[], int& aCount ) const
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT SCH_BUS_ENTRY_BASE::GetBoundingBox() const
|
||||
const BOX2I SCH_BUS_ENTRY_BASE::GetBoundingBox() const
|
||||
{
|
||||
EDA_RECT box;
|
||||
BOX2I bbox( m_pos );
|
||||
bbox.SetEnd( GetEnd() );
|
||||
|
||||
box.SetOrigin( m_pos );
|
||||
box.SetEnd( GetEnd() );
|
||||
bbox.Normalize();
|
||||
bbox.Inflate( ( GetPenWidth() / 2 ) + 1 );
|
||||
|
||||
box.Normalize();
|
||||
box.Inflate( ( GetPenWidth() / 2 ) + 1 );
|
||||
|
||||
return box;
|
||||
return bbox;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ public:
|
|||
|
||||
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
void Move( const VECTOR2I& aMoveVector ) override
|
||||
{
|
||||
|
|
|
@ -399,16 +399,16 @@ EDA_ANGLE SCH_FIELD::GetDrawRotation() const
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT SCH_FIELD::GetBoundingBox() const
|
||||
const BOX2I SCH_FIELD::GetBoundingBox() const
|
||||
{
|
||||
// Calculate the text bounding box:
|
||||
BOX2I rect = GetTextBox();
|
||||
BOX2I bbox = GetTextBox();
|
||||
|
||||
// Calculate the bounding box position relative to the parent:
|
||||
VECTOR2I origin = GetParentPosition();
|
||||
VECTOR2I pos = GetTextPos() - origin;
|
||||
VECTOR2I begin = rect.GetOrigin() - origin;
|
||||
VECTOR2I end = rect.GetEnd() - origin;
|
||||
VECTOR2I begin = bbox.GetOrigin() - origin;
|
||||
VECTOR2I end = bbox.GetEnd() - origin;
|
||||
RotatePoint( begin, pos, GetTextAngle() );
|
||||
RotatePoint( end, pos, GetTextAngle() );
|
||||
|
||||
|
@ -431,13 +431,13 @@ const EDA_RECT SCH_FIELD::GetBoundingBox() const
|
|||
transform = TRANSFORM( 1, 0, 0, 1 ); // identity transform
|
||||
}
|
||||
|
||||
rect.SetOrigin( transform.TransformCoordinate( begin ) );
|
||||
rect.SetEnd( transform.TransformCoordinate( end ) );
|
||||
bbox.SetOrigin( transform.TransformCoordinate( begin ) );
|
||||
bbox.SetEnd( transform.TransformCoordinate( end ) );
|
||||
|
||||
rect.Move( origin );
|
||||
rect.Normalize();
|
||||
bbox.Move( origin );
|
||||
bbox.Normalize();
|
||||
|
||||
return rect;
|
||||
return bbox;
|
||||
}
|
||||
|
||||
|
||||
|
@ -874,7 +874,7 @@ bool SCH_FIELD::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
|||
if( !IsVisible() || IsVoid() )
|
||||
return false;
|
||||
|
||||
EDA_RECT rect = GetBoundingBox();
|
||||
BOX2I rect = GetBoundingBox();
|
||||
|
||||
rect.Inflate( aAccuracy );
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ public:
|
|||
*/
|
||||
EDA_ANGLE GetDrawRotation() const override;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
/**
|
||||
* Return whether the field will be rendered with the horizontal justification
|
||||
|
|
|
@ -100,14 +100,12 @@ SHAPE_CIRCLE SCH_JUNCTION::getEffectiveShape() const
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT SCH_JUNCTION::GetBoundingBox() const
|
||||
const BOX2I SCH_JUNCTION::GetBoundingBox() const
|
||||
{
|
||||
EDA_RECT rect;
|
||||
BOX2I bbox( m_pos );
|
||||
bbox.Inflate( getEffectiveShape().GetRadius() );
|
||||
|
||||
rect.SetOrigin( m_pos );
|
||||
rect.Inflate( getEffectiveShape().GetRadius() );
|
||||
|
||||
return rect;
|
||||
return bbox;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
|
||||
|
||||
|
|
|
@ -657,7 +657,7 @@ const BOX2I SCH_LABEL_BASE::GetBodyBoundingBox() const
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT SCH_LABEL_BASE::GetBoundingBox() const
|
||||
const BOX2I SCH_LABEL_BASE::GetBoundingBox() const
|
||||
{
|
||||
// build the bounding box of the entire label, including its fields
|
||||
|
||||
|
@ -667,7 +667,7 @@ const EDA_RECT SCH_LABEL_BASE::GetBoundingBox() const
|
|||
{
|
||||
if( field.IsVisible() )
|
||||
{
|
||||
EDA_RECT fieldBBox = field.GetBoundingBox();
|
||||
BOX2I fieldBBox = field.GetBoundingBox();
|
||||
|
||||
if( Type() == SCH_LABEL_T || Type() == SCH_GLOBAL_LABEL_T )
|
||||
fieldBBox.Offset( GetSchematicTextOffset( nullptr ) );
|
||||
|
@ -694,7 +694,7 @@ bool SCH_LABEL_BASE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
|||
{
|
||||
if( field.IsVisible() )
|
||||
{
|
||||
EDA_RECT fieldBBox = field.GetBoundingBox();
|
||||
BOX2I fieldBBox = field.GetBoundingBox();
|
||||
fieldBBox.Inflate( aAccuracy );
|
||||
|
||||
if( Type() == SCH_LABEL_T || Type() == SCH_GLOBAL_LABEL_T )
|
||||
|
@ -728,7 +728,7 @@ bool SCH_LABEL_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccur
|
|||
{
|
||||
if( field.IsVisible() )
|
||||
{
|
||||
EDA_RECT fieldBBox = field.GetBoundingBox();
|
||||
BOX2I fieldBBox = field.GetBoundingBox();
|
||||
|
||||
if( Type() == SCH_LABEL_T || Type() == SCH_GLOBAL_LABEL_T )
|
||||
fieldBBox.Offset( GetSchematicTextOffset( nullptr ) );
|
||||
|
|
|
@ -152,7 +152,7 @@ public:
|
|||
/**
|
||||
* Return the bounding box of the label including its fields.
|
||||
*/
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
|
|
@ -188,18 +188,18 @@ void SCH_LINE::ViewGetLayers( int aLayers[], int& aCount ) const
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT SCH_LINE::GetBoundingBox() const
|
||||
const BOX2I SCH_LINE::GetBoundingBox() const
|
||||
{
|
||||
int width = m_stroke.GetWidth() / 2;
|
||||
int extra = m_stroke.GetWidth() & 0x1;
|
||||
int width = m_stroke.GetWidth() / 2;
|
||||
int extra = m_stroke.GetWidth() & 0x1;
|
||||
|
||||
int xmin = std::min( m_start.x, m_end.x ) - width;
|
||||
int ymin = std::min( m_start.y, m_end.y ) - width;
|
||||
int xmin = std::min( m_start.x, m_end.x ) - width;
|
||||
int ymin = std::min( m_start.y, m_end.y ) - width;
|
||||
|
||||
int xmax = std::max( m_start.x, m_end.x ) + width + extra;
|
||||
int ymax = std::max( m_start.y, m_end.y ) + width + extra;
|
||||
int xmax = std::max( m_start.x, m_end.x ) + width + extra;
|
||||
int ymax = std::max( m_start.y, m_end.y ) + width + extra;
|
||||
|
||||
EDA_RECT ret( VECTOR2I( xmin, ymin ), VECTOR2I( xmax - xmin, ymax - ymin ) );
|
||||
BOX2I ret( VECTOR2I( xmin, ymin ), VECTOR2I( xmax - xmin, ymax - ymin ) );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -188,7 +188,7 @@ public:
|
|||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
/**
|
||||
* @return The length of the line segment.
|
||||
|
|
|
@ -179,7 +179,7 @@ bool SCH_MARKER::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) c
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT SCH_MARKER::GetBoundingBox() const
|
||||
const BOX2I SCH_MARKER::GetBoundingBox() const
|
||||
{
|
||||
return GetBoundingBoxMarker();
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
// do not confirm this by locally implementing a no-op Plot().
|
||||
}
|
||||
|
||||
EDA_RECT const GetBoundingBox() const override;
|
||||
BOX2I const GetBoundingBox() const override;
|
||||
|
||||
// Geometric transforms (used in block operations):
|
||||
|
||||
|
|
|
@ -65,15 +65,14 @@ void SCH_NO_CONNECT::SwapData( SCH_ITEM* aItem )
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT SCH_NO_CONNECT::GetBoundingBox() const
|
||||
const BOX2I SCH_NO_CONNECT::GetBoundingBox() const
|
||||
{
|
||||
int delta = ( GetPenWidth() + GetSize() ) / 2;
|
||||
EDA_RECT box;
|
||||
int delta = ( GetPenWidth() + GetSize() ) / 2;
|
||||
BOX2I bbox( m_pos );
|
||||
|
||||
box.SetOrigin( m_pos );
|
||||
box.Inflate( delta );
|
||||
bbox.Inflate( delta );
|
||||
|
||||
return box;
|
||||
return bbox;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
|
||||
void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
// Geometric transforms (used in block operations):
|
||||
|
||||
|
|
|
@ -549,7 +549,7 @@ void SCH_PAINTER::boxText( const wxString& aText, const VECTOR2D& aPosition,
|
|||
|
||||
VECTOR2I extents = font->StringBoundaryLimits( aText, aAttrs.m_Size, aAttrs.m_StrokeWidth,
|
||||
aAttrs.m_Bold, aAttrs.m_Italic );
|
||||
EDA_RECT box( (VECTOR2I) aPosition, wxSize( extents.x, aAttrs.m_Size.y ) );
|
||||
BOX2I box( aPosition, VECTOR2I( extents.x, aAttrs.m_Size.y ) );
|
||||
|
||||
switch( aAttrs.m_Halign )
|
||||
{
|
||||
|
@ -874,7 +874,7 @@ void SCH_PAINTER::draw( const LIB_FIELD *aField, int aLayer )
|
|||
m_gal->SetStrokeColor( color );
|
||||
m_gal->SetFillColor( color );
|
||||
|
||||
EDA_RECT bbox = aField->GetBoundingBox();
|
||||
BOX2I bbox = aField->GetBoundingBox();
|
||||
|
||||
if( drawingShadows )
|
||||
{
|
||||
|
@ -929,7 +929,7 @@ void SCH_PAINTER::draw( const LIB_TEXT* aText, int aLayer )
|
|||
return;
|
||||
}
|
||||
|
||||
EDA_RECT bBox = aText->GetBoundingBox();
|
||||
BOX2I bBox = aText->GetBoundingBox();
|
||||
|
||||
m_gal->SetFillColor( color );
|
||||
m_gal->SetStrokeColor( color );
|
||||
|
@ -1838,7 +1838,7 @@ void SCH_PAINTER::draw( const SCH_TEXT *aText, int aLayer )
|
|||
|
||||
if( drawingShadows )
|
||||
{
|
||||
EDA_RECT bBox = aText->GetBoundingBox();
|
||||
BOX2I bBox = aText->GetBoundingBox();
|
||||
bBox.Inflate( getTextThickness( aText ) * 2 );
|
||||
bBox.RevertYAxis();
|
||||
|
||||
|
@ -2198,7 +2198,7 @@ void SCH_PAINTER::draw( const SCH_FIELD* aField, int aLayer )
|
|||
* to calculate so the easier way is to use no justifications (centered text) and use
|
||||
* GetBoundingBox to know the text coordinate considered as centered
|
||||
*/
|
||||
EDA_RECT bbox = aField->GetBoundingBox();
|
||||
BOX2I bbox = aField->GetBoundingBox();
|
||||
|
||||
if( aField->GetParent() && aField->GetParent()->Type() == SCH_GLOBAL_LABEL_T )
|
||||
{
|
||||
|
@ -2211,7 +2211,7 @@ void SCH_PAINTER::draw( const SCH_FIELD* aField, int aLayer )
|
|||
|
||||
if( drawingShadows )
|
||||
{
|
||||
EDA_RECT shadow_box = bbox;
|
||||
BOX2I shadow_box = bbox;
|
||||
shadow_box.Inflate( getTextThickness( aField ) * 2 );
|
||||
shadow_box.RevertYAxis();
|
||||
|
||||
|
|
|
@ -146,9 +146,7 @@ int SCH_PIN::GetLength() const
|
|||
|
||||
const BOX2I SCH_PIN::ViewBBox() const
|
||||
{
|
||||
EDA_RECT bbox = GetBoundingBox( false, true, true );
|
||||
|
||||
return BOX2I( bbox.GetOrigin(), bbox.GetSize() );
|
||||
return GetBoundingBox( false, true, true );
|
||||
}
|
||||
|
||||
|
||||
|
@ -317,11 +315,11 @@ VECTOR2I SCH_PIN::GetTransformedPosition() const
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT SCH_PIN::GetBoundingBox( bool aIncludeInvisiblePins, bool aIncludeNameAndNumber,
|
||||
bool aIncludeElectricalType ) const
|
||||
const BOX2I SCH_PIN::GetBoundingBox( bool aIncludeInvisiblePins, bool aIncludeNameAndNumber,
|
||||
bool aIncludeElectricalType ) const
|
||||
{
|
||||
TRANSFORM t = GetParentSymbol()->GetTransform();
|
||||
EDA_RECT r = m_libPin->GetBoundingBox( aIncludeInvisiblePins, aIncludeNameAndNumber,
|
||||
BOX2I r = m_libPin->GetBoundingBox( aIncludeInvisiblePins, aIncludeNameAndNumber,
|
||||
aIncludeElectricalType );
|
||||
|
||||
r.RevertYAxis();
|
||||
|
@ -340,7 +338,7 @@ bool SCH_PIN::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
|||
if( Schematic() )
|
||||
aAccuracy = std::max( aAccuracy, Schematic()->Settings().m_PinSymbolSize / 4 );
|
||||
|
||||
EDA_RECT rect = GetBoundingBox( false, true, m_flags & SHOW_ELEC_TYPE );
|
||||
BOX2I rect = GetBoundingBox( false, true, m_flags & SHOW_ELEC_TYPE );
|
||||
return rect.Inflate( aAccuracy ).Contains( aPosition );
|
||||
}
|
||||
|
||||
|
|
|
@ -84,14 +84,14 @@ public:
|
|||
void SetPosition( const VECTOR2I& aPosition ) override { m_position = aPosition; }
|
||||
|
||||
/* Cannot use a default parameter here as it will not be compatible with the virtual. */
|
||||
const EDA_RECT GetBoundingBox() const override { return GetBoundingBox( false, true, false ); }
|
||||
const BOX2I GetBoundingBox() const override { return GetBoundingBox( false, true, false ); }
|
||||
|
||||
/**
|
||||
* @param aIncludeInvisibles - if false, do not include labels for invisible pins
|
||||
* in the calculation.
|
||||
*/
|
||||
const EDA_RECT GetBoundingBox( bool aIncludeInvisiblePins, bool aIncludeNameAndNumber,
|
||||
bool aIncludeElectricalType ) const;
|
||||
const BOX2I GetBoundingBox( bool aIncludeInvisiblePins, bool aIncludeNameAndNumber,
|
||||
bool aIncludeElectricalType ) const;
|
||||
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
|
|
@ -2385,10 +2385,10 @@ void SCH_ALTIUM_PLUGIN::ParseImage( const std::map<wxString, wxString>& aPropert
|
|||
}
|
||||
|
||||
// we only support one scale, thus we need to select one in case it does not keep aspect ratio
|
||||
wxSize currentImageSize = bitmap->GetSize();
|
||||
VECTOR2I currentImageSize = bitmap->GetSize();
|
||||
VECTOR2I expectedImageSize = elem.location - elem.corner;
|
||||
double scaleX = std::abs( static_cast<double>( expectedImageSize.x ) / currentImageSize.x );
|
||||
double scaleY = std::abs( static_cast<double>( expectedImageSize.y ) / currentImageSize.y );
|
||||
double scaleX = std::abs( static_cast<double>( expectedImageSize.x ) / currentImageSize.x );
|
||||
double scaleY = std::abs( static_cast<double>( expectedImageSize.y ) / currentImageSize.y );
|
||||
bitmap->SetImageScale( std::min( scaleX, scaleY ) );
|
||||
|
||||
bitmap->SetFlags( IS_NEW );
|
||||
|
|
|
@ -158,9 +158,9 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh
|
|||
// Calculate the new sheet size.
|
||||
EDA_RECT sheetBoundingBox;
|
||||
|
||||
for( auto item : sheet->GetScreen()->Items() )
|
||||
for( SCH_ITEM* item : sheet->GetScreen()->Items() )
|
||||
{
|
||||
EDA_RECT bbox;
|
||||
BOX2I bbox;
|
||||
|
||||
// Only use the visible fields of the symbols to calculate their bounding box
|
||||
// (hidden fields could be very long and artificially enlarge the sheet bounding box)
|
||||
|
@ -2769,7 +2769,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings( EDA_TEXT* aKiCadT
|
|||
// so need to adjust the location of the text element based on Cadstar's original text
|
||||
// alignment (anchor position).
|
||||
setAlignment( aKiCadTextItem, textAlignment );
|
||||
EDA_RECT bb = textEdaItem->GetBoundingBox();
|
||||
BOX2I bb = textEdaItem->GetBoundingBox();
|
||||
int off = static_cast<SCH_TEXT*>( aKiCadTextItem )->GetTextOffset();
|
||||
wxPoint pos;
|
||||
|
||||
|
|
|
@ -111,9 +111,9 @@ static int countChildren( wxXmlNode* aCurrentNode, const wxString& aName )
|
|||
|
||||
|
||||
///< Compute a bounding box for all items in a schematic sheet
|
||||
static EDA_RECT getSheetBbox( SCH_SHEET* aSheet )
|
||||
static BOX2I getSheetBbox( SCH_SHEET* aSheet )
|
||||
{
|
||||
EDA_RECT bbox;
|
||||
BOX2I bbox;
|
||||
|
||||
for( SCH_ITEM* item : aSheet->GetScreen()->Items() )
|
||||
bbox.Merge( item->GetBoundingBox() );
|
||||
|
@ -756,7 +756,7 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
|
|||
// Calculate the already placed items bounding box and the page size to determine
|
||||
// placement for the new symbols
|
||||
wxSize pageSizeIU = m_rootSheet->GetScreen()->GetPageSettings().GetSizeIU( IU_PER_MILS );
|
||||
EDA_RECT sheetBbox = getSheetBbox( m_rootSheet );
|
||||
BOX2I sheetBbox = getSheetBbox( m_rootSheet );
|
||||
VECTOR2I newCmpPosition( sheetBbox.GetLeft(), sheetBbox.GetBottom() );
|
||||
int maxY = sheetBbox.GetY();
|
||||
|
||||
|
@ -783,8 +783,8 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
|
|||
symbol->AddHierarchicalReference( sheetpath.Path(), reference, unit );
|
||||
|
||||
// Calculate the placement position
|
||||
EDA_RECT cmpBbox = symbol->GetBoundingBox();
|
||||
int posY = newCmpPosition.y + cmpBbox.GetHeight();
|
||||
BOX2I cmpBbox = symbol->GetBoundingBox();
|
||||
int posY = newCmpPosition.y + cmpBbox.GetHeight();
|
||||
symbol->SetPosition( VECTOR2I( newCmpPosition.x, posY ) );
|
||||
newCmpPosition.x += cmpBbox.GetWidth();
|
||||
maxY = std::max( maxY, posY );
|
||||
|
@ -935,7 +935,7 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex )
|
|||
}
|
||||
|
||||
// Calculate the new sheet size.
|
||||
EDA_RECT sheetBoundingBox = getSheetBbox( m_currentSheet );
|
||||
BOX2I sheetBoundingBox = getSheetBbox( m_currentSheet );
|
||||
VECTOR2I targetSheetSize = sheetBoundingBox.GetSize();
|
||||
targetSheetSize += VECTOR2I( Mils2iu( 1500 ), Mils2iu( 1500 ) );
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
*/
|
||||
void insert( SCH_ITEM* aItem )
|
||||
{
|
||||
EDA_RECT bbox = aItem->GetBoundingBox();
|
||||
BOX2I bbox = aItem->GetBoundingBox();
|
||||
|
||||
// Inflate a bit for safety, selection shadows, etc.
|
||||
bbox.Inflate( aItem->GetPenWidth() );
|
||||
|
@ -79,7 +79,7 @@ public:
|
|||
bool remove( SCH_ITEM* aItem )
|
||||
{
|
||||
// First, attempt to remove the item using its given BBox
|
||||
EDA_RECT bbox = aItem->GetBoundingBox();
|
||||
BOX2I bbox = aItem->GetBoundingBox();
|
||||
|
||||
// Inflate a bit for safety, selection shadows, etc.
|
||||
bbox.Inflate( aItem->GetPenWidth() );
|
||||
|
@ -125,7 +125,7 @@ public:
|
|||
*/
|
||||
bool contains( const SCH_ITEM* aItem, bool aRobust = false ) const
|
||||
{
|
||||
EDA_RECT bbox = aItem->GetBoundingBox();
|
||||
BOX2I bbox = aItem->GetBoundingBox();
|
||||
|
||||
// Inflate a bit for safety, selection shadows, etc.
|
||||
bbox.Inflate( aItem->GetPenWidth() );
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
return m_stroke.GetPlotStyle();
|
||||
}
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override { return getBoundingBox(); }
|
||||
const BOX2I GetBoundingBox() const override { return getBoundingBox(); }
|
||||
|
||||
VECTOR2I GetPosition() const override { return getPosition(); }
|
||||
void SetPosition( const VECTOR2I& aPos ) override { setPosition( aPos ); }
|
||||
|
|
|
@ -454,7 +454,7 @@ int SCH_SHEET::GetMinWidth( bool aFromLeft ) const
|
|||
|
||||
if( edge == SHEET_SIDE::TOP || edge == SHEET_SIDE::BOTTOM )
|
||||
{
|
||||
EDA_RECT pinRect = m_pins[i]->GetBoundingBox();
|
||||
BOX2I pinRect = m_pins[i]->GetBoundingBox();
|
||||
|
||||
pinsLeft = std::min( pinsLeft, pinRect.GetLeft() );
|
||||
pinsRight = std::max( pinsRight, pinRect.GetRight() );
|
||||
|
@ -488,7 +488,7 @@ int SCH_SHEET::GetMinHeight( bool aFromTop ) const
|
|||
|
||||
if( edge == SHEET_SIDE::RIGHT || edge == SHEET_SIDE::LEFT )
|
||||
{
|
||||
EDA_RECT pinRect = m_pins[i]->GetBoundingBox();
|
||||
BOX2I pinRect = m_pins[i]->GetBoundingBox();
|
||||
|
||||
pinsTop = std::min( pinsTop, pinRect.GetTop() );
|
||||
pinsBottom = std::max( pinsBottom, pinRect.GetBottom() );
|
||||
|
@ -638,20 +638,20 @@ const BOX2I SCH_SHEET::GetBodyBoundingBox() const
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT SCH_SHEET::GetBoundingBox() const
|
||||
const BOX2I SCH_SHEET::GetBoundingBox() const
|
||||
{
|
||||
BOX2I box = GetBodyBoundingBox();
|
||||
BOX2I bbox = GetBodyBoundingBox();
|
||||
|
||||
for( const SCH_FIELD& field : m_fields )
|
||||
box.Merge( field.GetBoundingBox() );
|
||||
bbox.Merge( field.GetBoundingBox() );
|
||||
|
||||
return box;
|
||||
return bbox;
|
||||
}
|
||||
|
||||
|
||||
VECTOR2I SCH_SHEET::GetRotationCenter() const
|
||||
{
|
||||
EDA_RECT box( m_pos, m_size );
|
||||
BOX2I box( m_pos, m_size );
|
||||
return box.GetCenter();
|
||||
}
|
||||
|
||||
|
|
|
@ -250,7 +250,7 @@ public:
|
|||
*/
|
||||
const BOX2I GetBodyBoundingBox() const;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
/**
|
||||
* Rotating around the boundingBox's center can cause walking when the sheetname or
|
||||
|
|
|
@ -340,7 +340,7 @@ BITMAPS SCH_SHEET_PIN::GetMenuImage() const
|
|||
|
||||
bool SCH_SHEET_PIN::HitTest( const VECTOR2I& aPoint, int aAccuracy ) const
|
||||
{
|
||||
EDA_RECT rect = GetBoundingBox();
|
||||
BOX2I rect = GetBoundingBox();
|
||||
|
||||
rect.Inflate( aAccuracy );
|
||||
|
||||
|
|
|
@ -1447,13 +1447,13 @@ BOX2I SCH_SYMBOL::GetBodyBoundingBox() const
|
|||
}
|
||||
|
||||
|
||||
EDA_RECT SCH_SYMBOL::GetBodyAndPinsBoundingBox() const
|
||||
BOX2I SCH_SYMBOL::GetBodyAndPinsBoundingBox() const
|
||||
{
|
||||
return doGetBoundingBox( true, false );
|
||||
}
|
||||
|
||||
|
||||
const EDA_RECT SCH_SYMBOL::GetBoundingBox() const
|
||||
const BOX2I SCH_SYMBOL::GetBoundingBox() const
|
||||
{
|
||||
return doGetBoundingBox( true, true );
|
||||
}
|
||||
|
@ -1807,7 +1807,7 @@ bool SCH_SYMBOL::operator <( const SCH_ITEM& aItem ) const
|
|||
|
||||
auto symbol = static_cast<const SCH_SYMBOL*>( &aItem );
|
||||
|
||||
EDA_RECT rect = GetBodyAndPinsBoundingBox();
|
||||
BOX2I rect = GetBodyAndPinsBoundingBox();
|
||||
|
||||
if( rect.GetArea() != symbol->GetBodyAndPinsBoundingBox().GetArea() )
|
||||
return rect.GetArea() < symbol->GetBodyAndPinsBoundingBox().GetArea();
|
||||
|
|
|
@ -325,7 +325,7 @@ public:
|
|||
*/
|
||||
bool ReplaceInstanceSheetPath( const KIID_PATH& aOldSheetPath, const KIID_PATH& aNewSheetPath );
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
/**
|
||||
* Return a bounding box for the symbol body but not the pins or fields.
|
||||
|
@ -335,7 +335,7 @@ public:
|
|||
/**
|
||||
* Return a bounding box for the symbol body and pins but not the fields.
|
||||
*/
|
||||
EDA_RECT GetBodyAndPinsBoundingBox() const;
|
||||
BOX2I GetBodyAndPinsBoundingBox() const;
|
||||
|
||||
|
||||
//-----<Fields>-----------------------------------------------------------
|
||||
|
|
|
@ -313,24 +313,24 @@ void SCH_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT SCH_TEXT::GetBoundingBox() const
|
||||
const BOX2I SCH_TEXT::GetBoundingBox() const
|
||||
{
|
||||
BOX2I rect = GetTextBox();
|
||||
BOX2I bbox = GetTextBox();
|
||||
|
||||
if( !GetTextAngle().IsZero() ) // Rotate rect.
|
||||
if( !GetTextAngle().IsZero() ) // Rotate bbox.
|
||||
{
|
||||
VECTOR2I pos = rect.GetOrigin();
|
||||
VECTOR2I end = rect.GetEnd();
|
||||
VECTOR2I pos = bbox.GetOrigin();
|
||||
VECTOR2I end = bbox.GetEnd();
|
||||
|
||||
RotatePoint( pos, GetTextPos(), GetTextAngle() );
|
||||
RotatePoint( end, GetTextPos(), GetTextAngle() );
|
||||
|
||||
rect.SetOrigin( pos );
|
||||
rect.SetEnd( end );
|
||||
bbox.SetOrigin( pos );
|
||||
bbox.SetEnd( end );
|
||||
}
|
||||
|
||||
rect.Normalize();
|
||||
return rect;
|
||||
bbox.Normalize();
|
||||
return bbox;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ public:
|
|||
|
||||
void SwapData( SCH_ITEM* aItem ) override;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
bool operator<( const SCH_ITEM& aItem ) const override;
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
*/
|
||||
BOX2I ComputeBoundingBox() const;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override
|
||||
const BOX2I GetBoundingBox() const override
|
||||
{
|
||||
return ComputeBoundingBox();
|
||||
}
|
||||
|
|
|
@ -246,10 +246,10 @@ D_CODE* GERBER_DRAW_ITEM::GetDcodeDescr() const
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT GERBER_DRAW_ITEM::GetBoundingBox() const
|
||||
const BOX2I GERBER_DRAW_ITEM::GetBoundingBox() const
|
||||
{
|
||||
// return a rectangle which is (pos,dim) in nature. therefore the +1
|
||||
EDA_RECT bbox( m_Start, wxSize( 1, 1 ) );
|
||||
BOX2I bbox( m_Start, VECTOR2I( 1, 1 ) );
|
||||
D_CODE* code = GetDcodeDescr();
|
||||
|
||||
// TODO(JE) GERBER_DRAW_ITEM maybe should actually be a number of subclasses.
|
||||
|
@ -260,9 +260,9 @@ const EDA_RECT GERBER_DRAW_ITEM::GetBoundingBox() const
|
|||
{
|
||||
case GBR_POLYGON:
|
||||
{
|
||||
auto bb = m_Polygon.BBox();
|
||||
BOX2I bb = m_Polygon.BBox();
|
||||
bbox.Inflate( bb.GetWidth() / 2, bb.GetHeight() / 2 );
|
||||
bbox.SetOrigin( bb.GetOrigin().x, bb.GetOrigin().y );
|
||||
bbox.SetOrigin( bb.GetOrigin() );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -287,10 +287,7 @@ const EDA_RECT GERBER_DRAW_ITEM::GetBoundingBox() const
|
|||
angle.Normalize();
|
||||
|
||||
SHAPE_ARC arc( m_ArcCentre, m_Start, angle );
|
||||
BOX2I arc_bbox = arc.BBox( m_Size.x / 2 ); // m_Size.x is the line thickness
|
||||
bbox.SetOrigin( arc_bbox.GetX(), arc_bbox.GetY() );
|
||||
bbox.SetWidth( arc_bbox.GetWidth() );
|
||||
bbox.SetHeight( arc_bbox.GetHeight() );
|
||||
bbox = arc.BBox( m_Size.x / 2 ); // m_Size.x is the line thickness
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -358,16 +355,12 @@ const EDA_RECT GERBER_DRAW_ITEM::GetBoundingBox() const
|
|||
// So use a temporary polygon
|
||||
SHAPE_POLY_SET poly_shape;
|
||||
ConvertSegmentToPolygon( &poly_shape );
|
||||
BOX2I bb = poly_shape.BBox();
|
||||
bbox.SetSize( bb.GetWidth(), bb.GetHeight() );
|
||||
bbox.SetOrigin( bb.GetOrigin().x, bb.GetOrigin().y );
|
||||
bbox = poly_shape.BBox();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
BOX2I bb = m_Polygon.BBox();
|
||||
bbox.SetSize( bb.GetWidth(), bb.GetHeight() );
|
||||
bbox.SetOrigin( bb.GetOrigin().x, bb.GetOrigin().y );
|
||||
bbox = m_Polygon.BBox();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -380,7 +373,7 @@ const EDA_RECT GERBER_DRAW_ITEM::GetBoundingBox() const
|
|||
int ymin = std::min( m_Start.y, m_End.y ) - radius;
|
||||
int xmin = std::min( m_Start.x, m_End.x ) - radius;
|
||||
|
||||
bbox = EDA_RECT( VECTOR2I( xmin, ymin ), VECTOR2I( xmax - xmin + 1, ymax - ymin + 1 ) );
|
||||
bbox = BOX2I( VECTOR2I( xmin, ymin ), VECTOR2I( xmax - xmin + 1, ymax - ymin + 1 ) );
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -151,7 +151,7 @@ public:
|
|||
*/
|
||||
D_CODE* GetDcodeDescr() const;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
void Print( wxDC* aDC, const VECTOR2I& aOffset, GBR_DISPLAY_OPTIONS* aOptions );
|
||||
|
||||
|
|
|
@ -33,12 +33,10 @@ VECTOR2I GERBVIEW_SELECTION::GetCenter() const
|
|||
}
|
||||
else
|
||||
{
|
||||
EDA_RECT bbox = Front()->GetBoundingBox();
|
||||
auto i = m_items.begin();
|
||||
++i;
|
||||
BOX2I bbox;
|
||||
|
||||
for( ; i != m_items.end(); ++i )
|
||||
bbox.Merge( (*i)->GetBoundingBox() );
|
||||
for( EDA_ITEM* item : m_items )
|
||||
bbox.Merge( item->GetBoundingBox() );
|
||||
|
||||
centre = bbox.Centre();
|
||||
}
|
||||
|
@ -49,23 +47,19 @@ VECTOR2I GERBVIEW_SELECTION::GetCenter() const
|
|||
|
||||
const BOX2I GERBVIEW_SELECTION::ViewBBox() const
|
||||
{
|
||||
EDA_RECT eda_bbox;
|
||||
BOX2I bbox;
|
||||
|
||||
if( Size() == 1 )
|
||||
{
|
||||
eda_bbox = Front()->GetBoundingBox();
|
||||
bbox = Front()->GetBoundingBox();
|
||||
}
|
||||
else if( Size() > 1 )
|
||||
{
|
||||
eda_bbox = Front()->GetBoundingBox();
|
||||
auto i = m_items.begin();
|
||||
++i;
|
||||
|
||||
for( ; i != m_items.end(); ++i )
|
||||
eda_bbox.Merge( (*i)->GetBoundingBox() );
|
||||
for( EDA_ITEM* item : m_items )
|
||||
bbox.Merge( item->GetBoundingBox() );
|
||||
}
|
||||
|
||||
return BOX2I( eda_bbox.GetOrigin(), eda_bbox.GetSize() );
|
||||
return bbox;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ public:
|
|||
/**
|
||||
* @return the actual size (in user units, not in pixels) of the image
|
||||
*/
|
||||
wxSize GetSize() const;
|
||||
VECTOR2I GetSize() const;
|
||||
|
||||
/**
|
||||
* @return the size in pixels of the image
|
||||
|
@ -144,7 +144,7 @@ public:
|
|||
* and the units should be in the pcb or schematic coordinate system. It is OK to
|
||||
* overestimate the size by a few counts.
|
||||
*/
|
||||
const EDA_RECT GetBoundingBox() const;
|
||||
const BOX2I GetBoundingBox() const;
|
||||
|
||||
void DrawBitmap( wxDC* aDC, const VECTOR2I& aPos );
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ public:
|
|||
|
||||
// Derived types must define GetBoundingBox() as a minimum, and can then override the
|
||||
// two HitTest() functions if they need something more specific.
|
||||
const EDA_RECT GetBoundingBox() const override = 0;
|
||||
const BOX2I GetBoundingBox() const override = 0;
|
||||
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override
|
||||
{
|
||||
|
@ -138,7 +138,7 @@ public:
|
|||
VECTOR2I GetPosition() const override { return GetStart(); }
|
||||
void SetPosition( const VECTOR2I& aPos ) override { SetStart( aPos ); }
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
|
||||
void PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
|
||||
|
@ -171,7 +171,7 @@ public:
|
|||
VECTOR2I GetPosition() const override { return m_pos; }
|
||||
void SetPosition( const VECTOR2I& aPos ) override;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
@ -227,7 +227,7 @@ public:
|
|||
|
||||
void PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
@ -276,7 +276,7 @@ public:
|
|||
|
||||
void PrintWsItem( const RENDER_SETTINGS* , const VECTOR2I& ) override { /* do nothing */ }
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override { return false; }
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
|
@ -324,7 +324,7 @@ public:
|
|||
VECTOR2I GetPosition() const override { return GetTextPos(); }
|
||||
void SetPosition( const VECTOR2I& aPos ) override { SetTextPos( aPos ); }
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
@ -360,7 +360,7 @@ public:
|
|||
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
|
||||
|
|
|
@ -259,7 +259,7 @@ public:
|
|||
* object, and the units should be in the pcb or schematic coordinate
|
||||
* system. It is OK to overestimate the size by a few counts.
|
||||
*/
|
||||
virtual const EDA_RECT GetBoundingBox() const;
|
||||
virtual const BOX2I GetBoundingBox() const;
|
||||
|
||||
virtual VECTOR2I GetPosition() const { return VECTOR2I(); }
|
||||
virtual void SetPosition( const VECTOR2I& aPos ){};
|
||||
|
|
|
@ -158,7 +158,7 @@ public:
|
|||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
///< @copydoc EDA_ITEM::GetBoundingBox
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
///< @copydoc EDA_ITEM::Visit
|
||||
INSPECT_RESULT Visit( INSPECTOR aInspector, void* aTestData,
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
* Called soon after ComputeBoundingBox() to return the same EDA_RECT,
|
||||
* as long as the CLASS_PL_EDITOR_LAYOUT has not changed.
|
||||
*/
|
||||
const EDA_RECT GetBoundingBox() const { return m_boundingBox; }
|
||||
const BOX2I GetBoundingBox() const { return m_boundingBox; }
|
||||
|
||||
void SetBoundingBox( const EDA_RECT& aBox ) { m_boundingBox = aBox; }
|
||||
|
||||
|
|
|
@ -277,7 +277,7 @@ void AR_AUTOPLACER::addFpBody( const VECTOR2I& aStart, const VECTOR2I& aEnd, LSE
|
|||
void AR_AUTOPLACER::addPad( PAD* aPad, int aClearance )
|
||||
{
|
||||
// Add a polygonal shape (rectangle) to m_fpAreaFront and/or m_fpAreaBack
|
||||
EDA_RECT bbox = aPad->GetBoundingBox();
|
||||
BOX2I bbox = aPad->GetBoundingBox();
|
||||
bbox.Inflate( aClearance );
|
||||
|
||||
if( aPad->IsOnLayer( F_Cu ) )
|
||||
|
@ -317,7 +317,7 @@ void AR_AUTOPLACER::buildFpAreas( FOOTPRINT* aFootprint, int aFpClearance )
|
|||
if( aFootprint->GetLayer() == B_Cu )
|
||||
layerMask.set( B_Cu );
|
||||
|
||||
EDA_RECT fpBBox = aFootprint->GetBoundingBox();
|
||||
BOX2I fpBBox = aFootprint->GetBoundingBox();
|
||||
|
||||
fpBBox.Inflate( ( m_matrix.m_GridRouting / 2 ) + aFpClearance );
|
||||
|
||||
|
@ -335,9 +335,9 @@ void AR_AUTOPLACER::buildFpAreas( FOOTPRINT* aFootprint, int aFpClearance )
|
|||
|
||||
void AR_AUTOPLACER::genModuleOnRoutingMatrix( FOOTPRINT* Module )
|
||||
{
|
||||
int ox, oy, fx, fy;
|
||||
LSET layerMask;
|
||||
EDA_RECT fpBBox = Module->GetBoundingBox();
|
||||
int ox, oy, fx, fy;
|
||||
LSET layerMask;
|
||||
BOX2I fpBBox = Module->GetBoundingBox();
|
||||
|
||||
fpBBox.Inflate( m_matrix.m_GridRouting / 2 );
|
||||
ox = fpBBox.GetX();
|
||||
|
|
|
@ -1153,7 +1153,7 @@ unsigned BOARD::GetUnconnectedNetCount() const
|
|||
|
||||
BOX2I BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const
|
||||
{
|
||||
BOX2I area;
|
||||
BOX2I bbox;
|
||||
LSET visible = GetVisibleLayers();
|
||||
bool showInvisibleText = IsElementVisible( LAYER_MOD_TEXT_INVISIBLE )
|
||||
&& PgmOrNull() && !PgmOrNull()->m_Printing;
|
||||
|
@ -1168,7 +1168,7 @@ BOX2I BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const
|
|||
continue;
|
||||
|
||||
if( ( item->GetLayerSet() & visible ).any() )
|
||||
area.Merge( item->GetBoundingBox() );
|
||||
bbox.Merge( item->GetBoundingBox() );
|
||||
}
|
||||
|
||||
// Check footprints
|
||||
|
@ -1182,12 +1182,12 @@ BOX2I BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const
|
|||
for( const BOARD_ITEM* edge : footprint->GraphicalItems() )
|
||||
{
|
||||
if( edge->GetLayer() == Edge_Cuts && edge->Type() == PCB_FP_SHAPE_T )
|
||||
area.Merge( edge->GetBoundingBox() );
|
||||
bbox.Merge( edge->GetBoundingBox() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
area.Merge( footprint->GetBoundingBox( true, showInvisibleText ) );
|
||||
bbox.Merge( footprint->GetBoundingBox( true, showInvisibleText ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1197,18 +1197,18 @@ BOX2I BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const
|
|||
for( PCB_TRACK* track : m_tracks )
|
||||
{
|
||||
if( ( track->GetLayerSet() & visible ).any() )
|
||||
area.Merge( track->GetBoundingBox() );
|
||||
bbox.Merge( track->GetBoundingBox() );
|
||||
}
|
||||
|
||||
// Check zones
|
||||
for( ZONE* aZone : m_zones )
|
||||
{
|
||||
if( ( aZone->GetLayerSet() & visible ).any() )
|
||||
area.Merge( aZone->GetBoundingBox() );
|
||||
bbox.Merge( aZone->GetBoundingBox() );
|
||||
}
|
||||
}
|
||||
|
||||
return area;
|
||||
return bbox;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -803,7 +803,7 @@ public:
|
|||
*/
|
||||
BOX2I ComputeBoundingBox( bool aBoardEdgesOnly = false ) const;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override
|
||||
const BOX2I GetBoundingBox() const override
|
||||
{
|
||||
return ComputeBoundingBox( false );
|
||||
}
|
||||
|
@ -817,7 +817,7 @@ public:
|
|||
*
|
||||
* @return bounding box calculated using exclusively the board edges.
|
||||
*/
|
||||
const EDA_RECT GetBoardEdgesBoundingBox() const
|
||||
const BOX2I GetBoardEdgesBoundingBox() const
|
||||
{
|
||||
return ComputeBoundingBox( true );
|
||||
}
|
||||
|
|
|
@ -133,9 +133,9 @@ void BOARD_COMMIT::dirtyIntersectingZones( BOARD_ITEM* item )
|
|||
}
|
||||
else
|
||||
{
|
||||
BOARD* board = static_cast<BOARD*>( m_toolMgr->GetModel() );
|
||||
EDA_RECT bbox = item->GetBoundingBox();
|
||||
LSET layers = item->GetLayerSet();
|
||||
BOARD* board = static_cast<BOARD*>( m_toolMgr->GetModel() );
|
||||
BOX2I bbox = item->GetBoundingBox();
|
||||
LSET layers = item->GetLayerSet();
|
||||
|
||||
if( layers.test( Edge_Cuts ) || layers.test( Margin ) )
|
||||
layers = LSET::PhysicalLayersMask();
|
||||
|
|
|
@ -218,10 +218,7 @@ public:
|
|||
const BOX2I& BBox()
|
||||
{
|
||||
if( m_dirty && m_valid )
|
||||
{
|
||||
EDA_RECT box = m_parent->GetBoundingBox();
|
||||
m_bbox = BOX2I( box.GetPosition(), box.GetSize() );
|
||||
}
|
||||
m_bbox = m_parent->GetBoundingBox();
|
||||
|
||||
return m_bbox;
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
|
|||
return;
|
||||
}
|
||||
|
||||
BOX2I bbox = { { 0, 0 }, { 0, 0 } };
|
||||
BOX2I bbox;
|
||||
|
||||
if( footprint )
|
||||
{
|
||||
|
@ -191,16 +191,11 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
|
|||
pcb->HighLightON();
|
||||
|
||||
auto merge_area =
|
||||
[netcode, &bbox]( BOARD_CONNECTED_ITEM* aItem )
|
||||
{
|
||||
if( aItem->GetNetCode() == netcode )
|
||||
{
|
||||
if( bbox.GetWidth() == 0 )
|
||||
bbox = aItem->GetBoundingBox();
|
||||
else
|
||||
bbox.Merge( aItem->GetBoundingBox() );
|
||||
}
|
||||
};
|
||||
[netcode, &bbox]( BOARD_CONNECTED_ITEM* aItem )
|
||||
{
|
||||
if( aItem->GetNetCode() == netcode )
|
||||
bbox.Merge( aItem->GetBoundingBox() );
|
||||
};
|
||||
|
||||
if( crossProbingSettings.center_on_items )
|
||||
{
|
||||
|
|
|
@ -223,7 +223,7 @@ public:
|
|||
// shapes
|
||||
std::unordered_map<BOARD_ITEM*, bool> filterResults;
|
||||
|
||||
EDA_RECT box = aRefItem->GetBoundingBox();
|
||||
BOX2I box = aRefItem->GetBoundingBox();
|
||||
box.Inflate( aClearance );
|
||||
|
||||
int min[2] = { box.GetX(), box.GetY() };
|
||||
|
|
|
@ -298,8 +298,8 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone( BOARD_ITEM* aItem,
|
|||
return;
|
||||
}
|
||||
|
||||
EDA_RECT itemBBox = aItem->GetBoundingBox();
|
||||
EDA_RECT worstCaseBBox = itemBBox;
|
||||
BOX2I itemBBox = aItem->GetBoundingBox();
|
||||
BOX2I worstCaseBBox = itemBBox;
|
||||
|
||||
worstCaseBBox.Inflate( m_board->m_DRCMaxClearance );
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ bool DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances()
|
|||
frontA_worstCaseBBox.Inflate( m_largestCourtyardClearance );
|
||||
backA_worstCaseBBox.Inflate( m_largestCourtyardClearance );
|
||||
|
||||
EDA_RECT fpA_bbox = fpA->GetBoundingBox();
|
||||
BOX2I fpA_bbox = fpA->GetBoundingBox();
|
||||
|
||||
for( auto itB = itA + 1; itB != m_board->Footprints().end(); itB++ )
|
||||
{
|
||||
|
@ -205,7 +205,7 @@ bool DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances()
|
|||
frontB_worstCaseBBox.Inflate( m_largestCourtyardClearance );
|
||||
backB_worstCaseBBox.Inflate( m_largestCourtyardClearance );
|
||||
|
||||
EDA_RECT fpB_bbox = fpB->GetBoundingBox();
|
||||
BOX2I fpB_bbox = fpB->GetBoundingBox();
|
||||
DRC_CONSTRAINT constraint;
|
||||
int clearance;
|
||||
int actual;
|
||||
|
|
|
@ -701,8 +701,8 @@ void DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstZones( BOARD_ITEM* aIt
|
|||
if( !zone->GetLayerSet().test( aLayer ) )
|
||||
continue;
|
||||
|
||||
EDA_RECT itemBBox = aItem->GetBoundingBox();
|
||||
EDA_RECT worstCaseBBox = itemBBox;
|
||||
BOX2I itemBBox = aItem->GetBoundingBox();
|
||||
BOX2I worstCaseBBox = itemBBox;
|
||||
|
||||
worstCaseBBox.Inflate( m_board->m_DRCMaxClearance );
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ void DRC_TEST_PROVIDER_SOLDER_MASK::testSilkToMaskClearance()
|
|||
if( !item->IsOnLayer( layer ) )
|
||||
continue;
|
||||
|
||||
EDA_RECT itemBBox = item->GetBoundingBox();
|
||||
BOX2I itemBBox = item->GetBoundingBox();
|
||||
DRC_CONSTRAINT constraint = m_drcEngine->EvalRules( SILK_CLEARANCE_CONSTRAINT,
|
||||
item, nullptr, layer );
|
||||
int clearance = constraint.GetValue().Min();
|
||||
|
@ -662,7 +662,7 @@ void DRC_TEST_PROVIDER_SOLDER_MASK::testMaskBridges()
|
|||
if( !reportProgress( ii++, count, progressDelta ) )
|
||||
return false;
|
||||
|
||||
EDA_RECT itemBBox = item->GetBoundingBox();
|
||||
BOX2I itemBBox = item->GetBoundingBox();
|
||||
|
||||
if( item->IsOnLayer( F_Mask ) && !isNullAperture( item ) )
|
||||
{
|
||||
|
|
|
@ -99,7 +99,7 @@ void DRC_TEST_PROVIDER_ZONE_CONNECTIONS::testZoneLayer( ZONE* aZone, PCB_LAYER_I
|
|||
if( pad->GetNetCode() != aZone->GetNetCode() || pad->GetNetCode() <= 0 )
|
||||
continue;
|
||||
|
||||
EDA_RECT item_bbox = pad->GetBoundingBox();
|
||||
BOX2I item_bbox = pad->GetBoundingBox();
|
||||
|
||||
if( !item_bbox.Intersects( aZone->GetCachedBoundingBox() ) )
|
||||
continue;
|
||||
|
|
|
@ -734,7 +734,7 @@ wxString FOOTPRINT::GetTypeName() const
|
|||
|
||||
BOX2I FOOTPRINT::GetFpPadsLocalBbox() const
|
||||
{
|
||||
BOX2I area;
|
||||
BOX2I bbox;
|
||||
|
||||
// We want the bounding box of the footprint pads at rot 0, not flipped
|
||||
// Create such a image:
|
||||
|
@ -747,13 +747,13 @@ BOX2I FOOTPRINT::GetFpPadsLocalBbox() const
|
|||
dummy.Flip( VECTOR2I( 0, 0 ), false );
|
||||
|
||||
for( PAD* pad : dummy.Pads() )
|
||||
area.Merge( pad->GetBoundingBox() );
|
||||
bbox.Merge( pad->GetBoundingBox() );
|
||||
|
||||
return area;
|
||||
return bbox;
|
||||
}
|
||||
|
||||
|
||||
const EDA_RECT FOOTPRINT::GetBoundingBox() const
|
||||
const BOX2I FOOTPRINT::GetBoundingBox() const
|
||||
{
|
||||
return GetBoundingBox( true, true );
|
||||
}
|
||||
|
@ -783,11 +783,8 @@ const EDA_RECT FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisi
|
|||
}
|
||||
}
|
||||
|
||||
EDA_RECT area;
|
||||
|
||||
area.SetOrigin( m_pos );
|
||||
area.SetEnd( m_pos );
|
||||
area.Inflate( Millimeter2iu( 0.25 ) ); // Give a min size to the area
|
||||
BOX2I bbox( m_pos );
|
||||
bbox.Inflate( Millimeter2iu( 0.25 ) ); // Give a min size to the bbox
|
||||
|
||||
for( BOARD_ITEM* item : m_drawings )
|
||||
{
|
||||
|
@ -803,14 +800,14 @@ const EDA_RECT FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisi
|
|||
if( item->Type() == PCB_FP_TEXT_T )
|
||||
continue;
|
||||
|
||||
area.Merge( item->GetBoundingBox() );
|
||||
bbox.Merge( item->GetBoundingBox() );
|
||||
}
|
||||
|
||||
for( PAD* pad : m_pads )
|
||||
area.Merge( pad->GetBoundingBox() );
|
||||
bbox.Merge( pad->GetBoundingBox() );
|
||||
|
||||
for( FP_ZONE* zone : m_fp_zones )
|
||||
area.Merge( zone->GetBoundingBox() );
|
||||
bbox.Merge( zone->GetBoundingBox() );
|
||||
|
||||
bool noDrawItems = ( m_drawings.empty() && m_pads.empty() && m_fp_zones.empty() );
|
||||
|
||||
|
@ -825,7 +822,7 @@ const EDA_RECT FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisi
|
|||
// Only FP_TEXT items are independently selectable; FP_TEXTBOX items go in with
|
||||
// other graphic items above.
|
||||
if( item->Type() == PCB_FP_TEXT_T )
|
||||
area.Merge( item->GetBoundingBox() );
|
||||
bbox.Merge( item->GetBoundingBox() );
|
||||
}
|
||||
|
||||
// This can be further optimized when aIncludeInvisibleText is true, but currently
|
||||
|
@ -853,14 +850,14 @@ const EDA_RECT FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisi
|
|||
|| aIncludeInvisibleText
|
||||
|| noDrawItems )
|
||||
{
|
||||
area.Merge( m_value->GetBoundingBox() );
|
||||
bbox.Merge( m_value->GetBoundingBox() );
|
||||
}
|
||||
|
||||
if( ( m_reference->IsVisible() && refLayerIsVisible )
|
||||
|| aIncludeInvisibleText
|
||||
|| noDrawItems )
|
||||
{
|
||||
area.Merge( m_reference->GetBoundingBox() );
|
||||
bbox.Merge( m_reference->GetBoundingBox() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -869,21 +866,21 @@ const EDA_RECT FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisi
|
|||
if( ( aIncludeText && aIncludeInvisibleText ) || noDrawItems )
|
||||
{
|
||||
m_boundingBoxCacheTimeStamp = board->GetTimeStamp();
|
||||
m_cachedBoundingBox = area;
|
||||
m_cachedBoundingBox = bbox;
|
||||
}
|
||||
else if( aIncludeText )
|
||||
{
|
||||
m_visibleBBoxCacheTimeStamp = board->GetTimeStamp();
|
||||
m_cachedVisibleBBox = area;
|
||||
m_cachedVisibleBBox = bbox;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_textExcludedBBoxCacheTimeStamp = board->GetTimeStamp();
|
||||
m_cachedTextExcludedBBox = area;
|
||||
m_cachedTextExcludedBBox = bbox;
|
||||
}
|
||||
}
|
||||
|
||||
return area;
|
||||
return bbox;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ public:
|
|||
SHAPE_POLY_SET GetBoundingHull() const;
|
||||
|
||||
// Virtual function
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
const EDA_RECT GetBoundingBox( bool aIncludeText, bool aIncludeInvisibleText ) const;
|
||||
|
||||
PADS& Pads() { return m_pads; }
|
||||
|
|
|
@ -219,15 +219,15 @@ void FP_TEXT::SetLocalCoord()
|
|||
}
|
||||
}
|
||||
|
||||
const EDA_RECT FP_TEXT::GetBoundingBox() const
|
||||
const BOX2I FP_TEXT::GetBoundingBox() const
|
||||
{
|
||||
EDA_ANGLE angle = GetDrawRotation();
|
||||
BOX2I text_area = GetTextBox();
|
||||
BOX2I bbox = GetTextBox();
|
||||
|
||||
if( !angle.IsZero() )
|
||||
text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
|
||||
bbox = bbox.GetBoundingBoxRotated( GetTextPos(), angle );
|
||||
|
||||
return text_area;
|
||||
return bbox;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ public:
|
|||
virtual EDA_ANGLE GetDrawRotation() const override;
|
||||
|
||||
// Virtual function
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
///< Set absolute coordinates.
|
||||
void SetDrawCoord();
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
VECTOR2I GetPosition() const override
|
||||
{
|
||||
|
|
|
@ -149,10 +149,10 @@ bool NETINFO_ITEM::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData )
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT NETINFO_ITEM::GetBoundingBox() const
|
||||
const BOX2I NETINFO_ITEM::GetBoundingBox() const
|
||||
{
|
||||
std::shared_ptr<CONNECTIVITY_DATA> conn = GetBoard()->GetConnectivity();
|
||||
EDA_RECT bbox;
|
||||
BOX2I bbox;
|
||||
|
||||
for( BOARD_ITEM* item : conn->GetNetItems( m_netCode, { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T,
|
||||
PCB_ZONE_T, PCB_PAD_T } ) )
|
||||
|
|
|
@ -539,8 +539,7 @@ void PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const
|
|||
}
|
||||
}
|
||||
|
||||
BOX2I bbox = m_effectiveShape->BBox();
|
||||
m_effectiveBoundingBox = EDA_RECT( bbox );
|
||||
m_effectiveBoundingBox = m_effectiveShape->BBox();
|
||||
|
||||
// Hole shape
|
||||
VECTOR2I half_size = m_drill / 2;
|
||||
|
@ -551,8 +550,7 @@ void PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const
|
|||
|
||||
m_effectiveHoleShape = std::make_shared<SHAPE_SEGMENT>( m_pos - half_len, m_pos + half_len,
|
||||
half_width * 2 );
|
||||
bbox = m_effectiveHoleShape->BBox();
|
||||
m_effectiveBoundingBox.Merge( EDA_RECT( bbox ) );
|
||||
m_effectiveBoundingBox.Merge( m_effectiveHoleShape->BBox() );
|
||||
|
||||
// All done
|
||||
m_shapesDirty = false;
|
||||
|
@ -598,7 +596,7 @@ void PAD::BuildEffectivePolygon() const
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT PAD::GetBoundingBox() const
|
||||
const BOX2I PAD::GetBoundingBox() const
|
||||
{
|
||||
if( m_shapesDirty )
|
||||
BuildEffectiveShapes( UNDEFINED_LAYER );
|
||||
|
|
|
@ -621,7 +621,7 @@ public:
|
|||
/**
|
||||
* The bounding box is cached, so this will be efficient most of the time.
|
||||
*/
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
///< Set absolute coordinates.
|
||||
void SetDrawCoord();
|
||||
|
@ -716,7 +716,7 @@ private:
|
|||
// Must be set to true to force rebuild shapes to draw (after geometry change for instance)
|
||||
mutable bool m_shapesDirty;
|
||||
mutable std::mutex m_shapesBuildingLock;
|
||||
mutable EDA_RECT m_effectiveBoundingBox;
|
||||
mutable BOX2I m_effectiveBoundingBox;
|
||||
mutable std::shared_ptr<SHAPE_COMPOUND> m_effectiveShape;
|
||||
mutable std::shared_ptr<SHAPE_SEGMENT> m_effectiveHoleShape;
|
||||
|
||||
|
|
|
@ -120,13 +120,13 @@ double PCB_BITMAP::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT PCB_BITMAP::GetBoundingBox() const
|
||||
const BOX2I PCB_BITMAP::GetBoundingBox() const
|
||||
{
|
||||
// Bitmaps are center origin, EDA_RECTs need top-left origin
|
||||
// Bitmaps are center origin, BOX2Is need top-left origin
|
||||
VECTOR2I size = m_image->GetSize();
|
||||
VECTOR2I topLeft = { m_pos.x - size.x / 2, m_pos.y - size.y / 2 };
|
||||
|
||||
return EDA_RECT( topLeft, size );
|
||||
return BOX2I( topLeft, size );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ public:
|
|||
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
|
||||
FLASHING aFlash = FLASHING::DEFAULT ) const override;
|
||||
|
|
|
@ -422,10 +422,10 @@ bool PCB_DIMENSION_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aA
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT PCB_DIMENSION_BASE::GetBoundingBox() const
|
||||
const BOX2I PCB_DIMENSION_BASE::GetBoundingBox() const
|
||||
{
|
||||
EDA_RECT bBox;
|
||||
int xmin, xmax, ymin, ymax;
|
||||
BOX2I bBox;
|
||||
int xmin, xmax, ymin, ymax;
|
||||
|
||||
bBox = m_text.GetTextBox();
|
||||
xmin = bBox.GetX();
|
||||
|
@ -1260,7 +1260,7 @@ BITMAPS PCB_DIM_CENTER::GetMenuImage() const
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT PCB_DIM_CENTER::GetBoundingBox() const
|
||||
const BOX2I PCB_DIM_CENTER::GetBoundingBox() const
|
||||
{
|
||||
int halfWidth = VECTOR2I( m_end - m_start ).x + ( m_lineThickness / 2.0 );
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ public:
|
|||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy ) const override;
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer,
|
||||
FLASHING aFlash = FLASHING::DEFAULT ) const override;
|
||||
|
@ -609,7 +609,7 @@ public:
|
|||
return wxT( "PCB_DIM_CENTER" );
|
||||
}
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
const BOX2I ViewBBox() const override;
|
||||
|
||||
|
|
|
@ -621,7 +621,7 @@ static void intersectsAreaFunc( LIBEVAL::CONTEXT* aCtx, void* self )
|
|||
{
|
||||
BOARD* board = item->GetBoard();
|
||||
PCB_LAYER_ID layer = context->GetLayer();
|
||||
EDA_RECT itemBBox;
|
||||
BOX2I itemBBox;
|
||||
|
||||
if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
|
||||
itemBBox = static_cast<ZONE*>( item )->GetCachedBoundingBox();
|
||||
|
@ -689,7 +689,7 @@ static void enclosedByAreaFunc( LIBEVAL::CONTEXT* aCtx, void* self )
|
|||
BOARD* board = item->GetBoard();
|
||||
int maxError = board->GetDesignSettings().m_MaxError;
|
||||
PCB_LAYER_ID layer = context->GetLayer();
|
||||
EDA_RECT itemBBox;
|
||||
BOX2I itemBBox;
|
||||
|
||||
if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
|
||||
itemBBox = static_cast<ZONE*>( item )->GetCachedBoundingBox();
|
||||
|
|
|
@ -220,16 +220,16 @@ bool PCB_GROUP::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT PCB_GROUP::GetBoundingBox() const
|
||||
const BOX2I PCB_GROUP::GetBoundingBox() const
|
||||
{
|
||||
EDA_RECT area;
|
||||
BOX2I bbox;
|
||||
|
||||
for( BOARD_ITEM* item : m_items )
|
||||
area.Merge( item->GetBoundingBox() );
|
||||
bbox.Merge( item->GetBoundingBox() );
|
||||
|
||||
area.Inflate( Millimeter2iu( 0.25 ) ); // Give a min size to the area
|
||||
bbox.Inflate( Millimeter2iu( 0.25 ) ); // Give a min size to the bbox
|
||||
|
||||
return area;
|
||||
return bbox;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -299,7 +299,7 @@ void PCB_MARKER::SetZoom( double aZoomFactor )
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT PCB_MARKER::GetBoundingBox() const
|
||||
const BOX2I PCB_MARKER::GetBoundingBox() const
|
||||
{
|
||||
return GetBoundingBoxMarker();
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ public:
|
|||
|
||||
const BOX2I ViewBBox() const override;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
|
|
|
@ -568,7 +568,8 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
|
|||
if( m_pcbSettings.GetDrawBoundingBoxes() )
|
||||
{
|
||||
// Show bounding boxes of painted objects for debugging.
|
||||
EDA_RECT box = item->GetBoundingBox();
|
||||
BOX2I box = item->GetBoundingBox();
|
||||
|
||||
m_gal->SetIsFill( false );
|
||||
m_gal->SetIsStroke( true );
|
||||
|
||||
|
@ -1017,7 +1018,7 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
|
|||
if( netname.IsEmpty() && padNumber.IsEmpty() )
|
||||
return;
|
||||
|
||||
EDA_RECT padBBox = aPad->GetBoundingBox();
|
||||
BOX2I padBBox = aPad->GetBoundingBox();
|
||||
VECTOR2D position = padBBox.Centre();
|
||||
VECTOR2D padsize = VECTOR2D( padBBox.GetSize() );
|
||||
|
||||
|
@ -2142,9 +2143,10 @@ void PCB_PAINTER::draw( const PCB_GROUP* aGroup, int aLayer )
|
|||
|
||||
const COLOR4D color = m_pcbSettings.GetColor( aGroup, LAYER_ANCHOR );
|
||||
|
||||
EDA_RECT bbox = aGroup->GetBoundingBox();
|
||||
m_gal->SetStrokeColor( color );
|
||||
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth * 2.0f );
|
||||
|
||||
BOX2I bbox = aGroup->GetBoundingBox();
|
||||
VECTOR2I topLeft = bbox.GetPosition();
|
||||
VECTOR2I width = VECTOR2I( bbox.GetWidth(), 0 );
|
||||
VECTOR2I height = VECTOR2I( 0, bbox.GetHeight() );
|
||||
|
|
|
@ -120,7 +120,7 @@ public:
|
|||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override { return getBoundingBox(); }
|
||||
const BOX2I GetBoundingBox() const override { return getBoundingBox(); }
|
||||
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override
|
||||
{
|
||||
|
|
|
@ -101,7 +101,7 @@ void PCB_TARGET::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT PCB_TARGET::GetBoundingBox() const
|
||||
const BOX2I PCB_TARGET::GetBoundingBox() const
|
||||
{
|
||||
EDA_RECT bBox;
|
||||
bBox.SetX( m_pos.x - m_size / 2 );
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
// Virtual function
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer,
|
||||
FLASHING aFlash = FLASHING::DEFAULT ) const override;
|
||||
|
|
|
@ -157,7 +157,7 @@ int PCB_TEXT::getKnockoutMargin() const
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT PCB_TEXT::GetBoundingBox() const
|
||||
const BOX2I PCB_TEXT::GetBoundingBox() const
|
||||
{
|
||||
BOX2I rect = GetTextBox();
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ public:
|
|||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
||||
// Virtual function
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ EDA_ITEM_FLAGS PCB_TRACK::IsPointOnEnds( const VECTOR2I& point, int min_dist ) c
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT PCB_TRACK::GetBoundingBox() const
|
||||
const BOX2I PCB_TRACK::GetBoundingBox() const
|
||||
{
|
||||
// end of track is round, this is its radius, rounded up
|
||||
int radius = ( m_Width + 1 ) / 2;
|
||||
|
@ -245,7 +245,7 @@ const EDA_RECT PCB_TRACK::GetBoundingBox() const
|
|||
else if( Type() == PCB_ARC_T )
|
||||
{
|
||||
std::shared_ptr<SHAPE> arc = GetEffectiveShape();
|
||||
auto bbox = arc->BBox();
|
||||
BOX2I bbox = arc->BBox();
|
||||
|
||||
xmin = bbox.GetLeft();
|
||||
xmax = bbox.GetRight();
|
||||
|
@ -268,7 +268,7 @@ const EDA_RECT PCB_TRACK::GetBoundingBox() const
|
|||
xmin -= radius;
|
||||
|
||||
// return a rectangle which is [pos,dim) in nature. therefore the +1
|
||||
EDA_RECT ret( VECTOR2I( xmin, ymin ), VECTOR2I( xmax - xmin + 1, ymax - ymin + 1 ) );
|
||||
BOX2I ret( VECTOR2I( xmin, ymin ), VECTOR2I( xmax - xmin + 1, ymax - ymin + 1 ) );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ public:
|
|||
}
|
||||
|
||||
// Virtual function
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
/**
|
||||
* Function GetLength
|
||||
|
|
|
@ -318,11 +318,9 @@ bool ZONE::IsOnLayer( PCB_LAYER_ID aLayer ) const
|
|||
}
|
||||
|
||||
|
||||
const EDA_RECT ZONE::GetBoundingBox() const
|
||||
const BOX2I ZONE::GetBoundingBox() const
|
||||
{
|
||||
BOX2I bb = m_Poly->BBox();
|
||||
|
||||
return bb;
|
||||
return m_Poly->BBox();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -124,9 +124,9 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* @return an EDA_RECT that is the bounding box of the zone outline.
|
||||
* @return the bounding box of the zone outline.
|
||||
*/
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
/**
|
||||
* ONLY TO BE USED BY CLIENTS WHICH SET UP THE CACHE!
|
||||
|
|
|
@ -159,7 +159,7 @@ BOOST_AUTO_TEST_CASE( BasicProps )
|
|||
BOOST_CHECK( img.GetSizePixels() == size_4tile );
|
||||
BOOST_CHECK( img.GetSize() == size_4tile * 10 );
|
||||
|
||||
const EDA_RECT bb = img.GetBoundingBox();
|
||||
const BOX2I bb = img.GetBoundingBox();
|
||||
BOOST_CHECK( bb.GetPosition() == wxPoint( -40, -40 ) );
|
||||
BOOST_CHECK( bb.GetEnd() == wxPoint( 40, 40 ) );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue