KiCad PCB EDA Suite
|
Class 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 |
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... | |
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_RECT & | Inflate (wxCoord dx, wxCoord dy) |
Function Inflate inflates the rectangle horizontally by dx and vertically by dy. More... | |
EDA_RECT & | Inflate (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) |
Function GetBoundingBoxRotated. More... | |
Private Attributes | |
wxPoint | m_Pos |
wxSize | m_Size |
Class 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.
|
inline |
Definition at line 51 of file eda_rect.h.
|
inline |
Definition at line 53 of file eda_rect.h.
|
inlinevirtual |
Definition at line 58 of file eda_rect.h.
|
inline |
Definition at line 60 of file eda_rect.h.
References Contains(), Move(), Normalize(), wxPoint::x, and wxPoint::y.
Referenced by PCB_EDIT_FRAME::AppendBoardFile(), FOOTPRINT_EDIT_FRAME::BestZoom(), LIB_VIEW_FRAME::BestZoom(), PCB_BASE_FRAME::BestZoom(), GERBVIEW_FRAME::BestZoom(), LIB_EDIT_FRAME::BestZoom(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Rotate(), SCH_FIELD::Draw(), LIB_TEXT::drawGraphic(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), BOARD_NETLIST_UPDATER::estimateComponentInsertionPosition(), AUTOPLACER::field_box_placement(), AUTOPLACER::field_horiz_placement(), GENDRILL_WRITER_BASE::genDrillMapFile(), DRAWSEGMENT::GetCenter(), FOOTPRINT_EDIT_FRAME::HandleBlockEnd(), LIB_EDIT_FRAME::HandleBlockEnd(), SCH_EDIT_FRAME::HandleBlockEnd(), LIB_EDIT_FRAME::HandleBlockPlace(), initializePlotter(), CINFO3D_VISU::InitSettings(), Intersects(), SCH_FIELD::IsHorizJustifyFlipped(), SCH_EAGLE_PLUGIN::loadSheet(), LIB_PIN::Matches(), SCH_TEXT::Matches(), SCH_FIELD::Matches(), SCH_SHEET_PIN::Matches(), GERBVIEW_SELECTION_TOOL::MeasureTool(), SCH_EDIT_FRAME::MirrorSheet(), PCB_EDIT_FRAME::OnExportIDF3(), DIALOG_LIB_EDIT_PIN::OnPaintShowPanel(), LIB_TEXT::Plot(), SCH_FIELD::Plot(), LIB_FIELD::Plot(), DIALOG_RESCUE_EACH::renderPreview(), DIALOG_CHOOSE_COMPONENT::RenderPreview(), BOARD::ReplaceNetlist(), SCH_EDIT_FRAME::RotateHierarchicalSheet(), and EDA_DRAW_FRAME::Window_Zoom().
Return the point in this rect that is closest to the provided point.
Definition at line 540 of file base_struct.cpp.
References GetBottom(), GetLeft(), GetRight(), GetTop(), max, min, Normalize(), wxPoint::x, and wxPoint::y.
Referenced by RevertYAxis().
Function Common returns the area that is common with another rectangle.
aRect | is the rectangle to find the common area with. |
Definition at line 714 of file base_struct.cpp.
References GetEnd(), GetOrigin(), max, min, SetEnd(), SetOrigin(), wxPoint::x, and wxPoint::y.
Referenced by calcCommonArea(), DRAWSEGMENT::HitTest(), and operator BOX2I().
bool EDA_RECT::Contains | ( | const wxPoint & | aPoint | ) | const |
Function Contains.
aPoint | = the wxPoint to test |
Definition at line 354 of file base_struct.cpp.
References wxPoint::x, and wxPoint::y.
Referenced by PCB_EDIT_FRAME::AutoPlaceModule(), Centre(), compute_Ratsnest_PlaceModule(), Contains(), GRPutPixel(), PCB_TARGET::HitTest(), SCH_JUNCTION::HitTest(), SCH_NO_CONNECT::HitTest(), SCH_BUS_ENTRY_BASE::HitTest(), LIB_PIN::HitTest(), SCH_BITMAP::HitTest(), SCH_LINE::HitTest(), SCH_FIELD::HitTest(), SCH_TEXT::HitTest(), SCH_SHEET_PIN::HitTest(), DRAWSEGMENT::HitTest(), DIMENSION::HitTest(), TRACK::HitTest(), GERBER_DRAW_ITEM::HitTest(), ZONE_CONTAINER::HitTest(), WS_DRAW_ITEM_BITMAP::HitTest(), VIA::HitTest(), MODULE::HitTest(), SCH_SHEET::HitTest(), SCH_COMPONENT::HitTest(), D_PAD::HitTest(), MARKER_BASE::HitTestMarker(), LIB_BEZIER::Inside(), LIB_RECTANGLE::Inside(), LIB_POLYLINE::Inside(), LIB_ARC::Inside(), LIB_PIN::Inside(), Intersects(), EDA_DRAW_PANEL::IsPointOnDisplay(), MarkItemsInBloc(), PCB_EDIT_FRAME::SpreadFootprints(), TEXTE_MODULE::TextHitTest(), and EDA_TEXT::TextHitTest().
|
inline |
Function Contains.
x | = the x coordinate of the point to test |
y | = the x coordinate of the point to test |
Definition at line 92 of file eda_rect.h.
References Contains().
Referenced by Contains().
bool EDA_RECT::Contains | ( | const EDA_RECT & | aRect | ) | const |
Function Contains.
aRect | = the EDA_RECT to test |
Definition at line 375 of file base_struct.cpp.
References GetEnd(), and GetOrigin().
Return the point in this rect that is farthest from the provided point.
Definition at line 554 of file base_struct.cpp.
References abs, GetBottom(), GetLeft(), GetRight(), GetTop(), max, Normalize(), wxPoint::x, and wxPoint::y.
Referenced by RevertYAxis().
double EDA_RECT::GetArea | ( | ) | const |
Function GetArea returns the area of the rectangle.
Definition at line 708 of file base_struct.cpp.
Referenced by calcArea(), calcCommonArea(), MODULE::CoverageRatio(), operator BOX2I(), and SCH_COMPONENT::operator<().
|
inline |
Definition at line 122 of file eda_rect.h.
References wxPoint::y.
Referenced by clipCircle(), clipLine(), clipOutCode(), ClosestPointTo(), PCB_EDIT_FRAME::DoGenFootprintsReport(), GBR_LAYOUT::Draw(), BLOCK_SELECTOR::Draw(), EDA_DRAW_PANEL::DrawGrid(), DrawMovingBlockOutlines(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), EDA_DRAW_PANEL::EraseScreen(), BOARD_NETLIST_UPDATER::estimateComponentInsertionPosition(), FarthestPointTo(), AUTOPLACER::fit_fields_between_wires(), GENDRILL_WRITER_BASE::genDrillMapFile(), genModuleOnRoutingMatrix(), SCH_COMPONENT::GetBodyBoundingBox(), DIMENSION::GetBoundingBox(), SCH_SHEET::GetMinHeight(), GRArc(), GRArc1(), GRFilledArc(), GRRect(), GRRectPs(), LIB_EDIT_FRAME::HandleBlockEnd(), D_PAD::HitTest(), IsGRSPolyDrawable(), SCH_EAGLE_PLUGIN::loadSchematic(), EDA_DRAW_PANEL::ReDraw(), BOARD::ReplaceNetlist(), and TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon().
Function GetBoundingBoxRotated.
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 737 of file base_struct.cpp.
References max, min, RotatePoint(), SetEnd(), SetOrigin(), wxPoint::x, and wxPoint::y.
Referenced by TEXTE_PCB::GetBoundingBox(), TEXTE_MODULE::GetBoundingBox(), D_PAD::GetBoundingBox(), operator BOX2I(), and TEXTE_MODULE::ViewBBox().
|
inline |
Definition at line 115 of file eda_rect.h.
References wxPoint::x, and wxPoint::y.
Referenced by getAnchorPoint(), PCB_EDIT_FRAME::moveExact(), and DIALOG_EXPORT_STEP::onExportButton().
|
inline |
Definition at line 114 of file eda_rect.h.
References wxPoint::x, and wxPoint::y.
Referenced by BuildBoardPolygonOutlines(), CalculateKeepOutArea(), Common(), MATRIX_ROUTING_HEAD::ComputeMatrixSize(), Contains(), FillNegativeKnockout(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), GERBER_DRAW_ITEM::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), LIB_CIRCLE::GetMsgPanelInfo(), LIB_POLYLINE::GetMsgPanelInfo(), LIB_ARC::GetMsgPanelInfo(), LIB_BEZIER::GetMsgPanelInfo(), getOptimalModulePlacement(), SCH_EDIT_FRAME::HandleBlockEnd(), Merge(), DIALOG_UPDATE_PCB::PerformUpdate(), PCB_EDIT_FRAME::ReadPcbNetlist(), SVG_PLOTTER::Rect(), PCB_EDIT_FRAME::SpreadFootprints(), TRANSFORM::TransformCoordinate(), and TstRectangle().
|
inline |
Definition at line 118 of file eda_rect.h.
Referenced by GERBER_JOBFILE_WRITER::addJSONGeneralSpecs(), AllAreModulesAndReturnSmallestIfSo(), FOOTPRINT_EDIT_FRAME::BestZoom(), LIB_VIEW_FRAME::BestZoom(), PCB_BASE_FRAME::BestZoom(), GERBVIEW_FRAME::BestZoom(), LIB_EDIT_FRAME::BestZoom(), BuildBoardPolygonOutlines(), MODULE::CalculateBoundingBox(), EAGLE_PLUGIN::centerBoard(), ClipAndDrawPoly(), MATRIX_ROUTING_HEAD::ComputeMatrixSize(), DIALOG_SVG_PRINT::CreateSVGFile(), CreateThermalReliefPadPolygon(), BLOCK_SELECTOR::Draw(), DrawAndSizingBlockOutlines(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), DrawPageOnClipboard(), BOARD_NETLIST_UPDATER::estimateComponentInsertionPosition(), AUTOPLACER::field_box_placement(), AUTOPLACER::field_vert_placement(), fillRectList(), GENDRILL_WRITER_BASE::genDrillMapFile(), genPlacementRoutingMatrix(), AUTOPLACER::get_preferred_sides(), PCB_BASE_FRAME::GetBoardBoundingBox(), BOARD::GetFootprint(), SCH_SHEET::GetMinHeight(), D_PAD::HitTest(), CINFO3D_VISU::InitSettings(), Intersects(), SCH_EAGLE_PLUGIN::loadSchematic(), DSN::SPECCTRA_DB::makePADSTACK(), moveFootprintsInArea(), EDA_DRAW_PANEL::OnMouseEvent(), DIALOG_LIB_EDIT_PIN::OnPaintShowPanel(), SELECTION_TOOL::pickSmallestComponent(), PlaceCells(), EDA_DRAW_PANEL::RefreshDrawingRect(), DIALOG_RESCUE_EACH::renderPreview(), DIALOG_CHOOSE_COMPONENT::RenderPreview(), BOARD::ReplaceNetlist(), EDA_DRAW_PANEL::SetClipBox(), WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize(), and PCB_EDIT_FRAME::SpreadFootprints().
|
inline |
Definition at line 120 of file eda_rect.h.
References wxPoint::x.
Referenced by ClosestPointTo(), FarthestPointTo(), AUTOPLACER::field_horiz_placement(), D_PAD::HitTest(), and SCH_EAGLE_PLUGIN::loadSchematic().
|
inline |
Definition at line 112 of file eda_rect.h.
References m_Pos.
Referenced by PCB_EDIT_FRAME::AppendBoardFile(), BuildBoardPolygonOutlines(), CalculateKeepOutArea(), Common(), Contains(), DIALOG_SVG_PRINT::CreateSVGFile(), LIB_BEZIER::drawGraphic(), FillNegativeKnockout(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), GERBER_DRAW_ITEM::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), MATRIX_ROUTING_HEAD::GetBrdCoordOrigin(), LIB_CIRCLE::GetMsgPanelInfo(), LIB_POLYLINE::GetMsgPanelInfo(), LIB_ARC::GetMsgPanelInfo(), LIB_BEZIER::GetMsgPanelInfo(), getOptimalModulePlacement(), idf_export_outline(), GERBVIEW_SELECTION_TOOL::MeasureTool(), moveFootprintsInArea(), operator BOX2I(), DIALOG_UPDATE_PCB::PerformUpdate(), PCB_EDIT_FRAME::ReadPcbNetlist(), SVG_PLOTTER::Rect(), PCB_EDIT_FRAME::SpreadFootprints(), TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon(), TRANSFORM::TransformCoordinate(), TstRectangle(), SCH_SCREEN::UpdatePickList(), DRAWSEGMENT::ViewBBox(), GERBER_DRAW_ITEM::ViewBBox(), MODULE::ViewBBox(), and D_PAD::ViewBBox().
|
inline |
Definition at line 113 of file eda_rect.h.
References m_Pos.
Referenced by EDA_DRAW_PANEL::DrawGrid(), AUTOPLACER::fit_fields_between_wires(), getAnchorPoint(), MARKER_BASE::GetBoundingBoxMarker(), PCB_EDIT_FRAME::moveExact(), DIALOG_SHIM::Show(), and TEXTE_MODULE::ViewBBox().
|
inline |
Definition at line 119 of file eda_rect.h.
References wxPoint::x.
Referenced by clipCircle(), clipLine(), clipOutCode(), ClosestPointTo(), PCB_EDIT_FRAME::DoGenFootprintsReport(), GBR_LAYOUT::Draw(), BLOCK_SELECTOR::Draw(), EDA_DRAW_PANEL::DrawGrid(), DrawMovingBlockOutlines(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), EDA_DRAW_PANEL::EraseScreen(), FarthestPointTo(), AUTOPLACER::field_horiz_placement(), genModuleOnRoutingMatrix(), SCH_COMPONENT::GetBodyBoundingBox(), DIMENSION::GetBoundingBox(), SCH_SHEET::GetMinWidth(), GRArc(), GRArc1(), GRFilledArc(), GRRect(), GRRectPs(), LIB_EDIT_FRAME::HandleBlockEnd(), D_PAD::HitTest(), IsGRSPolyDrawable(), EDA_DRAW_PANEL::ReDraw(), and TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon().
|
inline |
Definition at line 101 of file eda_rect.h.
References m_Size.
Referenced by PCB_EDIT_FRAME::AppendBoardFile(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), MARKER_BASE::GetBoundingBoxMarker(), idf_export_outline(), initializePlotter(), CINFO3D_VISU::InitSettings(), SCH_EAGLE_PLUGIN::loadSheet(), GERBVIEW_SELECTION_TOOL::MeasureTool(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), operator BOX2I(), DIALOG_SHIM::Show(), SCH_SCREEN::UpdatePickList(), TEXTE_MODULE::ViewBBox(), DRAWSEGMENT::ViewBBox(), GERBER_DRAW_ITEM::ViewBBox(), MODULE::ViewBBox(), D_PAD::ViewBBox(), and EDA_DRAW_FRAME::Window_Zoom().
|
inline |
GetSizeMax.
Definition at line 107 of file eda_rect.h.
Referenced by CINFO3D_VISU::AddShapeWithClearanceToContainer(), and CINFO3D_VISU::transformGraphicModuleEdgeToPolygonSet().
|
inline |
Definition at line 121 of file eda_rect.h.
References wxPoint::y.
Referenced by ClosestPointTo(), AUTOPLACER::DoAutoplace(), FarthestPointTo(), AUTOPLACER::fit_fields_between_wires(), and D_PAD::HitTest().
|
inline |
Definition at line 117 of file eda_rect.h.
Referenced by GERBER_JOBFILE_WRITER::addJSONGeneralSpecs(), AllAreModulesAndReturnSmallestIfSo(), FOOTPRINT_EDIT_FRAME::BestZoom(), LIB_VIEW_FRAME::BestZoom(), PCB_BASE_FRAME::BestZoom(), GERBVIEW_FRAME::BestZoom(), LIB_EDIT_FRAME::BestZoom(), PCB_EDIT_FRAME::Block_SelectItems(), BuildBoardPolygonOutlines(), MODULE::CalculateBoundingBox(), EAGLE_PLUGIN::centerBoard(), ClipAndDrawPoly(), GBR_LAYOUT::ComputeBoundingBox(), MATRIX_ROUTING_HEAD::ComputeMatrixSize(), DIALOG_SVG_PRINT::CreateSVGFile(), CreateThermalReliefPadPolygon(), BLOCK_SELECTOR::Draw(), DrawAndSizingBlockOutlines(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), DrawPageOnClipboard(), BOARD_NETLIST_UPDATER::estimateComponentInsertionPosition(), AUTOPLACER::field_box_placement(), fillRectList(), GENDRILL_WRITER_BASE::genDrillMapFile(), genPlacementRoutingMatrix(), AUTOPLACER::get_preferred_sides(), PCB_BASE_FRAME::GetBoardBoundingBox(), BOARD::GetFootprint(), SCH_SHEET::GetMinWidth(), EDA_TEXT::GetTextBox(), D_PAD::HitTest(), CINFO3D_VISU::InitSettings(), Intersects(), SCH_EAGLE_PLUGIN::loadSchematic(), DSN::SPECCTRA_DB::makePADSTACK(), moveFootprintsInArea(), EDA_DRAW_PANEL::OnMouseEvent(), DIALOG_LIB_EDIT_PIN::OnPaintShowPanel(), SELECTION_TOOL::pickSmallestComponent(), PlaceCells(), EDA_DRAW_PANEL::RefreshDrawingRect(), DIALOG_RESCUE_EACH::renderPreview(), DIALOG_CHOOSE_COMPONENT::RenderPreview(), BOARD::ReplaceNetlist(), EDA_DRAW_PANEL::SetClipBox(), WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize(), PCB_EDIT_FRAME::SpreadFootprints(), and GERBER_DRAW_ITEM::ViewGetLOD().
|
inline |
Definition at line 109 of file eda_rect.h.
References wxPoint::x.
Referenced by Autoroute_One_Track(), Build_Work(), EAGLE_PLUGIN::centerBoard(), ClipAndDrawPoly(), clipCircle(), clipLine(), MATRIX_ROUTING_HEAD::ComputeMatrixSize(), CreateKeepOutRectangle(), PCB_EDIT_FRAME::DoGenFootprintsReport(), GBR_LAYOUT::Draw(), BLOCK_SELECTOR::Draw(), EDA_DRAW_PANEL::DrawGrid(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), DrawPageOnClipboard(), drawPlacementRoutingMatrix(), EDA_DRAW_PANEL::EraseScreen(), GENDRILL_WRITER_BASE::genDrillMapFile(), genModuleOnRoutingMatrix(), SCH_COMPONENT::GetBodyBoundingBox(), DRAWSEGMENT::GetBoundingBox(), DIMENSION::GetBoundingBox(), BOARD::GetFootprint(), EDA_TEXT::GetTextBox(), GRArc(), GRArc1(), GRFilledArc(), GRRect(), GRRectPs(), IsGRSPolyDrawable(), OrCell_Trace(), PlaceCells(), EDA_DRAW_PANEL::ReDraw(), EDA_DRAW_PANEL::RefreshDrawingRect(), EDA_DRAW_PANEL::SetClipBox(), and PCB_EDIT_FRAME::Solve().
|
inline |
Definition at line 110 of file eda_rect.h.
References wxPoint::y.
Referenced by Autoroute_One_Track(), Build_Work(), EAGLE_PLUGIN::centerBoard(), ClipAndDrawPoly(), clipCircle(), clipLine(), MATRIX_ROUTING_HEAD::ComputeMatrixSize(), CreateKeepOutRectangle(), PCB_EDIT_FRAME::DoGenFootprintsReport(), GBR_LAYOUT::Draw(), BLOCK_SELECTOR::Draw(), EDA_DRAW_PANEL::DrawGrid(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), DrawPageOnClipboard(), drawPlacementRoutingMatrix(), EDA_DRAW_PANEL::EraseScreen(), genModuleOnRoutingMatrix(), SCH_COMPONENT::GetBodyBoundingBox(), DRAWSEGMENT::GetBoundingBox(), DIMENSION::GetBoundingBox(), SCH_SHEET::GetBoundingBox(), BOARD::GetFootprint(), EDA_TEXT::GetTextBox(), GRArc(), GRArc1(), GRFilledArc(), GRRect(), GRRectPs(), IsGRSPolyDrawable(), SCH_EAGLE_PLUGIN::loadSchematic(), OrCell_Trace(), PlaceCells(), EDA_DRAW_PANEL::ReDraw(), EDA_DRAW_PANEL::RefreshDrawingRect(), EDA_DRAW_PANEL::SetClipBox(), and PCB_EDIT_FRAME::Solve().
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 609 of file base_struct.cpp.
Referenced by BuildBoardPolygonOutlines(), ZONE_FILLER::buildZoneFeatureHoleList(), GBR_LAYOUT::ComputeBoundingBox(), FillNegativeKnockout(), genModuleOnRoutingMatrix(), SCH_JUNCTION::GetBoundingBox(), SCH_NO_CONNECT::GetBoundingBox(), LIB_CIRCLE::GetBoundingBox(), LIB_RECTANGLE::GetBoundingBox(), LIB_POLYLINE::GetBoundingBox(), LIB_BEZIER::GetBoundingBox(), SCH_BUS_ENTRY_BASE::GetBoundingBox(), LIB_ARC::GetBoundingBox(), LIB_PIN::GetBoundingBox(), BITMAP_BASE::GetBoundingBox(), MODULE::GetBoundingBox(), DRAWSEGMENT::GetBoundingBox(), GERBER_DRAW_ITEM::GetBoundingBox(), SCH_SHEET::GetBoundingBox(), D_PAD::GetBoundingBox(), MODULE::GetFootprintRect(), GRCSegm(), GRLineArray(), GRSFilledRect(), PCB_TARGET::HitTest(), SCH_JUNCTION::HitTest(), SCH_NO_CONNECT::HitTest(), SCH_BUS_ENTRY_BASE::HitTest(), LIB_PIN::HitTest(), SCH_BITMAP::HitTest(), SCH_LINE::HitTest(), SCH_FIELD::HitTest(), SCH_TEXT::HitTest(), SCH_SHEET_PIN::HitTest(), DRAWSEGMENT::HitTest(), DIMENSION::HitTest(), TRACK::HitTest(), ZONE_CONTAINER::HitTest(), VIA::HitTest(), MODULE::HitTest(), SCH_SHEET::HitTest(), SCH_COMPONENT::HitTest(), D_PAD::HitTest(), CINFO3D_VISU::InitSettings(), Intersects(), EDA_DRAW_PANEL::IsPointOnDisplay(), moveBitmap(), SCH_EDIT_FRAME::OnDragItem(), operator BOX2I(), SCH_SCREEN::SelectBlockItems(), PCB_EDIT_FRAME::SpreadFootprints(), TEXTE_MODULE::TextHitTest(), EDA_TEXT::TextHitTest(), TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon(), TstModuleOnBoard(), TstRectangle(), and WinClipAndDrawLine().
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 602 of file base_struct.cpp.
bool EDA_RECT::Intersects | ( | const EDA_RECT & | aRect | ) | const |
Function Intersects tests for a common area between rectangles.
aRect | A rectangle to test intersection with. |
Definition at line 407 of file base_struct.cpp.
References m_Pos, m_Size, max, min, Normalize(), wxPoint::x, and wxPoint::y.
Referenced by ZONE_FILLER::buildZoneFeatureHoleList(), AUTOPLACER::filtered_colliders(), PCB_TARGET::HitTest(), SCH_JUNCTION::HitTest(), SCH_NO_CONNECT::HitTest(), SCH_BUS_ENTRY_BASE::HitTest(), SCH_BITMAP::HitTest(), WS_DRAW_ITEM_LINE::HitTest(), SCH_LINE::HitTest(), SCH_FIELD::HitTest(), SCH_TEXT::HitTest(), DRAWSEGMENT::HitTest(), DIMENSION::HitTest(), TRACK::HitTest(), WS_DRAW_ITEM_POLYGON::HitTest(), WS_DRAW_ITEM_RECT::HitTest(), ZONE_CONTAINER::HitTest(), WS_DRAW_ITEM_BITMAP::HitTest(), MODULE::HitTest(), SCH_SHEET::HitTest(), SCH_COMPONENT::HitTest(), D_PAD::HitTest(), LIB_TEXT::Inside(), LIB_FIELD::Inside(), RevertYAxis(), TEXTE_MODULE::TextHitTest(), and EDA_TEXT::TextHitTest().
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.
aRect | a rectangle to test intersection with |
aRot | rectangle rotation (in 1/10 degrees) |
Definition at line 435 of file base_struct.cpp.
References Centre(), Contains(), delta, GetHeight(), GetWidth(), i, Inflate(), RotatePoint(), and SetOrigin().
Function Intersects tests for a common area between a segment and this rectangle.
aPoint1 | First point of the segment to test intersection with. |
aPoint2 | Second point of the segment to test intersection with. |
Definition at line 381 of file base_struct.cpp.
References SegmentIntersectsSegment(), wxPoint::x, and wxPoint::y.
bool EDA_RECT::IntersectsCircle | ( | const wxPoint & | aCenter, |
const int | aRadius | ||
) | const |
Function IntersectsCircle tests for a common area between a circle and this rectangle.
aCenter | center of the circle |
aRadius | radius of the circle |
Definition at line 567 of file base_struct.cpp.
References wxPoint::x, and wxPoint::y.
Referenced by VIA::HitTest(), D_PAD::HitTest(), LIB_CIRCLE::Inside(), and RevertYAxis().
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.
aCenter | center of the circle |
aRadius | radius of the circle |
aWidth | width of the circle edge |
Definition at line 580 of file base_struct.cpp.
References Normalize(), wxPoint::x, and wxPoint::y.
Referenced by DRAWSEGMENT::HitTest(), and RevertYAxis().
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.
aRect | The rectangle to merge with this rectangle. |
Definition at line 677 of file base_struct.cpp.
References GetEnd(), m_Pos, max, min, Normalize(), wxPoint::x, and wxPoint::y.
Referenced by PCB_EDIT_FRAME::AppendBoardFile(), DRAWSEGMENT::computeArcBBox(), GBR_LAYOUT::ComputeBoundingBox(), BOARD::ComputeBoundingBox(), LIB_PART::GetBodyBoundingBox(), SELECTION::GetBoundingBox(), MODULE::GetBoundingBox(), SCH_COMPONENT::GetBoundingBox(), D_PAD::GetBoundingBox(), MODULE::GetFootprintRect(), getSheetBbox(), LIB_PART::GetUnitBoundingBox(), GERBVIEW_SELECTION_TOOL::MeasureTool(), and operator BOX2I().
void EDA_RECT::Merge | ( | const wxPoint & | aPoint | ) |
Function Merge modifies the position and size of the rectangle in order to contain the given point.
aPoint | The point to merge with the rectangle. |
Definition at line 694 of file base_struct.cpp.
References max, min, wxPoint::x, and wxPoint::y.
void EDA_RECT::Move | ( | const wxPoint & | aMoveVector | ) |
Function Move moves the rectangle by the aMoveVector.
aMoveVector | A wxPoint that is the value to move this rectangle |
Definition at line 348 of file base_struct.cpp.
Referenced by Centre(), LIB_PART::Draw(), LIB_CIRCLE::drawGraphic(), LIB_POLYLINE::drawGraphic(), LIB_RECTANGLE::drawGraphic(), LIB_TEXT::drawGraphic(), LIB_ARC::drawGraphic(), LIB_FIELD::drawGraphic(), LIB_PIN::drawGraphic(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), SCH_BITMAP::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), GERBER_DRAW_ITEM::GetBoundingBox(), getOptimalModulePlacement(), EDA_TEXT::GetTextBox(), WS_DRAW_ITEM_BITMAP::HitTest(), and TstModuleOnBoard().
void EDA_RECT::Normalize | ( | ) |
Function Normalize ensures that the height ant width are positive.
Definition at line 332 of file base_struct.cpp.
Referenced by PL_EDITOR_FRAME::Block_Move(), GERBVIEW_FRAME::Block_Move(), PCB_EDIT_FRAME::Block_SelectItems(), Centre(), ClosestPointTo(), GBR_LAYOUT::ComputeBoundingBox(), FarthestPointTo(), SCH_BUS_ENTRY_BASE::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), LIB_PIN::GetBoundingBox(), DRAWSEGMENT::GetBoundingBox(), DIMENSION::GetBoundingBox(), GERBER_DRAW_ITEM::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), SCH_GLOBALLABEL::GetBoundingBox(), SCH_HIERLABEL::GetBoundingBox(), EDA_TEXT::GetTextBox(), DRAWSEGMENT::HitTest(), ZONE_CONTAINER::HitTest(), D_PAD::HitTest(), Intersects(), IntersectsCircleEdge(), Merge(), operator BOX2I(), operator wxRect(), SVG_PLOTTER::Rect(), RevertYAxis(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SCH_SCREEN::UpdatePickList(), and EDA_DRAW_FRAME::Window_Zoom().
|
inline |
Definition at line 128 of file eda_rect.h.
References wxPoint::x, and wxPoint::y.
Referenced by SCH_COMPONENT::GetBodyBoundingBox().
|
inline |
Definition at line 129 of file eda_rect.h.
|
inline |
Function operator(BOX2I) overloads the cast operator to return a BOX2I.
Definition at line 228 of file eda_rect.h.
References Common(), GetArea(), GetBoundingBoxRotated(), GetOrigin(), GetSize(), Inflate(), Merge(), and Normalize().
|
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 216 of file eda_rect.h.
References m_Pos, m_Size, and Normalize().
|
inline |
Function RevertYAxis Mirror the rectangle from the X axis (negate Y pos and size)
Definition at line 144 of file eda_rect.h.
References ClosestPointTo(), FarthestPointTo(), Intersects(), IntersectsCircle(), IntersectsCircleEdge(), Normalize(), and wxPoint::y.
Referenced by LIB_PART::Draw(), LIB_CIRCLE::drawGraphic(), LIB_POLYLINE::drawGraphic(), LIB_RECTANGLE::drawGraphic(), LIB_TEXT::drawGraphic(), LIB_ARC::drawGraphic(), LIB_FIELD::drawGraphic(), LIB_PIN::drawGraphic(), LIB_CIRCLE::GetBoundingBox(), LIB_RECTANGLE::GetBoundingBox(), LIB_POLYLINE::GetBoundingBox(), LIB_BEZIER::GetBoundingBox(), LIB_TEXT::GetBoundingBox(), LIB_PIN::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), LIB_TEXT::Plot(), and LIB_FIELD::Plot().
|
inline |
Definition at line 134 of file eda_rect.h.
References SetEnd().
Referenced by Common(), MATRIX_ROUTING_HEAD::ComputeMatrixSize(), DrawAndSizingBlockOutlines(), PCB_BASE_EDIT_FRAME::duplicateItem(), PCB_BASE_FRAME::GetBoardBoundingBox(), LIB_CIRCLE::GetBoundingBox(), LIB_RECTANGLE::GetBoundingBox(), LIB_POLYLINE::GetBoundingBox(), LIB_BEZIER::GetBoundingBox(), SCH_BUS_ENTRY_BASE::GetBoundingBox(), LIB_TEXT::GetBoundingBox(), LIB_ARC::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), LIB_PIN::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), DRAWSEGMENT::GetBoundingBox(), GERBER_DRAW_ITEM::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), CPolyLine::GetBoundingBox(), SCH_SHEET::GetBoundingBox(), D_PAD::GetBoundingBox(), GetBoundingBoxRotated(), MODULE::GetFootprintRect(), MARKER_BASE::init(), LIB_EDIT_FRAME::OnOrient(), SetEnd(), and TRANSFORM::TransformCoordinate().
|
inline |
|
inline |
Definition at line 133 of file eda_rect.h.
Referenced by SCH_COMPONENT::GetBodyBoundingBox(), PCB_TARGET::GetBoundingBox(), DIMENSION::GetBoundingBox(), and PCB_EDIT_FRAME::SpreadFootprints().
|
inline |
Definition at line 124 of file eda_rect.h.
Referenced by PCB_EDIT_FRAME::AppendBoardFile(), Common(), DRAWSEGMENT::computeArcBBox(), AUTOPLACER::fit_fields_between_wires(), PCB_BASE_FRAME::GetBoardBoundingBox(), SCH_JUNCTION::GetBoundingBox(), SCH_NO_CONNECT::GetBoundingBox(), LIB_CIRCLE::GetBoundingBox(), LIB_RECTANGLE::GetBoundingBox(), LIB_POLYLINE::GetBoundingBox(), LIB_BEZIER::GetBoundingBox(), SCH_BUS_ENTRY_BASE::GetBoundingBox(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), LIB_ARC::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), LIB_PIN::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), DRAWSEGMENT::GetBoundingBox(), GERBER_DRAW_ITEM::GetBoundingBox(), SCH_LABEL::GetBoundingBox(), CPolyLine::GetBoundingBox(), D_PAD::GetBoundingBox(), GetBoundingBoxRotated(), MODULE::GetFootprintRect(), getOptimalModulePlacement(), EDA_TEXT::GetTextBox(), VIA::HitTest(), D_PAD::HitTest(), MARKER_BASE::init(), BLOCK_SELECTOR::InitData(), Intersects(), EDA_DRAW_PANEL::OnMouseEvent(), LIB_EDIT_FRAME::OnOrient(), EDA_DRAW_PANEL::SetClipBox(), PCB_EDIT_FRAME::SpreadFootprints(), TRANSFORM::TransformCoordinate(), SCH_SCREEN::UpdatePickList(), and DRAWSEGMENT::ViewBBox().
|
inline |
|
inline |
Definition at line 126 of file eda_rect.h.
Referenced by PCB_EDIT_FRAME::AppendBoardFile(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), EDA_DRAW_PANEL::EDA_DRAW_PANEL(), D_PAD::GetBoundingBox(), EDA_TEXT::GetTextBox(), D_PAD::HitTest(), BLOCK_SELECTOR::InitData(), EDA_DRAW_PANEL::SetClipBox(), and SCH_SCREEN::UpdatePickList().
|
inline |
Definition at line 127 of file eda_rect.h.
|
inline |
Definition at line 132 of file eda_rect.h.
Referenced by SCH_COMPONENT::GetBodyBoundingBox(), PCB_TARGET::GetBoundingBox(), DIMENSION::GetBoundingBox(), and PCB_EDIT_FRAME::SpreadFootprints().
|
inline |
Definition at line 130 of file eda_rect.h.
References wxPoint::x.
Referenced by MATRIX_ROUTING_HEAD::ComputeMatrixSize(), EDA_DRAW_PANEL::EDA_DRAW_PANEL(), SCH_COMPONENT::GetBodyBoundingBox(), PCB_TARGET::GetBoundingBox(), DRAWSEGMENT::GetBoundingBox(), DIMENSION::GetBoundingBox(), and EDA_TEXT::GetTextBox().
|
inline |
Definition at line 131 of file eda_rect.h.
References wxPoint::y.
Referenced by MATRIX_ROUTING_HEAD::ComputeMatrixSize(), EDA_DRAW_PANEL::EDA_DRAW_PANEL(), SCH_COMPONENT::GetBodyBoundingBox(), PCB_TARGET::GetBoundingBox(), DRAWSEGMENT::GetBoundingBox(), DIMENSION::GetBoundingBox(), SCH_SHEET::GetBoundingBox(), and EDA_TEXT::GetTextBox().
|
private |
Definition at line 47 of file eda_rect.h.
Referenced by GetOrigin(), GetPosition(), Intersects(), Merge(), and operator wxRect().
|
private |
Definition at line 48 of file eda_rect.h.
Referenced by GetSize(), Intersects(), and operator wxRect().