KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ZONE_CREATE_HELPER Class Reference

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>

Inheritance diagram for ZONE_CREATE_HELPER:
POLYGON_GEOM_MANAGER::CLIENT

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 ()
 
ZONEGetZone () 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< ZONEcreateNewZone (bool aKeepout)
 Prompt the user for new zone settings, and create a new zone with those settings.
 
std::unique_ptr< ZONEcreateZoneFromExisting (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_TOOLm_tool
 Parameters of the zone to be drawn.
 
PARAMSm_params
 The preview item to display.
 
KIGFX::PREVIEW::POLYGON_ITEM m_previewItem
 view that show the preview item
 
KIGFX::VIEWm_parentView
 The zone-in-progress.
 
std::unique_ptr< ZONEm_zone
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ZONE_CREATE_HELPER()

ZONE_CREATE_HELPER::ZONE_CREATE_HELPER ( DRAWING_TOOL aTool,
PARAMS aParams 
)
Parameters
aToolthe DRAWING_TOOL to provide the zone tool to.
aParamsthe parameters to use to guide the zone creation.

Definition at line 38 of file zone_create_helper.cpp.

References KIGFX::VIEW::Add(), m_parentView, and m_previewItem.

◆ ~ZONE_CREATE_HELPER()

ZONE_CREATE_HELPER::~ZONE_CREATE_HELPER ( )
virtual

Member Function Documentation

◆ commitZone()

void ZONE_CREATE_HELPER::commitZone ( std::unique_ptr< ZONE aZone)

◆ createNewZone()

◆ createZoneFromExisting()

std::unique_ptr< ZONE > ZONE_CREATE_HELPER::createZoneFromExisting ( const ZONE aSrcZone)

Create a new zone with the settings from an existing zone.

Parameters
aSrcZonethe zone to copy settings from
Returns
the new zone

Definition at line 149 of file zone_create_helper.cpp.

References ZONE_SETTINGS::ExportSetting(), TOOL_BASE::getModel(), and m_tool.

Referenced by OnFirstPoint().

◆ GetZone()

ZONE * ZONE_CREATE_HELPER::GetZone ( ) const
inline

Definition at line 74 of file zone_create_helper.h.

References m_zone.

Referenced by DRAWING_TOOL::DrawZone().

◆ OnComplete()

◆ OnFirstPoint()

◆ OnGeometryChange()

◆ performZoneCutout()

void ZONE_CREATE_HELPER::performZoneCutout ( ZONE aZone,
const ZONE aCutout 
)

◆ setUniquePriority()

void ZONE_CREATE_HELPER::setUniquePriority ( ZONE_SETTINGS aZoneInfo)
private

Choose a new priority for @aZoneInfo.

This will be the lowest unused zone priority number

Parameters
aZoneInfoZONE_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(), TOOL_BASE::getEditFrame(), m_tool, and ZONE_SETTINGS::m_ZonePriority.

Referenced by createNewZone().

Member Data Documentation

◆ m_params

PARAMS& ZONE_CREATE_HELPER::m_params
private

The preview item to display.

Definition at line 130 of file zone_create_helper.h.

Referenced by commitZone(), createNewZone(), OnFirstPoint(), and performZoneCutout().

◆ m_parentView

KIGFX::VIEW& ZONE_CREATE_HELPER::m_parentView
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().

◆ m_previewItem

KIGFX::PREVIEW::POLYGON_ITEM ZONE_CREATE_HELPER::m_previewItem
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().

◆ m_tool

DRAWING_TOOL& ZONE_CREATE_HELPER::m_tool
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(), and setUniquePriority().

◆ m_zone

std::unique_ptr<ZONE> ZONE_CREATE_HELPER::m_zone
private

Definition at line 139 of file zone_create_helper.h.

Referenced by GetZone(), OnComplete(), OnFirstPoint(), and OnGeometryChange().


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