Remove a few EDA_RECT instances.

This commit is contained in:
Jeff Young 2022-08-31 00:28:18 +01:00
parent c7036ae076
commit 5679b9dbdc
72 changed files with 186 additions and 209 deletions

View File

@ -317,7 +317,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
aWarningReporter->Report( wxEmptyString );
}
EDA_RECT bbbox;
BOX2I bbbox;
if( m_board )
{

View File

@ -153,8 +153,7 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
}
else
{
EDA_RECT targetBbox = getBoundingBox();
bBox = BOX2I( targetBbox.GetOrigin(), targetBbox.GetSize() );
bBox = getBoundingBox();
view->SetLayerVisible( LAYER_DRAWINGSHEET, false );
}

View File

@ -701,7 +701,7 @@ void DS_DATA_ITEM_TEXT::SetConstrainedTextSize()
dummy.SetVertJustify( m_Vjustify );
dummy.SetTextAngle( EDA_ANGLE( m_Orient, DEGREES_T ) );
EDA_RECT rect = dummy.GetTextBox();
BOX2I rect = dummy.GetTextBox();
VECTOR2D size;
size.x = rect.GetWidth() / FSCALE;
size.y = rect.GetHeight() / FSCALE;

View File

@ -631,9 +631,9 @@ void EDA_SHAPE::ShapeGetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
}
const EDA_RECT EDA_SHAPE::getBoundingBox() const
const BOX2I EDA_SHAPE::getBoundingBox() const
{
EDA_RECT bbox;
BOX2I bbox;
switch( m_shape )
{
@ -812,7 +812,7 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
arect.Normalize();
arect.Inflate( aAccuracy );
EDA_RECT bb = getBoundingBox();
BOX2I bb = getBoundingBox();
switch( m_shape )
{
@ -1015,7 +1015,7 @@ std::vector<VECTOR2I> EDA_SHAPE::GetRectCorners() const
}
void EDA_SHAPE::computeArcBBox( EDA_RECT& aBBox ) const
void EDA_SHAPE::computeArcBBox( BOX2I& aBBox ) const
{
// Start, end, and each inflection point the arc crosses will enclose the entire arc.
// Only include the center when filled; it's not necessarily inside the BB of an unfilled

View File

@ -497,7 +497,7 @@ int EDA_TEXT::GetInterline() const
}
EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
{
VECTOR2I drawPos = GetDrawPos();
@ -509,7 +509,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
return m_bounding_box_cache;
}
EDA_RECT rect;
BOX2I rect;
wxArrayString strings;
wxString text = GetShownText();
int thickness = GetEffectiveTextPenWidth();
@ -619,7 +619,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
bool EDA_TEXT::TextHitTest( const VECTOR2I& aPoint, int aAccuracy ) const
{
EDA_RECT rect = GetTextBox();
BOX2I rect = GetTextBox();
VECTOR2I location = aPoint;
rect.Inflate( aAccuracy );
@ -942,7 +942,7 @@ void EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon( SHAPE_POLY_SET* aCorn
VECTOR2I corners[4]; // Buffer of polygon corners
EDA_RECT rect = GetTextBox();
BOX2I rect = GetTextBox();
// TrueType bounding boxes aren't guaranteed to include all descenders, diacriticals, etc.
// Since we use this for zone knockouts and DRC, we need something more accurate.

View File

@ -89,7 +89,7 @@ MARKER_BASE::~MARKER_BASE()
bool MARKER_BASE::HitTestMarker( const VECTOR2I& aHitPosition, int aAccuracy ) const
{
EDA_RECT bbox = GetBoundingBoxMarker();
BOX2I bbox = GetBoundingBoxMarker();
bbox.Inflate( aAccuracy );
// Fast hit test using boundary box. A finer test will be made if requested
@ -120,17 +120,14 @@ void MARKER_BASE::ShapeToPolygon( SHAPE_LINE_CHAIN& aPolygon, int aScale ) const
}
EDA_RECT MARKER_BASE::GetBoundingBoxMarker() const
BOX2I MARKER_BASE::GetBoundingBoxMarker() const
{
VECTOR2I size_iu = m_shapeBoundingBox.GetSize();
VECTOR2I position_iu = m_shapeBoundingBox.GetPosition();
size_iu.x *= m_scalingFactor;
size_iu.y *= m_scalingFactor;
position_iu.x *= m_scalingFactor;
position_iu.y *= m_scalingFactor;
position_iu += m_Pos;
BOX2I bbox = m_shapeBoundingBox;
return EDA_RECT( position_iu, size_iu );
VECTOR2I pos = m_Pos;
pos += m_shapeBoundingBox.GetPosition() * m_scalingFactor;
return BOX2I( pos, bbox.GetSize() * m_scalingFactor );
}

View File

@ -26,6 +26,7 @@
#include <algorithm>
#include <eda_item.h>
#include <eda_rect.h>
#include <tool/selection.h>
@ -93,7 +94,7 @@ VECTOR2I SELECTION::GetCenter() const
}
}
EDA_RECT bbox;
BOX2I bbox;
if( hasOnlyText )
{
@ -116,9 +117,9 @@ VECTOR2I SELECTION::GetCenter() const
}
EDA_RECT SELECTION::GetBoundingBox() const
BOX2I SELECTION::GetBoundingBox() const
{
EDA_RECT bbox;
BOX2I bbox;
for( EDA_ITEM* item : m_items )
bbox.Merge( item->GetBoundingBox() );

View File

@ -373,7 +373,7 @@ const EDA_RECT 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.
*/
EDA_RECT rect = GetTextBox( -1, true );
BOX2I rect = GetTextBox( -1, true );
rect.RevertYAxis();
// We are using now a bottom to top Y axis.

View File

@ -415,7 +415,7 @@ void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
const EDA_RECT LIB_SHAPE::GetBoundingBox() const
{
EDA_RECT rect = getBoundingBox();
BOX2I rect = getBoundingBox();
rect.RevertYAxis();

View File

@ -911,10 +911,10 @@ void LIB_SYMBOL::ViewGetLayers( int aLayers[], int& aCount ) const
}
const EDA_RECT LIB_SYMBOL::GetBodyBoundingBox( int aUnit, int aConvert, bool aIncludePins,
const BOX2I LIB_SYMBOL::GetBodyBoundingBox( int aUnit, int aConvert, bool aIncludePins,
bool aIncludePrivateItems ) const
{
EDA_RECT bbox;
BOX2I bbox;
for( const LIB_ITEM& item : m_drawings )
{

View File

@ -225,7 +225,7 @@ public:
* if aConvert == 0 Convert is non used
* Fields are not taken in account
**/
const EDA_RECT GetBodyBoundingBox( int aUnit, int aConvert, bool aIncludePins,
const BOX2I GetBodyBoundingBox( int aUnit, int aConvert, bool aIncludePins,
bool aIncludePrivateItems ) const;
const EDA_RECT GetBoundingBox() const override

View File

@ -133,7 +133,7 @@ void LIB_TEXT::MoveTo( const VECTOR2I& newPosition )
void LIB_TEXT::NormalizeJustification( bool inverse )
{
VECTOR2I delta( 0, 0 );
EDA_RECT bbox = GetTextBox();
BOX2I bbox = GetTextBox();
if( GetTextAngle().IsHorizontal() )
{
@ -400,7 +400,7 @@ const EDA_RECT 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.
*/
EDA_RECT rect = GetTextBox( -1, true );
BOX2I rect = GetTextBox( -1, true );
rect.RevertYAxis();
// We are using now a bottom to top Y axis.

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -68,7 +68,7 @@ public:
rect.Inflate( aAccuracy );
EDA_RECT textBox = GetTextBox();
BOX2I textBox = GetTextBox();
textBox.RevertYAxis();
if( aContained )

View File

@ -1680,18 +1680,14 @@ const BOX2I SCH_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
DS_PROXY_VIEW_ITEM* ds = SCH_BASE_FRAME::GetCanvas()->GetView()->GetDrawingSheet();
EDA_ITEM* dsAsItem = static_cast<EDA_ITEM*>( ds );
// Need an EDA_RECT so the first ".Merge" sees it's uninitialized
EDA_RECT bBoxItems;
// Calc the bounding box of all items on screen except the page border
for( EDA_ITEM* item : GetScreen()->Items() )
{
if( item != dsAsItem ) // Ignore the drawing-sheet itself
bBoxItems.Merge( item->GetBoundingBox() );
bBoxDoc.Merge( item->GetBoundingBox() );
}
}
bBoxDoc = bBoxItems;
}
}
return bBoxDoc;
}

View File

@ -402,7 +402,7 @@ EDA_ANGLE SCH_FIELD::GetDrawRotation() const
const EDA_RECT SCH_FIELD::GetBoundingBox() const
{
// Calculate the text bounding box:
EDA_RECT rect = GetTextBox();
BOX2I rect = GetTextBox();
// Calculate the bounding box position relative to the parent:
VECTOR2I origin = GetParentPosition();

View File

@ -639,11 +639,11 @@ int SCH_LABEL_BASE::GetLabelBoxExpansion( const RENDER_SETTINGS* aSettings ) con
}
const EDA_RECT SCH_LABEL_BASE::GetBodyBoundingBox() const
const BOX2I SCH_LABEL_BASE::GetBodyBoundingBox() const
{
// build the bounding box of the label only, without taking into account its fields
EDA_RECT box;
BOX2I box;
std::vector<VECTOR2I> pts;
CreateGraphicShape( nullptr, pts, GetTextPos() );
@ -661,7 +661,7 @@ const EDA_RECT SCH_LABEL_BASE::GetBoundingBox() const
{
// build the bounding box of the entire label, including its fields
EDA_RECT box( GetBodyBoundingBox() );
BOX2I box = GetBodyBoundingBox();
for( const SCH_FIELD& field : m_fields )
{
@ -684,7 +684,7 @@ const EDA_RECT SCH_LABEL_BASE::GetBoundingBox() const
bool SCH_LABEL_BASE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{
EDA_RECT bbox = GetBodyBoundingBox();
BOX2I bbox = GetBodyBoundingBox();
bbox.Inflate( aAccuracy );
if( bbox.Contains( aPosition ) )
@ -960,9 +960,9 @@ SCH_LABEL::SCH_LABEL( const VECTOR2I& pos, const wxString& text ) :
}
const EDA_RECT SCH_LABEL::GetBodyBoundingBox() const
const BOX2I SCH_LABEL::GetBodyBoundingBox() const
{
EDA_RECT rect = GetTextBox();
BOX2I rect = GetTextBox();
rect.Offset( 0, -GetTextOffset() );
rect.Inflate( GetEffectiveTextPenWidth() );
@ -1501,7 +1501,7 @@ void SCH_HIERLABEL::CreateGraphicShape( const RENDER_SETTINGS* aSettings,
}
const EDA_RECT SCH_HIERLABEL::GetBodyBoundingBox() const
const BOX2I SCH_HIERLABEL::GetBodyBoundingBox() const
{
int penWidth = GetEffectiveTextPenWidth();
int margin = GetTextOffset();
@ -1548,7 +1548,7 @@ const EDA_RECT SCH_HIERLABEL::GetBodyBoundingBox() const
break;
}
EDA_RECT box( VECTOR2I( x, y ), VECTOR2I( dx, dy ) );
BOX2I box( VECTOR2I( x, y ), VECTOR2I( dx, dy ) );
box.Normalize();
return box;
}

View File

@ -147,7 +147,7 @@ public:
/**
* Return the bounding box of the label only, without taking in account its fields.
*/
virtual const EDA_RECT GetBodyBoundingBox() const;
virtual const BOX2I GetBodyBoundingBox() const;
/**
* Return the bounding box of the label including its fields.
@ -225,7 +225,7 @@ public:
return wxT( "SCH_LABEL" );
}
const EDA_RECT GetBodyBoundingBox() const override;
const BOX2I GetBodyBoundingBox() const override;
bool IsConnectable() const override { return true; }
@ -395,7 +395,7 @@ public:
void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
const VECTOR2I& aPos, LABEL_FLAG_SHAPE aShape ) const;
const EDA_RECT GetBodyBoundingBox() const override;
const BOX2I GetBodyBoundingBox() const override;
bool IsConnectable() const override { return true; }

View File

@ -1866,7 +1866,7 @@ void SCH_PAINTER::draw( const SCH_TEXT *aText, int aLayer )
// SCH_FIELD text.
if( aText->GetDrawFont()->IsOutline() )
{
EDA_RECT firstLineBBox = aText->GetTextBox( 0 );
BOX2I firstLineBBox = aText->GetTextBox( 0 );
int sizeDiff = firstLineBBox.GetHeight() - aText->GetTextSize().y;
int adjust = KiROUND( sizeDiff * 0.4 );
VECTOR2I adjust_offset( 0, - adjust );

View File

@ -1438,7 +1438,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdef
for( size_t ii = 0; ii < strings.size(); ++ii )
{
EDA_RECT bbox = libtext->GetTextBox( ii, true );
BOX2I bbox = libtext->GetTextBox( ii, true );
VECTOR2I linePos = { bbox.GetLeft(), -bbox.GetBottom() };
RotatePoint( linePos, libtext->GetTextPos(), -libtext->GetTextAngle() );

View File

@ -617,10 +617,10 @@ void SCH_SHEET::ViewGetLayers( int aLayers[], int& aCount ) const
}
const EDA_RECT SCH_SHEET::GetBodyBoundingBox() const
const BOX2I SCH_SHEET::GetBodyBoundingBox() const
{
VECTOR2I end;
EDA_RECT box( m_pos, m_size );
BOX2I box( m_pos, m_size );
int lineWidth = GetPenWidth();
int textLength = 0;
@ -640,7 +640,7 @@ const EDA_RECT SCH_SHEET::GetBodyBoundingBox() const
const EDA_RECT SCH_SHEET::GetBoundingBox() const
{
EDA_RECT box = GetBodyBoundingBox();
BOX2I box = GetBodyBoundingBox();
for( const SCH_FIELD& field : m_fields )
box.Merge( field.GetBoundingBox() );
@ -1024,7 +1024,7 @@ BITMAPS SCH_SHEET::GetMenuImage() const
bool SCH_SHEET::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{
EDA_RECT rect = GetBodyBoundingBox();
BOX2I rect = GetBodyBoundingBox();
rect.Inflate( aAccuracy );

View File

@ -248,7 +248,7 @@ public:
/**
* Return a bounding box for the sheet body but not the fields.
*/
const EDA_RECT GetBodyBoundingBox() const;
const BOX2I GetBodyBoundingBox() const;
const EDA_RECT GetBoundingBox() const override;

View File

@ -1396,9 +1396,9 @@ void SCH_SYMBOL::Show( int nestLevel, std::ostream& os ) const
#endif
EDA_RECT SCH_SYMBOL::doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) const
BOX2I SCH_SYMBOL::doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) const
{
EDA_RECT bBox;
BOX2I bBox;
if( m_part )
bBox = m_part->GetBodyBoundingBox( m_unit, m_convert, aIncludePins, false );
@ -1441,7 +1441,7 @@ EDA_RECT SCH_SYMBOL::doGetBoundingBox( bool aIncludePins, bool aIncludeFields )
}
EDA_RECT SCH_SYMBOL::GetBodyBoundingBox() const
BOX2I SCH_SYMBOL::GetBodyBoundingBox() const
{
return doGetBoundingBox( false, false );
}
@ -1883,7 +1883,7 @@ SCH_SYMBOL& SCH_SYMBOL::operator=( const SCH_ITEM& aItem )
bool SCH_SYMBOL::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{
EDA_RECT bBox = GetBodyBoundingBox();
BOX2I bBox = GetBodyBoundingBox();
bBox.Inflate( aAccuracy / 2 );
if( bBox.Contains( aPosition ) )

View File

@ -330,7 +330,7 @@ public:
/**
* Return a bounding box for the symbol body but not the pins or fields.
*/
EDA_RECT GetBodyBoundingBox() const;
BOX2I GetBodyBoundingBox() const;
/**
* Return a bounding box for the symbol body and pins but not the fields.
@ -705,7 +705,7 @@ public:
bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override;
private:
EDA_RECT doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) const;
BOX2I doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) const;
bool doIsConnected( const VECTOR2I& aPosition ) const override;

View File

@ -300,7 +300,7 @@ void SCH_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
// SCH_FIELD text.
if( GetDrawFont()->IsOutline() )
{
EDA_RECT firstLineBBox = GetTextBox( 0 );
BOX2I firstLineBBox = GetTextBox( 0 );
int sizeDiff = firstLineBBox.GetHeight() - GetTextSize().y;
int adjust = KiROUND( sizeDiff * 0.4 );
VECTOR2I adjust_offset( 0, - adjust );
@ -315,7 +315,7 @@ void SCH_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
const EDA_RECT SCH_TEXT::GetBoundingBox() const
{
EDA_RECT rect = GetTextBox();
BOX2I rect = GetTextBox();
if( !GetTextAngle().IsZero() ) // Rotate rect.
{
@ -456,7 +456,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter, bool aBackground ) const
// SCH_FIELD text.
if( GetDrawFont()->IsOutline() )
{
EDA_RECT firstLineBBox = GetTextBox( 0 );
BOX2I firstLineBBox = GetTextBox( 0 );
int sizeDiff = firstLineBBox.GetHeight() - GetTextSize().y;
int adjust = KiROUND( sizeDiff * 0.4 );
VECTOR2I adjust_offset( 0, - adjust );

View File

@ -82,9 +82,9 @@ EDA_ITEM* EE_SELECTION::GetTopLeftItem( bool onlyModules ) const
}
EDA_RECT EE_SELECTION::GetBoundingBox() const
BOX2I EE_SELECTION::GetBoundingBox() const
{
EDA_RECT bbox;
BOX2I bbox;
for( EDA_ITEM* item : m_items )
{

View File

@ -46,7 +46,7 @@ public:
EDA_ITEM* GetTopLeftItem( bool onlyModules = false ) const override;
EDA_RECT GetBoundingBox() const override;
BOX2I GetBoundingBox() const override;
void SetScreen( SCH_SCREEN* aScreen ) { m_screen = aScreen; }
SCH_SCREEN* GetScreen() { return m_screen; }

View File

@ -1058,7 +1058,7 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const
for( EDA_ITEM* item : collector )
{
EDA_RECT bbox = item->GetBoundingBox();
BOX2I bbox = item->GetBoundingBox();
int dist = INT_MAX / 2;
if( exactHits.count( item ) )
@ -1129,7 +1129,7 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const
// for selection and can be dropped.
if( closest ) // Don't try and get a tight bbox if nothing is near the mouse pointer
{
EDA_RECT tightBox = closest->GetBoundingBox();
BOX2I tightBox = closest->GetBoundingBox();
tightBox.Inflate( -tightBox.GetWidth() / 4, -tightBox.GetHeight() / 4 );
for( int i = collector.GetCount() - 1; i >= 0; --i )
@ -1622,7 +1622,7 @@ int EE_SELECTION_TOOL::SyncSelection( std::optional<SCH_SHEET_PATH> targetSheetP
for( SCH_ITEM* item : items )
select( item );
EDA_RECT bbox = m_selection.GetBoundingBox();
BOX2I bbox = m_selection.GetBoundingBox();
if( bbox.GetWidth() != 0 && bbox.GetHeight() != 0 )
{

View File

@ -1226,7 +1226,7 @@ int SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires( const TOOL_EVENT& aEvent )
SCH_SCREEN* screen = sch->CurrentSheet().LastScreen();
std::set<SCH_LINE*> lines;
EDA_RECT bb = aSelection->GetBoundingBox();
BOX2I bb = aSelection->GetBoundingBox();
for( EDA_ITEM* item : screen->Items().Overlapping( SCH_LINE_T, bb ) )
lines.insert( static_cast<SCH_LINE*>( item ) );
@ -1272,7 +1272,7 @@ int SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded( const TOOL_EVENT& aEvent )
std::vector<VECTOR2I> connections = m_frame->GetSchematicConnections();
std::set<SCH_LINE*> lines;
EDA_RECT bb = aSelection->GetBoundingBox();
BOX2I bb = aSelection->GetBoundingBox();
for( EDA_ITEM* item : m_frame->GetScreen()->Items().Overlapping( SCH_LINE_T, bb ) )
lines.insert( static_cast<SCH_LINE*>( item ) );

View File

@ -44,10 +44,9 @@ GERBER_FILE_IMAGE_LIST* GBR_LAYOUT::GetImagesList() const
}
EDA_RECT GBR_LAYOUT::ComputeBoundingBox() const
BOX2I GBR_LAYOUT::ComputeBoundingBox() const
{
EDA_RECT bbox;
bool first_item = true;
BOX2I bbox; // Start with a fresh BOX2I so the Merge algorithm works
for( unsigned layer = 0; layer < GetImagesList()->ImagesMaxCount(); ++layer )
{
@ -57,16 +56,8 @@ EDA_RECT GBR_LAYOUT::ComputeBoundingBox() const
continue;
for( GERBER_DRAW_ITEM* item : gerber->GetItems() )
{
if( first_item )
{
bbox = item->GetBoundingBox();
first_item = false;
}
else
bbox.Merge( item->GetBoundingBox() );
}
}
bbox.Normalize();

View File

@ -68,7 +68,7 @@ public:
*
* @return the full item list bounding box.
*/
EDA_RECT ComputeBoundingBox() const;
BOX2I ComputeBoundingBox() const;
const EDA_RECT GetBoundingBox() const override
{

View File

@ -95,7 +95,7 @@ void GERBVIEW_PRINTOUT::setupGal( KIGFX::GAL* aGal )
}
EDA_RECT GERBVIEW_PRINTOUT::getBoundingBox()
BOX2I GERBVIEW_PRINTOUT::getBoundingBox()
{
return m_layout->ComputeBoundingBox();
}

View File

@ -39,7 +39,7 @@ protected:
void setupGal( KIGFX::GAL* aGal ) override;
EDA_RECT getBoundingBox() override;
BOX2I getBoundingBox() override;
std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) override;

View File

@ -109,7 +109,7 @@ protected:
virtual void setupGal( KIGFX::GAL* aGal );
///< Returns bounding box of the printed objects (excluding drawing-sheet frame)
virtual EDA_RECT getBoundingBox() = 0;
virtual BOX2I getBoundingBox() = 0;
///< Returns a PAINTER instance used to draw the items.
virtual std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) = 0;

View File

@ -325,9 +325,9 @@ protected:
virtual EDA_ANGLE getParentOrientation() const = 0;
virtual VECTOR2I getParentPosition() const = 0;
const EDA_RECT getBoundingBox() const;
const BOX2I getBoundingBox() const;
void computeArcBBox( EDA_RECT& aBBox ) const;
void computeArcBBox( BOX2I& aBBox ) const;
bool hitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const;
bool hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const;

View File

@ -271,7 +271,7 @@ public:
* this rectangle is calculated for 0 orient text.
* If orientation is not 0 the rect must be rotated to match the physical area
*/
EDA_RECT GetTextBox( int aLine = -1, bool aInvertY = false ) const;
BOX2I GetTextBox( int aLine = -1, bool aInvertY = false ) const;
/**
* Return the distance between two lines of text.

View File

@ -120,7 +120,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.
*/
EDA_RECT GetBoundingBoxMarker() const;
BOX2I GetBoundingBoxMarker() const;
protected:
virtual KIGFX::COLOR4D getColor() const = 0;
@ -135,7 +135,7 @@ protected:
int m_scalingFactor; // Scaling factor to convert corners coordinates
// to internal units coordinates
EDA_RECT m_shapeBoundingBox; // Bounding box of the graphic symbol, relative
BOX2I m_shapeBoundingBox; // Bounding box of the graphic symbol, relative
// to the position of the shape, in marker shape
// units
};

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2016 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -23,11 +23,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file pcb_base_frame.h
* @brief Classes used in Pcbnew, CvPcb and GerbView.
*/
#ifndef PCB_BASE_FRAME_H
#define PCB_BASE_FRAME_H
@ -90,11 +85,9 @@ public:
*
* @param aMarkDirty alerts the 3D view that data is stale (it may not refresh instantly)
* @param aRefresh will tell the 3D view to refresh immediately
* @param aTitle is the new title of the 3D frame, or nullptr to do not change the
* frame title
* @param aTitle is the new title of the 3D frame, or nullptr to do not change the frame title
*/
virtual void Update3DView( bool aMarkDirty, bool aRefresh,
const wxString* aTitle = nullptr );
virtual void Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle = nullptr );
/**
* Attempt to load \a aFootprintId from the footprint library table.
@ -111,7 +104,7 @@ public:
* @param aBoardEdgesOnly is true if we are interested in board edge segments only.
* @return the board's bounding box.
*/
EDA_RECT GetBoardBoundingBox( bool aBoardEdgesOnly = false ) const;
BOX2I GetBoardBoundingBox( bool aBoardEdgesOnly = false ) const;
const BOX2I GetDocumentExtents( bool aIncludeAllVisible = true ) const override
{

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013-2017 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
@ -30,7 +30,6 @@
#include <optional>
#include <core/typeinfo.h>
#include <deque>
#include <eda_rect.h>
#include <eda_item.h>
#include <view/view_group.h>
@ -127,10 +126,12 @@ public:
const std::vector<EDA_ITEM*> GetItemsSortedByTypeAndXY( bool leftBeforeRight = true,
bool topBeforeBottom = true ) const
{
std::vector<EDA_ITEM*> sorted_items =
std::vector<EDA_ITEM*>( m_items.begin(), m_items.end() );
std::vector<EDA_ITEM*> sorted_items = std::vector<EDA_ITEM*>( m_items.begin(),
m_items.end() );
std::sort( sorted_items.begin(), sorted_items.end(), [&]( EDA_ITEM* a, EDA_ITEM* b ) {
std::sort( sorted_items.begin(), sorted_items.end(),
[&]( EDA_ITEM* a, EDA_ITEM* b )
{
if( a->Type() == b->Type() )
{
if( a->GetSortPosition().x == b->GetSortPosition().x )
@ -169,10 +170,10 @@ public:
/// Returns the top left point of the selection area bounding box.
VECTOR2I GetPosition() const
{
return static_cast<VECTOR2I>( GetBoundingBox().GetPosition() );
return GetBoundingBox().GetPosition();
}
virtual EDA_RECT GetBoundingBox() const;
virtual BOX2I GetBoundingBox() const;
virtual EDA_ITEM* GetTopLeftItem( bool onlyModules = false ) const
{

View File

@ -5,7 +5,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
*
* This program is free software; you can redistribute it and/or

View File

@ -23,18 +23,19 @@
*/
#include <eda_item.h>
#include <eda_rect.h>
#include "tools/pl_selection.h"
EDA_ITEM* PL_SELECTION::GetTopLeftItem( bool onlyModules ) const
{
EDA_ITEM* topLeftItem = nullptr;
EDA_RECT topLeftItemBB;
BOX2I topLeftItemBB;
// find the leftmost (smallest x coord) and highest (smallest y with the smallest x) item in the selection
for( EDA_ITEM* item : m_items )
{
EDA_RECT currentItemBB = item->GetBoundingBox();
BOX2I currentItemBB = item->GetBoundingBox();
if( topLeftItem == nullptr )
{

View File

@ -61,7 +61,7 @@ static int refreshCallback( FOOTPRINT* aFootprint )
int AUTOPLACE_TOOL::autoplace( std::vector<FOOTPRINT*>& aFootprints, bool aPlaceOffboard )
{
EDA_RECT bbox = board()->GetBoardEdgesBoundingBox();
BOX2I bbox = board()->GetBoardEdgesBoundingBox();
if( bbox.GetWidth() == 0 || bbox.GetHeight() == 0 )
{

View File

@ -1151,9 +1151,9 @@ unsigned BOARD::GetUnconnectedNetCount() const
}
EDA_RECT BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const
BOX2I BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const
{
EDA_RECT area;
BOX2I area;
LSET visible = GetVisibleLayers();
bool showInvisibleText = IsElementVisible( LAYER_MOD_TEXT_INVISIBLE )
&& PgmOrNull() && !PgmOrNull()->m_Printing;

View File

@ -801,7 +801,7 @@ public:
* @param aBoardEdgesOnly is true if we are interested in board edge segments only.
* @return the board's bounding box.
*/
EDA_RECT ComputeBoundingBox( bool aBoardEdgesOnly = false ) const;
BOX2I ComputeBoundingBox( bool aBoardEdgesOnly = false ) const;
const EDA_RECT GetBoundingBox() const override
{

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -869,7 +869,7 @@ bool BuildBoardPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, int aE
// create a rectangular outline, or, failing that, the bounding box of the items on
// the board.
EDA_RECT bbbox = aBoard->GetBoardEdgesBoundingBox();
BOX2I bbbox = aBoard->GetBoardEdgesBoundingBox();
// If null area, uses the global bounding box.
if( ( bbbox.GetWidth() ) == 0 || ( bbbox.GetHeight() == 0 ) )
@ -914,7 +914,7 @@ bool BuildBoardPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, int aE
*/
void buildBoardBoundingBoxPoly( const BOARD* aBoard, SHAPE_POLY_SET& aOutline )
{
EDA_RECT bbbox = aBoard->GetBoundingBox();
BOX2I bbbox = aBoard->GetBoundingBox();
SHAPE_LINE_CHAIN chain;
// If null area, uses the global bounding box.

View File

@ -194,7 +194,7 @@ void PCB_EDIT_FRAME::OnExportIDF3( wxCommandEvent& event )
if( dlg.GetAutoAdjustOffset() )
{
EDA_RECT bbox = GetBoard()->GetBoardEdgesBoundingBox();
BOX2I bbox = GetBoard()->GetBoardEdgesBoundingBox();
aXRef = bbox.Centre().x * MM_PER_IU;
aYRef = bbox.Centre().y * MM_PER_IU;

View File

@ -429,7 +429,7 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
case DIALOG_EXPORT_STEP::STEP_ORG_BOARD_CENTER:
{
EDA_RECT bbox = m_parent->GetBoard()->ComputeBoundingBox( true );
BOX2I bbox = m_parent->GetBoard()->ComputeBoundingBox( true );
xOrg = Iu2Millimeter( bbox.GetCenter().x );
yOrg = Iu2Millimeter( bbox.GetCenter().y );
LOCALE_IO dummy;
@ -497,7 +497,7 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
case DIALOG_EXPORT_STEP::STEP_ORG_BOARD_CENTER:
{
EDA_RECT bbox = m_parent->GetBoard()->ComputeBoundingBox( true );
BOX2I bbox = m_parent->GetBoard()->ComputeBoundingBox( true );
xOrg = Iu2Millimeter( bbox.GetCenter().x );
yOrg = Iu2Millimeter( bbox.GetCenter().y );
params.m_xOrigin = xOrg;

View File

@ -337,7 +337,7 @@ bool DIALOG_EXPORT_SVG::CreateSVGFile( const wxString& aFullFileName )
if( m_rbSvgPageSizeOpt->GetSelection() == 2 ) // Page is board boundary size
{
EDA_RECT bbox = m_board->ComputeBoundingBox();
BOX2I bbox = m_board->ComputeBoundingBox();
PAGE_INFO currpageInfo = m_board->GetPageSettings();
currpageInfo.SetWidthMils( bbox.GetWidth() / IU_PER_MILS );

View File

@ -34,7 +34,7 @@ DIALOG_MOVE_EXACT::MOVE_EXACT_OPTIONS DIALOG_MOVE_EXACT::m_options;
DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT( PCB_BASE_FRAME *aParent, VECTOR2I& aTranslate,
EDA_ANGLE& aRotate, ROTATION_ANCHOR& aAnchor,
const EDA_RECT& aBbox ) :
const BOX2I& aBbox ) :
DIALOG_MOVE_EXACT_BASE( aParent ),
m_translation( aTranslate ),
m_rotation( aRotate ),

View File

@ -47,7 +47,7 @@ class DIALOG_MOVE_EXACT : public DIALOG_MOVE_EXACT_BASE
{
public:
DIALOG_MOVE_EXACT( PCB_BASE_FRAME* aParent, VECTOR2I& aTranslate, EDA_ANGLE& aRotate,
ROTATION_ANCHOR& aAnchor, const EDA_RECT& aBbox );
ROTATION_ANCHOR& aAnchor, const BOX2I& aBbox );
~DIALOG_MOVE_EXACT() { };
private:
@ -113,7 +113,7 @@ private:
VECTOR2I& m_translation;
EDA_ANGLE& m_rotation;
ROTATION_ANCHOR& m_rotationAnchor;
const EDA_RECT& m_bbox;
const BOX2I& m_bbox;
UNIT_BINDER m_moveX;
UNIT_BINDER m_moveY;

View File

@ -304,7 +304,7 @@ std::string PLACE_FILE_EXPORTER::GenReportData()
buffer += "\n$BeginDESCRIPTION\n";
EDA_RECT bbbox = m_board->ComputeBoundingBox();
BOX2I bbbox = m_board->ComputeBoundingBox();
buffer += "\n$BOARD\n";

View File

@ -223,7 +223,7 @@ UseBoundingBox:
// Fetch a rectangular bounding box for the board; there is always some uncertainty in the
// board dimensions computed via ComputeBoundingBox() since this depends on the individual
// footprint entities.
EDA_RECT bbbox = aPcb->GetBoardEdgesBoundingBox();
BOX2I bbbox = aPcb->GetBoardEdgesBoundingBox();
// convert to mm and compensate for an assumed LINE_WIDTH line thickness
double x = ( bbbox.GetOrigin().x + LINE_WIDTH / 2 ) * scale + offX;

View File

@ -23,7 +23,6 @@
*/
#include <plotters/plotter_dxf.h>
#include <plotters/plotter_hpgl.h>
#include <plotters/plotter_gerber.h>
#include <plotters/plotters_pslike.h>
#include <eda_item.h>
@ -84,7 +83,7 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
// to calculate the board edges bounding box
LSET visibleLayers = m_pcb->GetVisibleLayers();
m_pcb->SetVisibleLayers( visibleLayers | LSET( Edge_Cuts ) );
EDA_RECT bbbox = m_pcb->GetBoardEdgesBoundingBox();
BOX2I bbbox = m_pcb->GetBoardEdgesBoundingBox();
m_pcb->SetVisibleLayers( visibleLayers );
// Some formats cannot be used to generate a document like the map files

View File

@ -266,7 +266,7 @@ void GERBER_JOBFILE_WRITER::addJSONGeneralSpecs()
m_json["GeneralSpecs"]["ProjectId"]["Revision"] = rev.ToAscii();
// output the board size in mm:
EDA_RECT brect = m_pcb->GetBoardEdgesBoundingBox();
BOX2I brect = m_pcb->GetBoardEdgesBoundingBox();
m_json["GeneralSpecs"]["Size"]["X"] = mapValue( brect.GetWidth() );
m_json["GeneralSpecs"]["Size"]["Y"] = mapValue( brect.GetHeight() );

View File

@ -208,7 +208,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CMP_FOOTPRINT );
// bbox of fp pads, pos 0, rot 0, non flipped
EDA_RECT bbox = footprint->GetFpPadsLocalBbox();
BOX2I bbox = footprint->GetFpPadsLocalBbox();
// negate bbox Y values if the fp is flipped (always flipped around X axis
// in Gerber P&P files).

View File

@ -732,9 +732,9 @@ wxString FOOTPRINT::GetTypeName() const
}
EDA_RECT FOOTPRINT::GetFpPadsLocalBbox() const
BOX2I FOOTPRINT::GetFpPadsLocalBbox() const
{
EDA_RECT area;
BOX2I area;
// We want the bounding box of the footprint pads at rot 0, not flipped
// Create such a image:

View File

@ -159,7 +159,7 @@ public:
*
* @return The rectangle containing the pads for the normalized footprint.
*/
EDA_RECT GetFpPadsLocalBbox() const;
BOX2I GetFpPadsLocalBbox() const;
/**
* Return a bounding polygon for the shapes and pads in the footprint.

View File

@ -74,7 +74,7 @@ FP_TEXT::~FP_TEXT()
bool FP_TEXT::TextHitTest( const VECTOR2I& aPoint, int aAccuracy ) const
{
EDA_RECT rect = GetTextBox();
BOX2I rect = GetTextBox();
VECTOR2I location = aPoint;
rect.Inflate( aAccuracy );
@ -222,7 +222,7 @@ void FP_TEXT::SetLocalCoord()
const EDA_RECT FP_TEXT::GetBoundingBox() const
{
EDA_ANGLE angle = GetDrawRotation();
EDA_RECT text_area = GetTextBox();
BOX2I text_area = GetTextBox();
if( !angle.IsZero() )
text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
@ -337,7 +337,7 @@ EDA_ITEM* FP_TEXT::Clone() const
const BOX2I FP_TEXT::ViewBBox() const
{
EDA_ANGLE angle = GetDrawRotation();
EDA_RECT text_area = GetTextBox();
BOX2I text_area = GetTextBox();
if( !angle.IsZero() )
text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );

View File

@ -102,14 +102,14 @@ wxString BOARD_NETLIST_UPDATER::getPinFunction( PAD* aPad )
}
wxPoint BOARD_NETLIST_UPDATER::estimateFootprintInsertionPosition()
VECTOR2I BOARD_NETLIST_UPDATER::estimateFootprintInsertionPosition()
{
wxPoint bestPosition;
VECTOR2I bestPosition;
if( !m_board->IsEmpty() )
{
// Position new components below any existing board features.
EDA_RECT bbox = m_board->GetBoardEdgesBoundingBox();
BOX2I bbox = m_board->GetBoardEdgesBoundingBox();
if( bbox.GetWidth() || bbox.GetHeight() )
{

View File

@ -6,7 +6,7 @@
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
*
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -98,7 +98,7 @@ private:
void cachePinFunction( PAD* aPad, const wxString& aPinFunction );
wxString getPinFunction( PAD* aPad );
wxPoint estimateFootprintInsertionPosition();
VECTOR2I estimateFootprintInsertionPosition();
FOOTPRINT* addNewFootprint( COMPONENT* aComponent );

View File

@ -635,9 +635,9 @@ void PCB_BASE_FRAME::SetPlotSettings( const PCB_PLOT_PARAMS& aSettings )
}
EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
BOX2I PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
{
EDA_RECT area = aBoardEdgesOnly ? m_pcb->GetBoardEdgesBoundingBox() : m_pcb->GetBoundingBox();
BOX2I area = aBoardEdgesOnly ? m_pcb->GetBoardEdgesBoundingBox() : m_pcb->GetBoundingBox();
if( area.GetWidth() == 0 && area.GetHeight() == 0 )
{

View File

@ -649,7 +649,7 @@ void PCB_DIM_ALIGNED::updateGeometry()
// Now that we have the text updated, we can determine how to draw the crossbar.
// First we need to create an appropriate bounding polygon to collide with
EDA_RECT textBox = m_text.GetTextBox().Inflate( m_text.GetTextWidth() / 2,
BOX2I textBox = m_text.GetTextBox().Inflate( m_text.GetTextWidth() / 2,
- m_text.GetEffectiveTextPenWidth() );
SHAPE_POLY_SET polyBox;
@ -827,7 +827,7 @@ void PCB_DIM_ORTHOGONAL::updateGeometry()
// Now that we have the text updated, we can determine how to draw the crossbar.
// First we need to create an appropriate bounding polygon to collide with
EDA_RECT textBox = m_text.GetTextBox().Inflate( m_text.GetTextWidth() / 2,
BOX2I textBox = m_text.GetTextBox().Inflate( m_text.GetTextWidth() / 2,
m_text.GetEffectiveTextPenWidth() );
SHAPE_POLY_SET polyBox;
@ -1001,7 +1001,7 @@ void PCB_DIM_LEADER::updateGeometry()
// Now that we have the text updated, we can determine how to draw the second line
// First we need to create an appropriate bounding polygon to collide with
EDA_RECT textBox = m_text.GetTextBox().Inflate( m_text.GetTextWidth() / 2,
BOX2I textBox = m_text.GetTextBox().Inflate( m_text.GetTextWidth() / 2,
m_text.GetEffectiveTextPenWidth() );
SHAPE_POLY_SET polyBox;
@ -1191,7 +1191,7 @@ void PCB_DIM_RADIAL::updateGeometry()
// Now that we have the text updated, we can determine how to draw the second line
// First we need to create an appropriate bounding polygon to collide with
EDA_RECT textBox = m_text.GetTextBox().Inflate( m_text.GetTextWidth() / 2,
BOX2I textBox = m_text.GetTextBox().Inflate( m_text.GetTextWidth() / 2,
m_text.GetEffectiveTextPenWidth() );
SHAPE_POLY_SET polyBox;

View File

@ -141,7 +141,7 @@ void PCB_SHAPE::NormalizeRect()
VECTOR2I start = GetStart();
VECTOR2I end = GetEnd();
EDA_RECT rect( start, end - start );
BOX2I rect( start, end - start );
rect.Normalize();
SetStart( rect.GetPosition() );

View File

@ -159,7 +159,7 @@ int PCB_TEXT::getKnockoutMargin() const
const EDA_RECT PCB_TEXT::GetBoundingBox() const
{
EDA_RECT rect = GetTextBox();
BOX2I rect = GetTextBox();
if( IsKnockout() )
rect.Inflate( getKnockoutMargin() );

View File

@ -270,7 +270,7 @@ void PCBNEW_PRINTOUT::setupGal( KIGFX::GAL* aGal )
}
EDA_RECT PCBNEW_PRINTOUT::getBoundingBox()
BOX2I PCBNEW_PRINTOUT::getBoundingBox()
{
return m_board->ComputeBoundingBox();
}

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2018 CERN
* Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
@ -66,7 +66,7 @@ protected:
void setupGal( KIGFX::GAL* aGal ) override;
EDA_RECT getBoundingBox() override;
BOX2I getBoundingBox() override;
std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) override;

View File

@ -998,7 +998,7 @@ static void initializePlotter( PLOTTER* aPlotter, const BOARD* aBoard,
autocenter = (aPlotOpts->GetScale() != 1.0);
}
EDA_RECT bbox = aBoard->ComputeBoundingBox();
BOX2I bbox = aBoard->ComputeBoundingBox();
VECTOR2I boardCenter = bbox.Centre();
VECTOR2I boardSize = bbox.GetSize();
@ -1052,12 +1052,13 @@ static void initializePlotter( PLOTTER* aPlotter, const BOARD* aBoard,
/**
* Prefill in black an area a little bigger than the board to prepare for the negative plot
*/
static void FillNegativeKnockout( PLOTTER *aPlotter, const EDA_RECT &aBbbox )
static void FillNegativeKnockout( PLOTTER *aPlotter, const BOX2I &aBbbox )
{
const int margin = 5 * IU_PER_MM; // Add a 5 mm margin around the board
aPlotter->SetNegative( true );
aPlotter->SetColor( WHITE ); // Which will be plotted as black
EDA_RECT area = aBbbox;
BOX2I area = aBbbox;
area.Inflate( margin );
aPlotter->Rect( area.GetOrigin(), area.GetEnd(), FILL_T::FILLED_SHAPE );
aPlotter->SetColor( BLACK );
@ -1192,7 +1193,7 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aL
// done in the driver (if supported)
if( aPlotOpts->GetNegative() )
{
EDA_RECT bbox = aBoard->ComputeBoundingBox();
BOX2I bbox = aBoard->ComputeBoundingBox();
FillNegativeKnockout( plotter, bbox );
}

View File

@ -636,7 +636,7 @@ void ALTIUM_PCB::Parse( const ALTIUM_COMPOUND_FILE& altiumPcbFi
}
// center board
EDA_RECT bbbox = m_board->GetBoardEdgesBoundingBox();
BOX2I bbbox = m_board->GetBoardEdgesBoundingBox();
int w = m_board->GetPageSettings().GetWidthIU( IU_PER_MILS );
int h = m_board->GetPageSettings().GetHeightIU( IU_PER_MILS );

View File

@ -126,7 +126,7 @@ BOARD* CADSTAR_PCB_ARCHIVE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppe
if( aProperties->Value( "page_width", &page_width )
&& aProperties->Value( "page_height", &page_height ) )
{
EDA_RECT bbbox = m_board->GetBoardEdgesBoundingBox();
BOX2I bbbox = m_board->GetBoardEdgesBoundingBox();
int w = atoi( page_width.c_str() );
int h = atoi( page_height.c_str() );

View File

@ -3117,7 +3117,7 @@ void EAGLE_PLUGIN::centerBoard()
if( m_props->Value( "page_width", &page_width ) &&
m_props->Value( "page_height", &page_height ) )
{
EDA_RECT bbbox = m_board->GetBoardEdgesBoundingBox();
BOX2I bbbox = m_board->GetBoardEdgesBoundingBox();
int w = atoi( page_width.c_str() );
int h = atoi( page_height.c_str() );

View File

@ -1657,7 +1657,7 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
: ROTATE_AROUND_ITEM_ANCHOR;
// TODO: Implement a visible bounding border at the edge
auto sel_box = selection.GetBoundingBox();
BOX2I sel_box = selection.GetBoundingBox();
DIALOG_MOVE_EXACT dialog( frame(), translation, rotation, rotationAnchor, sel_box );
int ret = dialog.ShowModal();

View File

@ -1540,7 +1540,7 @@ void PCB_SELECTION_TOOL::doSyncSelection( const std::vector<BOARD_ITEM*>& aItems
if( aWithNets )
selectConnections( aItems );
EDA_RECT bbox = m_selection.GetBoundingBox();
BOX2I bbox = m_selection.GetBoundingBox();
if( bbox.GetWidth() != 0 && bbox.GetHeight() != 0 )
{
@ -1615,8 +1615,8 @@ int PCB_SELECTION_TOOL::selectSameSheet( const TOOL_EVENT& aEvent )
void PCB_SELECTION_TOOL::zoomFitSelection()
{
// Should recalculate the view to zoom in on the selection.
auto selectionBox = m_selection.GetBoundingBox();
auto view = getView();
BOX2I selectionBox = m_selection.GetBoundingBox();
KIGFX::VIEW* view = getView();
VECTOR2D screenSize = view->ToWorld( m_frame->GetCanvas()->GetClientSize(), false );
screenSize.x = std::max( 10.0, screenSize.x );

View File

@ -322,9 +322,7 @@ const EDA_RECT ZONE::GetBoundingBox() const
{
BOX2I bb = m_Poly->BBox();
EDA_RECT ret( bb.GetOrigin(), VECTOR2I( bb.GetWidth(), bb.GetHeight() ) );
return ret;
return bb;
}