KiCad PCB EDA Suite
EDA_RECT Class Reference

EDA_RECT handles 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)
 Function Move moves the rectangle by the aMoveVector. More...
 
void Normalize ()
 Function Normalize ensures that the height ant width are positive. More...
 
bool Contains (const wxPoint &aPoint) const
 Function Contains. More...
 
bool Contains (int x, int y) const
 Function Contains. More...
 
bool Contains (const EDA_RECT &aRect) const
 Function Contains. More...
 
const wxSize GetSize () const
 
int GetSizeMax () const
 GetSizeMax. More...
 
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 ()
 Function RevertYAxis Mirror the rectangle from the X axis (negate Y pos and size) More...
 
bool Intersects (const EDA_RECT &aRect) const
 Function Intersects tests 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
 Function Intersects tests for a common area between a segment and this rectangle. More...
 
bool Intersects (const wxPoint &aPoint1, const wxPoint &aPoint2, wxPoint *aIntersection1, wxPoint *aIntersection2) const
 Tests 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
 Function IntersectsCircle tests for a common area between a circle and this rectangle. More...
 
bool IntersectsCircleEdge (const wxPoint &aCenter, const int aRadius, const int aWidth) const
 IntersectsCircleEdge Tests for intersection between this rect and the edge (radius) of a circle. More...
 
 operator wxRect () const
 Function operator(wxRect) overloads the cast operator to return a wxRect wxRect does not accept negative values for size, so ensure the wxRect size is always >= 0. More...
 
 operator BOX2I () const
 Function operator(BOX2I) overloads the cast operator to return a BOX2I. More...
 
EDA_RECTInflate (wxCoord dx, wxCoord dy)
 Function Inflate inflates the rectangle horizontally by dx and vertically by dy. More...
 
EDA_RECTInflate (int aDelta)
 Function Inflate inflates the rectangle horizontally and vertically by aDelta. More...
 
void Merge (const EDA_RECT &aRect)
 Function Merge modifies the position and size of the rectangle in order to contain aRect. More...
 
void Merge (const wxPoint &aPoint)
 Function Merge modifies the position and size of the rectangle in order to contain the given point. More...
 
double GetArea () const
 Function GetArea returns the area of the rectangle. More...
 
EDA_RECT Common (const EDA_RECT &aRect) const
 Function Common returns the area that is common with another rectangle. More...
 
const EDA_RECT GetBoundingBoxRotated (wxPoint aRotCenter, double aAngle) const
 Function GetBoundingBoxRotated. More...
 

Private Attributes

wxPoint m_Pos
 
wxSize m_Size
 
bool m_init
 

Detailed Description

EDA_RECT handles 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. so I prefer this more suitable class

Definition at line 44 of file eda_rect.h.

Constructor & Destructor Documentation

◆ EDA_RECT() [1/2]

EDA_RECT::EDA_RECT ( )
inline

Definition at line 52 of file eda_rect.h.

52 : m_init( false ) { };
bool m_init
Definition: eda_rect.h:49

◆ EDA_RECT() [2/2]

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

Definition at line 54 of file eda_rect.h.

54  :
55  m_Pos( aPos ),
56  m_Size( aSize ),
57  m_init( true )
58  { }
wxSize m_Size
Definition: eda_rect.h:48
bool m_init
Definition: eda_rect.h:49
wxPoint m_Pos
Definition: eda_rect.h:47

◆ ~EDA_RECT()

virtual EDA_RECT::~EDA_RECT ( )
inlinevirtual

Definition at line 60 of file eda_rect.h.

60 { };

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 518 of file base_struct.cpp.

519 {
520  EDA_RECT me( *this );
521 
522  me.Normalize(); // ensure size is >= 0
523 
524  // Determine closest point to the circle centre within this rect
525  int nx = std::max( me.GetLeft(), std::min( aPoint.x, me.GetRight() ) );
526  int ny = std::max( me.GetTop(), std::min( aPoint.y, me.GetBottom() ) );
527 
528  return wxPoint( nx, ny );
529 }
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44

References GetBottom(), GetLeft(), GetRight(), GetTop(), Normalize(), wxPoint::x, and wxPoint::y.

Referenced by IntersectsCircle().

◆ Common()

EDA_RECT EDA_RECT::Common ( const EDA_RECT aRect) const

Function Common returns 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 717 of file base_struct.cpp.

718 {
719  EDA_RECT r;
720 
721  if( Intersects( aRect ) )
722  {
723  wxPoint originA( std::min( GetOrigin().x, GetEnd().x ),
724  std::min( GetOrigin().y, GetEnd().y ) );
725  wxPoint originB( std::min( aRect.GetOrigin().x, aRect.GetEnd().x ),
726  std::min( aRect.GetOrigin().y, aRect.GetEnd().y ) );
727  wxPoint endA( std::max( GetOrigin().x, GetEnd().x ),
728  std::max( GetOrigin().y, GetEnd().y ) );
729  wxPoint endB( std::max( aRect.GetOrigin().x, aRect.GetEnd().x ),
730  std::max( aRect.GetOrigin().y, aRect.GetEnd().y ) );
731 
732  r.SetOrigin( wxPoint( std::max( originA.x, originB.x ), std::max( originA.y, originB.y ) ) );
733  r.SetEnd ( wxPoint( std::min( endA.x, endB.x ), std::min( endA.y, endB.y ) ) );
734  }
735 
736  return r;
737 }
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:131
const wxPoint GetEnd() const
Definition: eda_rect.h:116
const wxPoint GetOrigin() const
Definition: eda_rect.h:114
void SetEnd(int x, int y)
Definition: eda_rect.h:192
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.

References GetEnd(), GetOrigin(), Intersects(), SetEnd(), SetOrigin(), wxPoint::x, and wxPoint::y.

Referenced by calcCommonArea(), LIB_ARC::HitTest(), and DRAWSEGMENT::HitTest().

◆ Contains() [1/3]

bool EDA_RECT::Contains ( const wxPoint aPoint) const

Function Contains.

Parameters
aPoint= the wxPoint to test
Returns
true if aPoint is inside the boundary box. A point on a edge is seen as inside

Definition at line 287 of file base_struct.cpp.

288 {
289  wxPoint rel_pos = aPoint - m_Pos;
290  wxSize size = m_Size;
291 
292  if( size.x < 0 )
293  {
294  size.x = -size.x;
295  rel_pos.x += size.x;
296  }
297 
298  if( size.y < 0 )
299  {
300  size.y = -size.y;
301  rel_pos.y += size.y;
302  }
303 
304  return (rel_pos.x >= 0) && (rel_pos.y >= 0) && ( rel_pos.y <= size.y) && ( rel_pos.x <= size.x);
305 }
wxSize m_Size
Definition: eda_rect.h:48
wxPoint m_Pos
Definition: eda_rect.h:47

References m_Pos, m_Size, wxPoint::x, and wxPoint::y.

Referenced by AR_AUTOPLACER::AutoplaceModules(), Contains(), GRPutPixel(), LIB_CIRCLE::HitTest(), LIB_BEZIER::HitTest(), LIB_ARC::HitTest(), LIB_POLYLINE::HitTest(), SCH_PIN::HitTest(), PCB_TARGET::HitTest(), SCH_JUNCTION::HitTest(), WS_DRAW_ITEM_BASE::HitTest(), SCH_NO_CONNECT::HitTest(), SCH_BUS_ENTRY_BASE::HitTest(), PCB_GROUP::HitTest(), SCH_BITMAP::HitTest(), WS_DRAW_ITEM_POLYPOLYGONS::HitTest(), SCH_FIELD::HitTest(), LIB_ITEM::HitTest(), TRACK::HitTest(), SCH_SHEET_PIN::HitTest(), LIB_PIN::HitTest(), SCH_LINE::HitTest(), DIMENSION::HitTest(), GERBER_DRAW_ITEM::HitTest(), DRAWSEGMENT::HitTest(), SCH_TEXT::HitTest(), ARC::HitTest(), WS_DRAW_ITEM_BITMAP::HitTest(), VIA::HitTest(), MODULE::HitTest(), ZONE_CONTAINER::HitTest(), D_PAD::HitTest(), SCH_SHEET::HitTest(), SCH_COMPONENT::HitTest(), MARKER_BASE::HitTestMarker(), Intersects(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), AR_AUTOPLACER::nearestPad(), ALTIUM_PCB::ParsePolygons6Data(), SELECTION_TOOL::selectPoint(), TEXTE_MODULE::TextHitTest(), and EDA_TEXT::TextHitTest().

◆ Contains() [2/3]

bool EDA_RECT::Contains ( int  x,
int  y 
) const
inline

Function Contains.

Parameters
x= the x coordinate of the point to test
y= the 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 94 of file eda_rect.h.

94 { return Contains( wxPoint( x, y ) ); }
bool Contains(const wxPoint &aPoint) const
Function Contains.

References Contains().

Referenced by Contains().

◆ Contains() [3/3]

bool EDA_RECT::Contains ( const EDA_RECT aRect) const

Function Contains.

Parameters
aRect= the EDA_RECT to test
Returns
true if aRect is Contained. A common edge is seen as contained

Definition at line 308 of file base_struct.cpp.

309 {
310  return Contains( aRect.GetOrigin() ) && Contains( aRect.GetEnd() );
311 }
bool Contains(const wxPoint &aPoint) const
Function Contains.
const wxPoint GetEnd() const
Definition: eda_rect.h:116
const wxPoint GetOrigin() const
Definition: eda_rect.h:114

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 532 of file base_struct.cpp.

533 {
534  EDA_RECT me( *this );
535 
536  me.Normalize(); // ensure size is >= 0
537 
538  int fx = std::max( std::abs( aPoint.x - me.GetLeft() ), std::abs( aPoint.x - me.GetRight() ) );
539  int fy = std::max( std::abs( aPoint.y - me.GetTop() ), std::abs( aPoint.y - me.GetBottom() ) );
540 
541  return wxPoint( fx, fy );
542 }
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44

References GetBottom(), GetLeft(), GetRight(), GetTop(), Normalize(), wxPoint::x, and wxPoint::y.

Referenced by IntersectsCircleEdge().

◆ GetArea()

double EDA_RECT::GetArea ( ) const

Function GetArea returns the area of the rectangle.

Returns
The area of the rectangle.

Definition at line 711 of file base_struct.cpp.

712 {
713  return (double) GetWidth() * (double) GetHeight();
714 }
int GetWidth() const
Definition: eda_rect.h:119
int GetHeight() const
Definition: eda_rect.h:120

References GetHeight(), and GetWidth().

Referenced by calcArea(), calcCommonArea(), MODULE::CoverageRatio(), and SCH_COMPONENT::operator<().

◆ GetBottom()

◆ GetBoundingBoxRotated()

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

Function GetBoundingBoxRotated.

Returns
the bounding box of this, after rotation
Parameters
aAngle= the rotation angle in 0.1 deg.
aRotCenter= the rotation point. useful to calculate bounding box of rotated items, when rotation if not k*90 degrees

Definition at line 740 of file base_struct.cpp.

741 {
742  wxPoint corners[4];
743 
744  // Build the corners list
745  corners[0] = GetOrigin();
746  corners[2] = GetEnd();
747  corners[1].x = corners[0].x;
748  corners[1].y = corners[2].y;
749  corners[3].x = corners[2].x;
750  corners[3].y = corners[0].y;
751 
752  // Rotate all corners, to find the bounding box
753  for( int ii = 0; ii < 4; ii ++ )
754  RotatePoint( &corners[ii], aRotCenter, aAngle );
755 
756  // Find the corners bounding box
757  wxPoint start = corners[0];
758  wxPoint end = corners[0];
759 
760  for( int ii = 1; ii < 4; ii ++ )
761  {
762  start.x = std::min( start.x, corners[ii].x);
763  start.y = std::min( start.y, corners[ii].y);
764  end.x = std::max( end.x, corners[ii].x);
765  end.y = std::max( end.y, corners[ii].y);
766  }
767 
768  EDA_RECT bbox;
769  bbox.SetOrigin( start );
770  bbox.SetEnd( end );
771 
772  return bbox;
773 }
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:131
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
const wxPoint GetEnd() const
Definition: eda_rect.h:116
const wxPoint GetOrigin() const
Definition: eda_rect.h:114
void SetEnd(int x, int y)
Definition: eda_rect.h:192
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44

References GetEnd(), GetOrigin(), RotatePoint(), SetEnd(), SetOrigin(), wxPoint::x, and wxPoint::y.

Referenced by WX_ANGLE_TEXT::GetBoundingBox(), TEXTE_PCB::GetBoundingBox(), TEXTE_MODULE::GetBoundingBox(), WX_ANGLE_TEXT::OnPaint(), TEXTE_MODULE::ViewBBox(), and WX_ANGLE_TEXT::WX_ANGLE_TEXT().

◆ GetCenter()

◆ GetEnd()

◆ GetHeight()

int EDA_RECT::GetHeight ( ) const
inline

◆ GetLeft()

◆ GetOrigin()

◆ GetPosition()

◆ GetRight()

◆ GetSize()

◆ GetSizeMax()

int EDA_RECT::GetSizeMax ( ) const
inline

GetSizeMax.

Returns
the max size dimension

Definition at line 109 of file eda_rect.h.

109 { return ( m_Size.x > m_Size.y )?m_Size.x:m_Size.y; }
wxSize m_Size
Definition: eda_rect.h:48

References m_Size.

Referenced by BOARD_ADAPTER::AddShapeWithClearanceToContainer().

◆ GetTop()

◆ GetWidth()

int EDA_RECT::GetWidth ( ) const
inline

Definition at line 119 of file eda_rect.h.

119 { return m_Size.x; }
wxSize m_Size
Definition: eda_rect.h:48

References m_Size.

Referenced by GERBER_JOBFILE_WRITER::addJSONGeneralSpecs(), AUTOPLACE_TOOL::autoplace(), BuildBoardPolygonOutlines(), EAGLE_PLUGIN::centerBoard(), ClipAndDrawPoly(), AR_MATRIX::ComputeMatrixSize(), DIALOG_EXPORT_SVG::CreateSVGFile(), KIGFX::PCB_PAINTER::draw(), BOARD_NETLIST_UPDATER::estimateComponentInsertionPosition(), AUTOPLACER::field_box_placement(), fillRectList(), SCH_EDITOR_CONTROL::FindComponentAndItem(), GENDRILL_WRITER_BASE::genDrillMapFile(), AR_AUTOPLACER::genPlacementRoutingMatrix(), AUTOPLACER::get_preferred_sides(), GetArea(), MODULE::GetArea(), PCB_BASE_FRAME::GetBoardBoundingBox(), MARKER_PCB::GetBoundingBox(), LIB_VIEW_FRAME::GetDocumentExtents(), BOARD::GetFootprint(), SCH_SHEET::GetMinWidth(), EDA_TEXT::GetTextBox(), EE_SELECTION_TOOL::GuessSelectionCandidates(), 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(), ALTIUM_PCB::ParsePolygons6Data(), SELECTION_TOOL::pickSmallestComponent(), WS_DATA_ITEM_TEXT::SetConstrainedTextSize(), SpreadFootprints(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperDrawItem(), LEADER::updateGeometry(), MARKER_PCB::ViewBBox(), GERBER_DRAW_ITEM::ViewGetLOD(), and WX_ANGLE_TEXT::WX_ANGLE_TEXT().

◆ GetX()

◆ GetY()

◆ Inflate() [1/2]

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

Function Inflate inflates the rectangle horizontally by dx and vertically by dy.

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

Definition at line 593 of file base_struct.cpp.

594 {
595  if( m_Size.x >= 0 )
596  {
597  if( m_Size.x < -2 * dx )
598  {
599  // Don't allow deflate to eat more width than we have,
600  m_Pos.x += m_Size.x / 2;
601  m_Size.x = 0;
602  }
603  else
604  {
605  // The inflate is valid.
606  m_Pos.x -= dx;
607  m_Size.x += 2 * dx;
608  }
609  }
610  else // size.x < 0:
611  {
612  if( m_Size.x > -2 * dx )
613  {
614  // Don't allow deflate to eat more width than we have,
615  m_Pos.x -= m_Size.x / 2;
616  m_Size.x = 0;
617  }
618  else
619  {
620  // The inflate is valid.
621  m_Pos.x += dx;
622  m_Size.x -= 2 * dx; // m_Size.x <0: inflate when dx > 0
623  }
624  }
625 
626  if( m_Size.y >= 0 )
627  {
628  if( m_Size.y < -2 * dy )
629  {
630  // Don't allow deflate to eat more height than we have,
631  m_Pos.y += m_Size.y / 2;
632  m_Size.y = 0;
633  }
634  else
635  {
636  // The inflate is valid.
637  m_Pos.y -= dy;
638  m_Size.y += 2 * dy;
639  }
640  }
641  else // size.y < 0:
642  {
643  if( m_Size.y > 2 * dy )
644  {
645  // Don't allow deflate to eat more height than we have,
646  m_Pos.y -= m_Size.y / 2;
647  m_Size.y = 0;
648  }
649  else
650  {
651  // The inflate is valid.
652  m_Pos.y += dy;
653  m_Size.y -= 2 * dy; // m_Size.y <0: inflate when dy > 0
654  }
655  }
656 
657  return *this;
658 }
wxSize m_Size
Definition: eda_rect.h:48
wxPoint m_Pos
Definition: eda_rect.h:47

References m_Pos, m_Size, wxPoint::x, and wxPoint::y.

Referenced by AR_AUTOPLACER::addPad(), BuildBoardPolygonOutlines(), ZONE_FILLER::buildCopperItemClearances(), AR_AUTOPLACER::buildFpAreas(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::doPadToPadsDrc(), ZONE_FILLER::Fill(), FillNegativeKnockout(), SCH_EDITOR_CONTROL::FindComponentAndItem(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), APERTURE_MACRO::GetApertureMacroShape(), SCH_SHEET::GetBodyBoundingBox(), LIB_CIRCLE::GetBoundingBox(), SCH_JUNCTION::GetBoundingBox(), LIB_RECTANGLE::GetBoundingBox(), LIB_BEZIER::GetBoundingBox(), LIB_ARC::GetBoundingBox(), SCH_NO_CONNECT::GetBoundingBox(), LIB_POLYLINE::GetBoundingBox(), SCH_BUS_ENTRY_BASE::GetBoundingBox(), PCB_GROUP::GetBoundingBox(), BITMAP_BASE::GetBoundingBox(), LIB_PIN::GetBoundingBox(), GERBER_DRAW_ITEM::GetBoundingBox(), DRAWSEGMENT::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), MODULE::GetFootprintRect(), SCH_SCREEN::GetItem(), GRCSegm(), GRLineArray(), GRSFilledRect(), EE_SELECTION_TOOL::GuessSelectionCandidates(), hasThermalConnection(), LIB_CIRCLE::HitTest(), LIB_BEZIER::HitTest(), LIB_ARC::HitTest(), LIB_POLYLINE::HitTest(), SCH_PIN::HitTest(), PCB_TARGET::HitTest(), SCH_JUNCTION::HitTest(), WS_DRAW_ITEM_BASE::HitTest(), SCH_NO_CONNECT::HitTest(), SCH_BUS_ENTRY_BASE::HitTest(), PCB_GROUP::HitTest(), SCH_BITMAP::HitTest(), WS_DRAW_ITEM_POLYPOLYGONS::HitTest(), SCH_FIELD::HitTest(), LIB_ITEM::HitTest(), TRACK::HitTest(), SCH_SHEET_PIN::HitTest(), LIB_PIN::HitTest(), SCH_LINE::HitTest(), DIMENSION::HitTest(), DRAWSEGMENT::HitTest(), SCH_TEXT::HitTest(), ARC::HitTest(), WS_DRAW_ITEM_BITMAP::HitTest(), VIA::HitTest(), MODULE::HitTest(), ZONE_CONTAINER::HitTest(), D_PAD::HitTest(), SCH_SHEET::HitTest(), SCH_COMPONENT::HitTest(), MARKER_BASE::HitTestMarker(), Inflate(), BOARD_ADAPTER::InitSettings(), Intersects(), EE_RTREE::Overlapping(), SpreadFootprints(), AR_AUTOPLACER::testModuleOnBoard(), AR_AUTOPLACER::testRectangle(), TEXTE_MODULE::TextHitTest(), EDA_TEXT::TextHitTest(), EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon(), ALIGNED_DIMENSION::updateGeometry(), ORTHOGONAL_DIMENSION::updateGeometry(), LEADER::updateGeometry(), MODULE::ViewBBox(), and WinClipAndDrawLine().

◆ Inflate() [2/2]

EDA_RECT & EDA_RECT::Inflate ( int  aDelta)

Function Inflate inflates the rectangle horizontally and vertically by aDelta.

If aDelta is negative the rectangle is deflated.

Definition at line 586 of file base_struct.cpp.

587 {
588  Inflate( aDelta, aDelta );
589  return *this;
590 }
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.

References Inflate().

◆ Intersects() [1/4]

bool EDA_RECT::Intersects ( const EDA_RECT aRect) const

Function Intersects tests for a common area between rectangles.

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

Definition at line 379 of file base_struct.cpp.

380 {
381  if( !m_init )
382  return false;
383 
384  // this logic taken from wxWidgets' geometry.cpp file:
385  bool rc;
386  EDA_RECT me(*this);
387  EDA_RECT rect(aRect);
388  me.Normalize(); // ensure size is >= 0
389  rect.Normalize(); // ensure size is >= 0
390 
391  // calculate the left common area coordinate:
392  int left = std::max( me.m_Pos.x, rect.m_Pos.x );
393  // calculate the right common area coordinate:
394  int right = std::min( me.m_Pos.x + me.m_Size.x, rect.m_Pos.x + rect.m_Size.x );
395  // calculate the upper common area coordinate:
396  int top = std::max( me.m_Pos.y, aRect.m_Pos.y );
397  // calculate the lower common area coordinate:
398  int bottom = std::min( me.m_Pos.y + me.m_Size.y, rect.m_Pos.y + rect.m_Size.y );
399 
400  // if a common area exists, it must have a positive (null accepted) size
401  if( left <= right && top <= bottom )
402  rc = true;
403  else
404  rc = false;
405 
406  return rc;
407 }
bool m_init
Definition: eda_rect.h:49
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
wxPoint m_Pos
Definition: eda_rect.h:47

References m_init, m_Pos, m_Size, Normalize(), wxPoint::x, and wxPoint::y.

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), BOOST_AUTO_TEST_CASE(), Common(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::doPadToPadsDrc(), ZONE_FILLER::Fill(), AUTOPLACER::filtered_colliders(), hasThermalConnection(), LIB_CIRCLE::HitTest(), LIB_BEZIER::HitTest(), LIB_ARC::HitTest(), LIB_POLYLINE::HitTest(), PCB_TARGET::HitTest(), WS_DRAW_ITEM_BASE::HitTest(), SCH_JUNCTION::HitTest(), SCH_NO_CONNECT::HitTest(), SCH_BUS_ENTRY_BASE::HitTest(), PCB_GROUP::HitTest(), SCH_BITMAP::HitTest(), WS_DRAW_ITEM_POLYPOLYGONS::HitTest(), LIB_ITEM::HitTest(), SCH_FIELD::HitTest(), TRACK::HitTest(), LIB_PIN::HitTest(), SCH_LINE::HitTest(), DIMENSION::HitTest(), DRAWSEGMENT::HitTest(), SCH_TEXT::HitTest(), ARC::HitTest(), ZONE_CONTAINER::HitTest(), MODULE::HitTest(), D_PAD::HitTest(), SCH_SHEET::HitTest(), SCH_COMPONENT::HitTest(), Intersects(), TEXTE_MODULE::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 410 of file base_struct.cpp.

411 {
412  if( !m_init )
413  return false;
414 
415  /* Most rectangles will be axis aligned.
416  * It is quicker to check for this case and pass the rect
417  * to the simpler intersection test
418  */
419 
420  // Prevent floating point comparison errors
421  static const double ROT_EPS = 0.000000001;
422 
423  static const double ROT_PARALLEL[] = { -3600, -1800, 0, 1800, 3600 };
424  static const double ROT_PERPENDICULAR[] = { -2700, -900, 0, 900, 2700 };
425 
426  NORMALIZE_ANGLE_POS<double>( aRot );
427 
428  // Test for non-rotated rectangle
429  for( int ii = 0; ii < 5; ii++ )
430  {
431  if( std::fabs( aRot - ROT_PARALLEL[ii] ) < ROT_EPS )
432  {
433  return Intersects( aRect );
434  }
435  }
436 
437  // Test for rectangle rotated by multiple of 90 degrees
438  for( int jj = 0; jj < 4; jj++ )
439  {
440  if( std::fabs( aRot - ROT_PERPENDICULAR[jj] ) < ROT_EPS )
441  {
442  EDA_RECT rotRect;
443 
444  // Rotate the supplied rect by 90 degrees
445  rotRect.SetOrigin( aRect.Centre() );
446  rotRect.Inflate( aRect.GetHeight(), aRect.GetWidth() );
447  return Intersects( rotRect );
448  }
449  }
450 
451  /* There is some non-orthogonal rotation.
452  * There are three cases to test:
453  * A) One point of this rect is inside the rotated rect
454  * B) One point of the rotated rect is inside this rect
455  * C) One of the sides of the rotated rect intersect this
456  */
457 
458  wxPoint corners[4];
459 
460  /* Test A : Any corners exist in rotated rect? */
461 
462  corners[0] = m_Pos;
463  corners[1] = m_Pos + wxPoint( m_Size.x, 0 );
464  corners[2] = m_Pos + wxPoint( m_Size.x, m_Size.y );
465  corners[3] = m_Pos + wxPoint( 0, m_Size.y );
466 
467  wxPoint rCentre = aRect.Centre();
468 
469  for( int i = 0; i < 4; i++ )
470  {
471  wxPoint delta = corners[i] - rCentre;
472  RotatePoint( &delta, -aRot );
473  delta += rCentre;
474 
475  if( aRect.Contains( delta ) )
476  {
477  return true;
478  }
479  }
480 
481  /* Test B : Any corners of rotated rect exist in this one? */
482  int w = aRect.GetWidth() / 2;
483  int h = aRect.GetHeight() / 2;
484 
485  // Construct corners around center of shape
486  corners[0] = wxPoint( -w, -h );
487  corners[1] = wxPoint( w, -h );
488  corners[2] = wxPoint( w, h );
489  corners[3] = wxPoint( -w, h );
490 
491  // Rotate and test each corner
492  for( int j=0; j<4; j++ )
493  {
494  RotatePoint( &corners[j], aRot );
495  corners[j] += rCentre;
496 
497  if( Contains( corners[j] ) )
498  {
499  return true;
500  }
501  }
502 
503  /* Test C : Any sides of rotated rect intersect this */
504 
505  if( Intersects( corners[0], corners[1] ) ||
506  Intersects( corners[1], corners[2] ) ||
507  Intersects( corners[2], corners[3] ) ||
508  Intersects( corners[3], corners[0] ) )
509  {
510  return true;
511  }
512 
513 
514  return false;
515 }
int GetWidth() const
Definition: eda_rect.h:119
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:131
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
bool Contains(const wxPoint &aPoint) const
Function Contains.
wxSize m_Size
Definition: eda_rect.h:48
int GetHeight() const
Definition: eda_rect.h:120
bool m_init
Definition: eda_rect.h:49
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
wxPoint m_Pos
Definition: eda_rect.h:47
wxPoint Centre() const
Definition: eda_rect.h:62
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.

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

Function Intersects tests 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
bool - true if the argument segment intersects this rectangle. (i.e. if the segment and rectangle have at least a common point)

Definition at line 314 of file base_struct.cpp.

315 {
316  wxPoint point2, point4;
317 
318  if( Contains( aPoint1 ) || Contains( aPoint2 ) )
319  return true;
320 
321  point2.x = GetEnd().x;
322  point2.y = GetOrigin().y;
323  point4.x = GetOrigin().x;
324  point4.y = GetEnd().y;
325 
326  //Only need to test 3 sides since a straight line cant enter and exit on same side
327  if( SegmentIntersectsSegment( aPoint1, aPoint2, GetOrigin() , point2 ) )
328  return true;
329 
330  if( SegmentIntersectsSegment( aPoint1, aPoint2, point2 , GetEnd() ) )
331  return true;
332 
333  if( SegmentIntersectsSegment( aPoint1, aPoint2, GetEnd() , point4 ) )
334  return true;
335 
336  return false;
337 }
bool Contains(const wxPoint &aPoint) const
Function Contains.
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:116
const wxPoint GetOrigin() const
Definition: eda_rect.h:114

References Contains(), GetEnd(), GetOrigin(), SegmentIntersectsSegment(), wxPoint::x, and wxPoint::y.

◆ Intersects() [4/4]

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

Tests 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 340 of file base_struct.cpp.

342 {
343  wxPoint point2, point4;
344 
345  point2.x = GetEnd().x;
346  point2.y = GetOrigin().y;
347  point4.x = GetOrigin().x;
348  point4.y = GetEnd().y;
349 
350  bool intersects = false;
351 
352  wxPoint* aPointToFill = aIntersection1;
353 
354  if( SegmentIntersectsSegment( aPoint1, aPoint2, GetOrigin(), point2, aPointToFill ) )
355  intersects = true;
356 
357  if( intersects )
358  aPointToFill = aIntersection2;
359 
360  if( SegmentIntersectsSegment( aPoint1, aPoint2, point2, GetEnd(), aPointToFill ) )
361  intersects = true;
362 
363  if( intersects )
364  aPointToFill = aIntersection2;
365 
366  if( SegmentIntersectsSegment( aPoint1, aPoint2, GetEnd(), point4, aPointToFill ) )
367  intersects = true;
368 
369  if( intersects )
370  aPointToFill = aIntersection2;
371 
372  if( SegmentIntersectsSegment( aPoint1, aPoint2, point4, GetOrigin(), aPointToFill ) )
373  intersects = true;
374 
375  return intersects;
376 }
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:116
const wxPoint GetOrigin() const
Definition: eda_rect.h:114

References GetEnd(), GetOrigin(), SegmentIntersectsSegment(), wxPoint::x, and wxPoint::y.

◆ IntersectsCircle()

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

Function IntersectsCircle tests for a common area between a circle and this rectangle.

Parameters
aCentercenter of the circle
aRadiusradius of the circle

Definition at line 545 of file base_struct.cpp.

546 {
547  if( !m_init )
548  return false;
549 
550  wxPoint closest = ClosestPointTo( aCenter );
551 
552  double dx = aCenter.x - closest.x;
553  double dy = aCenter.y - closest.y;
554 
555  double r = (double) aRadius;
556 
557  return ( dx * dx + dy * dy ) <= ( r * r );
558 }
bool m_init
Definition: eda_rect.h:49
const wxPoint ClosestPointTo(const wxPoint &aPoint) const
Return the point in this rect that is closest to the provided point.

References ClosestPointTo(), m_init, wxPoint::x, and wxPoint::y.

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

◆ IntersectsCircleEdge()

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

IntersectsCircleEdge Tests 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 561 of file base_struct.cpp.

562 {
563  if( !m_init )
564  return false;
565 
566  EDA_RECT me( *this );
567  me.Normalize(); // ensure size is >= 0
568 
569  // Test if the circle intersects at all
570  if( !IntersectsCircle( aCenter, aRadius + aWidth / 2 ) )
571  {
572  return false;
573  }
574 
575  wxPoint farpt = FarthestPointTo( aCenter );
576  // Farthest point must be further than the inside of the line
577  double fx = (double) farpt.x;
578  double fy = (double) farpt.y;
579 
580  double r = (double) aRadius - (double) aWidth / 2;
581 
582  return ( fx * fx + fy * fy ) > ( r * r );
583 }
bool IntersectsCircle(const wxPoint &aCenter, const int aRadius) const
Function IntersectsCircle tests for a common area between a circle and this rectangle.
const wxPoint FarthestPointTo(const wxPoint &aPoint) const
Return the point in this rect that is farthest from the provided point.
bool m_init
Definition: eda_rect.h:49
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44

References FarthestPointTo(), IntersectsCircle(), m_init, Normalize(), wxPoint::x, and wxPoint::y.

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

◆ IsValid()

bool EDA_RECT::IsValid ( ) const
inline

Definition at line 126 of file eda_rect.h.

127  {
128  return m_init;
129  }
bool m_init
Definition: eda_rect.h:49

References m_init.

Referenced by Merge().

◆ Merge() [1/2]

void EDA_RECT::Merge ( const EDA_RECT aRect)

Function Merge modifies 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 661 of file base_struct.cpp.

662 {
663  if( !m_init )
664  {
665  if( aRect.IsValid() )
666  {
667  m_Pos = aRect.GetPosition();
668  m_Size = aRect.GetSize();
669  m_init = true;
670  }
671  return;
672  }
673 
674  Normalize(); // ensure width and height >= 0
675  EDA_RECT rect = aRect;
676  rect.Normalize(); // ensure width and height >= 0
677  wxPoint end = GetEnd();
678  wxPoint rect_end = rect.GetEnd();
679 
680  // Change origin and size in order to contain the given rect
681  m_Pos.x = std::min( m_Pos.x, rect.m_Pos.x );
682  m_Pos.y = std::min( m_Pos.y, rect.m_Pos.y );
683  end.x = std::max( end.x, rect_end.x );
684  end.y = std::max( end.y, rect_end.y );
685  SetEnd( end );
686 }
const wxPoint GetEnd() const
Definition: eda_rect.h:116
wxSize m_Size
Definition: eda_rect.h:48
void SetEnd(int x, int y)
Definition: eda_rect.h:192
const wxPoint GetPosition() const
Definition: eda_rect.h:115
void Normalize()
Function Normalize ensures that the height ant width are positive.
bool m_init
Definition: eda_rect.h:49
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
wxPoint m_Pos
Definition: eda_rect.h:47
bool IsValid() const
Definition: eda_rect.h:126
const wxSize GetSize() const
Definition: eda_rect.h:103

References GetEnd(), GetPosition(), GetSize(), IsValid(), m_init, m_Pos, m_Size, Normalize(), SetEnd(), wxPoint::x, and wxPoint::y.

Referenced by DRAWSEGMENT::computeArcBBox(), GBR_LAYOUT::ComputeBoundingBox(), BOARD::ComputeBoundingBox(), LIB_PART::GetBodyBoundingBox(), PCB_GROUP::GetBoundingBox(), SELECTION::GetBoundingBox(), MODULE::GetBoundingBox(), DRAWSEGMENT::GetBoundingBox(), SCH_COMPONENT::GetBoundingBox(), SCH_SHEET::GetBoundingBox(), GERBVIEW_SELECTION::GetCenter(), MODULE::GetFootprintRect(), MODULE::GetFpPadsLocalBbox(), KIGFX::SCH_VIEW::GetItemsExtents(), getSheetBbox(), LIB_PART::GetUnitBoundingBox(), ARC::HitTest(), GERBVIEW_SELECTION::ViewBBox(), and MODULE::ViewBBox().

◆ Merge() [2/2]

void EDA_RECT::Merge ( const wxPoint aPoint)

Function Merge modifies 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 689 of file base_struct.cpp.

690 {
691  if( !m_init )
692  {
693  m_Pos = aPoint;
694  m_Size = wxSize( 0, 0 );
695  m_init = true;
696  return;
697  }
698 
699  Normalize(); // ensure width and height >= 0
700 
701  wxPoint end = GetEnd();
702  // Change origin and size in order to contain the given rect
703  m_Pos.x = std::min( m_Pos.x, aPoint.x );
704  m_Pos.y = std::min( m_Pos.y, aPoint.y );
705  end.x = std::max( end.x, aPoint.x );
706  end.y = std::max( end.y, aPoint.y );
707  SetEnd( end );
708 }
const wxPoint GetEnd() const
Definition: eda_rect.h:116
wxSize m_Size
Definition: eda_rect.h:48
void SetEnd(int x, int y)
Definition: eda_rect.h:192
void Normalize()
Function Normalize ensures that the height ant width are positive.
bool m_init
Definition: eda_rect.h:49
wxPoint m_Pos
Definition: eda_rect.h:47

References GetEnd(), m_init, m_Pos, m_Size, Normalize(), SetEnd(), wxPoint::x, and wxPoint::y.

◆ Move()

void EDA_RECT::Move ( const wxPoint aMoveVector)

Function Move moves the rectangle by the aMoveVector.

Parameters
aMoveVectorA wxPoint that is the value to move this rectangle

Definition at line 281 of file base_struct.cpp.

282 {
283  m_Pos += aMoveVector;
284 }
wxPoint m_Pos
Definition: eda_rect.h:47

References m_Pos.

Referenced by APERTURE_MACRO::GetApertureMacroShape(), SCH_BITMAP::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), AR_AUTOPLACER::getOptimalModulePlacement(), EDA_TEXT::GetTextBox(), MODULE::SetPosition(), and AR_AUTOPLACER::testModuleOnBoard().

◆ Normalize()

◆ Offset() [1/2]

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

Definition at line 157 of file eda_rect.h.

158  {
159  m_Pos.x += dx;
160  m_Pos.y += dy;
161  }
wxPoint m_Pos
Definition: eda_rect.h:47

References m_Pos, wxPoint::x, and wxPoint::y.

Referenced by SCH_COMPONENT::GetBodyBoundingBox(), and SCH_PIN::GetBoundingBox().

◆ Offset() [2/2]

void EDA_RECT::Offset ( const wxPoint offset)
inline

Definition at line 163 of file eda_rect.h.

164  {
165  m_Pos += offset;
166  }
wxPoint m_Pos
Definition: eda_rect.h:47

References m_Pos.

◆ operator BOX2I()

EDA_RECT::operator BOX2I ( ) const
inline

Function operator(BOX2I) overloads the cast operator to return a BOX2I.

Returns
BOX2I - this box shaped as a BOX2I object.

Definition at line 304 of file eda_rect.h.

305  {
306  EDA_RECT rect( m_Pos, m_Size );
307  rect.Normalize();
308  return BOX2I( rect.GetOrigin(), rect.GetSize() );
309  }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:522
wxSize m_Size
Definition: eda_rect.h:48
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
wxPoint m_Pos
Definition: eda_rect.h:47

References GetOrigin(), GetSize(), m_Pos, m_Size, and Normalize().

◆ operator wxRect()

EDA_RECT::operator wxRect ( ) const
inline

Function operator(wxRect) overloads 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 292 of file eda_rect.h.

293  {
294  EDA_RECT rect( m_Pos, m_Size );
295  rect.Normalize();
296  return wxRect( rect.m_Pos, rect.m_Size );
297  }
wxSize m_Size
Definition: eda_rect.h:48
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
wxPoint m_Pos
Definition: eda_rect.h:47

References m_Pos, m_Size, and Normalize().

◆ RevertYAxis()

void EDA_RECT::RevertYAxis ( )
inline

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

Definition at line 209 of file eda_rect.h.

210  {
211  m_Pos.y = -m_Pos.y;
212  m_Size.y = -m_Size.y;
213  Normalize();
214  }
wxSize m_Size
Definition: eda_rect.h:48
void Normalize()
Function Normalize ensures that the height ant width are positive.
wxPoint m_Pos
Definition: eda_rect.h:47

References m_Pos, m_Size, Normalize(), and wxPoint::y.

Referenced by KIGFX::SCH_PAINTER::draw(), LIB_CIRCLE::GetBoundingBox(), LIB_RECTANGLE::GetBoundingBox(), LIB_BEZIER::GetBoundingBox(), LIB_TEXT::GetBoundingBox(), LIB_POLYLINE::GetBoundingBox(), SCH_PIN::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), LIB_PIN::GetBoundingBox(), 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 198 of file eda_rect.h.

199  {
200  m_Size.x = pos.x - m_Pos.x;
201  m_Size.y = pos.y - m_Pos.y;
202  m_init = true;
203  }
wxSize m_Size
Definition: eda_rect.h:48
bool m_init
Definition: eda_rect.h:49
wxPoint m_Pos
Definition: eda_rect.h:47

References m_init, m_Pos, m_Size, wxPoint::x, and wxPoint::y.

◆ SetHeight()

void EDA_RECT::SetHeight ( int  val)
inline

◆ SetOrigin() [1/2]

◆ SetOrigin() [2/2]

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

Definition at line 137 of file eda_rect.h.

138  {
139  m_Pos.x = x;
140  m_Pos.y = y;
141  m_init = true;
142  }
bool m_init
Definition: eda_rect.h:49
wxPoint m_Pos
Definition: eda_rect.h:47

References m_init, m_Pos, wxPoint::x, and wxPoint::y.

◆ SetSize() [1/2]

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

Definition at line 144 of file eda_rect.h.

145  {
146  m_Size = size;
147  m_init = true;
148  }
wxSize m_Size
Definition: eda_rect.h:48
bool m_init
Definition: eda_rect.h:49

References m_init, and m_Size.

Referenced by WS_DRAW_ITEM_BITMAP::GetBoundingBox(), EDA_TEXT::GetTextBox(), and DIALOG_SHIM::ResetSize().

◆ SetSize() [2/2]

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

Definition at line 150 of file eda_rect.h.

151  {
152  m_Size.x = w;
153  m_Size.y = h;
154  m_init = true;
155  }
wxSize m_Size
Definition: eda_rect.h:48
bool m_init
Definition: eda_rect.h:49

References m_init, and m_Size.

◆ SetWidth()

void EDA_RECT::SetWidth ( int  val)
inline

◆ 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: