KiCad PCB EDA Suite
|
An adjunct helper to the DRAWING_TOOL interactive tool, which handles incoming geometry changes from a POLYGON_GEOM_MANAGER and translates that into a SCH_RULE_AREA based on given parameters. More...
#include <rule_area_create_helper.h>
Public Member Functions | |
RULE_AREA_CREATE_HELPER (KIGFX::VIEW &aView, SCH_EDIT_FRAME *aFrame, TOOL_MANAGER *aMgr) | |
virtual | ~RULE_AREA_CREATE_HELPER () |
SCH_RULE_AREA * | GetRuleArea () const |
void | OnGeometryChange (const POLYGON_GEOM_MANAGER &aMgr) override |
Called when the polygon is complete. | |
bool | OnFirstPoint (POLYGON_GEOM_MANAGER &aMgr) override |
Called before the first point is added - clients can do initialization here, and can veto the start of the process (e.g. | |
void | OnComplete (const POLYGON_GEOM_MANAGER &aMgr) override |
std::unique_ptr< SCH_RULE_AREA > | createNewRuleArea () |
Create a new SCH_RULE_AREA. | |
void | commitRuleArea (std::unique_ptr< SCH_RULE_AREA > aRuleArea) |
Commit the current rule area in progress to the schematic. | |
Private Attributes | |
KIGFX::PREVIEW::POLYGON_ITEM | m_previewItem |
< The preview item to display | |
KIGFX::VIEW & | m_parentView |
The active schematic edit frame. | |
SCH_EDIT_FRAME * | m_frame |
The rule area in progress. | |
std::unique_ptr< SCH_RULE_AREA > | m_rule_area |
The TOOL_MANAGER running the tool. | |
TOOL_MANAGER * | m_toolManager |
An adjunct helper to the DRAWING_TOOL interactive tool, which handles incoming geometry changes from a POLYGON_GEOM_MANAGER and translates that into a SCH_RULE_AREA based on given parameters.
Definition at line 44 of file rule_area_create_helper.h.
RULE_AREA_CREATE_HELPER::RULE_AREA_CREATE_HELPER | ( | KIGFX::VIEW & | aView, |
SCH_EDIT_FRAME * | aFrame, | ||
TOOL_MANAGER * | aMgr | ||
) |
Definition at line 35 of file rule_area_create_helper.cpp.
References KIGFX::VIEW::Add(), m_parentView, and m_previewItem.
|
virtual |
Definition at line 44 of file rule_area_create_helper.cpp.
References m_parentView, m_previewItem, KIGFX::VIEW::Remove(), and KIGFX::VIEW::SetVisible().
void RULE_AREA_CREATE_HELPER::commitRuleArea | ( | std::unique_ptr< SCH_RULE_AREA > | aRuleArea | ) |
Commit the current rule area in progress to the schematic.
aRuleArea | is the drawn rule area outline to commit. |
Definition at line 62 of file rule_area_create_helper.cpp.
References _, COMMIT::Add(), EE_ACTIONS::addItemToSel, KIGFX::VIEW::ClearPreview(), SCH_EDIT_FRAME::GetScreen(), m_frame, m_parentView, m_toolManager, SCH_COMMIT::Push(), and TOOL_MANAGER::RunAction().
Referenced by OnComplete().
std::unique_ptr< SCH_RULE_AREA > RULE_AREA_CREATE_HELPER::createNewRuleArea | ( | ) |
Create a new SCH_RULE_AREA.
Definition at line 52 of file rule_area_create_helper.cpp.
Referenced by OnFirstPoint().
|
inline |
Definition at line 51 of file rule_area_create_helper.h.
References m_rule_area.
|
overridevirtual |
Implements POLYGON_GEOM_MANAGER::CLIENT.
Definition at line 120 of file rule_area_create_helper.cpp.
References SHAPE_LINE_CHAIN::Append(), commitRuleArea(), SHAPE_LINE_CHAIN::CPoint(), POLYGON_GEOM_MANAGER::DEG45, POLYGON_GEOM_MANAGER::GetLeaderLinePoints(), POLYGON_GEOM_MANAGER::GetLeaderMode(), POLYGON_GEOM_MANAGER::GetLockedInPoints(), POLYGON_GEOM_MANAGER::GetLoopLinePoints(), SEG::LineDistance(), m_parentView, m_previewItem, m_rule_area, SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::Outline(), SHAPE_LINE_CHAIN::PointCount(), and KIGFX::VIEW::SetVisible().
|
overridevirtual |
Called before the first point is added - clients can do initialization here, and can veto the start of the process (e.g.
if user cancels a dialog)
Implements POLYGON_GEOM_MANAGER::CLIENT.
Definition at line 77 of file rule_area_create_helper.cpp.
References EE_ACTIONS::clearSelection, color, createNewRuleArea(), POLYGON_GEOM_MANAGER::DEG45, SCH_BASE_FRAME::GetColorSettings(), KIGFX::RENDER_SETTINGS::GetLayerColor(), LAYER_RULE_AREAS, SCH_RENDER_SETTINGS::LoadColors(), m_frame, m_parentView, m_previewItem, m_rule_area, m_toolManager, TOOL_MANAGER::RunAction(), KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM::SetFillColor(), KIGFX::PREVIEW::POLYGON_ITEM::SetLeaderColor(), POLYGON_GEOM_MANAGER::SetLeaderMode(), KIGFX::PREVIEW::POLYGON_ITEM::SetLineColor(), and KIGFX::VIEW::SetVisible().
|
overridevirtual |
Called when the polygon is complete.
Implements POLYGON_GEOM_MANAGER::CLIENT.
Definition at line 103 of file rule_area_create_helper.cpp.
References KIGFX::GEOMETRY, POLYGON_GEOM_MANAGER::GetLeaderLinePoints(), POLYGON_GEOM_MANAGER::GetLockedInPoints(), POLYGON_GEOM_MANAGER::GetLoopLinePoints(), POLYGON_GEOM_MANAGER::IsPolygonInProgress(), m_parentView, m_previewItem, m_rule_area, KIGFX::PREVIEW::POLYGON_ITEM::SetPoints(), KIGFX::VIEW::SetVisible(), and KIGFX::VIEW::Update().
|
private |
The rule area in progress.
Definition at line 84 of file rule_area_create_helper.h.
Referenced by commitRuleArea(), and OnFirstPoint().
|
private |
The active schematic edit frame.
Definition at line 81 of file rule_area_create_helper.h.
Referenced by commitRuleArea(), OnComplete(), OnFirstPoint(), OnGeometryChange(), RULE_AREA_CREATE_HELPER(), and ~RULE_AREA_CREATE_HELPER().
|
private |
< The preview item to display
view that show the preview item
Definition at line 78 of file rule_area_create_helper.h.
Referenced by OnComplete(), OnFirstPoint(), OnGeometryChange(), RULE_AREA_CREATE_HELPER(), and ~RULE_AREA_CREATE_HELPER().
|
private |
The TOOL_MANAGER running the tool.
Definition at line 87 of file rule_area_create_helper.h.
Referenced by GetRuleArea(), OnComplete(), OnFirstPoint(), and OnGeometryChange().
|
private |
Definition at line 90 of file rule_area_create_helper.h.
Referenced by commitRuleArea(), and OnFirstPoint().