KiCad PCB EDA Suite
EDA_RECT Class Reference

Handle the component boundary box. More...

#include <eda_rect.h>

Public Member Functions

 EDA_RECT ()
 
 EDA_RECT (const wxPoint &aPos, const wxSize &aSize)
 
virtual ~EDA_RECT ()
 
wxPoint Centre () const
 
void Move (const wxPoint &aMoveVector)
 Move the rectangle by the aMoveVector. More...
 
void Normalize ()
 Ensures that the height ant width are positive. More...
 
bool Contains (const wxPoint &aPoint) const
 
bool Contains (int x, int y) const
 
bool Contains (const EDA_RECT &aRect) const
 
const wxSize GetSize () const
 
int GetSizeMax () const
 
int GetX () const
 
int GetY () const
 
const wxPoint GetOrigin () const
 
const wxPoint GetPosition () const
 
const wxPoint GetEnd () const
 
const wxPoint GetCenter () const
 
int GetWidth () const
 
int GetHeight () const
 
int GetRight () const
 
int GetLeft () const
 
int GetTop () const
 
int GetBottom () const
 
bool IsValid () const
 
void SetOrigin (const wxPoint &pos)
 
void SetOrigin (int x, int y)
 
void SetSize (const wxSize &size)
 
void SetSize (int w, int h)
 
void Offset (int dx, int dy)
 
void Offset (const wxPoint &offset)
 
void SetX (int val)
 
void SetY (int val)
 
void SetWidth (int val)
 
void SetHeight (int val)
 
void SetEnd (int x, int y)
 
void SetEnd (const wxPoint &pos)
 
void RevertYAxis ()
 Mirror the rectangle from the X axis (negate Y pos and size). More...
 
bool Intersects (const EDA_RECT &aRect) const
 Test for a common area between rectangles. More...
 
bool Intersects (const EDA_RECT &aRect, double aRot) const
 Tests for a common area between this rectangle, and a rectangle with arbitrary rotation. More...
 
bool Intersects (const wxPoint &aPoint1, const wxPoint &aPoint2) const
 Test for a common area between a segment and this rectangle. More...
 
bool Intersects (const wxPoint &aPoint1, const wxPoint &aPoint2, wxPoint *aIntersection1, wxPoint *aIntersection2) const
 Test for intersection between a segment and this rectangle, returning the intersections. More...
 
const wxPoint ClosestPointTo (const wxPoint &aPoint) const
 Return the point in this rect that is closest to the provided point. More...
 
const wxPoint FarthestPointTo (const wxPoint &aPoint) const
 Return the point in this rect that is farthest from the provided point. More...
 
bool IntersectsCircle (const wxPoint &aCenter, const int aRadius) const
 Test for a common area between a circle and this rectangle. More...
 
bool IntersectsCircleEdge (const wxPoint &aCenter, const int aRadius, const int aWidth) const
 Test for intersection between this rect and the edge (radius) of a circle. More...
 
 operator wxRect () const
 Overload the cast operator to return a wxRect. More...
 
 operator BOX2I () const
 Overload the cast operator to return a BOX2I. More...
 
EDA_RECTInflate (wxCoord dx, wxCoord dy)
 Inflate the rectangle horizontally by dx and vertically by dy. More...
 
EDA_RECTInflate (int aDelta)
 Inflate the rectangle horizontally and vertically by aDelta. More...
 
void Merge (const EDA_RECT &aRect)
 Modify the position and size of the rectangle in order to contain aRect. More...
 
void Merge (const wxPoint &aPoint)
 Modify the position and size of the rectangle in order to contain the given point. More...
 
double GetArea () const
 Return the area of the rectangle. More...
 
EDA_RECT Common (const EDA_RECT &aRect) const
 Return the area that is common with another rectangle. More...
 
const EDA_RECT GetBoundingBoxRotated (const wxPoint &aRotCenter, double aAngle) const
 Useful to calculate bounding box of rotated items, when rotation if not k*90 degrees. More...
 

Private Attributes

wxPoint m_pos
 
wxSize m_size
 
bool m_init
 

Detailed Description

Handle the component boundary box.

This class is similar to wxRect, but some wxRect functions are very curious, and are working only if dimensions are >= 0 (not always the case in KiCad) and also KiCad needs some specific method which makes this a more suitable class.

Definition at line 42 of file eda_rect.h.

Constructor & Destructor Documentation

◆ EDA_RECT() [1/2]

EDA_RECT::EDA_RECT ( )
inline

Definition at line 45 of file eda_rect.h.

45 : m_init( false ) { };
bool m_init
Definition: eda_rect.h:350

◆ EDA_RECT() [2/2]

EDA_RECT::EDA_RECT ( const wxPoint &  aPos,
const wxSize &  aSize 
)
inline

Definition at line 47 of file eda_rect.h.

47  :
48  m_pos( aPos ),
49  m_size( aSize ),
50  m_init( true )
51  { }
wxPoint m_pos
Definition: eda_rect.h:348
wxSize m_size
Definition: eda_rect.h:349
bool m_init
Definition: eda_rect.h:350

◆ ~EDA_RECT()

virtual EDA_RECT::~EDA_RECT ( )
inlinevirtual

Definition at line 53 of file eda_rect.h.

53 { };

Member Function Documentation

◆ Centre()

◆ ClosestPointTo()

const wxPoint EDA_RECT::ClosestPointTo ( const wxPoint &  aPoint) const

Return the point in this rect that is closest to the provided point.

Definition at line 288 of file eda_rect.cpp.

289 {
290  EDA_RECT me( *this );
291 
292  me.Normalize(); // ensure size is >= 0
293 
294  // Determine closest point to the circle centre within this rect
295  int nx = std::max( me.GetLeft(), std::min( aPoint.x, me.GetRight() ) );
296  int ny = std::max( me.GetTop(), std::min( aPoint.y, me.GetBottom() ) );
297 
298  return wxPoint( nx, ny );
299 }
Handle the component boundary box.
Definition: eda_rect.h:42

References GetBottom(), GetLeft(), GetRight(), GetTop(), and Normalize().

Referenced by IntersectsCircle().

◆ Common()

EDA_RECT EDA_RECT::Common ( const EDA_RECT aRect) const

Return the area that is common with another rectangle.

Parameters
aRectis the rectangle to find the common area with.
Returns
The common area rect or 0-sized rectangle if there is no intersection.

Definition at line 489 of file eda_rect.cpp.

490 {
491  EDA_RECT r;
492 
493  if( Intersects( aRect ) )
494  {
495  wxPoint originA(
496  std::min( GetOrigin().x, GetEnd().x ), std::min( GetOrigin().y, GetEnd().y ) );
497  wxPoint originB( std::min( aRect.GetOrigin().x, aRect.GetEnd().x ),
498  std::min( aRect.GetOrigin().y, aRect.GetEnd().y ) );
499  wxPoint endA(
500  std::max( GetOrigin().x, GetEnd().x ), std::max( GetOrigin().y, GetEnd().y ) );
501  wxPoint endB( std::max( aRect.GetOrigin().x, aRect.GetEnd().x ),
502  std::max( aRect.GetOrigin().y, aRect.GetEnd().y ) );
503 
504  r.SetOrigin(
505  wxPoint( std::max( originA.x, originB.x ), std::max( originA.y, originB.y ) ) );
506  r.SetEnd( wxPoint( std::min( endA.x, endB.x ), std::min( endA.y, endB.y ) ) );
507  }
508 
509  return r;
510 }
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:121
const wxPoint GetEnd() const
Definition: eda_rect.h:103
const wxPoint GetOrigin() const
Definition: eda_rect.h:101
void SetEnd(int x, int y)
Definition: eda_rect.h:182
Handle the component boundary box.
Definition: eda_rect.h:42
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
Definition: eda_rect.cpp:150

References GetEnd(), GetOrigin(), Intersects(), SetEnd(), and SetOrigin().

Referenced by LIB_ARC::HitTest(), and PCB_SHAPE::HitTest().

◆ Contains() [1/3]

bool EDA_RECT::Contains ( const wxPoint &  aPoint) const
Parameters
aPointthe wxPoint to test.
Returns
true if aPoint is inside the boundary box. A point on a edge is seen as inside.

Definition at line 57 of file eda_rect.cpp.

58 {
59  wxPoint rel_pos = aPoint - m_pos;
60  wxSize size = m_size;
61 
62  if( size.x < 0 )
63  {
64  size.x = -size.x;
65  rel_pos.x += size.x;
66  }
67 
68  if( size.y < 0 )
69  {
70  size.y = -size.y;
71  rel_pos.y += size.y;
72  }
73 
74  return ( rel_pos.x >= 0 ) && ( rel_pos.y >= 0 ) && ( rel_pos.y <= size.y )
75  && ( rel_pos.x <= size.x );
76 }
wxPoint m_pos
Definition: eda_rect.h:348
wxSize m_size
Definition: eda_rect.h:349

References m_pos, and m_size.

Referenced by AR_AUTOPLACER::AutoplaceFootprints(), Contains(), GRPutPixel(), LIB_CIRCLE::HitTest(), LIB_RECTANGLE::HitTest(), LIB_ARC::HitTest(), LIB_TEXT::HitTest(), LIB_BEZIER::HitTest(), LIB_POLYLINE::HitTest(), SCH_PIN::HitTest(), PCB_TARGET::HitTest(), DS_DRAW_ITEM_BASE::HitTest(), SCH_BUS_ENTRY_BASE::HitTest(), SCH_JUNCTION::HitTest(), SCH_NO_CONNECT::HitTest(), SCH_BITMAP::HitTest(), LIB_ITEM::HitTest(), LIB_PIN::HitTest(), DS_DRAW_ITEM_POLYPOLYGONS::HitTest(), PCB_TRACK::HitTest(), SCH_SHEET_PIN::HitTest(), SCH_FIELD::HitTest(), GERBER_DRAW_ITEM::HitTest(), SCH_LINE::HitTest(), DS_DRAW_ITEM_RECT::HitTest(), SCH_TEXT::HitTest(), PCB_DIMENSION_BASE::HitTest(), PCB_SHAPE::HitTest(), PCB_ARC::HitTest(), DS_DRAW_ITEM_BITMAP::HitTest(), SCH_SHEET::HitTest(), PCB_VIA::HitTest(), FOOTPRINT::HitTest(), ZONE::HitTest(), PAD::HitTest(), SCH_SYMBOL::HitTest(), MARKER_BASE::HitTestMarker(), insideFootprintCourtyard(), Intersects(), AR_AUTOPLACER::nearestPad(), ALTIUM_PCB::ParsePolygons6Data(), SCH_DRAWING_TOOLS::PlaceImage(), SCH_DRAWING_TOOLS::PlaceSymbol(), PCB_SELECTION_TOOL::selectPoint(), PCB_TEXT::TextHitTest(), FP_TEXT::TextHitTest(), and EDA_TEXT::TextHitTest().

◆ Contains() [2/3]

bool EDA_RECT::Contains ( int  x,
int  y 
) const
inline
Parameters
xthe x coordinate of the point to test.
ythe x coordinate of the point to test.
Returns
true if point is inside the boundary box. A point on a edge is seen as inside

Definition at line 83 of file eda_rect.h.

83 { return Contains( wxPoint( x, y ) ); }
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57

References Contains().

Referenced by Contains().

◆ Contains() [3/3]

bool EDA_RECT::Contains ( const EDA_RECT aRect) const
Parameters
aRectthe EDA_RECT to test.
Returns
true if aRect is Contained. A common edge is seen as contained.

Definition at line 79 of file eda_rect.cpp.

80 {
81  return Contains( aRect.GetOrigin() ) && Contains( aRect.GetEnd() );
82 }
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
const wxPoint GetEnd() const
Definition: eda_rect.h:103
const wxPoint GetOrigin() const
Definition: eda_rect.h:101

References Contains(), GetEnd(), and GetOrigin().

◆ FarthestPointTo()

const wxPoint EDA_RECT::FarthestPointTo ( const wxPoint &  aPoint) const

Return the point in this rect that is farthest from the provided point.

Definition at line 302 of file eda_rect.cpp.

303 {
304  EDA_RECT me( *this );
305 
306  me.Normalize(); // ensure size is >= 0
307 
308  int fx = std::max( std::abs( aPoint.x - me.GetLeft() ), std::abs( aPoint.x - me.GetRight() ) );
309  int fy = std::max( std::abs( aPoint.y - me.GetTop() ), std::abs( aPoint.y - me.GetBottom() ) );
310 
311  return wxPoint( fx, fy );
312 }
Handle the component boundary box.
Definition: eda_rect.h:42

References GetBottom(), GetLeft(), GetRight(), GetTop(), and Normalize().

Referenced by IntersectsCircleEdge().

◆ GetArea()

double EDA_RECT::GetArea ( ) const

Return the area of the rectangle.

Returns
The area of the rectangle.

Definition at line 483 of file eda_rect.cpp.

484 {
485  return (double) GetWidth() * (double) GetHeight();
486 }
int GetWidth() const
Definition: eda_rect.h:109
int GetHeight() const
Definition: eda_rect.h:110

References GetHeight(), and GetWidth().

Referenced by SCH_SYMBOL::operator<(), and FABMASTER::orderZones().

◆ GetBottom()

◆ GetBoundingBoxRotated()

const EDA_RECT EDA_RECT::GetBoundingBoxRotated ( const wxPoint &  aRotCenter,
double  aAngle 
) const

Useful to calculate bounding box of rotated items, when rotation if not k*90 degrees.

Parameters
aAnglethe rotation angle in 0.1 deg.
aRotCenterthe rotation point.
Returns
the bounding box of this, after rotation.

Definition at line 513 of file eda_rect.cpp.

514 {
515  wxPoint corners[4];
516 
517  // Build the corners list
518  corners[0] = GetOrigin();
519  corners[2] = GetEnd();
520  corners[1].x = corners[0].x;
521  corners[1].y = corners[2].y;
522  corners[3].x = corners[2].x;
523  corners[3].y = corners[0].y;
524 
525  // Rotate all corners, to find the bounding box
526  for( int ii = 0; ii < 4; ii++ )
527  RotatePoint( &corners[ii], aRotCenter, aAngle );
528 
529  // Find the corners bounding box
530  wxPoint start = corners[0];
531  wxPoint end = corners[0];
532 
533  for( int ii = 1; ii < 4; ii++ )
534  {
535  start.x = std::min( start.x, corners[ii].x );
536  start.y = std::min( start.y, corners[ii].y );
537  end.x = std::max( end.x, corners[ii].x );
538  end.y = std::max( end.y, corners[ii].y );
539  }
540 
541  EDA_RECT bbox;
542  bbox.SetOrigin( start );
543  bbox.SetEnd( end );
544 
545  return bbox;
546 }
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:121
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
const wxPoint GetEnd() const
Definition: eda_rect.h:103
const wxPoint GetOrigin() const
Definition: eda_rect.h:101
void SetEnd(int x, int y)
Definition: eda_rect.h:182
Handle the component boundary box.
Definition: eda_rect.h:42

References GetEnd(), GetOrigin(), RotatePoint(), SetEnd(), and SetOrigin().

Referenced by PCB_TEXT::GetBoundingBox(), FP_TEXT::GetBoundingBox(), and FP_TEXT::ViewBBox().

◆ GetCenter()

const wxPoint EDA_RECT::GetCenter ( ) const
inline

◆ GetEnd()

◆ GetHeight()

int EDA_RECT::GetHeight ( ) const
inline

◆ GetLeft()

◆ GetOrigin()

◆ GetPosition()

const wxPoint EDA_RECT::GetPosition ( ) const
inline

◆ GetRight()

◆ GetSize()

◆ GetSizeMax()

int EDA_RECT::GetSizeMax ( ) const
inline
Returns
the max size dimension.

Definition at line 96 of file eda_rect.h.

96 { return ( m_size.x > m_size.y ) ? m_size.x : m_size.y; }
wxSize m_size
Definition: eda_rect.h:349

References m_size.

Referenced by BOARD_ADAPTER::addShapeWithClearance(), and SCH_GLOBALLABEL::AutoplaceFields().

◆ GetTop()

◆ GetWidth()

int EDA_RECT::GetWidth ( ) const
inline

Definition at line 109 of file eda_rect.h.

109 { return m_size.x; }
wxSize m_size
Definition: eda_rect.h:349

References m_size.

Referenced by GERBER_JOBFILE_WRITER::addJSONGeneralSpecs(), AUTOPLACE_TOOL::autoplace(), buildBoardBoundingBoxPoly(), BuildBoardPolygonOutlines(), EAGLE_PLUGIN::centerBoard(), ClipAndDrawPoly(), AUTOPLACER::computeFBoxSize(), AR_MATRIX::ComputeMatrixSize(), DIALOG_EXPORT_SVG::CreateSVGFile(), KIGFX::PCB_PAINTER::draw(), DRAWING_TOOL::DrawBoardCharacteristics(), BOARD_NETLIST_UPDATER::estimateFootprintInsertionPosition(), AUTOPLACER::fieldBoxPlacement(), fillRectList(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), GENDRILL_WRITER_BASE::genDrillMapFile(), AR_AUTOPLACER::genPlacementRoutingMatrix(), GetArea(), FOOTPRINT::GetArea(), PCB_BASE_FRAME::GetBoardBoundingBox(), PCB_MARKER::GetBoundingBox(), SYMBOL_VIEWER_FRAME::GetDocumentExtents(), BOARD::GetFootprint(), AUTOPLACER::getPreferredSides(), EDA_TEXT::GetTextBox(), EE_SELECTION_TOOL::GuessSelectionCandidates(), SCH_JUNCTION::HitTest(), PCB_SELECTION_TOOL::hitTestDistance(), BOARD_ADAPTER::InitSettings(), Intersects(), CADSTAR_PCB_ARCHIVE_PLUGIN::Load(), SCH_EAGLE_PLUGIN::loadSchematic(), DSN::SPECCTRA_DB::makePADSTACK(), moveFootprintsInArea(), LIB_TEXT::NormalizeJustification(), DIALOG_PIN_PROPERTIES::OnPaintShowPanel(), DIALOG_PAD_PROPERTIES::padValuesOK(), ALTIUM_PCB::Parse(), ALTIUM_PCB::ParsePolygons6Data(), DS_DATA_ITEM_TEXT::SetConstrainedTextSize(), SpreadFootprints(), PCB_DIM_LEADER::updateGeometry(), PCB_MARKER::ViewBBox(), and GERBER_DRAW_ITEM::ViewGetLOD().

◆ GetX()

◆ GetY()

◆ Inflate() [1/2]

EDA_RECT & EDA_RECT::Inflate ( wxCoord  dx,
wxCoord  dy 
)

Inflate the rectangle horizontally by dx and vertically by dy.

If dx and/or dy is negative the rectangle is deflated.

Definition at line 364 of file eda_rect.cpp.

365 {
366  if( m_size.x >= 0 )
367  {
368  if( m_size.x < -2 * dx )
369  {
370  // Don't allow deflate to eat more width than we have,
371  m_pos.x += m_size.x / 2;
372  m_size.x = 0;
373  }
374  else
375  {
376  // The inflate is valid.
377  m_pos.x -= dx;
378  m_size.x += 2 * dx;
379  }
380  }
381  else // size.x < 0:
382  {
383  if( m_size.x > -2 * dx )
384  {
385  // Don't allow deflate to eat more width than we have,
386  m_pos.x -= m_size.x / 2;
387  m_size.x = 0;
388  }
389  else
390  {
391  // The inflate is valid.
392  m_pos.x += dx;
393  m_size.x -= 2 * dx; // m_Size.x <0: inflate when dx > 0
394  }
395  }
396 
397  if( m_size.y >= 0 )
398  {
399  if( m_size.y < -2 * dy )
400  {
401  // Don't allow deflate to eat more height than we have,
402  m_pos.y += m_size.y / 2;
403  m_size.y = 0;
404  }
405  else
406  {
407  // The inflate is valid.
408  m_pos.y -= dy;
409  m_size.y += 2 * dy;
410  }
411  }
412  else // size.y < 0:
413  {
414  if( m_size.y > 2 * dy )
415  {
416  // Don't allow deflate to eat more height than we have,
417  m_pos.y -= m_size.y / 2;
418  m_size.y = 0;
419  }
420  else
421  {
422  // The inflate is valid.
423  m_pos.y += dy;
424  m_size.y -= 2 * dy; // m_Size.y <0: inflate when dy > 0
425  }
426  }
427 
428  return *this;
429 }
wxPoint m_pos
Definition: eda_rect.h:348
wxSize m_size
Definition: eda_rect.h:349

References m_pos, and m_size.

Referenced by AR_AUTOPLACER::addPad(), buildBoardBoundingBoxPoly(), BuildBoardPolygonOutlines(), ZONE_FILLER::buildCopperItemClearances(), AR_AUTOPLACER::buildFpAreas(), PCB_SHAPE::computeArcBBox(), ZONE_FILLER::Fill(), FillNegativeKnockout(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), APERTURE_MACRO::GetApertureMacroShape(), SCH_SHEET::GetBodyBoundingBox(), LIB_CIRCLE::GetBoundingBox(), LIB_ARC::GetBoundingBox(), LIB_RECTANGLE::GetBoundingBox(), SCH_JUNCTION::GetBoundingBox(), LIB_BEZIER::GetBoundingBox(), SCH_NO_CONNECT::GetBoundingBox(), LIB_POLYLINE::GetBoundingBox(), SCH_BUS_ENTRY_BASE::GetBoundingBox(), BITMAP_BASE::GetBoundingBox(), FOOTPRINT::GetBoundingBox(), PCB_GROUP::GetBoundingBox(), LIB_PIN::GetBoundingBox(), GERBER_DRAW_ITEM::GetBoundingBox(), PCB_SHAPE::GetBoundingBox(), SCH_DRAWING_TOOLS::GetCanvasFreeAreaPixels(), SCH_SCREEN::GetItem(), EDA_TEXT::GetTextBox(), GRCSegm(), GRLineArray(), GRSFilledRect(), EE_SELECTION_TOOL::GuessSelectionCandidates(), hasThermalConnection(), LIB_CIRCLE::HitTest(), LIB_RECTANGLE::HitTest(), LIB_ARC::HitTest(), LIB_TEXT::HitTest(), LIB_BEZIER::HitTest(), LIB_POLYLINE::HitTest(), SCH_PIN::HitTest(), PCB_TARGET::HitTest(), DS_DRAW_ITEM_BASE::HitTest(), SCH_BUS_ENTRY_BASE::HitTest(), SCH_NO_CONNECT::HitTest(), SCH_JUNCTION::HitTest(), SCH_BITMAP::HitTest(), LIB_ITEM::HitTest(), LIB_PIN::HitTest(), DS_DRAW_ITEM_POLYPOLYGONS::HitTest(), PCB_TRACK::HitTest(), SCH_SHEET_PIN::HitTest(), SCH_FIELD::HitTest(), SCH_LINE::HitTest(), DS_DRAW_ITEM_RECT::HitTest(), SCH_TEXT::HitTest(), PCB_DIMENSION_BASE::HitTest(), PCB_SHAPE::HitTest(), PCB_ARC::HitTest(), DS_DRAW_ITEM_BITMAP::HitTest(), SCH_SHEET::HitTest(), PCB_VIA::HitTest(), FOOTPRINT::HitTest(), ZONE::HitTest(), PAD::HitTest(), SCH_SYMBOL::HitTest(), MARKER_BASE::HitTestMarker(), Inflate(), BOARD_ADAPTER::InitSettings(), Intersects(), EE_SELECTION_TOOL::Main(), EE_RTREE::Overlapping(), DRC_RTREE::Overlapping(), DRC_RTREE::QueryColliding(), SpreadFootprints(), AR_AUTOPLACER::testFootprintOnBoard(), AR_AUTOPLACER::testRectangle(), PCB_TEXT::TextHitTest(), FP_TEXT::TextHitTest(), EDA_TEXT::TextHitTest(), EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon(), PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), PCB_DIM_LEADER::updateGeometry(), FOOTPRINT::ViewBBox(), and WinClipAndDrawLine().

◆ Inflate() [2/2]

EDA_RECT & EDA_RECT::Inflate ( int  aDelta)

Inflate the rectangle horizontally and vertically by aDelta.

If aDelta is negative the rectangle is deflated.

Definition at line 357 of file eda_rect.cpp.

358 {
359  Inflate( aDelta, aDelta );
360  return *this;
361 }
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364

References Inflate().

◆ Intersects() [1/4]

bool EDA_RECT::Intersects ( const EDA_RECT aRect) const

Test for a common area between rectangles.

Parameters
aRectA rectangle to test intersection with.
Returns
true if the argument rectangle intersects this rectangle. (i.e. if the 2 rectangles have at least a common point)

Definition at line 150 of file eda_rect.cpp.

151 {
152  if( !m_init )
153  return false;
154 
155  // this logic taken from wxWidgets' geometry.cpp file:
156  bool rc;
157  EDA_RECT me( *this );
158  EDA_RECT rect( aRect );
159  me.Normalize(); // ensure size is >= 0
160  rect.Normalize(); // ensure size is >= 0
161 
162  // calculate the left common area coordinate:
163  int left = std::max( me.m_pos.x, rect.m_pos.x );
164 
165  // calculate the right common area coordinate:
166  int right = std::min( me.m_pos.x + me.m_size.x, rect.m_pos.x + rect.m_size.x );
167 
168  // calculate the upper common area coordinate:
169  int top = std::max( me.m_pos.y, aRect.m_pos.y );
170 
171  // calculate the lower common area coordinate:
172  int bottom = std::min( me.m_pos.y + me.m_size.y, rect.m_pos.y + rect.m_size.y );
173 
174  // if a common area exists, it must have a positive (null accepted) size
175  if( left <= right && top <= bottom )
176  rc = true;
177  else
178  rc = false;
179 
180  return rc;
181 }
wxPoint m_pos
Definition: eda_rect.h:348
bool m_init
Definition: eda_rect.h:350
Handle the component boundary box.
Definition: eda_rect.h:42

References left, m_init, m_pos, m_size, Normalize(), and right.

Referenced by BOOST_AUTO_TEST_CASE(), Common(), ZONE_FILLER::Fill(), AUTOPLACER::filterCollisions(), hasThermalConnection(), LIB_CIRCLE::HitTest(), LIB_RECTANGLE::HitTest(), LIB_ARC::HitTest(), LIB_TEXT::HitTest(), LIB_BEZIER::HitTest(), LIB_POLYLINE::HitTest(), PCB_TARGET::HitTest(), DS_DRAW_ITEM_BASE::HitTest(), SCH_BUS_ENTRY_BASE::HitTest(), SCH_NO_CONNECT::HitTest(), SCH_BITMAP::HitTest(), LIB_ITEM::HitTest(), LIB_PIN::HitTest(), DS_DRAW_ITEM_POLYPOLYGONS::HitTest(), PCB_TRACK::HitTest(), SCH_FIELD::HitTest(), SCH_LINE::HitTest(), DS_DRAW_ITEM_RECT::HitTest(), SCH_TEXT::HitTest(), PCB_DIMENSION_BASE::HitTest(), PCB_SHAPE::HitTest(), PCB_ARC::HitTest(), SCH_SHEET::HitTest(), FOOTPRINT::HitTest(), ZONE::HitTest(), PAD::HitTest(), SCH_SYMBOL::HitTest(), insideFootprintCourtyard(), Intersects(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones(), PCB_TEXT::TextHitTest(), FP_TEXT::TextHitTest(), and EDA_TEXT::TextHitTest().

◆ Intersects() [2/4]

bool EDA_RECT::Intersects ( const EDA_RECT aRect,
double  aRot 
) const

Tests for a common area between this rectangle, and a rectangle with arbitrary rotation.

Parameters
aRecta rectangle to test intersection with.
aRotrectangle rotation (in 1/10 degrees).

Definition at line 184 of file eda_rect.cpp.

185 {
186  if( !m_init )
187  return false;
188 
189  /* Most rectangles will be axis aligned.
190  * It is quicker to check for this case and pass the rect
191  * to the simpler intersection test
192  */
193 
194  // Prevent floating point comparison errors
195  static const double ROT_EPS = 0.000000001;
196 
197  static const double ROT_PARALLEL[] = { -3600, -1800, 0, 1800, 3600 };
198  static const double ROT_PERPENDICULAR[] = { -2700, -900, 0, 900, 2700 };
199 
200  NORMALIZE_ANGLE_POS<double>( aRot );
201 
202  // Test for non-rotated rectangle
203  for( int ii = 0; ii < 5; ii++ )
204  {
205  if( std::fabs( aRot - ROT_PARALLEL[ii] ) < ROT_EPS )
206  {
207  return Intersects( aRect );
208  }
209  }
210 
211  // Test for rectangle rotated by multiple of 90 degrees
212  for( int jj = 0; jj < 4; jj++ )
213  {
214  if( std::fabs( aRot - ROT_PERPENDICULAR[jj] ) < ROT_EPS )
215  {
216  EDA_RECT rotRect;
217 
218  // Rotate the supplied rect by 90 degrees
219  rotRect.SetOrigin( aRect.Centre() );
220  rotRect.Inflate( aRect.GetHeight(), aRect.GetWidth() );
221  return Intersects( rotRect );
222  }
223  }
224 
225  /* There is some non-orthogonal rotation.
226  * There are three cases to test:
227  * A) One point of this rect is inside the rotated rect
228  * B) One point of the rotated rect is inside this rect
229  * C) One of the sides of the rotated rect intersect this
230  */
231 
232  wxPoint corners[4];
233 
234  /* Test A : Any corners exist in rotated rect? */
235  corners[0] = m_pos;
236  corners[1] = m_pos + wxPoint( m_size.x, 0 );
237  corners[2] = m_pos + wxPoint( m_size.x, m_size.y );
238  corners[3] = m_pos + wxPoint( 0, m_size.y );
239 
240  wxPoint rCentre = aRect.Centre();
241 
242  for( int i = 0; i < 4; i++ )
243  {
244  wxPoint delta = corners[i] - rCentre;
245  RotatePoint( &delta, -aRot );
246  delta += rCentre;
247 
248  if( aRect.Contains( delta ) )
249  {
250  return true;
251  }
252  }
253 
254  /* Test B : Any corners of rotated rect exist in this one? */
255  int w = aRect.GetWidth() / 2;
256  int h = aRect.GetHeight() / 2;
257 
258  // Construct corners around center of shape
259  corners[0] = wxPoint( -w, -h );
260  corners[1] = wxPoint( w, -h );
261  corners[2] = wxPoint( w, h );
262  corners[3] = wxPoint( -w, h );
263 
264  // Rotate and test each corner
265  for( int j = 0; j < 4; j++ )
266  {
267  RotatePoint( &corners[j], aRot );
268  corners[j] += rCentre;
269 
270  if( Contains( corners[j] ) )
271  {
272  return true;
273  }
274  }
275 
276  /* Test C : Any sides of rotated rect intersect this */
277  if( Intersects( corners[0], corners[1] ) || Intersects( corners[1], corners[2] )
278  || Intersects( corners[2], corners[3] ) || Intersects( corners[3], corners[0] ) )
279  {
280  return true;
281  }
282 
283 
284  return false;
285 }
int GetWidth() const
Definition: eda_rect.h:109
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:121
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
int GetHeight() const
Definition: eda_rect.h:110
wxPoint m_pos
Definition: eda_rect.h:348
wxSize m_size
Definition: eda_rect.h:349
bool m_init
Definition: eda_rect.h:350
Handle the component boundary box.
Definition: eda_rect.h:42
wxPoint Centre() const
Definition: eda_rect.h:55
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
Definition: eda_rect.cpp:150
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364

References Centre(), Contains(), GetHeight(), GetWidth(), Inflate(), Intersects(), m_init, m_pos, m_size, RotatePoint(), and SetOrigin().

◆ Intersects() [3/4]

bool EDA_RECT::Intersects ( const wxPoint &  aPoint1,
const wxPoint &  aPoint2 
) const

Test for a common area between a segment and this rectangle.

Parameters
aPoint1First point of the segment to test intersection with.
aPoint2Second point of the segment to test intersection with.
Returns
true if the argument segment intersects this rectangle. (i.e. if the segment and rectangle have at least a common point)

Definition at line 85 of file eda_rect.cpp.

86 {
87  wxPoint point2, point4;
88 
89  if( Contains( aPoint1 ) || Contains( aPoint2 ) )
90  return true;
91 
92  point2.x = GetEnd().x;
93  point2.y = GetOrigin().y;
94  point4.x = GetOrigin().x;
95  point4.y = GetEnd().y;
96 
97  //Only need to test 3 sides since a straight line can't enter and exit on same side
98  if( SegmentIntersectsSegment( aPoint1, aPoint2, GetOrigin(), point2 ) )
99  return true;
100 
101  if( SegmentIntersectsSegment( aPoint1, aPoint2, point2, GetEnd() ) )
102  return true;
103 
104  if( SegmentIntersectsSegment( aPoint1, aPoint2, GetEnd(), point4 ) )
105  return true;
106 
107  return false;
108 }
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
bool SegmentIntersectsSegment(const wxPoint &a_p1_l1, const wxPoint &a_p2_l1, const wxPoint &a_p1_l2, const wxPoint &a_p2_l2, wxPoint *aIntersectionPoint=nullptr)
Test if two lines intersect.
Definition: trigo.cpp:61
const wxPoint GetEnd() const
Definition: eda_rect.h:103
const wxPoint GetOrigin() const
Definition: eda_rect.h:101

References Contains(), GetEnd(), GetOrigin(), and SegmentIntersectsSegment().

◆ Intersects() [4/4]

bool EDA_RECT::Intersects ( const wxPoint &  aPoint1,
const wxPoint &  aPoint2,
wxPoint *  aIntersection1,
wxPoint *  aIntersection2 
) const

Test for intersection between a segment and this rectangle, returning the intersections.

Parameters
aPoint1is the first point of the segment to test intersection with.
aPoint2is the second point of the segment to test intersection with.
aIntersection1will be filled with the first intersection point, if any.
aIntersection2will be filled with the second intersection point, if any.
Returns
true if the segment intersects the rect.

Definition at line 111 of file eda_rect.cpp.

113 {
114  wxPoint point2, point4;
115 
116  point2.x = GetEnd().x;
117  point2.y = GetOrigin().y;
118  point4.x = GetOrigin().x;
119  point4.y = GetEnd().y;
120 
121  bool intersects = false;
122 
123  wxPoint* aPointToFill = aIntersection1;
124 
125  if( SegmentIntersectsSegment( aPoint1, aPoint2, GetOrigin(), point2, aPointToFill ) )
126  intersects = true;
127 
128  if( intersects )
129  aPointToFill = aIntersection2;
130 
131  if( SegmentIntersectsSegment( aPoint1, aPoint2, point2, GetEnd(), aPointToFill ) )
132  intersects = true;
133 
134  if( intersects )
135  aPointToFill = aIntersection2;
136 
137  if( SegmentIntersectsSegment( aPoint1, aPoint2, GetEnd(), point4, aPointToFill ) )
138  intersects = true;
139 
140  if( intersects )
141  aPointToFill = aIntersection2;
142 
143  if( SegmentIntersectsSegment( aPoint1, aPoint2, point4, GetOrigin(), aPointToFill ) )
144  intersects = true;
145 
146  return intersects;
147 }
bool SegmentIntersectsSegment(const wxPoint &a_p1_l1, const wxPoint &a_p2_l1, const wxPoint &a_p1_l2, const wxPoint &a_p2_l2, wxPoint *aIntersectionPoint=nullptr)
Test if two lines intersect.
Definition: trigo.cpp:61
const wxPoint GetEnd() const
Definition: eda_rect.h:103
const wxPoint GetOrigin() const
Definition: eda_rect.h:101

References GetEnd(), GetOrigin(), and SegmentIntersectsSegment().

◆ IntersectsCircle()

bool EDA_RECT::IntersectsCircle ( const wxPoint &  aCenter,
const int  aRadius 
) const

Test for a common area between a circle and this rectangle.

Parameters
aCentercenter of the circle.
aRadiusradius of the circle.

Definition at line 315 of file eda_rect.cpp.

316 {
317  if( !m_init )
318  return false;
319 
320  wxPoint closest = ClosestPointTo( aCenter );
321 
322  double dx = static_cast<double>( aCenter.x ) - closest.x;
323  double dy = static_cast<double>( aCenter.y ) - closest.y;
324 
325  double r = static_cast<double>( aRadius );
326 
327  return ( dx * dx + dy * dy ) <= ( r * r );
328 }
bool m_init
Definition: eda_rect.h:350
const wxPoint ClosestPointTo(const wxPoint &aPoint) const
Return the point in this rect that is closest to the provided point.
Definition: eda_rect.cpp:288

References ClosestPointTo(), and m_init.

Referenced by PCB_VIA::HitTest(), and IntersectsCircleEdge().

◆ IntersectsCircleEdge()

bool EDA_RECT::IntersectsCircleEdge ( const wxPoint &  aCenter,
const int  aRadius,
const int  aWidth 
) const

Test for intersection between this rect and the edge (radius) of a circle.

Parameters
aCentercenter of the circle.
aRadiusradius of the circle.
aWidthwidth of the circle edge.

Definition at line 331 of file eda_rect.cpp.

333 {
334  if( !m_init )
335  return false;
336 
337  EDA_RECT me( *this );
338  me.Normalize(); // ensure size is >= 0
339 
340  // Test if the circle intersects at all
341  if( !IntersectsCircle( aCenter, aRadius + aWidth / 2 ) )
342  {
343  return false;
344  }
345 
346  wxPoint farpt = FarthestPointTo( aCenter );
347  // Farthest point must be further than the inside of the line
348  double fx = (double) farpt.x;
349  double fy = (double) farpt.y;
350 
351  double r = (double) aRadius - (double) aWidth / 2;
352 
353  return ( fx * fx + fy * fy ) > ( r * r );
354 }
bool IntersectsCircle(const wxPoint &aCenter, const int aRadius) const
Test for a common area between a circle and this rectangle.
Definition: eda_rect.cpp:315
const wxPoint FarthestPointTo(const wxPoint &aPoint) const
Return the point in this rect that is farthest from the provided point.
Definition: eda_rect.cpp:302
bool m_init
Definition: eda_rect.h:350
Handle the component boundary box.
Definition: eda_rect.h:42

References FarthestPointTo(), IntersectsCircle(), m_init, and Normalize().

Referenced by LIB_CIRCLE::HitTest(), LIB_ARC::HitTest(), and PCB_SHAPE::HitTest().

◆ IsValid()

bool EDA_RECT::IsValid ( ) const
inline

Definition at line 116 of file eda_rect.h.

117  {
118  return m_init;
119  }
bool m_init
Definition: eda_rect.h:350

References m_init.

Referenced by Merge().

◆ Merge() [1/2]

void EDA_RECT::Merge ( const EDA_RECT aRect)

Modify the position and size of the rectangle in order to contain aRect.

It is mainly used to calculate bounding boxes.

Parameters
aRectThe rectangle to merge with this rectangle.

Definition at line 432 of file eda_rect.cpp.

433 {
434  if( !m_init )
435  {
436  if( aRect.IsValid() )
437  {
438  m_pos = aRect.GetPosition();
439  m_size = aRect.GetSize();
440  m_init = true;
441  }
442  return;
443  }
444 
445  Normalize(); // ensure width and height >= 0
446  EDA_RECT rect = aRect;
447  rect.Normalize(); // ensure width and height >= 0
448  wxPoint end = GetEnd();
449  wxPoint rect_end = rect.GetEnd();
450 
451  // Change origin and size in order to contain the given rect
452  m_pos.x = std::min( m_pos.x, rect.m_pos.x );
453  m_pos.y = std::min( m_pos.y, rect.m_pos.y );
454  end.x = std::max( end.x, rect_end.x );
455  end.y = std::max( end.y, rect_end.y );
456  SetEnd( end );
457 }
const wxPoint GetEnd() const
Definition: eda_rect.h:103
void SetEnd(int x, int y)
Definition: eda_rect.h:182
const wxPoint GetPosition() const
Definition: eda_rect.h:102
void Normalize()
Ensures that the height ant width are positive.
Definition: eda_rect.cpp:35
wxPoint m_pos
Definition: eda_rect.h:348
wxSize m_size
Definition: eda_rect.h:349
bool m_init
Definition: eda_rect.h:350
Handle the component boundary box.
Definition: eda_rect.h:42
bool IsValid() const
Definition: eda_rect.h:116
const wxSize GetSize() const
Definition: eda_rect.h:91

References GetEnd(), GetPosition(), GetSize(), IsValid(), m_init, m_pos, m_size, Normalize(), and SetEnd().

Referenced by PCB_SHAPE::computeArcBBox(), GBR_LAYOUT::ComputeBoundingBox(), BOARD::ComputeBoundingBox(), LIB_SYMBOL::GetBodyBoundingBox(), EE_SELECTION::GetBoundingBox(), SELECTION::GetBoundingBox(), FOOTPRINT::GetBoundingBox(), PCB_GROUP::GetBoundingBox(), SCH_SHEET::GetBoundingBox(), PCB_SHAPE::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), SCH_SYMBOL::GetBoundingBox(), SCH_GLOBALLABEL::GetBoundingBox(), GERBVIEW_SELECTION::GetCenter(), SELECTION::GetCenter(), SCH_EDIT_FRAME::GetDocumentExtents(), FOOTPRINT::GetFpPadsLocalBbox(), getSheetBbox(), LIB_SYMBOL::GetUnitBoundingBox(), PCB_ARC::HitTest(), CADSTAR_SCH_ARCHIVE_LOADER::Load(), SCH_EDIT_FRAME::TrimWire(), and GERBVIEW_SELECTION::ViewBBox().

◆ Merge() [2/2]

void EDA_RECT::Merge ( const wxPoint &  aPoint)

Modify the position and size of the rectangle in order to contain the given point.

Parameters
aPointThe point to merge with the rectangle.

Definition at line 460 of file eda_rect.cpp.

461 {
462  if( !m_init )
463  {
464  m_pos = aPoint;
465  m_size = wxSize( 0, 0 );
466  m_init = true;
467  return;
468  }
469 
470  Normalize(); // ensure width and height >= 0
471 
472  wxPoint end = GetEnd();
473 
474  // Change origin and size in order to contain the given rect
475  m_pos.x = std::min( m_pos.x, aPoint.x );
476  m_pos.y = std::min( m_pos.y, aPoint.y );
477  end.x = std::max( end.x, aPoint.x );
478  end.y = std::max( end.y, aPoint.y );
479  SetEnd( end );
480 }
const wxPoint GetEnd() const
Definition: eda_rect.h:103
void SetEnd(int x, int y)
Definition: eda_rect.h:182
void Normalize()
Ensures that the height ant width are positive.
Definition: eda_rect.cpp:35
wxPoint m_pos
Definition: eda_rect.h:348
wxSize m_size
Definition: eda_rect.h:349
bool m_init
Definition: eda_rect.h:350

References GetEnd(), m_init, m_pos, m_size, Normalize(), and SetEnd().

◆ Move()

void EDA_RECT::Move ( const wxPoint &  aMoveVector)

Move the rectangle by the aMoveVector.

Parameters
aMoveVectorA wxPoint that is the value to move this rectangle.

Definition at line 51 of file eda_rect.cpp.

52 {
53  m_pos += aMoveVector;
54 }
wxPoint m_pos
Definition: eda_rect.h:348

References m_pos.

Referenced by APERTURE_MACRO::GetApertureMacroShape(), SCH_BITMAP::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), AR_AUTOPLACER::getOptimalFPPlacement(), EDA_TEXT::GetTextBox(), FOOTPRINT::MoveAnchorPosition(), FOOTPRINT::SetPosition(), and AR_AUTOPLACER::testFootprintOnBoard().

◆ Normalize()

◆ Offset() [1/2]

void EDA_RECT::Offset ( int  dx,
int  dy 
)
inline

Definition at line 147 of file eda_rect.h.

148  {
149  m_pos.x += dx;
150  m_pos.y += dy;
151  }
wxPoint m_pos
Definition: eda_rect.h:348

References m_pos.

Referenced by SCH_SYMBOL::GetBodyBoundingBox(), SCH_PIN::GetBoundingBox(), and SCH_LABEL::GetBoundingBox().

◆ Offset() [2/2]

void EDA_RECT::Offset ( const wxPoint &  offset)
inline

Definition at line 153 of file eda_rect.h.

154  {
155  m_pos += offset;
156  }
wxPoint m_pos
Definition: eda_rect.h:348

References m_pos.

◆ operator BOX2I()

EDA_RECT::operator BOX2I ( ) const
inline

Overload the cast operator to return a BOX2I.

Returns
this box shaped as a BOX2I object.

Definition at line 288 of file eda_rect.h.

289  {
290  EDA_RECT rect( m_pos, m_size );
291  rect.Normalize();
292  return BOX2I( rect.GetOrigin(), rect.GetSize() );
293  }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:506
wxPoint m_pos
Definition: eda_rect.h:348
wxSize m_size
Definition: eda_rect.h:349
Handle the component boundary box.
Definition: eda_rect.h:42

References GetOrigin(), GetSize(), m_pos, m_size, and Normalize().

◆ operator wxRect()

EDA_RECT::operator wxRect ( ) const
inline

Overload the cast operator to return a wxRect.

wxRect does not accept negative values for size, so ensure the wxRect size is always >= 0.

Definition at line 276 of file eda_rect.h.

277  {
278  EDA_RECT rect( m_pos, m_size );
279  rect.Normalize();
280  return wxRect( rect.m_pos, rect.m_size );
281  }
wxPoint m_pos
Definition: eda_rect.h:348
wxSize m_size
Definition: eda_rect.h:349
Handle the component boundary box.
Definition: eda_rect.h:42

References m_pos, m_size, and Normalize().

◆ RevertYAxis()

void EDA_RECT::RevertYAxis ( )
inline

Mirror the rectangle from the X axis (negate Y pos and size).

Definition at line 198 of file eda_rect.h.

199  {
200  m_pos.y = -m_pos.y;
201  m_size.y = -m_size.y;
202  Normalize();
203  }
void Normalize()
Ensures that the height ant width are positive.
Definition: eda_rect.cpp:35
wxPoint m_pos
Definition: eda_rect.h:348
wxSize m_size
Definition: eda_rect.h:349

References m_pos, m_size, and Normalize().

Referenced by KIGFX::SCH_PAINTER::draw(), LIB_CIRCLE::GetBoundingBox(), LIB_RECTANGLE::GetBoundingBox(), LIB_BEZIER::GetBoundingBox(), LIB_POLYLINE::GetBoundingBox(), SCH_PIN::GetBoundingBox(), LIB_TEXT::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), LIB_PIN::GetBoundingBox(), LIB_TEXT::HitTest(), LIB_TEXT::Plot(), LIB_FIELD::Plot(), and LIB_TEXT::print().

◆ SetEnd() [1/2]

◆ SetEnd() [2/2]

void EDA_RECT::SetEnd ( const wxPoint &  pos)
inline

Definition at line 188 of file eda_rect.h.

189  {
190  m_size.x = pos.x - m_pos.x;
191  m_size.y = pos.y - m_pos.y;
192  m_init = true;
193  }
wxPoint m_pos
Definition: eda_rect.h:348
wxSize m_size
Definition: eda_rect.h:349
bool m_init
Definition: eda_rect.h:350

References m_init, m_pos, and m_size.

◆ SetHeight()

◆ SetOrigin() [1/2]

◆ SetOrigin() [2/2]

void EDA_RECT::SetOrigin ( int  x,
int  y 
)
inline

Definition at line 127 of file eda_rect.h.

128  {
129  m_pos.x = x;
130  m_pos.y = y;
131  m_init = true;
132  }
wxPoint m_pos
Definition: eda_rect.h:348
bool m_init
Definition: eda_rect.h:350

References m_init, and m_pos.

◆ SetSize() [1/2]

void EDA_RECT::SetSize ( const wxSize &  size)
inline

Definition at line 134 of file eda_rect.h.

135  {
136  m_size = size;
137  m_init = true;
138  }
wxSize m_size
Definition: eda_rect.h:349
bool m_init
Definition: eda_rect.h:350

References m_init, and m_size.

Referenced by DS_DRAW_ITEM_BITMAP::GetBoundingBox(), and EDA_TEXT::GetTextBox().

◆ SetSize() [2/2]

void EDA_RECT::SetSize ( int  w,
int  h 
)
inline

Definition at line 140 of file eda_rect.h.

141  {
142  m_size.x = w;
143  m_size.y = h;
144  m_init = true;
145  }
wxSize m_size
Definition: eda_rect.h:349
bool m_init
Definition: eda_rect.h:350

References m_init, and m_size.

◆ SetWidth()

◆ SetX()

◆ SetY()

Member Data Documentation

◆ m_init

bool EDA_RECT::m_init
private

◆ m_pos

◆ m_size


The documentation for this class was generated from the following files: