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 ZONE based on given parameters. More...
#include <zone_create_helper.h>
Classes | |
struct | PARAMS |
Parameters used to fully describe a zone creation process. More... | |
Public Member Functions | |
ZONE_CREATE_HELPER (DRAWING_TOOL &aTool, PARAMS &aParams) | |
virtual | ~ZONE_CREATE_HELPER () |
ZONE * | GetZone () 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< ZONE > | createNewZone (bool aKeepout) |
Prompt the user for new zone settings, and create a new zone with those settings. | |
std::unique_ptr< ZONE > | createZoneFromExisting (const ZONE &aSrcZone) |
Create a new zone with the settings from an existing zone. | |
void | performZoneCutout (ZONE &aZone, const ZONE &aCutout) |
Cut one zone out of another one (i.e. | |
void | commitZone (std::unique_ptr< ZONE > aZone) |
Commit the current zone-in-progress to the BOARD. | |
Private Member Functions | |
void | setUniquePriority (ZONE_SETTINGS &aZoneInfo) |
Choose a new priority for @aZoneInfo. | |
Private Attributes | |
DRAWING_TOOL & | m_tool |
Parameters of the zone to be drawn. | |
PARAMS & | m_params |
The preview item to display. | |
KIGFX::PREVIEW::POLYGON_ITEM | m_previewItem |
view that show the preview item | |
KIGFX::VIEW & | m_parentView |
The zone-in-progress. | |
std::unique_ptr< ZONE > | m_zone |
An adjunct helper to the DRAWING_TOOL interactive tool, which handles incoming geometry changes from a POLYGON_GEOM_MANAGER and translates that into a ZONE based on given parameters.
Definition at line 42 of file zone_create_helper.h.
ZONE_CREATE_HELPER::ZONE_CREATE_HELPER | ( | DRAWING_TOOL & | aTool, |
PARAMS & | aParams ) |
aTool | the DRAWING_TOOL to provide the zone tool to. |
aParams | the parameters to use to guide the zone creation. |
Definition at line 38 of file zone_create_helper.cpp.
References m_params, m_parentView, m_previewItem, and m_tool.
|
virtual |
Definition at line 47 of file zone_create_helper.cpp.
References m_parentView, and m_previewItem.
void ZONE_CREATE_HELPER::commitZone | ( | std::unique_ptr< ZONE > | aZone | ) |
Commit the current zone-in-progress to the BOARD.
This might be adding a new zone, or modifying an existing zone with a cutout, depending on parameters.
aZone | is the drawn zone outline to commit. |
Definition at line 213 of file zone_create_helper.cpp.
References _, ADD, COMMIT::Add(), B_CrtYd, CUTOUT, Edge_Cuts, F_CrtYd, BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetLineThickness(), GRAPHIC_POLYGON, m_params, m_tool, performZoneCutout(), POLY, BOARD_COMMIT::Push(), ACTIONS::selectItem, EDA_SHAPE::SetFilled(), PCB_SHAPE::SetLayer(), EDA_SHAPE::SetPolyShape(), EDA_SHAPE::SetShape(), PCB_SHAPE::SetStroke(), SIMILAR, and SOLID.
Referenced by OnComplete().
std::unique_ptr< ZONE > ZONE_CREATE_HELPER::createNewZone | ( | bool | aKeepout | ) |
Prompt the user for new zone settings, and create a new zone with those settings.
aKeepout | should the zone be a keepout |
Definition at line 87 of file zone_create_helper.cpp.
References LSET::AllCuMask(), SELECTION::Empty(), ZONE_SETTINGS::ExportSetting(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetCanvas(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), SELECTION::GetItems(), PCB_SELECTION_TOOL::GetSelection(), GRAPHIC_POLYGON, InvokeCopperZonesEditor(), InvokeNonCopperZonesEditor(), InvokeRuleAreaEditor(), ZONE_SETTINGS::m_LayerProperties, ZONE_SETTINGS::m_Layers, ZONE_SETTINGS::m_Netcode, m_params, m_tool, PCB_FOOTPRINT_T, BASE_SET::reset(), BASE_SET::set(), EDA_DRAW_PANEL_GAL::SetFocus(), ZONE_SETTINGS::SetIsRuleArea(), setUniquePriority(), EDA_ITEM::Type(), and KIGFX::VIEW_CONTROLS::WarpMouseCursor().
Referenced by OnFirstPoint().
Create a new zone with the settings from an existing zone.
aSrcZone | the zone to copy settings from |
Definition at line 149 of file zone_create_helper.cpp.
References ZONE_SETTINGS::ExportSetting(), and m_tool.
Referenced by OnFirstPoint().
|
inline |
Definition at line 74 of file zone_create_helper.h.
References m_zone.
Referenced by DRAWING_TOOL::DrawZone().
|
overridevirtual |
Implements POLYGON_GEOM_MANAGER::CLIENT.
Definition at line 311 of file zone_create_helper.cpp.
References SHAPE_POLY_SET::Append(), chain, commitZone(), SHAPE_LINE_CHAIN::CPoint(), DEG45, DEG90, POLYGON_GEOM_MANAGER::GetLeaderLinePoints(), POLYGON_GEOM_MANAGER::GetLeaderMode(), POLYGON_GEOM_MANAGER::GetLockedInPoints(), POLYGON_GEOM_MANAGER::GetLoopLinePoints(), SEG::LineDistance(), m_parentView, m_previewItem, m_zone, SHAPE_POLY_SET::Outline(), and SHAPE_LINE_CHAIN::PointCount().
|
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 261 of file zone_create_helper.cpp.
References color, createNewZone(), createZoneFromExisting(), KIGFX::RENDER_SETTINGS::GetColor(), m_params, m_parentView, m_previewItem, m_tool, m_zone, ACTIONS::selectionClear, POLYGON_GEOM_MANAGER::SetLeaderMode(), and COLOR4D::WHITE.
|
overridevirtual |
Called when the polygon is complete.
Implements POLYGON_GEOM_MANAGER::CLIENT.
Definition at line 294 of file zone_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, and m_zone.
Referenced by DRAWING_TOOL::DrawZone().
Cut one zone out of another one (i.e.
subtraction) and update the zone..
aZone | the zone to removed area from |
aCutout | the area to remove |
Definition at line 164 of file zone_create_helper.cpp.
References _, COMMIT::Add(), SHAPE_POLY_SET::AddHole(), SHAPE_POLY_SET::AddOutline(), SHAPE_POLY_SET::BooleanSubtract(), SHAPE_POLY_SET::CHole(), ZONE::HatchBorder(), SHAPE_POLY_SET::HoleCount(), m_params, m_tool, SHAPE_POLY_SET::Outline(), ZONE::Outline(), SHAPE_POLY_SET::OutlineCount(), BOARD_COMMIT::Push(), COMMIT::Remove(), TOOL_MANAGER::RunAction(), ACTIONS::selectionClear, ACTIONS::selectItem, ZONE::SetLocalFlags(), ZONE::SetOutline(), and ZONE::UnFill().
Referenced by commitZone().
|
private |
Choose a new priority for @aZoneInfo.
This will be the lowest unused zone priority number
aZoneInfo | ZONE_SETTINGS to apply the new priority number to |
Definition at line 55 of file zone_create_helper.cpp.
References LSET::AllCuMask(), PCB_BASE_FRAME::GetBoard(), m_tool, ZONE_SETTINGS::m_ZonePriority, and TD_NONE.
Referenced by createNewZone().
|
private |
The preview item to display.
Definition at line 130 of file zone_create_helper.h.
Referenced by commitZone(), createNewZone(), OnFirstPoint(), performZoneCutout(), and ZONE_CREATE_HELPER().
|
private |
The zone-in-progress.
Definition at line 136 of file zone_create_helper.h.
Referenced by OnComplete(), OnFirstPoint(), OnGeometryChange(), ZONE_CREATE_HELPER(), and ~ZONE_CREATE_HELPER().
|
private |
view that show the preview item
Definition at line 133 of file zone_create_helper.h.
Referenced by OnComplete(), OnFirstPoint(), OnGeometryChange(), ZONE_CREATE_HELPER(), and ~ZONE_CREATE_HELPER().
|
private |
Parameters of the zone to be drawn.
Definition at line 127 of file zone_create_helper.h.
Referenced by commitZone(), createNewZone(), createZoneFromExisting(), OnFirstPoint(), performZoneCutout(), setUniquePriority(), and ZONE_CREATE_HELPER().
|
private |
Definition at line 139 of file zone_create_helper.h.
Referenced by GetZone(), OnComplete(), OnFirstPoint(), and OnGeometryChange().