More EDA_RECE yeetage.
This commit is contained in:
parent
ebe9617e77
commit
b4492e0bd2
|
@ -23,7 +23,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <bitmap_base.h>
|
#include <bitmap_base.h>
|
||||||
#include <eda_rect.h> // for EDA_RECT
|
|
||||||
#include <gr_basic.h>
|
#include <gr_basic.h>
|
||||||
#include <math/util.h> // for KiROUND
|
#include <math/util.h> // for KiROUND
|
||||||
#include <memory> // for make_unique, unique_ptr
|
#include <memory> // for make_unique, unique_ptr
|
||||||
|
|
|
@ -247,7 +247,7 @@ bool DIALOG_SHIM::Show( bool show )
|
||||||
#endif
|
#endif
|
||||||
ret = wxDialog::Show( show );
|
ret = wxDialog::Show( show );
|
||||||
|
|
||||||
// classname is key, returns a zeroed out default EDA_RECT if none existed before.
|
// classname is key, returns a zeroed-out default wxRect if none existed before.
|
||||||
wxRect savedDialogRect = class_map[ hash_key ];
|
wxRect savedDialogRect = class_map[ hash_key ];
|
||||||
|
|
||||||
if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
|
if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
#include <bitmaps.h>
|
#include <bitmaps.h>
|
||||||
#include <eda_item.h>
|
#include <eda_item.h>
|
||||||
#include <eda_rect.h>
|
|
||||||
#include <trace_helpers.h>
|
#include <trace_helpers.h>
|
||||||
#include <trigo.h>
|
#include <trigo.h>
|
||||||
#include <i18n_utility.h>
|
#include <i18n_utility.h>
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
#include <eda_item.h>
|
#include <eda_item.h>
|
||||||
#include <base_units.h>
|
#include <base_units.h>
|
||||||
#include <callback_gal.h>
|
#include <callback_gal.h>
|
||||||
#include <eda_rect.h>
|
|
||||||
#include <eda_text.h> // for EDA_TEXT, TEXT_EFFECTS, GR_TEXT_VJUSTIF...
|
#include <eda_text.h> // for EDA_TEXT, TEXT_EFFECTS, GR_TEXT_VJUSTIF...
|
||||||
#include <gal/color4d.h> // for COLOR4D, COLOR4D::BLACK
|
#include <gal/color4d.h> // for COLOR4D, COLOR4D::BLACK
|
||||||
#include <gr_text.h>
|
#include <gr_text.h>
|
||||||
|
@ -509,7 +508,7 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
|
||||||
return m_bounding_box_cache;
|
return m_bounding_box_cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOX2I rect;
|
BOX2I bbox;
|
||||||
wxArrayString strings;
|
wxArrayString strings;
|
||||||
wxString text = GetShownText();
|
wxString text = GetShownText();
|
||||||
int thickness = GetEffectiveTextPenWidth();
|
int thickness = GetEffectiveTextPenWidth();
|
||||||
|
@ -549,7 +548,7 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
|
||||||
if( aInvertY )
|
if( aInvertY )
|
||||||
pos.y = -pos.y;
|
pos.y = -pos.y;
|
||||||
|
|
||||||
rect.SetOrigin( pos );
|
bbox.SetOrigin( pos );
|
||||||
|
|
||||||
// for multiline texts and aLine < 0, merge all rectangles (aLine == -1 signals all lines)
|
// for multiline texts and aLine < 0, merge all rectangles (aLine == -1 signals all lines)
|
||||||
if( IsMultilineAllowed() && aLine < 0 && strings.GetCount() )
|
if( IsMultilineAllowed() && aLine < 0 && strings.GetCount() )
|
||||||
|
@ -566,7 +565,7 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
|
||||||
textsize.y += KiROUND( ( strings.GetCount() - 1 ) * font->GetInterline( fontSize.y ) );
|
textsize.y += KiROUND( ( strings.GetCount() - 1 ) * font->GetInterline( fontSize.y ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
rect.SetSize( textsize );
|
bbox.SetSize( textsize );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* At this point the rectangle origin is the text origin (m_Pos). This is correct only for
|
* At this point the rectangle origin is the text origin (m_Pos). This is correct only for
|
||||||
|
@ -578,16 +577,16 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
|
||||||
{
|
{
|
||||||
case GR_TEXT_H_ALIGN_LEFT:
|
case GR_TEXT_H_ALIGN_LEFT:
|
||||||
if( IsMirrored() )
|
if( IsMirrored() )
|
||||||
rect.SetX( rect.GetX() - ( rect.GetWidth() - italicOffset ) );
|
bbox.SetX( bbox.GetX() - ( bbox.GetWidth() - italicOffset ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GR_TEXT_H_ALIGN_CENTER:
|
case GR_TEXT_H_ALIGN_CENTER:
|
||||||
rect.SetX( rect.GetX() - ( rect.GetWidth() - italicOffset ) / 2 );
|
bbox.SetX( bbox.GetX() - ( bbox.GetWidth() - italicOffset ) / 2 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GR_TEXT_H_ALIGN_RIGHT:
|
case GR_TEXT_H_ALIGN_RIGHT:
|
||||||
if( !IsMirrored() )
|
if( !IsMirrored() )
|
||||||
rect.SetX( rect.GetX() - ( rect.GetWidth() - italicOffset ) );
|
bbox.SetX( bbox.GetX() - ( bbox.GetWidth() - italicOffset ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,23 +596,23 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GR_TEXT_V_ALIGN_CENTER:
|
case GR_TEXT_V_ALIGN_CENTER:
|
||||||
rect.SetY( rect.GetY() - ( rect.GetHeight() + overbarOffset ) / 2 );
|
bbox.SetY( bbox.GetY() - ( bbox.GetHeight() + overbarOffset ) / 2 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GR_TEXT_V_ALIGN_BOTTOM:
|
case GR_TEXT_V_ALIGN_BOTTOM:
|
||||||
rect.SetY( rect.GetY() - ( rect.GetHeight() + overbarOffset ) );
|
bbox.SetY( bbox.GetY() - ( bbox.GetHeight() + overbarOffset ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rect.Normalize(); // Make h and v sizes always >= 0
|
bbox.Normalize(); // Make h and v sizes always >= 0
|
||||||
|
|
||||||
m_bounding_box_cache_valid = true;
|
m_bounding_box_cache_valid = true;
|
||||||
m_bounding_box_cache_pos = drawPos;
|
m_bounding_box_cache_pos = drawPos;
|
||||||
m_bounding_box_cache_line = aLine;
|
m_bounding_box_cache_line = aLine;
|
||||||
m_bounding_box_cache_inverted = aInvertY;
|
m_bounding_box_cache_inverted = aInvertY;
|
||||||
m_bounding_box_cache = rect;
|
m_bounding_box_cache = bbox;
|
||||||
|
|
||||||
return rect;
|
return bbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ void ORIGIN_VIEWITEM::ViewDraw( int, VIEW* aView ) const
|
||||||
|
|
||||||
VECTOR2D start( m_position );
|
VECTOR2D start( m_position );
|
||||||
VECTOR2D end( m_end );
|
VECTOR2D end( m_end );
|
||||||
EDA_RECT clip( VECTOR2I( start ), VECTOR2I( end.x - start.x, end.y - start.y ) );
|
BOX2I clip( VECTOR2I( start ), VECTOR2I( end.x - start.x, end.y - start.y ) );
|
||||||
clip.Normalize();
|
clip.Normalize();
|
||||||
|
|
||||||
double theta = atan2( end.y - start.y, end.x - start.x );
|
double theta = atan2( end.y - start.y, end.x - start.x );
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include <base_units.h>
|
#include <base_units.h>
|
||||||
#include <charconv>
|
#include <charconv>
|
||||||
#include <string_utils.h>
|
#include <string_utils.h>
|
||||||
#include <eda_rect.h>
|
|
||||||
#include <render_settings.h>
|
#include <render_settings.h>
|
||||||
#include <geometry/shape.h>
|
#include <geometry/shape.h>
|
||||||
#include <geometry/shape_segment.h>
|
#include <geometry/shape_segment.h>
|
||||||
|
@ -94,8 +93,7 @@ void STROKE_PARAMS::Stroke( const SHAPE* aShape, PLOT_DASH_TYPE aLineStyle, int
|
||||||
|
|
||||||
VECTOR2D start = line->GetSeg().A;
|
VECTOR2D start = line->GetSeg().A;
|
||||||
VECTOR2D end = line->GetSeg().B;
|
VECTOR2D end = line->GetSeg().B;
|
||||||
|
BOX2I clip( start, VECTOR2I( end.x - start.x, end.y - start.y ) );
|
||||||
EDA_RECT clip( (VECTOR2I) start, wxSize( end.x - start.x, end.y - start.y ) );
|
|
||||||
clip.Normalize();
|
clip.Normalize();
|
||||||
|
|
||||||
double theta = atan2( end.y - start.y, end.x - start.x );
|
double theta = atan2( end.y - start.y, end.x - start.x );
|
||||||
|
|
|
@ -26,9 +26,8 @@
|
||||||
#include <trigo.h>
|
#include <trigo.h>
|
||||||
#include <transform.h>
|
#include <transform.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <eda_rect.h>
|
|
||||||
#include <math/util.h> // for KiROUND
|
#include <math/util.h> // for KiROUND
|
||||||
|
#include <math/box2.h>
|
||||||
|
|
||||||
bool TRANSFORM::operator==( const TRANSFORM& aTransform ) const
|
bool TRANSFORM::operator==( const TRANSFORM& aTransform ) const
|
||||||
{
|
{
|
||||||
|
@ -45,9 +44,9 @@ VECTOR2I TRANSFORM::TransformCoordinate( const VECTOR2I& aPoint ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDA_RECT TRANSFORM::TransformCoordinate( const EDA_RECT& aRect ) const
|
BOX2I TRANSFORM::TransformCoordinate( const BOX2I& aRect ) const
|
||||||
{
|
{
|
||||||
EDA_RECT rect;
|
BOX2I rect;
|
||||||
rect.SetOrigin( TransformCoordinate( aRect.GetOrigin() ) );
|
rect.SetOrigin( TransformCoordinate( aRect.GetOrigin() ) );
|
||||||
rect.SetEnd( TransformCoordinate( aRect.GetEnd() ) );
|
rect.SetEnd( TransformCoordinate( aRect.GetEnd() ) );
|
||||||
return rect;
|
return rect;
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#ifndef CLASS_PIN_H
|
#ifndef CLASS_PIN_H
|
||||||
#define CLASS_PIN_H
|
#define CLASS_PIN_H
|
||||||
|
|
||||||
#include <eda_rect.h>
|
|
||||||
#include <lib_item.h>
|
#include <lib_item.h>
|
||||||
#include <pin_type.h>
|
#include <pin_type.h>
|
||||||
#include <lib_symbol.h>
|
#include <lib_symbol.h>
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#define EESCHEMA_SCH_RTREE_H_
|
#define EESCHEMA_SCH_RTREE_H_
|
||||||
|
|
||||||
#include <core/typeinfo.h>
|
#include <core/typeinfo.h>
|
||||||
#include <eda_rect.h>
|
|
||||||
#include <sch_item.h>
|
#include <sch_item.h>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
|
@ -25,10 +25,9 @@
|
||||||
#ifndef BITMAP_BASE_H
|
#ifndef BITMAP_BASE_H
|
||||||
#define BITMAP_BASE_H
|
#define BITMAP_BASE_H
|
||||||
|
|
||||||
#include <eda_rect.h>
|
|
||||||
|
|
||||||
#include <wx/bitmap.h>
|
#include <wx/bitmap.h>
|
||||||
#include <wx/image.h>
|
#include <wx/image.h>
|
||||||
|
#include <math/box2.h>
|
||||||
|
|
||||||
namespace KIGFX
|
namespace KIGFX
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,22 +25,18 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file board_printout.h
|
|
||||||
* @brief Board print handler definition file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef BOARD_PRINTOUT_H
|
#ifndef BOARD_PRINTOUT_H
|
||||||
#define BOARD_PRINTOUT_H
|
#define BOARD_PRINTOUT_H
|
||||||
|
|
||||||
#include <wx/print.h>
|
#include <wx/print.h>
|
||||||
#include <layer_ids.h>
|
#include <layer_ids.h>
|
||||||
#include <eda_rect.h>
|
|
||||||
#include <printout.h>
|
#include <printout.h>
|
||||||
|
#include <math/box2.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace KIGFX {
|
namespace KIGFX
|
||||||
|
{
|
||||||
class GAL;
|
class GAL;
|
||||||
class VIEW;
|
class VIEW;
|
||||||
class PAINTER;
|
class PAINTER;
|
||||||
|
|
|
@ -242,7 +242,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Test if \a aRect intersects this item.
|
* Test if \a aRect intersects this item.
|
||||||
*
|
*
|
||||||
* @param aRect A reference to a #EDA_RECT object containing the rectangle to test.
|
* @param aRect A reference to a #BOX2I object containing the rectangle to test.
|
||||||
* @param aContained Set to true to test for containment instead of an intersection.
|
* @param aContained Set to true to test for containment instead of an intersection.
|
||||||
* @param aAccuracy Increase \a aRect by this amount.
|
* @param aAccuracy Increase \a aRect by this amount.
|
||||||
* @return True if \a aRect contains or intersects the item bounding box.
|
* @return True if \a aRect contains or intersects the item bounding box.
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <outline_mode.h>
|
#include <outline_mode.h>
|
||||||
#include <eda_rect.h>
|
|
||||||
#include <eda_search_data.h>
|
#include <eda_search_data.h>
|
||||||
#include <font/glyph.h>
|
#include <font/glyph.h>
|
||||||
#include <font/text_attributes.h>
|
#include <font/text_attributes.h>
|
||||||
|
@ -388,7 +387,7 @@ private:
|
||||||
mutable VECTOR2I m_bounding_box_cache_pos;
|
mutable VECTOR2I m_bounding_box_cache_pos;
|
||||||
mutable int m_bounding_box_cache_line;
|
mutable int m_bounding_box_cache_line;
|
||||||
mutable bool m_bounding_box_cache_inverted;
|
mutable bool m_bounding_box_cache_inverted;
|
||||||
mutable EDA_RECT m_bounding_box_cache;
|
mutable BOX2I m_bounding_box_cache;
|
||||||
|
|
||||||
TEXT_ATTRIBUTES m_attributes;
|
TEXT_ATTRIBUTES m_attributes;
|
||||||
VECTOR2I m_pos;
|
VECTOR2I m_pos;
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
|
|
||||||
#include <rc_item.h>
|
#include <rc_item.h>
|
||||||
#include <gr_basic.h>
|
#include <gr_basic.h>
|
||||||
#include <eda_rect.h>
|
|
||||||
|
|
||||||
|
|
||||||
class SHAPE_LINE_CHAIN;
|
class SHAPE_LINE_CHAIN;
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
|
|
||||||
#include <wx/gdicmn.h>
|
#include <wx/gdicmn.h>
|
||||||
#include <geometry/eda_angle.h>
|
#include <geometry/eda_angle.h>
|
||||||
|
#include <math/box2.h>
|
||||||
|
|
||||||
class EDA_RECT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* for transforming drawing coordinates for a wxDC device context.
|
* for transforming drawing coordinates for a wxDC device context.
|
||||||
|
@ -64,9 +64,8 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate a new coordinate according to the mirror/rotation transform.
|
* Calculate a new coordinate according to the mirror/rotation transform.
|
||||||
* Useful to calculate actual coordinates of a point
|
* Useful to calculate actual coordinates of a point from coordinates relative to a symbol,
|
||||||
* from coordinates relative to a symbol.
|
* which are given for a non-rotated,-non mirrored item.
|
||||||
* which are given for a non rotated, non mirrored item
|
|
||||||
* @param aPoint = The position to transform
|
* @param aPoint = The position to transform
|
||||||
* @return The transformed coordinate.
|
* @return The transformed coordinate.
|
||||||
*/
|
*/
|
||||||
|
@ -74,19 +73,17 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate a new rect according to the mirror/rotation transform.
|
* Calculate a new rect according to the mirror/rotation transform.
|
||||||
* Useful to calculate actual coordinates of a point
|
* Useful to calculate actual coordinates of a point from coordinates relative to a symbol,
|
||||||
* from coordinates relative to a symbol
|
* which are given for a non-rotated,-non mirrored item.
|
||||||
* which are given for a non rotated, non mirrored item
|
|
||||||
* @param aRect = The rectangle to transform
|
* @param aRect = The rectangle to transform
|
||||||
* @return The transformed rectangle.
|
* @return The transformed rectangle.
|
||||||
*/
|
*/
|
||||||
EDA_RECT TransformCoordinate( const EDA_RECT& aRect ) const;
|
BOX2I TransformCoordinate( const BOX2I& aRect ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the Inverse mirror/rotation transform.
|
* Calculate the Inverse mirror/rotation transform.
|
||||||
* Useful to calculate coordinates relative to a symbol.
|
* Useful to calculate coordinates relative to a symbol, which must be for a non-rotated,
|
||||||
* which must be for a non rotated, non mirrored item
|
* non-mirrored item from the actual coordinate.
|
||||||
* from the actual coordinate.
|
|
||||||
* @return The inverse transform.
|
* @return The inverse transform.
|
||||||
*/
|
*/
|
||||||
TRANSFORM InverseTransform( ) const;
|
TRANSFORM InverseTransform( ) const;
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
#include <math.h> // for copysign
|
#include <math.h> // for copysign
|
||||||
#include <stdlib.h> // for abs
|
#include <stdlib.h> // for abs
|
||||||
#include <math/vector2d.h>
|
#include <math/box2.h>
|
||||||
#include <geometry/eda_angle.h>
|
#include <geometry/eda_angle.h>
|
||||||
|
|
||||||
class EDA_RECT;
|
class EDA_RECT;
|
||||||
|
@ -187,7 +187,7 @@ VECTOR2<ret_type> GetClampedCoords( const VECTOR2<in_type>& aCoords, pad_type aP
|
||||||
*
|
*
|
||||||
* @return - False if any part of the line lies within the rectangle.
|
* @return - False if any part of the line lies within the rectangle.
|
||||||
*/
|
*/
|
||||||
bool ClipLine( const EDA_RECT *aClipBox, int &x1, int &y1, int &x2, int &y2 );
|
bool ClipLine( const BOX2I *aClipBox, int &x1, int &y1, int &x2, int &y2 );
|
||||||
|
|
||||||
|
|
||||||
#endif // #ifndef GEOMETRY_UTILS_H
|
#endif // #ifndef GEOMETRY_UTILS_H
|
||||||
|
|
|
@ -114,7 +114,7 @@ int GetCircleToPolyCorrection( int aMaxError )
|
||||||
* Utility for the line clipping code, returns the boundary code of
|
* Utility for the line clipping code, returns the boundary code of
|
||||||
* a point. Bit allocation is arbitrary
|
* a point. Bit allocation is arbitrary
|
||||||
*/
|
*/
|
||||||
inline int clipOutCode( const EDA_RECT *aClipBox, int x, int y )
|
inline int clipOutCode( const BOX2I *aClipBox, int x, int y )
|
||||||
{
|
{
|
||||||
int code;
|
int code;
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ inline int clipOutCode( const EDA_RECT *aClipBox, int x, int y )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ClipLine( const EDA_RECT *aClipBox, int &x1, int &y1, int &x2, int &y2 )
|
bool ClipLine( const BOX2I *aClipBox, int &x1, int &y1, int &x2, int &y2 )
|
||||||
{
|
{
|
||||||
// Stock Cohen-Sutherland algorithm; check *any* CG book for details
|
// Stock Cohen-Sutherland algorithm; check *any* CG book for details
|
||||||
int outcode1 = clipOutCode( aClipBox, x1, y1 );
|
int outcode1 = clipOutCode( aClipBox, x1, y1 );
|
||||||
|
@ -194,6 +194,7 @@ bool ClipLine( const EDA_RECT *aClipBox, int &x1, int &y1, int &x2, int &y2 )
|
||||||
outcode2 = clipOutCode( aClipBox, x2, y2 );
|
outcode2 = clipOutCode( aClipBox, x2, y2 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
/**
|
|
||||||
* @file pl_editor_layout.cpp
|
|
||||||
* @brief PL_EDITOR_LAYOUT class functions.
|
|
||||||
*/
|
|
||||||
/*
|
/*
|
||||||
* 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) 2019-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
|
||||||
|
@ -26,12 +23,7 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <climits>
|
|
||||||
|
|
||||||
#include <eda_draw_frame.h>
|
#include <eda_draw_frame.h>
|
||||||
#include <eda_item.h>
|
|
||||||
#include <eda_rect.h>
|
|
||||||
#include "pl_editor_layout.h"
|
#include "pl_editor_layout.h"
|
||||||
|
|
||||||
PL_EDITOR_LAYOUT::PL_EDITOR_LAYOUT()
|
PL_EDITOR_LAYOUT::PL_EDITOR_LAYOUT()
|
||||||
|
@ -46,9 +38,9 @@ PL_EDITOR_LAYOUT::~PL_EDITOR_LAYOUT()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDA_RECT PL_EDITOR_LAYOUT::ComputeBoundingBox()
|
BOX2I PL_EDITOR_LAYOUT::ComputeBoundingBox()
|
||||||
{
|
{
|
||||||
EDA_RECT bbox;
|
BOX2I bbox;
|
||||||
|
|
||||||
SetBoundingBox( bbox );
|
SetBoundingBox( bbox );
|
||||||
return bbox;
|
return bbox;
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
/**
|
|
||||||
* @file pl_editor_layout.h
|
|
||||||
*/
|
|
||||||
/*
|
/*
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
|
@ -64,22 +61,22 @@ public:
|
||||||
*
|
*
|
||||||
* @return the full item list bounding box.
|
* @return the full item list bounding box.
|
||||||
*/
|
*/
|
||||||
EDA_RECT ComputeBoundingBox();
|
BOX2I ComputeBoundingBox();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called soon after ComputeBoundingBox() to return the same EDA_RECT,
|
* Called soon after ComputeBoundingBox() to return the same BOX2I, as long as the
|
||||||
* as long as the CLASS_PL_EDITOR_LAYOUT has not changed.
|
* CLASS_PL_EDITOR_LAYOUT has not changed.
|
||||||
*/
|
*/
|
||||||
const BOX2I GetBoundingBox() const { return m_boundingBox; }
|
const BOX2I GetBoundingBox() const { return m_boundingBox; }
|
||||||
|
|
||||||
void SetBoundingBox( const EDA_RECT& aBox ) { m_boundingBox = aBox; }
|
void SetBoundingBox( const BOX2I& aBox ) { m_boundingBox = aBox; }
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
void Show( int nestLevel, std::ostream& os ) const;
|
void Show( int nestLevel, std::ostream& os ) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EDA_RECT m_boundingBox;
|
BOX2I m_boundingBox;
|
||||||
PAGE_INFO m_paper;
|
PAGE_INFO m_paper;
|
||||||
TITLE_BLOCK m_titles;
|
TITLE_BLOCK m_titles;
|
||||||
|
|
||||||
|
|
|
@ -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) 2019 CERN
|
* Copyright (C) 2019 CERN
|
||||||
* Copyright (C) 2019 KiCad Developers, see AUTHORS.TXT for contributors.
|
* Copyright (C) 2019-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,8 +23,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#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
|
||||||
|
|
|
@ -396,8 +396,8 @@ bool PL_SELECTION_TOOL::selectMultiple()
|
||||||
bool anyAdded = false;
|
bool anyAdded = false;
|
||||||
bool anySubtracted = false;
|
bool anySubtracted = false;
|
||||||
|
|
||||||
// Construct an EDA_RECT to determine EDA_ITEM selection
|
// Construct a BOX2I to determine EDA_ITEM selection
|
||||||
EDA_RECT selectionRect( (wxPoint)area.GetOrigin(), wxSize( width, height ) );
|
BOX2I selectionRect( area.GetOrigin(), VECTOR2I( width, height ) );
|
||||||
|
|
||||||
selectionRect.Normalize();
|
selectionRect.Normalize();
|
||||||
|
|
||||||
|
|
|
@ -1790,7 +1790,7 @@ FOOTPRINT* BOARD::GetFootprint( const VECTOR2I& aPosition, PCB_LAYER_ID aActiveL
|
||||||
// Filter non visible footprints if requested
|
// Filter non visible footprints if requested
|
||||||
if( !aVisibleOnly || IsFootprintLayerVisible( layer ) )
|
if( !aVisibleOnly || IsFootprintLayerVisible( layer ) )
|
||||||
{
|
{
|
||||||
EDA_RECT bb = candidate->GetBoundingBox( false, false );
|
BOX2I bb = candidate->GetBoundingBox( false, false );
|
||||||
|
|
||||||
int offx = bb.GetX() + bb.GetWidth() / 2;
|
int offx = bb.GetX() + bb.GetWidth() / 2;
|
||||||
int offy = bb.GetY() + bb.GetHeight() / 2;
|
int offy = bb.GetY() + bb.GetHeight() / 2;
|
||||||
|
|
|
@ -1296,7 +1296,7 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK()
|
||||||
{
|
{
|
||||||
for( const std::shared_ptr<PCB_SHAPE>& shape : m_dummyPad->GetPrimitives() )
|
for( const std::shared_ptr<PCB_SHAPE>& shape : m_dummyPad->GetPrimitives() )
|
||||||
{
|
{
|
||||||
EDA_RECT shapeBBox = shape->GetBoundingBox();
|
BOX2I shapeBBox = shape->GetBoundingBox();
|
||||||
|
|
||||||
if( absMargin > shapeBBox.GetWidth() || absMargin > shapeBBox.GetHeight() )
|
if( absMargin > shapeBBox.GetWidth() || absMargin > shapeBBox.GetHeight() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -280,13 +280,14 @@ public:
|
||||||
* It checks all items in the bbox overlap to find the minimal actual distance and
|
* It checks all items in the bbox overlap to find the minimal actual distance and
|
||||||
* position.
|
* position.
|
||||||
*/
|
*/
|
||||||
bool QueryColliding( EDA_RECT aBox, SHAPE* aRefShape, PCB_LAYER_ID aLayer, int aClearance,
|
bool QueryColliding( const BOX2I& aBox, SHAPE* aRefShape, PCB_LAYER_ID aLayer, int aClearance,
|
||||||
int* aActual, VECTOR2I* aPos ) const
|
int* aActual, VECTOR2I* aPos ) const
|
||||||
{
|
{
|
||||||
aBox.Inflate( aClearance );
|
BOX2I bbox = aBox;
|
||||||
|
bbox.Inflate( aClearance );
|
||||||
|
|
||||||
int min[2] = { aBox.GetX(), aBox.GetY() };
|
int min[2] = { bbox.GetX(), bbox.GetY() };
|
||||||
int max[2] = { aBox.GetRight(), aBox.GetBottom() };
|
int max[2] = { bbox.GetRight(), bbox.GetBottom() };
|
||||||
|
|
||||||
bool collision = false;
|
bool collision = false;
|
||||||
int actual = INT_MAX;
|
int actual = INT_MAX;
|
||||||
|
@ -335,7 +336,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Quicker version of above that just reports a raw yes/no.
|
* Quicker version of above that just reports a raw yes/no.
|
||||||
*/
|
*/
|
||||||
bool QueryColliding( EDA_RECT aBox, SHAPE* aRefShape, PCB_LAYER_ID aLayer ) const
|
bool QueryColliding( const BOX2I& aBox, SHAPE* aRefShape, PCB_LAYER_ID aLayer ) const
|
||||||
{
|
{
|
||||||
SHAPE_POLY_SET* poly = dynamic_cast<SHAPE_POLY_SET*>( aRefShape );
|
SHAPE_POLY_SET* poly = dynamic_cast<SHAPE_POLY_SET*>( aRefShape );
|
||||||
|
|
||||||
|
@ -531,7 +532,7 @@ public:
|
||||||
m_rect = { { INT_MIN, INT_MIN }, { INT_MAX, INT_MAX } };
|
m_rect = { { INT_MIN, INT_MIN }, { INT_MAX, INT_MAX } };
|
||||||
};
|
};
|
||||||
|
|
||||||
DRC_LAYER( drc_rtree* aTree, const EDA_RECT aRect ) : layer_tree( aTree )
|
DRC_LAYER( drc_rtree* aTree, const BOX2I& aRect ) : layer_tree( aTree )
|
||||||
{
|
{
|
||||||
m_rect = { { aRect.GetX(), aRect.GetY() },
|
m_rect = { { aRect.GetX(), aRect.GetY() },
|
||||||
{ aRect.GetRight(), aRect.GetBottom() } };
|
{ aRect.GetRight(), aRect.GetBottom() } };
|
||||||
|
@ -558,12 +559,12 @@ public:
|
||||||
|
|
||||||
DRC_LAYER Overlapping( PCB_LAYER_ID aLayer, const VECTOR2I& aPoint, int aAccuracy = 0 ) const
|
DRC_LAYER Overlapping( PCB_LAYER_ID aLayer, const VECTOR2I& aPoint, int aAccuracy = 0 ) const
|
||||||
{
|
{
|
||||||
EDA_RECT rect( aPoint, VECTOR2I( 0, 0 ) );
|
BOX2I rect( aPoint, VECTOR2I( 0, 0 ) );
|
||||||
rect.Inflate( aAccuracy );
|
rect.Inflate( aAccuracy );
|
||||||
return DRC_LAYER( m_tree[int( aLayer )], rect );
|
return DRC_LAYER( m_tree[int( aLayer )], rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
DRC_LAYER Overlapping( PCB_LAYER_ID aLayer, const EDA_RECT& aRect ) const
|
DRC_LAYER Overlapping( PCB_LAYER_ID aLayer, const BOX2I& aRect ) const
|
||||||
{
|
{
|
||||||
return DRC_LAYER( m_tree[int( aLayer )], aRect );
|
return DRC_LAYER( m_tree[int( aLayer )], aRect );
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,8 +116,8 @@ bool DRC_TEST_PROVIDER_DISALLOW::Run()
|
||||||
|
|
||||||
ZONE* ruleArea = areaZonePair.first;
|
ZONE* ruleArea = areaZonePair.first;
|
||||||
ZONE* copperZone = areaZonePair.second;
|
ZONE* copperZone = areaZonePair.second;
|
||||||
EDA_RECT areaBBox = ruleArea->GetCachedBoundingBox();
|
BOX2I areaBBox = ruleArea->GetCachedBoundingBox();
|
||||||
EDA_RECT copperBBox = copperZone->GetCachedBoundingBox();
|
BOX2I copperBBox = copperZone->GetCachedBoundingBox();
|
||||||
bool isInside = false;
|
bool isInside = false;
|
||||||
|
|
||||||
if( copperZone->IsFilled() && areaBBox.Intersects( copperBBox ) )
|
if( copperZone->IsFilled() && areaBBox.Intersects( copperBBox ) )
|
||||||
|
|
|
@ -79,9 +79,9 @@ private:
|
||||||
void testSilkToMaskClearance();
|
void testSilkToMaskClearance();
|
||||||
void testMaskBridges();
|
void testMaskBridges();
|
||||||
|
|
||||||
void testItemAgainstItems( BOARD_ITEM* aItem, const EDA_RECT& aItemBBox,
|
void testItemAgainstItems( BOARD_ITEM* aItem, const BOX2I& aItemBBox,
|
||||||
PCB_LAYER_ID aRefLayer, PCB_LAYER_ID aTargetLayer );
|
PCB_LAYER_ID aRefLayer, PCB_LAYER_ID aTargetLayer );
|
||||||
void testMaskItemAgainstZones( BOARD_ITEM* item, const EDA_RECT& itemBBox,
|
void testMaskItemAgainstZones( BOARD_ITEM* item, const BOX2I& itemBBox,
|
||||||
PCB_LAYER_ID refLayer, PCB_LAYER_ID targetLayer );
|
PCB_LAYER_ID refLayer, PCB_LAYER_ID targetLayer );
|
||||||
|
|
||||||
bool checkMaskAperture( BOARD_ITEM* aMaskItem, BOARD_ITEM* aTestItem, PCB_LAYER_ID aTestLayer,
|
bool checkMaskAperture( BOARD_ITEM* aMaskItem, BOARD_ITEM* aTestItem, PCB_LAYER_ID aTestLayer,
|
||||||
|
@ -400,8 +400,7 @@ bool DRC_TEST_PROVIDER_SOLDER_MASK::checkItemMask( BOARD_ITEM* aMaskItem, int aT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DRC_TEST_PROVIDER_SOLDER_MASK::testItemAgainstItems( BOARD_ITEM* aItem,
|
void DRC_TEST_PROVIDER_SOLDER_MASK::testItemAgainstItems( BOARD_ITEM* aItem, const BOX2I& aItemBBox,
|
||||||
const EDA_RECT& aItemBBox,
|
|
||||||
PCB_LAYER_ID aRefLayer,
|
PCB_LAYER_ID aRefLayer,
|
||||||
PCB_LAYER_ID aTargetLayer )
|
PCB_LAYER_ID aTargetLayer )
|
||||||
{
|
{
|
||||||
|
@ -558,7 +557,7 @@ void DRC_TEST_PROVIDER_SOLDER_MASK::testItemAgainstItems( BOARD_ITEM* aItem,
|
||||||
|
|
||||||
|
|
||||||
void DRC_TEST_PROVIDER_SOLDER_MASK::testMaskItemAgainstZones( BOARD_ITEM* aItem,
|
void DRC_TEST_PROVIDER_SOLDER_MASK::testMaskItemAgainstZones( BOARD_ITEM* aItem,
|
||||||
const EDA_RECT& aItemBBox,
|
const BOX2I& aItemBBox,
|
||||||
PCB_LAYER_ID aMaskLayer,
|
PCB_LAYER_ID aMaskLayer,
|
||||||
PCB_LAYER_ID aTargetLayer )
|
PCB_LAYER_ID aTargetLayer )
|
||||||
{
|
{
|
||||||
|
@ -577,7 +576,7 @@ void DRC_TEST_PROVIDER_SOLDER_MASK::testMaskItemAgainstZones( BOARD_ITEM* aItem,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
EDA_RECT inflatedBBox( aItemBBox );
|
BOX2I inflatedBBox( aItemBBox );
|
||||||
int clearance = m_board->GetDesignSettings().m_SolderMaskToCopperClearance;
|
int clearance = m_board->GetDesignSettings().m_SolderMaskToCopperClearance;
|
||||||
|
|
||||||
if( aItem->Type() == PCB_PAD_T )
|
if( aItem->Type() == PCB_PAD_T )
|
||||||
|
|
|
@ -664,7 +664,7 @@ void FOOTPRINT::Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aMode )
|
||||||
|
|
||||||
double FOOTPRINT::GetArea( int aPadding ) const
|
double FOOTPRINT::GetArea( int aPadding ) const
|
||||||
{
|
{
|
||||||
EDA_RECT bbox = GetBoundingBox( false, false );
|
BOX2I bbox = GetBoundingBox( false, false );
|
||||||
|
|
||||||
double w = std::abs( static_cast<double>( bbox.GetWidth() ) ) + aPadding;
|
double w = std::abs( static_cast<double>( bbox.GetWidth() ) ) + aPadding;
|
||||||
double h = std::abs( static_cast<double>( bbox.GetHeight() ) ) + aPadding;
|
double h = std::abs( static_cast<double>( bbox.GetHeight() ) ) + aPadding;
|
||||||
|
@ -759,7 +759,7 @@ const BOX2I FOOTPRINT::GetBoundingBox() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const EDA_RECT FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisibleText ) const
|
const BOX2I FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisibleText ) const
|
||||||
{
|
{
|
||||||
const BOARD* board = GetBoard();
|
const BOARD* board = GetBoard();
|
||||||
bool isFPEdit = board && board->IsFootprintHolder();
|
bool isFPEdit = board && board->IsFootprintHolder();
|
||||||
|
@ -1059,7 +1059,7 @@ bool FOOTPRINT::IsOnLayer( PCB_LAYER_ID aLayer ) const
|
||||||
|
|
||||||
bool FOOTPRINT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
bool FOOTPRINT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
EDA_RECT rect = GetBoundingBox( false, false );
|
BOX2I rect = GetBoundingBox( false, false );
|
||||||
return rect.Inflate( aAccuracy ).Contains( aPosition );
|
return rect.Inflate( aAccuracy ).Contains( aPosition );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1494,7 +1494,7 @@ double FOOTPRINT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||||
|
|
||||||
const BOX2I FOOTPRINT::ViewBBox() const
|
const BOX2I FOOTPRINT::ViewBBox() const
|
||||||
{
|
{
|
||||||
EDA_RECT area = GetBoundingBox( true, true );
|
BOX2I area = GetBoundingBox( true, true );
|
||||||
|
|
||||||
// Add the Clearance shape size: (shape around the pads when the clearance is shown. Not
|
// Add the Clearance shape size: (shape around the pads when the clearance is shown. Not
|
||||||
// optimized, but the draw cost is small (perhaps smaller than optimization).
|
// optimized, but the draw cost is small (perhaps smaller than optimization).
|
||||||
|
|
|
@ -170,7 +170,7 @@ public:
|
||||||
|
|
||||||
// Virtual function
|
// Virtual function
|
||||||
const BOX2I GetBoundingBox() const override;
|
const BOX2I GetBoundingBox() const override;
|
||||||
const EDA_RECT GetBoundingBox( bool aIncludeText, bool aIncludeInvisibleText ) const;
|
const BOX2I GetBoundingBox( bool aIncludeText, bool aIncludeInvisibleText ) const;
|
||||||
|
|
||||||
PADS& Pads() { return m_pads; }
|
PADS& Pads() { return m_pads; }
|
||||||
const PADS& Pads() const { return m_pads; }
|
const PADS& Pads() const { return m_pads; }
|
||||||
|
@ -797,11 +797,11 @@ private:
|
||||||
// that any edit that could affect the bounding boxes (including edits to the footprint
|
// that any edit that could affect the bounding boxes (including edits to the footprint
|
||||||
// children) marked the bounding boxes dirty. It would definitely be faster -- but also more
|
// children) marked the bounding boxes dirty. It would definitely be faster -- but also more
|
||||||
// fragile.
|
// fragile.
|
||||||
mutable EDA_RECT m_cachedBoundingBox;
|
mutable BOX2I m_cachedBoundingBox;
|
||||||
mutable int m_boundingBoxCacheTimeStamp;
|
mutable int m_boundingBoxCacheTimeStamp;
|
||||||
mutable EDA_RECT m_cachedVisibleBBox;
|
mutable BOX2I m_cachedVisibleBBox;
|
||||||
mutable int m_visibleBBoxCacheTimeStamp;
|
mutable int m_visibleBBoxCacheTimeStamp;
|
||||||
mutable EDA_RECT m_cachedTextExcludedBBox;
|
mutable BOX2I m_cachedTextExcludedBBox;
|
||||||
mutable int m_textExcludedBBoxCacheTimeStamp;
|
mutable int m_textExcludedBBoxCacheTimeStamp;
|
||||||
mutable SHAPE_POLY_SET m_cachedHull;
|
mutable SHAPE_POLY_SET m_cachedHull;
|
||||||
mutable int m_hullCacheTimeStamp;
|
mutable int m_hullCacheTimeStamp;
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#include <board_item.h>
|
#include <board_item.h>
|
||||||
|
|
||||||
class LINE_READER;
|
class LINE_READER;
|
||||||
class EDA_RECT;
|
|
||||||
class FOOTPRINT;
|
class FOOTPRINT;
|
||||||
class MSG_PANEL_ITEM;
|
class MSG_PANEL_ITEM;
|
||||||
class PCB_BASE_FRAME;
|
class PCB_BASE_FRAME;
|
||||||
|
|
|
@ -231,7 +231,7 @@ VECTOR2I FP_TEXTBOX::GetDrawPos() const
|
||||||
|
|
||||||
bool FP_TEXTBOX::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
bool FP_TEXTBOX::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
EDA_RECT rect = GetBoundingBox();
|
BOX2I rect = GetBoundingBox();
|
||||||
|
|
||||||
rect.Inflate( aAccuracy );
|
rect.Inflate( aAccuracy );
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include <fp_shape.h>
|
#include <fp_shape.h>
|
||||||
|
|
||||||
class LINE_READER;
|
class LINE_READER;
|
||||||
class EDA_RECT;
|
|
||||||
class FOOTPRINT;
|
class FOOTPRINT;
|
||||||
class MSG_PANEL_ITEM;
|
class MSG_PANEL_ITEM;
|
||||||
class PCB_BASE_FRAME;
|
class PCB_BASE_FRAME;
|
||||||
|
|
|
@ -100,8 +100,8 @@ void PCB_EDIT_FRAME::OnNetlistChanged( BOARD_NETLIST_UPDATER& aUpdater, bool* aR
|
||||||
std::vector<FOOTPRINT*> newFootprints = aUpdater.GetAddedFootprints();
|
std::vector<FOOTPRINT*> newFootprints = aUpdater.GetAddedFootprints();
|
||||||
|
|
||||||
// Spread new footprints.
|
// Spread new footprints.
|
||||||
wxPoint areaPosition = (wxPoint) GetCanvas()->GetViewControls()->GetCursorPosition();
|
VECTOR2I areaPosition = GetCanvas()->GetViewControls()->GetCursorPosition();
|
||||||
EDA_RECT bbox = board->GetBoundingBox();
|
BOX2I bbox = board->GetBoundingBox();
|
||||||
|
|
||||||
GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
|
GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||||
|
|
||||||
|
|
|
@ -1430,7 +1430,7 @@ const BOX2I PAD::ViewBBox() const
|
||||||
// margins can be < 0
|
// margins can be < 0
|
||||||
int solderMaskMargin = std::max( GetSolderMaskExpansion(), 0 );
|
int solderMaskMargin = std::max( GetSolderMaskExpansion(), 0 );
|
||||||
VECTOR2I solderPasteMargin = VECTOR2D( GetSolderPasteMargin() );
|
VECTOR2I solderPasteMargin = VECTOR2D( GetSolderPasteMargin() );
|
||||||
EDA_RECT bbox = GetBoundingBox();
|
BOX2I bbox = GetBoundingBox();
|
||||||
|
|
||||||
// get the biggest possible clearance
|
// get the biggest possible clearance
|
||||||
int clearance = 0;
|
int clearance = 0;
|
||||||
|
|
|
@ -132,9 +132,9 @@ const BOX2I PCB_BITMAP::GetBoundingBox() const
|
||||||
|
|
||||||
std::shared_ptr<SHAPE> PCB_BITMAP::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
|
std::shared_ptr<SHAPE> PCB_BITMAP::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
|
||||||
{
|
{
|
||||||
EDA_RECT box = GetBoundingBox();
|
BOX2I box = GetBoundingBox();
|
||||||
return std::shared_ptr<SHAPE_RECT>(
|
return std::shared_ptr<SHAPE_RECT>( new SHAPE_RECT( box.GetCenter(), box.GetWidth(),
|
||||||
new SHAPE_RECT( box.GetCenter(), box.GetWidth(), box.GetHeight() ) );
|
box.GetHeight() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ void PCB_BITMAP::Show( int nestLevel, std::ostream& os ) const
|
||||||
|
|
||||||
bool PCB_BITMAP::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
bool PCB_BITMAP::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
EDA_RECT rect = GetBoundingBox();
|
BOX2I rect = GetBoundingBox();
|
||||||
|
|
||||||
rect.Inflate( aAccuracy );
|
rect.Inflate( aAccuracy );
|
||||||
|
|
||||||
|
|
|
@ -1264,7 +1264,7 @@ const BOX2I PCB_DIM_CENTER::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
int halfWidth = VECTOR2I( m_end - m_start ).x + ( m_lineThickness / 2.0 );
|
int halfWidth = VECTOR2I( m_end - m_start ).x + ( m_lineThickness / 2.0 );
|
||||||
|
|
||||||
EDA_RECT bBox;
|
BOX2I bBox;
|
||||||
|
|
||||||
bBox.SetX( m_start.x - halfWidth );
|
bBox.SetX( m_start.x - halfWidth );
|
||||||
bBox.SetY( m_start.y - halfWidth );
|
bBox.SetY( m_start.y - halfWidth );
|
||||||
|
|
|
@ -406,7 +406,7 @@ static void intersectsBackCourtyardFunc( LIBEVAL::CONTEXT* aCtx, void* self )
|
||||||
bool collidesWithArea( BOARD_ITEM* aItem, PCB_EXPR_CONTEXT* aCtx, ZONE* aArea )
|
bool collidesWithArea( BOARD_ITEM* aItem, PCB_EXPR_CONTEXT* aCtx, ZONE* aArea )
|
||||||
{
|
{
|
||||||
BOARD* board = aArea->GetBoard();
|
BOARD* board = aArea->GetBoard();
|
||||||
EDA_RECT areaBBox = aArea->GetCachedBoundingBox();
|
BOX2I areaBBox = aArea->GetCachedBoundingBox();
|
||||||
std::shared_ptr<SHAPE> shape;
|
std::shared_ptr<SHAPE> shape;
|
||||||
|
|
||||||
// Collisions include touching, so we need to deflate outline by enough to exclude it.
|
// Collisions include touching, so we need to deflate outline by enough to exclude it.
|
||||||
|
|
|
@ -307,8 +307,7 @@ const BOX2I PCB_MARKER::GetBoundingBox() const
|
||||||
|
|
||||||
const BOX2I PCB_MARKER::ViewBBox() const
|
const BOX2I PCB_MARKER::ViewBBox() const
|
||||||
{
|
{
|
||||||
EDA_RECT bbox = GetBoundingBox();
|
return GetBoundingBox();
|
||||||
return BOX2I( bbox.GetOrigin(), VECTOR2I( bbox.GetWidth(), bbox.GetHeight() ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -629,8 +629,9 @@ void PCB_PAINTER::draw( const PCB_TRACK* aTrack, int aLayer )
|
||||||
|
|
||||||
viewport.SetOrigin( VECTOR2D( matrix * VECTOR2D( 0, 0 ) ) );
|
viewport.SetOrigin( VECTOR2D( matrix * VECTOR2D( 0, 0 ) ) );
|
||||||
viewport.SetEnd( VECTOR2D( matrix * screenSize ) );
|
viewport.SetEnd( VECTOR2D( matrix * screenSize ) );
|
||||||
|
viewport.Normalize();
|
||||||
|
|
||||||
EDA_RECT clipBox( viewport.Normalize() );
|
BOX2I clipBox( viewport.GetOrigin(), viewport.GetSize() );
|
||||||
SEG visibleSeg( start, end );
|
SEG visibleSeg( start, end );
|
||||||
|
|
||||||
ClipLine( &clipBox, visibleSeg.A.x, visibleSeg.A.y, visibleSeg.B.x, visibleSeg.B.y );
|
ClipLine( &clipBox, visibleSeg.A.x, visibleSeg.A.y, visibleSeg.B.x, visibleSeg.B.y );
|
||||||
|
@ -2088,7 +2089,7 @@ void PCB_PAINTER::draw( const FOOTPRINT* aFootprint, int aLayer )
|
||||||
const SHAPE_POLY_SET& poly = aFootprint->GetBoundingHull();
|
const SHAPE_POLY_SET& poly = aFootprint->GetBoundingHull();
|
||||||
m_gal->DrawPolygon( poly );
|
m_gal->DrawPolygon( poly );
|
||||||
#else
|
#else
|
||||||
EDA_RECT bbox = aFootprint->GetBoundingBox( false, false );
|
BOX2I bbox = aFootprint->GetBoundingBox( false, false );
|
||||||
VECTOR2I topLeft = bbox.GetPosition();
|
VECTOR2I topLeft = bbox.GetPosition();
|
||||||
VECTOR2I botRight = bbox.GetPosition() + bbox.GetSize();
|
VECTOR2I botRight = bbox.GetPosition() + bbox.GetSize();
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ void PCB_TARGET::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
|
||||||
|
|
||||||
const BOX2I PCB_TARGET::GetBoundingBox() const
|
const BOX2I PCB_TARGET::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
EDA_RECT bBox;
|
BOX2I bBox;
|
||||||
bBox.SetX( m_pos.x - m_size / 2 );
|
bBox.SetX( m_pos.x - m_size / 2 );
|
||||||
bBox.SetY( m_pos.y - m_size / 2 );
|
bBox.SetY( m_pos.y - m_size / 2 );
|
||||||
bBox.SetWidth( m_size );
|
bBox.SetWidth( m_size );
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include <board_item.h>
|
#include <board_item.h>
|
||||||
|
|
||||||
|
|
||||||
class EDA_RECT;
|
|
||||||
class LINE_READER;
|
class LINE_READER;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -102,8 +102,8 @@ public:
|
||||||
return TextHitTest( aPosition, aAccuracy );
|
return TextHitTest( aPosition, aAccuracy );
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @copydoc BOARD_ITEM::HitTest(const EDA_RECT& aRect,
|
/**
|
||||||
* bool aContained = true, int aAccuracy ) const
|
* @copydoc BOARD_ITEM::HitTest(const BOX2I& aRect, bool aContained, int aAccuracy ) const
|
||||||
*/
|
*/
|
||||||
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override
|
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override
|
||||||
{
|
{
|
||||||
|
|
|
@ -379,7 +379,7 @@ void PCB_TEXTBOX::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
|
||||||
|
|
||||||
bool PCB_TEXTBOX::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
bool PCB_TEXTBOX::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
EDA_RECT rect = GetBoundingBox();
|
BOX2I rect = GetBoundingBox();
|
||||||
|
|
||||||
rect.Inflate( aAccuracy );
|
rect.Inflate( aAccuracy );
|
||||||
|
|
||||||
|
|
|
@ -627,7 +627,8 @@ double PCB_TRACK::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||||
// When drawing netnames, clip the track to the viewport
|
// When drawing netnames, clip the track to the viewport
|
||||||
VECTOR2I start( GetStart() );
|
VECTOR2I start( GetStart() );
|
||||||
VECTOR2I end( GetEnd() );
|
VECTOR2I end( GetEnd() );
|
||||||
EDA_RECT clipBox( aView->GetViewport() );
|
BOX2D viewport = aView->GetViewport();
|
||||||
|
BOX2I clipBox( viewport.GetOrigin(), viewport.GetSize() );
|
||||||
|
|
||||||
ClipLine( &clipBox, start.x, start.y, end.x, end.y );
|
ClipLine( &clipBox, start.x, start.y, end.x, end.y );
|
||||||
|
|
||||||
|
@ -1009,7 +1010,7 @@ bool PCB_ARC::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) cons
|
||||||
|
|
||||||
bool PCB_VIA::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
|
bool PCB_VIA::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
EDA_RECT arect = aRect;
|
BOX2I arect = aRect;
|
||||||
arect.Inflate( aAccuracy );
|
arect.Inflate( aAccuracy );
|
||||||
|
|
||||||
BOX2I box( GetStart() );
|
BOX2I box( GetStart() );
|
||||||
|
|
|
@ -1812,7 +1812,7 @@ void ALTIUM_PCB::ParsePolygons6Data( const ALTIUM_COMPOUND_FILE& aAltiumPcbF
|
||||||
if( elem.hatchstyle == ALTIUM_POLYGON_HATCHSTYLE::NONE )
|
if( elem.hatchstyle == ALTIUM_POLYGON_HATCHSTYLE::NONE )
|
||||||
{
|
{
|
||||||
// use a small hack to get us only an outline (hopefully)
|
// use a small hack to get us only an outline (hopefully)
|
||||||
const EDA_RECT& bbox = zone->GetBoundingBox();
|
const BOX2I& bbox = zone->GetBoundingBox();
|
||||||
zone->SetHatchGap( std::max( bbox.GetHeight(), bbox.GetWidth() ) );
|
zone->SetHatchGap( std::max( bbox.GetHeight(), bbox.GetWidth() ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -576,7 +576,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, PAD* aPad )
|
||||||
|
|
||||||
// this string _must_ be unique for a given physical shape, so try to make it unique
|
// this string _must_ be unique for a given physical shape, so try to make it unique
|
||||||
MD5_HASH hash = pad_shape.GetHash();
|
MD5_HASH hash = pad_shape.GetHash();
|
||||||
EDA_RECT rect = aPad->GetBoundingBox();
|
BOX2I rect = aPad->GetBoundingBox();
|
||||||
snprintf( name, sizeof( name ), "Cust%sPad_%.6gx%.6g_%.6gx_%.6g_%d_um_%s",
|
snprintf( name, sizeof( name ), "Cust%sPad_%.6gx%.6g_%.6gx_%.6g_%d_um_%s",
|
||||||
uniqifier.c_str(), IU2um( aPad->GetSize().x ), IU2um( aPad->GetSize().y ),
|
uniqifier.c_str(), IU2um( aPad->GetSize().x ), IU2um( aPad->GetSize().y ),
|
||||||
IU2um( rect.GetWidth() ), IU2um( rect.GetHeight() ), (int) polygonal_shape.size(),
|
IU2um( rect.GetWidth() ), IU2um( rect.GetHeight() ), (int) polygonal_shape.size(),
|
||||||
|
|
|
@ -139,12 +139,12 @@ void DRC_TEST_PROVIDER_COURTYARD_CLEARANCE_ON_MOVE::testCourtyardClearances()
|
||||||
frontBBox.Inflate( m_largestCourtyardClearance );
|
frontBBox.Inflate( m_largestCourtyardClearance );
|
||||||
backBBox.Inflate( m_largestCourtyardClearance );
|
backBBox.Inflate( m_largestCourtyardClearance );
|
||||||
|
|
||||||
EDA_RECT fpABBox = fpA->GetBoundingBox();
|
BOX2I fpABBox = fpA->GetBoundingBox();
|
||||||
|
|
||||||
for( FOOTPRINT* fpB : m_FpInMove )
|
for( FOOTPRINT* fpB : m_FpInMove )
|
||||||
{
|
{
|
||||||
fpB->BuildCourtyardCaches();
|
fpB->BuildCourtyardCaches();
|
||||||
EDA_RECT fpBBBox = fpB->GetBoundingBox();
|
BOX2I fpBBBox = fpB->GetBoundingBox();
|
||||||
const SHAPE_POLY_SET& frontB = fpB->GetCourtyard( F_CrtYd );
|
const SHAPE_POLY_SET& frontB = fpB->GetCourtyard( F_CrtYd );
|
||||||
const SHAPE_POLY_SET& backB = fpB->GetCourtyard( B_CrtYd );
|
const SHAPE_POLY_SET& backB = fpB->GetCourtyard( B_CrtYd );
|
||||||
DRC_CONSTRAINT constraint;
|
DRC_CONSTRAINT constraint;
|
||||||
|
|
|
@ -885,8 +885,8 @@ bool PCB_SELECTION_TOOL::selectMultiple()
|
||||||
|
|
||||||
int height = area.GetEnd().y - area.GetOrigin().y;
|
int height = area.GetEnd().y - area.GetOrigin().y;
|
||||||
|
|
||||||
// Construct an EDA_RECT to determine BOARD_ITEM selection
|
// Construct a BOX2I to determine BOARD_ITEM selection
|
||||||
EDA_RECT selectionRect( (wxPoint) area.GetOrigin(), wxSize( width, height ) );
|
BOX2I selectionRect( area.GetOrigin(), VECTOR2I( width, height ) );
|
||||||
|
|
||||||
selectionRect.Normalize();
|
selectionRect.Normalize();
|
||||||
|
|
||||||
|
@ -2582,7 +2582,7 @@ int PCB_SELECTION_TOOL::hitTestDistance( const wxPoint& aWhere, BOARD_ITEM* aIte
|
||||||
case PCB_FOOTPRINT_T:
|
case PCB_FOOTPRINT_T:
|
||||||
{
|
{
|
||||||
FOOTPRINT* footprint = static_cast<FOOTPRINT*>( aItem );
|
FOOTPRINT* footprint = static_cast<FOOTPRINT*>( aItem );
|
||||||
EDA_RECT bbox = footprint->GetBoundingBox( false, false );
|
BOX2I bbox = footprint->GetBoundingBox( false, false );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -131,7 +131,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* ONLY TO BE USED BY CLIENTS WHICH SET UP THE CACHE!
|
* ONLY TO BE USED BY CLIENTS WHICH SET UP THE CACHE!
|
||||||
*/
|
*/
|
||||||
const EDA_RECT GetCachedBoundingBox() const { return m_bboxCache; }
|
const BOX2I GetCachedBoundingBox() const { return m_bboxCache; }
|
||||||
void CacheBoundingBox() { m_bboxCache = GetBoundingBox(); }
|
void CacheBoundingBox() { m_bboxCache = GetBoundingBox(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -425,8 +425,7 @@ public:
|
||||||
SHAPE_POLY_SET::VERTEX_INDEX* aCornerHit = nullptr ) const;
|
SHAPE_POLY_SET::VERTEX_INDEX* aCornerHit = nullptr ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copydoc BOARD_ITEM::HitTest(const EDA_RECT& aRect,
|
* @copydoc BOARD_ITEM::HitTest(const BOX2I& aRect, bool aContained, int aAccuracy) const
|
||||||
* bool aContained = true, int aAccuracy) const
|
|
||||||
*/
|
*/
|
||||||
bool HitTest( const BOX2I& aRect, bool aContained = true, int aAccuracy = 0 ) const override;
|
bool HitTest( const BOX2I& aRect, bool aContained = true, int aAccuracy = 0 ) const override;
|
||||||
|
|
||||||
|
@ -876,7 +875,7 @@ protected:
|
||||||
std::map<PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>> m_FilledPolysList;
|
std::map<PCB_LAYER_ID, std::shared_ptr<SHAPE_POLY_SET>> m_FilledPolysList;
|
||||||
|
|
||||||
/// Temp variables used while filling
|
/// Temp variables used while filling
|
||||||
EDA_RECT m_bboxCache;
|
BOX2I m_bboxCache;
|
||||||
std::map<PCB_LAYER_ID, bool> m_fillFlags;
|
std::map<PCB_LAYER_ID, bool> m_fillFlags;
|
||||||
|
|
||||||
/// A hash value used in zone filling calculations to see if the filled areas are up to date
|
/// A hash value used in zone filling calculations to see if the filled areas are up to date
|
||||||
|
|
|
@ -203,7 +203,7 @@ bool ZONE_FILLER::Fill( std::vector<ZONE*>& aZones, bool aCheck, wxWindow* aPare
|
||||||
|
|
||||||
// A higher priority zone is found: if we intersect and it's not filled yet
|
// A higher priority zone is found: if we intersect and it's not filled yet
|
||||||
// then we have to wait.
|
// then we have to wait.
|
||||||
EDA_RECT inflatedBBox = aZone->GetCachedBoundingBox();
|
BOX2I inflatedBBox = aZone->GetCachedBoundingBox();
|
||||||
inflatedBBox.Inflate( m_worstClearance );
|
inflatedBBox.Inflate( m_worstClearance );
|
||||||
|
|
||||||
return inflatedBBox.Intersects( aOtherZone->GetCachedBoundingBox() );
|
return inflatedBBox.Intersects( aOtherZone->GetCachedBoundingBox() );
|
||||||
|
@ -572,7 +572,7 @@ void ZONE_FILLER::knockoutThermalReliefs( const ZONE* aZone, PCB_LAYER_ID aLayer
|
||||||
{
|
{
|
||||||
for( PAD* pad : footprint->Pads() )
|
for( PAD* pad : footprint->Pads() )
|
||||||
{
|
{
|
||||||
EDA_RECT padBBox = pad->GetBoundingBox();
|
BOX2I padBBox = pad->GetBoundingBox();
|
||||||
padBBox.Inflate( m_worstClearance );
|
padBBox.Inflate( m_worstClearance );
|
||||||
|
|
||||||
if( !padBBox.Intersects( aZone->GetCachedBoundingBox() ) )
|
if( !padBBox.Intersects( aZone->GetCachedBoundingBox() ) )
|
||||||
|
@ -672,7 +672,7 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa
|
||||||
// A small extra clearance to be sure actual track clearances are not smaller than
|
// A small extra clearance to be sure actual track clearances are not smaller than
|
||||||
// requested clearance due to many approximations in calculations, like arc to segment
|
// requested clearance due to many approximations in calculations, like arc to segment
|
||||||
// approx, rounding issues, etc.
|
// approx, rounding issues, etc.
|
||||||
EDA_RECT zone_boundingbox = aZone->GetCachedBoundingBox();
|
BOX2I zone_boundingbox = aZone->GetCachedBoundingBox();
|
||||||
int extra_margin = Millimeter2iu( ADVANCED_CFG::GetCfg().m_ExtraClearance );
|
int extra_margin = Millimeter2iu( ADVANCED_CFG::GetCfg().m_ExtraClearance );
|
||||||
|
|
||||||
// Items outside the zone bounding box are skipped, so it needs to be inflated by the
|
// Items outside the zone bounding box are skipped, so it needs to be inflated by the
|
||||||
|
@ -1179,7 +1179,7 @@ bool ZONE_FILLER::fillCopperZone( const ZONE* aZone, PCB_LAYER_ID aLayer, PCB_LA
|
||||||
for( int ii = aFillPolys.OutlineCount() - 1; ii >= 0; ii-- )
|
for( int ii = aFillPolys.OutlineCount() - 1; ii >= 0; ii-- )
|
||||||
{
|
{
|
||||||
std::vector<SHAPE_LINE_CHAIN>& island = aFillPolys.Polygon( ii );
|
std::vector<SHAPE_LINE_CHAIN>& island = aFillPolys.Polygon( ii );
|
||||||
EDA_RECT islandExtents = island.front().BBox();
|
BOX2I islandExtents = island.front().BBox();
|
||||||
|
|
||||||
if( islandExtents.GetSizeMax() < half_min_width )
|
if( islandExtents.GetSizeMax() < half_min_width )
|
||||||
aFillPolys.DeletePolygon( ii );
|
aFillPolys.DeletePolygon( ii );
|
||||||
|
@ -1239,7 +1239,7 @@ bool ZONE_FILLER::fillNonCopperZone( const ZONE* aZone, PCB_LAYER_ID aLayer,
|
||||||
SHAPE_POLY_SET& aFillPolys )
|
SHAPE_POLY_SET& aFillPolys )
|
||||||
{
|
{
|
||||||
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
|
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
|
||||||
EDA_RECT zone_boundingbox = aZone->GetCachedBoundingBox();
|
BOX2I zone_boundingbox = aZone->GetCachedBoundingBox();
|
||||||
SHAPE_POLY_SET clearanceHoles;
|
SHAPE_POLY_SET clearanceHoles;
|
||||||
long ticker = 0;
|
long ticker = 0;
|
||||||
|
|
||||||
|
@ -1357,7 +1357,7 @@ void ZONE_FILLER::buildThermalSpokes( const ZONE* aZone, PCB_LAYER_ID aLayer,
|
||||||
std::deque<SHAPE_LINE_CHAIN>& aSpokesList )
|
std::deque<SHAPE_LINE_CHAIN>& aSpokesList )
|
||||||
{
|
{
|
||||||
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
|
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
|
||||||
EDA_RECT zoneBB = aZone->GetCachedBoundingBox();
|
BOX2I zoneBB = aZone->GetCachedBoundingBox();
|
||||||
DRC_CONSTRAINT constraint;
|
DRC_CONSTRAINT constraint;
|
||||||
|
|
||||||
zoneBB.Inflate( std::max( bds.GetBiggestClearanceValue(), aZone->GetLocalClearance() ) );
|
zoneBB.Inflate( std::max( bds.GetBiggestClearanceValue(), aZone->GetLocalClearance() ) );
|
||||||
|
@ -1626,7 +1626,7 @@ bool ZONE_FILLER::addHatchFillTypeOnZone( const ZONE* aZone, PCB_LAYER_ID aLayer
|
||||||
// one of the holes. Effectively this means their copper outline needs to be expanded
|
// one of the holes. Effectively this means their copper outline needs to be expanded
|
||||||
// to be at least as wide as the gap so that it is guaranteed to touch at least one
|
// to be at least as wide as the gap so that it is guaranteed to touch at least one
|
||||||
// edge.
|
// edge.
|
||||||
EDA_RECT zone_boundingbox = aZone->GetCachedBoundingBox();
|
BOX2I zone_boundingbox = aZone->GetCachedBoundingBox();
|
||||||
SHAPE_POLY_SET aprons;
|
SHAPE_POLY_SET aprons;
|
||||||
int min_apron_radius = ( aZone->GetHatchGap() * 10 ) / 19;
|
int min_apron_radius = ( aZone->GetHatchGap() * 10 ) / 19;
|
||||||
|
|
||||||
|
|
|
@ -84,12 +84,13 @@ BOOST_AUTO_TEST_CASE( Default )
|
||||||
BOOST_CHECK_EQUAL( count, 0 );
|
BOOST_CHECK_EQUAL( count, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
EDA_RECT bbox;
|
BOX2I bbox;
|
||||||
|
|
||||||
for( int type = 0; type <= MAX_STRUCT_TYPE_ID; type++ )
|
for( int type = 0; type <= MAX_STRUCT_TYPE_ID; type++ )
|
||||||
{
|
{
|
||||||
count = 0;
|
count = 0;
|
||||||
for( auto item : m_tree.Overlapping( SCH_JUNCTION_T, bbox ) )
|
|
||||||
|
for( SCH_ITEM* item : m_tree.Overlapping( SCH_JUNCTION_T, bbox ) )
|
||||||
{
|
{
|
||||||
ignore_unused( item );
|
ignore_unused( item );
|
||||||
count++;
|
count++;
|
||||||
|
@ -127,12 +128,13 @@ BOOST_AUTO_TEST_CASE( Junctions )
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL( count, 0 );
|
BOOST_CHECK_EQUAL( count, 0 );
|
||||||
|
|
||||||
EDA_RECT small_bbox( VECTOR2I( -1, -1 ), VECTOR2I( Mils2iu( 2 ), Mils2iu( 2 ) ) );
|
BOX2I small_bbox( VECTOR2I( -1, -1 ), VECTOR2I( Mils2iu( 2 ), Mils2iu( 2 ) ) );
|
||||||
EDA_RECT med_bbox( VECTOR2I( 0, 0 ), VECTOR2I( Mils2iu( 100 ), Mils2iu( 100 ) ) );
|
BOX2I med_bbox( VECTOR2I( 0, 0 ), VECTOR2I( Mils2iu( 100 ), Mils2iu( 100 ) ) );
|
||||||
EDA_RECT big_bbox( VECTOR2I( 0, 0 ), VECTOR2I( Mils2iu( 5000 ), Mils2iu( 5000 ) ) );
|
BOX2I big_bbox( VECTOR2I( 0, 0 ), VECTOR2I( Mils2iu( 5000 ), Mils2iu( 5000 ) ) );
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for( auto item : m_tree.Overlapping( small_bbox ) )
|
|
||||||
|
for( SCH_ITEM* item : m_tree.Overlapping( small_bbox ) )
|
||||||
{
|
{
|
||||||
BOOST_CHECK( small_bbox.Intersects( item->GetBoundingBox() ) );
|
BOOST_CHECK( small_bbox.Intersects( item->GetBoundingBox() ) );
|
||||||
count++;
|
count++;
|
||||||
|
@ -141,7 +143,8 @@ BOOST_AUTO_TEST_CASE( Junctions )
|
||||||
BOOST_CHECK_EQUAL( count, 1 );
|
BOOST_CHECK_EQUAL( count, 1 );
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for( auto item : m_tree.Overlapping( SCH_JUNCTION_T, small_bbox ) )
|
|
||||||
|
for( SCH_ITEM* item : m_tree.Overlapping( SCH_JUNCTION_T, small_bbox ) )
|
||||||
{
|
{
|
||||||
BOOST_CHECK( small_bbox.Intersects( item->GetBoundingBox() ) );
|
BOOST_CHECK( small_bbox.Intersects( item->GetBoundingBox() ) );
|
||||||
count++;
|
count++;
|
||||||
|
@ -150,7 +153,8 @@ BOOST_AUTO_TEST_CASE( Junctions )
|
||||||
BOOST_CHECK_EQUAL( count, 1 );
|
BOOST_CHECK_EQUAL( count, 1 );
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for( auto item : m_tree.Overlapping( SCH_NO_CONNECT_T, small_bbox ) )
|
|
||||||
|
for( SCH_ITEM* item : m_tree.Overlapping( SCH_NO_CONNECT_T, small_bbox ) )
|
||||||
{
|
{
|
||||||
BOOST_CHECK( small_bbox.Intersects( item->GetBoundingBox() ) );
|
BOOST_CHECK( small_bbox.Intersects( item->GetBoundingBox() ) );
|
||||||
count++;
|
count++;
|
||||||
|
@ -159,7 +163,8 @@ BOOST_AUTO_TEST_CASE( Junctions )
|
||||||
BOOST_CHECK_EQUAL( count, 0 );
|
BOOST_CHECK_EQUAL( count, 0 );
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for( auto item : m_tree.Overlapping( med_bbox ) )
|
|
||||||
|
for( SCH_ITEM* item : m_tree.Overlapping( med_bbox ) )
|
||||||
{
|
{
|
||||||
BOOST_CHECK( med_bbox.Intersects( item->GetBoundingBox() ) );
|
BOOST_CHECK( med_bbox.Intersects( item->GetBoundingBox() ) );
|
||||||
count++;
|
count++;
|
||||||
|
@ -168,7 +173,8 @@ BOOST_AUTO_TEST_CASE( Junctions )
|
||||||
BOOST_CHECK_EQUAL( count, 2 );
|
BOOST_CHECK_EQUAL( count, 2 );
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for( auto item : m_tree.Overlapping( big_bbox ) )
|
|
||||||
|
for( SCH_ITEM* item : m_tree.Overlapping( big_bbox ) )
|
||||||
{
|
{
|
||||||
BOOST_CHECK( big_bbox.Intersects( item->GetBoundingBox() ) );
|
BOOST_CHECK( big_bbox.Intersects( item->GetBoundingBox() ) );
|
||||||
count++;
|
count++;
|
||||||
|
@ -187,18 +193,18 @@ BOOST_AUTO_TEST_CASE( MixedElements )
|
||||||
int x_sign = ( i % 2 == 0 ) ? -1 : 1;
|
int x_sign = ( i % 2 == 0 ) ? -1 : 1;
|
||||||
int y_sign = ( i % 3 == 0 ) ? -1 : 1;
|
int y_sign = ( i % 3 == 0 ) ? -1 : 1;
|
||||||
|
|
||||||
SCH_JUNCTION* junction = new SCH_JUNCTION(
|
SCH_JUNCTION* junction = new SCH_JUNCTION( VECTOR2I( Mils2iu( 100 ) * i * x_sign,
|
||||||
VECTOR2I( Mils2iu( 100 ) * i * x_sign, Mils2iu( 100 ) * i * y_sign ) );
|
Mils2iu( 100 ) * i * y_sign ) );
|
||||||
m_tree.insert( junction );
|
m_tree.insert( junction );
|
||||||
|
|
||||||
SCH_NO_CONNECT* nc = new SCH_NO_CONNECT(
|
SCH_NO_CONNECT* nc = new SCH_NO_CONNECT( VECTOR2I( Mils2iu( 150 ) * i * y_sign,
|
||||||
VECTOR2I( Mils2iu( 150 ) * i * y_sign, Mils2iu( 150 ) * i * x_sign ) );
|
Mils2iu( 150 ) * i * x_sign ) );
|
||||||
m_tree.insert( nc );
|
m_tree.insert( nc );
|
||||||
}
|
}
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for( auto item : m_tree.OfType( SCH_JUNCTION_T ) )
|
for( SCH_ITEM* item : m_tree.OfType( SCH_JUNCTION_T ) )
|
||||||
{
|
{
|
||||||
ignore_unused( item );
|
ignore_unused( item );
|
||||||
count++;
|
count++;
|
||||||
|
@ -207,7 +213,8 @@ BOOST_AUTO_TEST_CASE( MixedElements )
|
||||||
BOOST_CHECK_EQUAL( count, 100 );
|
BOOST_CHECK_EQUAL( count, 100 );
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for( auto item : m_tree.OfType( SCH_NO_CONNECT_T ) )
|
|
||||||
|
for( SCH_ITEM* item : m_tree.OfType( SCH_NO_CONNECT_T ) )
|
||||||
{
|
{
|
||||||
ignore_unused( item );
|
ignore_unused( item );
|
||||||
count++;
|
count++;
|
||||||
|
@ -218,7 +225,8 @@ BOOST_AUTO_TEST_CASE( MixedElements )
|
||||||
EDA_RECT small_bbox( VECTOR2I( -1, -1 ), VECTOR2I( Mils2iu( 2 ), Mils2iu( 2 ) ) );
|
EDA_RECT small_bbox( VECTOR2I( -1, -1 ), VECTOR2I( Mils2iu( 2 ), Mils2iu( 2 ) ) );
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for( auto item : m_tree.Overlapping( small_bbox ) )
|
|
||||||
|
for( SCH_ITEM* item : m_tree.Overlapping( small_bbox ) )
|
||||||
{
|
{
|
||||||
BOOST_CHECK( small_bbox.Intersects( item->GetBoundingBox() ) );
|
BOOST_CHECK( small_bbox.Intersects( item->GetBoundingBox() ) );
|
||||||
count++;
|
count++;
|
||||||
|
@ -227,7 +235,8 @@ BOOST_AUTO_TEST_CASE( MixedElements )
|
||||||
BOOST_CHECK_EQUAL( count, 2 );
|
BOOST_CHECK_EQUAL( count, 2 );
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for( auto item : m_tree.Overlapping( SCH_JUNCTION_T, small_bbox ) )
|
|
||||||
|
for( SCH_ITEM* item : m_tree.Overlapping( SCH_JUNCTION_T, small_bbox ) )
|
||||||
{
|
{
|
||||||
BOOST_CHECK( small_bbox.Intersects( item->GetBoundingBox() ) );
|
BOOST_CHECK( small_bbox.Intersects( item->GetBoundingBox() ) );
|
||||||
count++;
|
count++;
|
||||||
|
@ -236,7 +245,8 @@ BOOST_AUTO_TEST_CASE( MixedElements )
|
||||||
BOOST_CHECK_EQUAL( count, 1 );
|
BOOST_CHECK_EQUAL( count, 1 );
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for( auto item : m_tree.Overlapping( SCH_NO_CONNECT_T, small_bbox ) )
|
|
||||||
|
for( SCH_ITEM* item : m_tree.Overlapping( SCH_NO_CONNECT_T, small_bbox ) )
|
||||||
{
|
{
|
||||||
BOOST_CHECK( small_bbox.Intersects( item->GetBoundingBox() ) );
|
BOOST_CHECK( small_bbox.Intersects( item->GetBoundingBox() ) );
|
||||||
count++;
|
count++;
|
||||||
|
|
Loading…
Reference in New Issue