Remove a few EDA_RECT instances.
This commit is contained in:
parent
c7036ae076
commit
5679b9dbdc
|
@ -317,7 +317,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||||
aWarningReporter->Report( wxEmptyString );
|
aWarningReporter->Report( wxEmptyString );
|
||||||
}
|
}
|
||||||
|
|
||||||
EDA_RECT bbbox;
|
BOX2I bbbox;
|
||||||
|
|
||||||
if( m_board )
|
if( m_board )
|
||||||
{
|
{
|
||||||
|
|
|
@ -153,8 +153,7 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EDA_RECT targetBbox = getBoundingBox();
|
bBox = getBoundingBox();
|
||||||
bBox = BOX2I( targetBbox.GetOrigin(), targetBbox.GetSize() );
|
|
||||||
view->SetLayerVisible( LAYER_DRAWINGSHEET, false );
|
view->SetLayerVisible( LAYER_DRAWINGSHEET, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -701,7 +701,7 @@ void DS_DATA_ITEM_TEXT::SetConstrainedTextSize()
|
||||||
dummy.SetVertJustify( m_Vjustify );
|
dummy.SetVertJustify( m_Vjustify );
|
||||||
dummy.SetTextAngle( EDA_ANGLE( m_Orient, DEGREES_T ) );
|
dummy.SetTextAngle( EDA_ANGLE( m_Orient, DEGREES_T ) );
|
||||||
|
|
||||||
EDA_RECT rect = dummy.GetTextBox();
|
BOX2I rect = dummy.GetTextBox();
|
||||||
VECTOR2D size;
|
VECTOR2D size;
|
||||||
size.x = rect.GetWidth() / FSCALE;
|
size.x = rect.GetWidth() / FSCALE;
|
||||||
size.y = rect.GetHeight() / FSCALE;
|
size.y = rect.GetHeight() / FSCALE;
|
||||||
|
|
|
@ -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 )
|
switch( m_shape )
|
||||||
{
|
{
|
||||||
|
@ -812,7 +812,7 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
||||||
arect.Normalize();
|
arect.Normalize();
|
||||||
arect.Inflate( aAccuracy );
|
arect.Inflate( aAccuracy );
|
||||||
|
|
||||||
EDA_RECT bb = getBoundingBox();
|
BOX2I bb = getBoundingBox();
|
||||||
|
|
||||||
switch( m_shape )
|
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.
|
// 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
|
// Only include the center when filled; it's not necessarily inside the BB of an unfilled
|
||||||
|
|
|
@ -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();
|
VECTOR2I drawPos = GetDrawPos();
|
||||||
|
|
||||||
|
@ -509,7 +509,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
|
||||||
return m_bounding_box_cache;
|
return m_bounding_box_cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
EDA_RECT rect;
|
BOX2I rect;
|
||||||
wxArrayString strings;
|
wxArrayString strings;
|
||||||
wxString text = GetShownText();
|
wxString text = GetShownText();
|
||||||
int thickness = GetEffectiveTextPenWidth();
|
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
|
bool EDA_TEXT::TextHitTest( const VECTOR2I& aPoint, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
EDA_RECT rect = GetTextBox();
|
BOX2I rect = GetTextBox();
|
||||||
VECTOR2I location = aPoint;
|
VECTOR2I location = aPoint;
|
||||||
|
|
||||||
rect.Inflate( aAccuracy );
|
rect.Inflate( aAccuracy );
|
||||||
|
@ -942,7 +942,7 @@ void EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon( SHAPE_POLY_SET* aCorn
|
||||||
|
|
||||||
VECTOR2I corners[4]; // Buffer of polygon corners
|
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.
|
// 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.
|
// Since we use this for zone knockouts and DRC, we need something more accurate.
|
||||||
|
|
|
@ -71,10 +71,10 @@ MARKER_BASE::MARKER_BASE( int aScalingFactor, std::shared_ptr<RC_ITEM> aItem, TY
|
||||||
for( unsigned ii = 1; ii < CORNERS_COUNT; ii++ )
|
for( unsigned ii = 1; ii < CORNERS_COUNT; ii++ )
|
||||||
{
|
{
|
||||||
++point_shape;
|
++point_shape;
|
||||||
start.x = std::min( start.x, point_shape->x);
|
start.x = std::min( start.x, point_shape->x );
|
||||||
start.y = std::min( start.y, point_shape->y);
|
start.y = std::min( start.y, point_shape->y );
|
||||||
end.x = std::max( end.x, point_shape->x);
|
end.x = std::max( end.x, point_shape->x );
|
||||||
end.y = std::max( end.y, point_shape->y);
|
end.y = std::max( end.y, point_shape->y );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_shapeBoundingBox.SetOrigin( start);
|
m_shapeBoundingBox.SetOrigin( start);
|
||||||
|
@ -89,7 +89,7 @@ MARKER_BASE::~MARKER_BASE()
|
||||||
|
|
||||||
bool MARKER_BASE::HitTestMarker( const VECTOR2I& aHitPosition, int aAccuracy ) const
|
bool MARKER_BASE::HitTestMarker( const VECTOR2I& aHitPosition, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
EDA_RECT bbox = GetBoundingBoxMarker();
|
BOX2I bbox = GetBoundingBoxMarker();
|
||||||
bbox.Inflate( aAccuracy );
|
bbox.Inflate( aAccuracy );
|
||||||
|
|
||||||
// Fast hit test using boundary box. A finer test will be made if requested
|
// 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();
|
BOX2I bbox = m_shapeBoundingBox;
|
||||||
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;
|
|
||||||
|
|
||||||
return EDA_RECT( position_iu, size_iu );
|
VECTOR2I pos = m_Pos;
|
||||||
|
pos += m_shapeBoundingBox.GetPosition() * m_scalingFactor;
|
||||||
|
|
||||||
|
return BOX2I( pos, bbox.GetSize() * m_scalingFactor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <eda_item.h>
|
#include <eda_item.h>
|
||||||
|
#include <eda_rect.h>
|
||||||
#include <tool/selection.h>
|
#include <tool/selection.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,7 +94,7 @@ VECTOR2I SELECTION::GetCenter() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EDA_RECT bbox;
|
BOX2I bbox;
|
||||||
|
|
||||||
if( hasOnlyText )
|
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 )
|
for( EDA_ITEM* item : m_items )
|
||||||
bbox.Merge( item->GetBoundingBox() );
|
bbox.Merge( item->GetBoundingBox() );
|
||||||
|
|
|
@ -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
|
/* 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.
|
* calling GetTextBox() that works using top to bottom Y axis orientation.
|
||||||
*/
|
*/
|
||||||
EDA_RECT rect = GetTextBox( -1, true );
|
BOX2I rect = GetTextBox( -1, true );
|
||||||
rect.RevertYAxis();
|
rect.RevertYAxis();
|
||||||
|
|
||||||
// We are using now a bottom to top Y axis.
|
// We are using now a bottom to top Y axis.
|
||||||
|
|
|
@ -415,7 +415,7 @@ void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
|
||||||
|
|
||||||
const EDA_RECT LIB_SHAPE::GetBoundingBox() const
|
const EDA_RECT LIB_SHAPE::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
EDA_RECT rect = getBoundingBox();
|
BOX2I rect = getBoundingBox();
|
||||||
|
|
||||||
rect.RevertYAxis();
|
rect.RevertYAxis();
|
||||||
|
|
||||||
|
|
|
@ -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
|
bool aIncludePrivateItems ) const
|
||||||
{
|
{
|
||||||
EDA_RECT bbox;
|
BOX2I bbox;
|
||||||
|
|
||||||
for( const LIB_ITEM& item : m_drawings )
|
for( const LIB_ITEM& item : m_drawings )
|
||||||
{
|
{
|
||||||
|
|
|
@ -225,8 +225,8 @@ public:
|
||||||
* if aConvert == 0 Convert is non used
|
* if aConvert == 0 Convert is non used
|
||||||
* Fields are not taken in account
|
* 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;
|
bool aIncludePrivateItems ) const;
|
||||||
|
|
||||||
const EDA_RECT GetBoundingBox() const override
|
const EDA_RECT GetBoundingBox() const override
|
||||||
{
|
{
|
||||||
|
|
|
@ -133,7 +133,7 @@ void LIB_TEXT::MoveTo( const VECTOR2I& newPosition )
|
||||||
void LIB_TEXT::NormalizeJustification( bool inverse )
|
void LIB_TEXT::NormalizeJustification( bool inverse )
|
||||||
{
|
{
|
||||||
VECTOR2I delta( 0, 0 );
|
VECTOR2I delta( 0, 0 );
|
||||||
EDA_RECT bbox = GetTextBox();
|
BOX2I bbox = GetTextBox();
|
||||||
|
|
||||||
if( GetTextAngle().IsHorizontal() )
|
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
|
/* 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.
|
* calling GetTextBox() that works using top to bottom Y axis orientation.
|
||||||
*/
|
*/
|
||||||
EDA_RECT rect = GetTextBox( -1, true );
|
BOX2I rect = GetTextBox( -1, true );
|
||||||
rect.RevertYAxis();
|
rect.RevertYAxis();
|
||||||
|
|
||||||
// We are using now a bottom to top Y axis.
|
// We are using now a bottom to top Y axis.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* 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 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
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -68,7 +68,7 @@ public:
|
||||||
|
|
||||||
rect.Inflate( aAccuracy );
|
rect.Inflate( aAccuracy );
|
||||||
|
|
||||||
EDA_RECT textBox = GetTextBox();
|
BOX2I textBox = GetTextBox();
|
||||||
textBox.RevertYAxis();
|
textBox.RevertYAxis();
|
||||||
|
|
||||||
if( aContained )
|
if( aContained )
|
||||||
|
|
|
@ -1680,18 +1680,14 @@ const BOX2I SCH_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
|
||||||
DS_PROXY_VIEW_ITEM* ds = SCH_BASE_FRAME::GetCanvas()->GetView()->GetDrawingSheet();
|
DS_PROXY_VIEW_ITEM* ds = SCH_BASE_FRAME::GetCanvas()->GetView()->GetDrawingSheet();
|
||||||
EDA_ITEM* dsAsItem = static_cast<EDA_ITEM*>( ds );
|
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
|
// Calc the bounding box of all items on screen except the page border
|
||||||
for( EDA_ITEM* item : GetScreen()->Items() )
|
for( EDA_ITEM* item : GetScreen()->Items() )
|
||||||
{
|
{
|
||||||
if( item != dsAsItem ) // Ignore the drawing-sheet itself
|
if( item != dsAsItem ) // Ignore the drawing-sheet itself
|
||||||
bBoxItems.Merge( item->GetBoundingBox() );
|
bBoxDoc.Merge( item->GetBoundingBox() );
|
||||||
|
|
||||||
bBoxDoc = bBoxItems;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return bBoxDoc;
|
return bBoxDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -402,7 +402,7 @@ EDA_ANGLE SCH_FIELD::GetDrawRotation() const
|
||||||
const EDA_RECT SCH_FIELD::GetBoundingBox() const
|
const EDA_RECT SCH_FIELD::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
// Calculate the text bounding box:
|
// Calculate the text bounding box:
|
||||||
EDA_RECT rect = GetTextBox();
|
BOX2I rect = GetTextBox();
|
||||||
|
|
||||||
// Calculate the bounding box position relative to the parent:
|
// Calculate the bounding box position relative to the parent:
|
||||||
VECTOR2I origin = GetParentPosition();
|
VECTOR2I origin = GetParentPosition();
|
||||||
|
|
|
@ -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
|
// build the bounding box of the label only, without taking into account its fields
|
||||||
|
|
||||||
EDA_RECT box;
|
BOX2I box;
|
||||||
std::vector<VECTOR2I> pts;
|
std::vector<VECTOR2I> pts;
|
||||||
|
|
||||||
CreateGraphicShape( nullptr, pts, GetTextPos() );
|
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
|
// 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 )
|
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
|
bool SCH_LABEL_BASE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
EDA_RECT bbox = GetBodyBoundingBox();
|
BOX2I bbox = GetBodyBoundingBox();
|
||||||
bbox.Inflate( aAccuracy );
|
bbox.Inflate( aAccuracy );
|
||||||
|
|
||||||
if( bbox.Contains( aPosition ) )
|
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.Offset( 0, -GetTextOffset() );
|
||||||
rect.Inflate( GetEffectiveTextPenWidth() );
|
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 penWidth = GetEffectiveTextPenWidth();
|
||||||
int margin = GetTextOffset();
|
int margin = GetTextOffset();
|
||||||
|
@ -1548,7 +1548,7 @@ const EDA_RECT SCH_HIERLABEL::GetBodyBoundingBox() const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
EDA_RECT box( VECTOR2I( x, y ), VECTOR2I( dx, dy ) );
|
BOX2I box( VECTOR2I( x, y ), VECTOR2I( dx, dy ) );
|
||||||
box.Normalize();
|
box.Normalize();
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Return the bounding box of the label only, without taking in account its fields.
|
* 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.
|
* Return the bounding box of the label including its fields.
|
||||||
|
@ -225,7 +225,7 @@ public:
|
||||||
return wxT( "SCH_LABEL" );
|
return wxT( "SCH_LABEL" );
|
||||||
}
|
}
|
||||||
|
|
||||||
const EDA_RECT GetBodyBoundingBox() const override;
|
const BOX2I GetBodyBoundingBox() const override;
|
||||||
|
|
||||||
bool IsConnectable() const override { return true; }
|
bool IsConnectable() const override { return true; }
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ public:
|
||||||
void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
|
void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
|
||||||
const VECTOR2I& aPos, LABEL_FLAG_SHAPE aShape ) const;
|
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; }
|
bool IsConnectable() const override { return true; }
|
||||||
|
|
||||||
|
|
|
@ -1866,7 +1866,7 @@ void SCH_PAINTER::draw( const SCH_TEXT *aText, int aLayer )
|
||||||
// SCH_FIELD text.
|
// SCH_FIELD text.
|
||||||
if( aText->GetDrawFont()->IsOutline() )
|
if( aText->GetDrawFont()->IsOutline() )
|
||||||
{
|
{
|
||||||
EDA_RECT firstLineBBox = aText->GetTextBox( 0 );
|
BOX2I firstLineBBox = aText->GetTextBox( 0 );
|
||||||
int sizeDiff = firstLineBBox.GetHeight() - aText->GetTextSize().y;
|
int sizeDiff = firstLineBBox.GetHeight() - aText->GetTextSize().y;
|
||||||
int adjust = KiROUND( sizeDiff * 0.4 );
|
int adjust = KiROUND( sizeDiff * 0.4 );
|
||||||
VECTOR2I adjust_offset( 0, - adjust );
|
VECTOR2I adjust_offset( 0, - adjust );
|
||||||
|
|
|
@ -1438,7 +1438,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdef
|
||||||
|
|
||||||
for( size_t ii = 0; ii < strings.size(); ++ii )
|
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() };
|
VECTOR2I linePos = { bbox.GetLeft(), -bbox.GetBottom() };
|
||||||
|
|
||||||
RotatePoint( linePos, libtext->GetTextPos(), -libtext->GetTextAngle() );
|
RotatePoint( linePos, libtext->GetTextPos(), -libtext->GetTextAngle() );
|
||||||
|
|
|
@ -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;
|
VECTOR2I end;
|
||||||
EDA_RECT box( m_pos, m_size );
|
BOX2I box( m_pos, m_size );
|
||||||
int lineWidth = GetPenWidth();
|
int lineWidth = GetPenWidth();
|
||||||
int textLength = 0;
|
int textLength = 0;
|
||||||
|
|
||||||
|
@ -640,7 +640,7 @@ const EDA_RECT SCH_SHEET::GetBodyBoundingBox() const
|
||||||
|
|
||||||
const EDA_RECT SCH_SHEET::GetBoundingBox() const
|
const EDA_RECT SCH_SHEET::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
EDA_RECT box = GetBodyBoundingBox();
|
BOX2I box = GetBodyBoundingBox();
|
||||||
|
|
||||||
for( const SCH_FIELD& field : m_fields )
|
for( const SCH_FIELD& field : m_fields )
|
||||||
box.Merge( field.GetBoundingBox() );
|
box.Merge( field.GetBoundingBox() );
|
||||||
|
@ -1024,7 +1024,7 @@ BITMAPS SCH_SHEET::GetMenuImage() const
|
||||||
|
|
||||||
bool SCH_SHEET::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
bool SCH_SHEET::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
EDA_RECT rect = GetBodyBoundingBox();
|
BOX2I rect = GetBodyBoundingBox();
|
||||||
|
|
||||||
rect.Inflate( aAccuracy );
|
rect.Inflate( aAccuracy );
|
||||||
|
|
||||||
|
|
|
@ -248,7 +248,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Return a bounding box for the sheet body but not the fields.
|
* 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;
|
const EDA_RECT GetBoundingBox() const override;
|
||||||
|
|
||||||
|
|
|
@ -1396,9 +1396,9 @@ void SCH_SYMBOL::Show( int nestLevel, std::ostream& os ) const
|
||||||
#endif
|
#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 )
|
if( m_part )
|
||||||
bBox = m_part->GetBodyBoundingBox( m_unit, m_convert, aIncludePins, false );
|
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 );
|
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
|
bool SCH_SYMBOL::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
EDA_RECT bBox = GetBodyBoundingBox();
|
BOX2I bBox = GetBodyBoundingBox();
|
||||||
bBox.Inflate( aAccuracy / 2 );
|
bBox.Inflate( aAccuracy / 2 );
|
||||||
|
|
||||||
if( bBox.Contains( aPosition ) )
|
if( bBox.Contains( aPosition ) )
|
||||||
|
|
|
@ -330,7 +330,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Return a bounding box for the symbol body but not the pins or fields.
|
* 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.
|
* 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;
|
bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EDA_RECT doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) const;
|
BOX2I doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) const;
|
||||||
|
|
||||||
bool doIsConnected( const VECTOR2I& aPosition ) const override;
|
bool doIsConnected( const VECTOR2I& aPosition ) const override;
|
||||||
|
|
||||||
|
|
|
@ -300,7 +300,7 @@ void SCH_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
|
||||||
// SCH_FIELD text.
|
// SCH_FIELD text.
|
||||||
if( GetDrawFont()->IsOutline() )
|
if( GetDrawFont()->IsOutline() )
|
||||||
{
|
{
|
||||||
EDA_RECT firstLineBBox = GetTextBox( 0 );
|
BOX2I firstLineBBox = GetTextBox( 0 );
|
||||||
int sizeDiff = firstLineBBox.GetHeight() - GetTextSize().y;
|
int sizeDiff = firstLineBBox.GetHeight() - GetTextSize().y;
|
||||||
int adjust = KiROUND( sizeDiff * 0.4 );
|
int adjust = KiROUND( sizeDiff * 0.4 );
|
||||||
VECTOR2I adjust_offset( 0, - adjust );
|
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
|
const EDA_RECT SCH_TEXT::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
EDA_RECT rect = GetTextBox();
|
BOX2I rect = GetTextBox();
|
||||||
|
|
||||||
if( !GetTextAngle().IsZero() ) // Rotate rect.
|
if( !GetTextAngle().IsZero() ) // Rotate rect.
|
||||||
{
|
{
|
||||||
|
@ -456,7 +456,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
||||||
// SCH_FIELD text.
|
// SCH_FIELD text.
|
||||||
if( GetDrawFont()->IsOutline() )
|
if( GetDrawFont()->IsOutline() )
|
||||||
{
|
{
|
||||||
EDA_RECT firstLineBBox = GetTextBox( 0 );
|
BOX2I firstLineBBox = GetTextBox( 0 );
|
||||||
int sizeDiff = firstLineBBox.GetHeight() - GetTextSize().y;
|
int sizeDiff = firstLineBBox.GetHeight() - GetTextSize().y;
|
||||||
int adjust = KiROUND( sizeDiff * 0.4 );
|
int adjust = KiROUND( sizeDiff * 0.4 );
|
||||||
VECTOR2I adjust_offset( 0, - adjust );
|
VECTOR2I adjust_offset( 0, - adjust );
|
||||||
|
|
|
@ -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 )
|
for( EDA_ITEM* item : m_items )
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
|
|
||||||
EDA_ITEM* GetTopLeftItem( bool onlyModules = false ) const override;
|
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; }
|
void SetScreen( SCH_SCREEN* aScreen ) { m_screen = aScreen; }
|
||||||
SCH_SCREEN* GetScreen() { return m_screen; }
|
SCH_SCREEN* GetScreen() { return m_screen; }
|
||||||
|
|
|
@ -1058,8 +1058,8 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const
|
||||||
|
|
||||||
for( EDA_ITEM* item : collector )
|
for( EDA_ITEM* item : collector )
|
||||||
{
|
{
|
||||||
EDA_RECT bbox = item->GetBoundingBox();
|
BOX2I bbox = item->GetBoundingBox();
|
||||||
int dist = INT_MAX / 2;
|
int dist = INT_MAX / 2;
|
||||||
|
|
||||||
if( exactHits.count( item ) )
|
if( exactHits.count( item ) )
|
||||||
{
|
{
|
||||||
|
@ -1129,7 +1129,7 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const
|
||||||
// for selection and can be dropped.
|
// for selection and can be dropped.
|
||||||
if( closest ) // Don't try and get a tight bbox if nothing is near the mouse pointer
|
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 );
|
tightBox.Inflate( -tightBox.GetWidth() / 4, -tightBox.GetHeight() / 4 );
|
||||||
|
|
||||||
for( int i = collector.GetCount() - 1; i >= 0; --i )
|
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 )
|
for( SCH_ITEM* item : items )
|
||||||
select( item );
|
select( item );
|
||||||
|
|
||||||
EDA_RECT bbox = m_selection.GetBoundingBox();
|
BOX2I bbox = m_selection.GetBoundingBox();
|
||||||
|
|
||||||
if( bbox.GetWidth() != 0 && bbox.GetHeight() != 0 )
|
if( bbox.GetWidth() != 0 && bbox.GetHeight() != 0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1226,7 +1226,7 @@ int SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires( const TOOL_EVENT& aEvent )
|
||||||
SCH_SCREEN* screen = sch->CurrentSheet().LastScreen();
|
SCH_SCREEN* screen = sch->CurrentSheet().LastScreen();
|
||||||
|
|
||||||
std::set<SCH_LINE*> lines;
|
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 ) )
|
for( EDA_ITEM* item : screen->Items().Overlapping( SCH_LINE_T, bb ) )
|
||||||
lines.insert( static_cast<SCH_LINE*>( item ) );
|
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::vector<VECTOR2I> connections = m_frame->GetSchematicConnections();
|
||||||
|
|
||||||
std::set<SCH_LINE*> lines;
|
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 ) )
|
for( EDA_ITEM* item : m_frame->GetScreen()->Items().Overlapping( SCH_LINE_T, bb ) )
|
||||||
lines.insert( static_cast<SCH_LINE*>( item ) );
|
lines.insert( static_cast<SCH_LINE*>( item ) );
|
||||||
|
|
|
@ -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;
|
BOX2I bbox; // Start with a fresh BOX2I so the Merge algorithm works
|
||||||
bool first_item = true;
|
|
||||||
|
|
||||||
for( unsigned layer = 0; layer < GetImagesList()->ImagesMaxCount(); ++layer )
|
for( unsigned layer = 0; layer < GetImagesList()->ImagesMaxCount(); ++layer )
|
||||||
{
|
{
|
||||||
|
@ -57,15 +56,7 @@ EDA_RECT GBR_LAYOUT::ComputeBoundingBox() const
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for( GERBER_DRAW_ITEM* item : gerber->GetItems() )
|
for( GERBER_DRAW_ITEM* item : gerber->GetItems() )
|
||||||
{
|
bbox.Merge( item->GetBoundingBox() );
|
||||||
if( first_item )
|
|
||||||
{
|
|
||||||
bbox = item->GetBoundingBox();
|
|
||||||
first_item = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
bbox.Merge( item->GetBoundingBox() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bbox.Normalize();
|
bbox.Normalize();
|
||||||
|
|
|
@ -68,7 +68,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return the full item list bounding box.
|
* @return the full item list bounding box.
|
||||||
*/
|
*/
|
||||||
EDA_RECT ComputeBoundingBox() const;
|
BOX2I ComputeBoundingBox() const;
|
||||||
|
|
||||||
const EDA_RECT GetBoundingBox() const override
|
const EDA_RECT GetBoundingBox() const override
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,7 +95,7 @@ void GERBVIEW_PRINTOUT::setupGal( KIGFX::GAL* aGal )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDA_RECT GERBVIEW_PRINTOUT::getBoundingBox()
|
BOX2I GERBVIEW_PRINTOUT::getBoundingBox()
|
||||||
{
|
{
|
||||||
return m_layout->ComputeBoundingBox();
|
return m_layout->ComputeBoundingBox();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ protected:
|
||||||
|
|
||||||
void setupGal( KIGFX::GAL* aGal ) override;
|
void setupGal( KIGFX::GAL* aGal ) override;
|
||||||
|
|
||||||
EDA_RECT getBoundingBox() override;
|
BOX2I getBoundingBox() override;
|
||||||
|
|
||||||
std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) override;
|
std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) override;
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ protected:
|
||||||
virtual void setupGal( KIGFX::GAL* aGal );
|
virtual void setupGal( KIGFX::GAL* aGal );
|
||||||
|
|
||||||
///< Returns bounding box of the printed objects (excluding drawing-sheet frame)
|
///< 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.
|
///< Returns a PAINTER instance used to draw the items.
|
||||||
virtual std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) = 0;
|
virtual std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) = 0;
|
||||||
|
|
|
@ -325,9 +325,9 @@ protected:
|
||||||
virtual EDA_ANGLE getParentOrientation() const = 0;
|
virtual EDA_ANGLE getParentOrientation() const = 0;
|
||||||
virtual VECTOR2I getParentPosition() 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 VECTOR2I& aPosition, int aAccuracy = 0 ) const;
|
||||||
bool hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const;
|
bool hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const;
|
||||||
|
|
|
@ -271,7 +271,7 @@ public:
|
||||||
* this rectangle is calculated for 0 orient text.
|
* this rectangle is calculated for 0 orient text.
|
||||||
* If orientation is not 0 the rect must be rotated to match the physical area
|
* 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.
|
* Return the distance between two lines of text.
|
||||||
|
|
|
@ -120,7 +120,7 @@ public:
|
||||||
* object, and the units should be in the pcb or schematic coordinate system.
|
* object, and the units should be in the pcb or schematic coordinate system.
|
||||||
* It is OK to overestimate the size by a few counts.
|
* It is OK to overestimate the size by a few counts.
|
||||||
*/
|
*/
|
||||||
EDA_RECT GetBoundingBoxMarker() const;
|
BOX2I GetBoundingBoxMarker() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual KIGFX::COLOR4D getColor() const = 0;
|
virtual KIGFX::COLOR4D getColor() const = 0;
|
||||||
|
@ -135,7 +135,7 @@ protected:
|
||||||
|
|
||||||
int m_scalingFactor; // Scaling factor to convert corners coordinates
|
int m_scalingFactor; // Scaling factor to convert corners coordinates
|
||||||
// to internal units 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
|
// to the position of the shape, in marker shape
|
||||||
// units
|
// units
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2008-2016 Wayne Stambaugh <stambaughw@gmail.com>
|
* 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
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* 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
|
* 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
|
#ifndef PCB_BASE_FRAME_H
|
||||||
#define 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 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 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
|
* @param aTitle is the new title of the 3D frame, or nullptr to do not change the frame title
|
||||||
* frame title
|
|
||||||
*/
|
*/
|
||||||
virtual void Update3DView( bool aMarkDirty, bool aRefresh,
|
virtual void Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle = nullptr );
|
||||||
const wxString* aTitle = nullptr );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempt to load \a aFootprintId from the footprint library table.
|
* 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.
|
* @param aBoardEdgesOnly is true if we are interested in board edge segments only.
|
||||||
* @return the board's bounding box.
|
* @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
|
const BOX2I GetDocumentExtents( bool aIncludeAllVisible = true ) const override
|
||||||
{
|
{
|
||||||
|
@ -414,7 +407,7 @@ protected:
|
||||||
PCB_ORIGIN_TRANSFORMS m_originTransforms;
|
PCB_ORIGIN_TRANSFORMS m_originTransforms;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NL_PCBNEW_PLUGIN* m_spaceMouse;
|
NL_PCBNEW_PLUGIN* m_spaceMouse;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PCB_BASE_FRAME_H
|
#endif // PCB_BASE_FRAME_H
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013-2017 CERN
|
* 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 Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||||
*
|
*
|
||||||
|
@ -30,7 +30,6 @@
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <core/typeinfo.h>
|
#include <core/typeinfo.h>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <eda_rect.h>
|
|
||||||
#include <eda_item.h>
|
#include <eda_item.h>
|
||||||
#include <view/view_group.h>
|
#include <view/view_group.h>
|
||||||
|
|
||||||
|
@ -127,31 +126,33 @@ public:
|
||||||
const std::vector<EDA_ITEM*> GetItemsSortedByTypeAndXY( bool leftBeforeRight = true,
|
const std::vector<EDA_ITEM*> GetItemsSortedByTypeAndXY( bool leftBeforeRight = true,
|
||||||
bool topBeforeBottom = true ) const
|
bool topBeforeBottom = true ) const
|
||||||
{
|
{
|
||||||
std::vector<EDA_ITEM*> sorted_items =
|
std::vector<EDA_ITEM*> sorted_items = std::vector<EDA_ITEM*>( m_items.begin(),
|
||||||
std::vector<EDA_ITEM*>( m_items.begin(), m_items.end() );
|
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(),
|
||||||
if( a->Type() == b->Type() )
|
[&]( EDA_ITEM* a, EDA_ITEM* b )
|
||||||
{
|
|
||||||
if( a->GetSortPosition().x == b->GetSortPosition().x )
|
|
||||||
{
|
{
|
||||||
// Ensure deterministic sort
|
if( a->Type() == b->Type() )
|
||||||
if( a->GetSortPosition().y == b->GetSortPosition().y )
|
{
|
||||||
return a->m_Uuid < b->m_Uuid;
|
if( a->GetSortPosition().x == b->GetSortPosition().x )
|
||||||
|
{
|
||||||
|
// Ensure deterministic sort
|
||||||
|
if( a->GetSortPosition().y == b->GetSortPosition().y )
|
||||||
|
return a->m_Uuid < b->m_Uuid;
|
||||||
|
|
||||||
if( topBeforeBottom )
|
if( topBeforeBottom )
|
||||||
return a->GetSortPosition().y < b->GetSortPosition().y;
|
return a->GetSortPosition().y < b->GetSortPosition().y;
|
||||||
|
else
|
||||||
|
return a->GetSortPosition().y > b->GetSortPosition().y;
|
||||||
|
}
|
||||||
|
else if( leftBeforeRight )
|
||||||
|
return a->GetSortPosition().x < b->GetSortPosition().x;
|
||||||
|
else
|
||||||
|
return a->GetSortPosition().x > b->GetSortPosition().x;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return a->GetSortPosition().y > b->GetSortPosition().y;
|
return a->Type() < b->Type();
|
||||||
}
|
} );
|
||||||
else if( leftBeforeRight )
|
|
||||||
return a->GetSortPosition().x < b->GetSortPosition().x;
|
|
||||||
else
|
|
||||||
return a->GetSortPosition().x > b->GetSortPosition().x;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return a->Type() < b->Type();
|
|
||||||
} );
|
|
||||||
|
|
||||||
return sorted_items;
|
return sorted_items;
|
||||||
}
|
}
|
||||||
|
@ -169,10 +170,10 @@ public:
|
||||||
/// Returns the top left point of the selection area bounding box.
|
/// Returns the top left point of the selection area bounding box.
|
||||||
VECTOR2I GetPosition() const
|
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
|
virtual EDA_ITEM* GetTopLeftItem( bool onlyModules = false ) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 CERN
|
* 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
|
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
|
|
@ -23,18 +23,19 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <eda_item.h>
|
#include <eda_item.h>
|
||||||
|
#include <eda_rect.h>
|
||||||
#include "tools/pl_selection.h"
|
#include "tools/pl_selection.h"
|
||||||
|
|
||||||
|
|
||||||
EDA_ITEM* PL_SELECTION::GetTopLeftItem( bool onlyModules ) const
|
EDA_ITEM* PL_SELECTION::GetTopLeftItem( bool onlyModules ) const
|
||||||
{
|
{
|
||||||
EDA_ITEM* topLeftItem = nullptr;
|
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
|
// find the leftmost (smallest x coord) and highest (smallest y with the smallest x) item in the selection
|
||||||
for( EDA_ITEM* item : m_items )
|
for( EDA_ITEM* item : m_items )
|
||||||
{
|
{
|
||||||
EDA_RECT currentItemBB = item->GetBoundingBox();
|
BOX2I currentItemBB = item->GetBoundingBox();
|
||||||
|
|
||||||
if( topLeftItem == nullptr )
|
if( topLeftItem == nullptr )
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,7 +61,7 @@ static int refreshCallback( FOOTPRINT* aFootprint )
|
||||||
|
|
||||||
int AUTOPLACE_TOOL::autoplace( std::vector<FOOTPRINT*>& aFootprints, bool aPlaceOffboard )
|
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 )
|
if( bbox.GetWidth() == 0 || bbox.GetHeight() == 0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1151,12 +1151,12 @@ 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();
|
LSET visible = GetVisibleLayers();
|
||||||
bool showInvisibleText = IsElementVisible( LAYER_MOD_TEXT_INVISIBLE )
|
bool showInvisibleText = IsElementVisible( LAYER_MOD_TEXT_INVISIBLE )
|
||||||
&& PgmOrNull() && !PgmOrNull()->m_Printing;
|
&& PgmOrNull() && !PgmOrNull()->m_Printing;
|
||||||
|
|
||||||
if( aBoardEdgesOnly )
|
if( aBoardEdgesOnly )
|
||||||
visible.set( Edge_Cuts );
|
visible.set( Edge_Cuts );
|
||||||
|
|
|
@ -801,7 +801,7 @@ public:
|
||||||
* @param aBoardEdgesOnly is true if we are interested in board edge segments only.
|
* @param aBoardEdgesOnly is true if we are interested in board edge segments only.
|
||||||
* @return the board's bounding box.
|
* @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
|
const EDA_RECT GetBoundingBox() const override
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* 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
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* 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
|
// create a rectangular outline, or, failing that, the bounding box of the items on
|
||||||
// the board.
|
// the board.
|
||||||
|
|
||||||
EDA_RECT bbbox = aBoard->GetBoardEdgesBoundingBox();
|
BOX2I bbbox = aBoard->GetBoardEdgesBoundingBox();
|
||||||
|
|
||||||
// If null area, uses the global bounding box.
|
// If null area, uses the global bounding box.
|
||||||
if( ( bbbox.GetWidth() ) == 0 || ( bbbox.GetHeight() == 0 ) )
|
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 )
|
void buildBoardBoundingBoxPoly( const BOARD* aBoard, SHAPE_POLY_SET& aOutline )
|
||||||
{
|
{
|
||||||
EDA_RECT bbbox = aBoard->GetBoundingBox();
|
BOX2I bbbox = aBoard->GetBoundingBox();
|
||||||
SHAPE_LINE_CHAIN chain;
|
SHAPE_LINE_CHAIN chain;
|
||||||
|
|
||||||
// If null area, uses the global bounding box.
|
// If null area, uses the global bounding box.
|
||||||
|
|
|
@ -194,7 +194,7 @@ void PCB_EDIT_FRAME::OnExportIDF3( wxCommandEvent& event )
|
||||||
|
|
||||||
if( dlg.GetAutoAdjustOffset() )
|
if( dlg.GetAutoAdjustOffset() )
|
||||||
{
|
{
|
||||||
EDA_RECT bbox = GetBoard()->GetBoardEdgesBoundingBox();
|
BOX2I bbox = GetBoard()->GetBoardEdgesBoundingBox();
|
||||||
|
|
||||||
aXRef = bbox.Centre().x * MM_PER_IU;
|
aXRef = bbox.Centre().x * MM_PER_IU;
|
||||||
aYRef = bbox.Centre().y * MM_PER_IU;
|
aYRef = bbox.Centre().y * MM_PER_IU;
|
||||||
|
|
|
@ -429,7 +429,7 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
case DIALOG_EXPORT_STEP::STEP_ORG_BOARD_CENTER:
|
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 );
|
xOrg = Iu2Millimeter( bbox.GetCenter().x );
|
||||||
yOrg = Iu2Millimeter( bbox.GetCenter().y );
|
yOrg = Iu2Millimeter( bbox.GetCenter().y );
|
||||||
LOCALE_IO dummy;
|
LOCALE_IO dummy;
|
||||||
|
@ -497,7 +497,7 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
case DIALOG_EXPORT_STEP::STEP_ORG_BOARD_CENTER:
|
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 );
|
xOrg = Iu2Millimeter( bbox.GetCenter().x );
|
||||||
yOrg = Iu2Millimeter( bbox.GetCenter().y );
|
yOrg = Iu2Millimeter( bbox.GetCenter().y );
|
||||||
params.m_xOrigin = xOrg;
|
params.m_xOrigin = xOrg;
|
||||||
|
|
|
@ -337,8 +337,8 @@ bool DIALOG_EXPORT_SVG::CreateSVGFile( const wxString& aFullFileName )
|
||||||
|
|
||||||
if( m_rbSvgPageSizeOpt->GetSelection() == 2 ) // Page is board boundary size
|
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();
|
PAGE_INFO currpageInfo = m_board->GetPageSettings();
|
||||||
|
|
||||||
currpageInfo.SetWidthMils( bbox.GetWidth() / IU_PER_MILS );
|
currpageInfo.SetWidthMils( bbox.GetWidth() / IU_PER_MILS );
|
||||||
currpageInfo.SetHeightMils( bbox.GetHeight() / IU_PER_MILS );
|
currpageInfo.SetHeightMils( bbox.GetHeight() / IU_PER_MILS );
|
||||||
|
|
|
@ -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,
|
DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT( PCB_BASE_FRAME *aParent, VECTOR2I& aTranslate,
|
||||||
EDA_ANGLE& aRotate, ROTATION_ANCHOR& aAnchor,
|
EDA_ANGLE& aRotate, ROTATION_ANCHOR& aAnchor,
|
||||||
const EDA_RECT& aBbox ) :
|
const BOX2I& aBbox ) :
|
||||||
DIALOG_MOVE_EXACT_BASE( aParent ),
|
DIALOG_MOVE_EXACT_BASE( aParent ),
|
||||||
m_translation( aTranslate ),
|
m_translation( aTranslate ),
|
||||||
m_rotation( aRotate ),
|
m_rotation( aRotate ),
|
||||||
|
|
|
@ -47,7 +47,7 @@ class DIALOG_MOVE_EXACT : public DIALOG_MOVE_EXACT_BASE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DIALOG_MOVE_EXACT( PCB_BASE_FRAME* aParent, VECTOR2I& aTranslate, EDA_ANGLE& aRotate,
|
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() { };
|
~DIALOG_MOVE_EXACT() { };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -113,7 +113,7 @@ private:
|
||||||
VECTOR2I& m_translation;
|
VECTOR2I& m_translation;
|
||||||
EDA_ANGLE& m_rotation;
|
EDA_ANGLE& m_rotation;
|
||||||
ROTATION_ANCHOR& m_rotationAnchor;
|
ROTATION_ANCHOR& m_rotationAnchor;
|
||||||
const EDA_RECT& m_bbox;
|
const BOX2I& m_bbox;
|
||||||
|
|
||||||
UNIT_BINDER m_moveX;
|
UNIT_BINDER m_moveX;
|
||||||
UNIT_BINDER m_moveY;
|
UNIT_BINDER m_moveY;
|
||||||
|
|
|
@ -304,7 +304,7 @@ std::string PLACE_FILE_EXPORTER::GenReportData()
|
||||||
|
|
||||||
buffer += "\n$BeginDESCRIPTION\n";
|
buffer += "\n$BeginDESCRIPTION\n";
|
||||||
|
|
||||||
EDA_RECT bbbox = m_board->ComputeBoundingBox();
|
BOX2I bbbox = m_board->ComputeBoundingBox();
|
||||||
|
|
||||||
buffer += "\n$BOARD\n";
|
buffer += "\n$BOARD\n";
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@ UseBoundingBox:
|
||||||
// Fetch a rectangular bounding box for the board; there is always some uncertainty in the
|
// 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
|
// board dimensions computed via ComputeBoundingBox() since this depends on the individual
|
||||||
// footprint entities.
|
// footprint entities.
|
||||||
EDA_RECT bbbox = aPcb->GetBoardEdgesBoundingBox();
|
BOX2I bbbox = aPcb->GetBoardEdgesBoundingBox();
|
||||||
|
|
||||||
// convert to mm and compensate for an assumed LINE_WIDTH line thickness
|
// convert to mm and compensate for an assumed LINE_WIDTH line thickness
|
||||||
double x = ( bbbox.GetOrigin().x + LINE_WIDTH / 2 ) * scale + offX;
|
double x = ( bbbox.GetOrigin().x + LINE_WIDTH / 2 ) * scale + offX;
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <plotters/plotter_dxf.h>
|
#include <plotters/plotter_dxf.h>
|
||||||
#include <plotters/plotter_hpgl.h>
|
|
||||||
#include <plotters/plotter_gerber.h>
|
#include <plotters/plotter_gerber.h>
|
||||||
#include <plotters/plotters_pslike.h>
|
#include <plotters/plotters_pslike.h>
|
||||||
#include <eda_item.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
|
// to calculate the board edges bounding box
|
||||||
LSET visibleLayers = m_pcb->GetVisibleLayers();
|
LSET visibleLayers = m_pcb->GetVisibleLayers();
|
||||||
m_pcb->SetVisibleLayers( visibleLayers | LSET( Edge_Cuts ) );
|
m_pcb->SetVisibleLayers( visibleLayers | LSET( Edge_Cuts ) );
|
||||||
EDA_RECT bbbox = m_pcb->GetBoardEdgesBoundingBox();
|
BOX2I bbbox = m_pcb->GetBoardEdgesBoundingBox();
|
||||||
m_pcb->SetVisibleLayers( visibleLayers );
|
m_pcb->SetVisibleLayers( visibleLayers );
|
||||||
|
|
||||||
// Some formats cannot be used to generate a document like the map files
|
// Some formats cannot be used to generate a document like the map files
|
||||||
|
|
|
@ -266,7 +266,7 @@ void GERBER_JOBFILE_WRITER::addJSONGeneralSpecs()
|
||||||
m_json["GeneralSpecs"]["ProjectId"]["Revision"] = rev.ToAscii();
|
m_json["GeneralSpecs"]["ProjectId"]["Revision"] = rev.ToAscii();
|
||||||
|
|
||||||
// output the board size in mm:
|
// 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"]["X"] = mapValue( brect.GetWidth() );
|
||||||
m_json["GeneralSpecs"]["Size"]["Y"] = mapValue( brect.GetHeight() );
|
m_json["GeneralSpecs"]["Size"]["Y"] = mapValue( brect.GetHeight() );
|
||||||
|
|
|
@ -208,7 +208,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
|
||||||
GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CMP_FOOTPRINT );
|
GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CMP_FOOTPRINT );
|
||||||
|
|
||||||
// bbox of fp pads, pos 0, rot 0, non flipped
|
// 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
|
// negate bbox Y values if the fp is flipped (always flipped around X axis
|
||||||
// in Gerber P&P files).
|
// in Gerber P&P files).
|
||||||
|
|
|
@ -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
|
// We want the bounding box of the footprint pads at rot 0, not flipped
|
||||||
// Create such a image:
|
// Create such a image:
|
||||||
|
|
|
@ -159,7 +159,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return The rectangle containing the pads for the normalized footprint.
|
* @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.
|
* Return a bounding polygon for the shapes and pads in the footprint.
|
||||||
|
|
|
@ -74,7 +74,7 @@ FP_TEXT::~FP_TEXT()
|
||||||
|
|
||||||
bool FP_TEXT::TextHitTest( const VECTOR2I& aPoint, int aAccuracy ) const
|
bool FP_TEXT::TextHitTest( const VECTOR2I& aPoint, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
EDA_RECT rect = GetTextBox();
|
BOX2I rect = GetTextBox();
|
||||||
VECTOR2I location = aPoint;
|
VECTOR2I location = aPoint;
|
||||||
|
|
||||||
rect.Inflate( aAccuracy );
|
rect.Inflate( aAccuracy );
|
||||||
|
@ -222,7 +222,7 @@ void FP_TEXT::SetLocalCoord()
|
||||||
const EDA_RECT FP_TEXT::GetBoundingBox() const
|
const EDA_RECT FP_TEXT::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
EDA_ANGLE angle = GetDrawRotation();
|
EDA_ANGLE angle = GetDrawRotation();
|
||||||
EDA_RECT text_area = GetTextBox();
|
BOX2I text_area = GetTextBox();
|
||||||
|
|
||||||
if( !angle.IsZero() )
|
if( !angle.IsZero() )
|
||||||
text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
|
text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
|
||||||
|
@ -337,7 +337,7 @@ EDA_ITEM* FP_TEXT::Clone() const
|
||||||
const BOX2I FP_TEXT::ViewBBox() const
|
const BOX2I FP_TEXT::ViewBBox() const
|
||||||
{
|
{
|
||||||
EDA_ANGLE angle = GetDrawRotation();
|
EDA_ANGLE angle = GetDrawRotation();
|
||||||
EDA_RECT text_area = GetTextBox();
|
BOX2I text_area = GetTextBox();
|
||||||
|
|
||||||
if( !angle.IsZero() )
|
if( !angle.IsZero() )
|
||||||
text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
|
text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
|
||||||
|
|
|
@ -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() )
|
if( !m_board->IsEmpty() )
|
||||||
{
|
{
|
||||||
// Position new components below any existing board features.
|
// Position new components below any existing board features.
|
||||||
EDA_RECT bbox = m_board->GetBoardEdgesBoundingBox();
|
BOX2I bbox = m_board->GetBoardEdgesBoundingBox();
|
||||||
|
|
||||||
if( bbox.GetWidth() || bbox.GetHeight() )
|
if( bbox.GetWidth() || bbox.GetHeight() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
* 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
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -98,7 +98,7 @@ private:
|
||||||
void cachePinFunction( PAD* aPad, const wxString& aPinFunction );
|
void cachePinFunction( PAD* aPad, const wxString& aPinFunction );
|
||||||
wxString getPinFunction( PAD* aPad );
|
wxString getPinFunction( PAD* aPad );
|
||||||
|
|
||||||
wxPoint estimateFootprintInsertionPosition();
|
VECTOR2I estimateFootprintInsertionPosition();
|
||||||
|
|
||||||
FOOTPRINT* addNewFootprint( COMPONENT* aComponent );
|
FOOTPRINT* addNewFootprint( COMPONENT* aComponent );
|
||||||
|
|
||||||
|
|
|
@ -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 )
|
if( area.GetWidth() == 0 && area.GetHeight() == 0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -649,8 +649,8 @@ void PCB_DIM_ALIGNED::updateGeometry()
|
||||||
|
|
||||||
// Now that we have the text updated, we can determine how to draw the crossbar.
|
// 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
|
// 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() );
|
- m_text.GetEffectiveTextPenWidth() );
|
||||||
|
|
||||||
SHAPE_POLY_SET polyBox;
|
SHAPE_POLY_SET polyBox;
|
||||||
polyBox.NewOutline();
|
polyBox.NewOutline();
|
||||||
|
@ -827,8 +827,8 @@ void PCB_DIM_ORTHOGONAL::updateGeometry()
|
||||||
|
|
||||||
// Now that we have the text updated, we can determine how to draw the crossbar.
|
// 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
|
// 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() );
|
m_text.GetEffectiveTextPenWidth() );
|
||||||
|
|
||||||
SHAPE_POLY_SET polyBox;
|
SHAPE_POLY_SET polyBox;
|
||||||
polyBox.NewOutline();
|
polyBox.NewOutline();
|
||||||
|
@ -1001,8 +1001,8 @@ void PCB_DIM_LEADER::updateGeometry()
|
||||||
|
|
||||||
// Now that we have the text updated, we can determine how to draw the second line
|
// 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
|
// 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() );
|
m_text.GetEffectiveTextPenWidth() );
|
||||||
|
|
||||||
SHAPE_POLY_SET polyBox;
|
SHAPE_POLY_SET polyBox;
|
||||||
polyBox.NewOutline();
|
polyBox.NewOutline();
|
||||||
|
@ -1191,8 +1191,8 @@ void PCB_DIM_RADIAL::updateGeometry()
|
||||||
|
|
||||||
// Now that we have the text updated, we can determine how to draw the second line
|
// 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
|
// 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() );
|
m_text.GetEffectiveTextPenWidth() );
|
||||||
|
|
||||||
SHAPE_POLY_SET polyBox;
|
SHAPE_POLY_SET polyBox;
|
||||||
polyBox.NewOutline();
|
polyBox.NewOutline();
|
||||||
|
|
|
@ -141,7 +141,7 @@ void PCB_SHAPE::NormalizeRect()
|
||||||
VECTOR2I start = GetStart();
|
VECTOR2I start = GetStart();
|
||||||
VECTOR2I end = GetEnd();
|
VECTOR2I end = GetEnd();
|
||||||
|
|
||||||
EDA_RECT rect( start, end - start );
|
BOX2I rect( start, end - start );
|
||||||
rect.Normalize();
|
rect.Normalize();
|
||||||
|
|
||||||
SetStart( rect.GetPosition() );
|
SetStart( rect.GetPosition() );
|
||||||
|
|
|
@ -159,7 +159,7 @@ int PCB_TEXT::getKnockoutMargin() const
|
||||||
|
|
||||||
const EDA_RECT PCB_TEXT::GetBoundingBox() const
|
const EDA_RECT PCB_TEXT::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
EDA_RECT rect = GetTextBox();
|
BOX2I rect = GetTextBox();
|
||||||
|
|
||||||
if( IsKnockout() )
|
if( IsKnockout() )
|
||||||
rect.Inflate( getKnockoutMargin() );
|
rect.Inflate( getKnockoutMargin() );
|
||||||
|
|
|
@ -270,7 +270,7 @@ void PCBNEW_PRINTOUT::setupGal( KIGFX::GAL* aGal )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDA_RECT PCBNEW_PRINTOUT::getBoundingBox()
|
BOX2I PCBNEW_PRINTOUT::getBoundingBox()
|
||||||
{
|
{
|
||||||
return m_board->ComputeBoundingBox();
|
return m_board->ComputeBoundingBox();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 CERN
|
* 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>
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||||
*
|
*
|
||||||
|
@ -66,7 +66,7 @@ protected:
|
||||||
|
|
||||||
void setupGal( KIGFX::GAL* aGal ) override;
|
void setupGal( KIGFX::GAL* aGal ) override;
|
||||||
|
|
||||||
EDA_RECT getBoundingBox() override;
|
BOX2I getBoundingBox() override;
|
||||||
|
|
||||||
std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) override;
|
std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) override;
|
||||||
|
|
||||||
|
|
|
@ -998,7 +998,7 @@ static void initializePlotter( PLOTTER* aPlotter, const BOARD* aBoard,
|
||||||
autocenter = (aPlotOpts->GetScale() != 1.0);
|
autocenter = (aPlotOpts->GetScale() != 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EDA_RECT bbox = aBoard->ComputeBoundingBox();
|
BOX2I bbox = aBoard->ComputeBoundingBox();
|
||||||
VECTOR2I boardCenter = bbox.Centre();
|
VECTOR2I boardCenter = bbox.Centre();
|
||||||
VECTOR2I boardSize = bbox.GetSize();
|
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
|
* 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
|
const int margin = 5 * IU_PER_MM; // Add a 5 mm margin around the board
|
||||||
aPlotter->SetNegative( true );
|
aPlotter->SetNegative( true );
|
||||||
aPlotter->SetColor( WHITE ); // Which will be plotted as black
|
aPlotter->SetColor( WHITE ); // Which will be plotted as black
|
||||||
EDA_RECT area = aBbbox;
|
|
||||||
|
BOX2I area = aBbbox;
|
||||||
area.Inflate( margin );
|
area.Inflate( margin );
|
||||||
aPlotter->Rect( area.GetOrigin(), area.GetEnd(), FILL_T::FILLED_SHAPE );
|
aPlotter->Rect( area.GetOrigin(), area.GetEnd(), FILL_T::FILLED_SHAPE );
|
||||||
aPlotter->SetColor( BLACK );
|
aPlotter->SetColor( BLACK );
|
||||||
|
@ -1192,7 +1193,7 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aL
|
||||||
// done in the driver (if supported)
|
// done in the driver (if supported)
|
||||||
if( aPlotOpts->GetNegative() )
|
if( aPlotOpts->GetNegative() )
|
||||||
{
|
{
|
||||||
EDA_RECT bbox = aBoard->ComputeBoundingBox();
|
BOX2I bbox = aBoard->ComputeBoundingBox();
|
||||||
FillNegativeKnockout( plotter, bbox );
|
FillNegativeKnockout( plotter, bbox );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -636,7 +636,7 @@ void ALTIUM_PCB::Parse( const ALTIUM_COMPOUND_FILE& altiumPcbFi
|
||||||
}
|
}
|
||||||
|
|
||||||
// center board
|
// center board
|
||||||
EDA_RECT bbbox = m_board->GetBoardEdgesBoundingBox();
|
BOX2I bbbox = m_board->GetBoardEdgesBoundingBox();
|
||||||
|
|
||||||
int w = m_board->GetPageSettings().GetWidthIU( IU_PER_MILS );
|
int w = m_board->GetPageSettings().GetWidthIU( IU_PER_MILS );
|
||||||
int h = m_board->GetPageSettings().GetHeightIU( IU_PER_MILS );
|
int h = m_board->GetPageSettings().GetHeightIU( IU_PER_MILS );
|
||||||
|
|
|
@ -126,7 +126,7 @@ BOARD* CADSTAR_PCB_ARCHIVE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppe
|
||||||
if( aProperties->Value( "page_width", &page_width )
|
if( aProperties->Value( "page_width", &page_width )
|
||||||
&& aProperties->Value( "page_height", &page_height ) )
|
&& 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 w = atoi( page_width.c_str() );
|
||||||
int h = atoi( page_height.c_str() );
|
int h = atoi( page_height.c_str() );
|
||||||
|
|
|
@ -3117,7 +3117,7 @@ void EAGLE_PLUGIN::centerBoard()
|
||||||
if( m_props->Value( "page_width", &page_width ) &&
|
if( m_props->Value( "page_width", &page_width ) &&
|
||||||
m_props->Value( "page_height", &page_height ) )
|
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 w = atoi( page_width.c_str() );
|
||||||
int h = atoi( page_height.c_str() );
|
int h = atoi( page_height.c_str() );
|
||||||
|
|
|
@ -1657,7 +1657,7 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
|
||||||
: ROTATE_AROUND_ITEM_ANCHOR;
|
: ROTATE_AROUND_ITEM_ANCHOR;
|
||||||
|
|
||||||
// TODO: Implement a visible bounding border at the edge
|
// 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 );
|
DIALOG_MOVE_EXACT dialog( frame(), translation, rotation, rotationAnchor, sel_box );
|
||||||
int ret = dialog.ShowModal();
|
int ret = dialog.ShowModal();
|
||||||
|
|
|
@ -1540,7 +1540,7 @@ void PCB_SELECTION_TOOL::doSyncSelection( const std::vector<BOARD_ITEM*>& aItems
|
||||||
if( aWithNets )
|
if( aWithNets )
|
||||||
selectConnections( aItems );
|
selectConnections( aItems );
|
||||||
|
|
||||||
EDA_RECT bbox = m_selection.GetBoundingBox();
|
BOX2I bbox = m_selection.GetBoundingBox();
|
||||||
|
|
||||||
if( bbox.GetWidth() != 0 && bbox.GetHeight() != 0 )
|
if( bbox.GetWidth() != 0 && bbox.GetHeight() != 0 )
|
||||||
{
|
{
|
||||||
|
@ -1615,10 +1615,10 @@ int PCB_SELECTION_TOOL::selectSameSheet( const TOOL_EVENT& aEvent )
|
||||||
void PCB_SELECTION_TOOL::zoomFitSelection()
|
void PCB_SELECTION_TOOL::zoomFitSelection()
|
||||||
{
|
{
|
||||||
// Should recalculate the view to zoom in on the selection.
|
// Should recalculate the view to zoom in on the selection.
|
||||||
auto selectionBox = m_selection.GetBoundingBox();
|
BOX2I selectionBox = m_selection.GetBoundingBox();
|
||||||
auto view = getView();
|
KIGFX::VIEW* view = getView();
|
||||||
|
|
||||||
VECTOR2D screenSize = view->ToWorld( m_frame->GetCanvas()->GetClientSize(), false );
|
VECTOR2D screenSize = view->ToWorld( m_frame->GetCanvas()->GetClientSize(), false );
|
||||||
screenSize.x = std::max( 10.0, screenSize.x );
|
screenSize.x = std::max( 10.0, screenSize.x );
|
||||||
screenSize.y = std::max( 10.0, screenSize.y );
|
screenSize.y = std::max( 10.0, screenSize.y );
|
||||||
|
|
||||||
|
|
|
@ -322,9 +322,7 @@ const EDA_RECT ZONE::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
BOX2I bb = m_Poly->BBox();
|
BOX2I bb = m_Poly->BBox();
|
||||||
|
|
||||||
EDA_RECT ret( bb.GetOrigin(), VECTOR2I( bb.GetWidth(), bb.GetHeight() ) );
|
return bb;
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue