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

A class that manages "construction" objects and geometry. More...

#include <construction_manager.h>

Classes

struct  CONSTRUCTION_ITEM
 Items to be used for the construction of "virtual" anchors, for example, when snapping to a point involving an extension of an existing line or arc. More...
 
struct  PENDING_BATCH
 

Public Types

enum class  SOURCE { FROM_ITEMS , FROM_SNAP_LINE }
 
using CONSTRUCTION_ITEM_BATCH = std::vector< CONSTRUCTION_ITEM >
 

Public Member Functions

 CONSTRUCTION_MANAGER (CONSTRUCTION_VIEW_HANDLER &aViewHandler)
 
 ~CONSTRUCTION_MANAGER ()
 
void ProposeConstructionItems (std::unique_ptr< CONSTRUCTION_ITEM_BATCH > aBatch, bool aIsPersistent)
 Add a batch of construction items to the helper.
 
void CancelProposal ()
 Cancel outstanding proposals for new geometry.
 
bool InvolvesAllGivenRealItems (const std::vector< EDA_ITEM * > &aItems) const
 Check if all 'real' (non-null = constructed) the items in the batch are in the list of items currently 'involved' in an active construction.
 
void GetConstructionItems (std::vector< CONSTRUCTION_ITEM_BATCH > &aToExtend) const
 Get the list of additional geometry items that should be considered.
 
bool HasActiveConstruction () const
 

Private Member Functions

void acceptConstructionItems (std::unique_ptr< PENDING_BATCH > aAcceptedBatchHash)
 

Private Attributes

CONSTRUCTION_VIEW_HANDLERm_viewHandler
 
std::optional< CONSTRUCTION_ITEM_BATCHm_persistentConstructionBatch
 Within one "operation", there is one set of construction items that are "persistent", and are always shown.
 
std::deque< CONSTRUCTION_ITEM_BATCHm_temporaryConstructionBatches
 Temporary construction items are added and removed as needed.
 
std::set< EDA_ITEM * > m_involvedItems
 Set of all items for which construction geometry has been added.
 
std::unique_ptr< ACTIVATION_HELPER< std::unique_ptr< PENDING_BATCH > > > m_activationHelper
 
std::mutex m_batchesMutex
 Protects the persistent and temporary construction batches.
 

Detailed Description

A class that manages "construction" objects and geometry.

These are things like line extensions, arc centers, etc.

Definition at line 139 of file construction_manager.h.

Member Typedef Documentation

◆ CONSTRUCTION_ITEM_BATCH

Member Enumeration Documentation

◆ SOURCE

enum class CONSTRUCTION_MANAGER::SOURCE
strong
Enumerator
FROM_ITEMS 
FROM_SNAP_LINE 

Definition at line 145 of file construction_manager.h.

Constructor & Destructor Documentation

◆ CONSTRUCTION_MANAGER()

CONSTRUCTION_MANAGER::CONSTRUCTION_MANAGER ( CONSTRUCTION_VIEW_HANDLER aViewHandler)

◆ ~CONSTRUCTION_MANAGER()

CONSTRUCTION_MANAGER::~CONSTRUCTION_MANAGER ( )

Definition at line 195 of file construction_manager.cpp.

Member Function Documentation

◆ acceptConstructionItems()

◆ CancelProposal()

void CONSTRUCTION_MANAGER::CancelProposal ( )

Cancel outstanding proposals for new geometry.

Definition at line 235 of file construction_manager.cpp.

References m_activationHelper.

Referenced by PCB_GRID_HELPER::BestSnapAnchor().

◆ GetConstructionItems()

void CONSTRUCTION_MANAGER::GetConstructionItems ( std::vector< CONSTRUCTION_ITEM_BATCH > &  aToExtend) const

Get the list of additional geometry items that should be considered.

Definition at line 352 of file construction_manager.cpp.

References m_batchesMutex, m_persistentConstructionBatch, and m_temporaryConstructionBatches.

Referenced by SNAP_MANAGER::GetConstructionItems().

◆ HasActiveConstruction()

bool CONSTRUCTION_MANAGER::HasActiveConstruction ( ) const

◆ InvolvesAllGivenRealItems()

bool CONSTRUCTION_MANAGER::InvolvesAllGivenRealItems ( const std::vector< EDA_ITEM * > &  aItems) const

Check if all 'real' (non-null = constructed) the items in the batch are in the list of items currently 'involved' in an active construction.

Definition at line 337 of file construction_manager.cpp.

References m_involvedItems.

Referenced by PCB_GRID_HELPER::BestSnapAnchor().

◆ ProposeConstructionItems()

void CONSTRUCTION_MANAGER::ProposeConstructionItems ( std::unique_ptr< CONSTRUCTION_ITEM_BATCH aBatch,
bool  aIsPersistent 
)

Add a batch of construction items to the helper.

Parameters
aBatchThe batch of construction items to add.
aIsPersistentIf true, the batch is considered "persistent" and will always be shown (and it will replace any previous persistent batch). If false, the batch is temporary and may be pushed out by other batches.

Definition at line 217 of file construction_manager.cpp.

References HashConstructionBatchSources(), and m_activationHelper.

Referenced by PCB_GRID_HELPER::AddConstructionItems().

Member Data Documentation

◆ m_activationHelper

std::unique_ptr<ACTIVATION_HELPER<std::unique_ptr<PENDING_BATCH> > > CONSTRUCTION_MANAGER::m_activationHelper
private

◆ m_batchesMutex

std::mutex CONSTRUCTION_MANAGER::m_batchesMutex
mutableprivate

Protects the persistent and temporary construction batches.

Definition at line 220 of file construction_manager.h.

Referenced by acceptConstructionItems(), GetConstructionItems(), and HasActiveConstruction().

◆ m_involvedItems

std::set<EDA_ITEM*> CONSTRUCTION_MANAGER::m_involvedItems
private

Set of all items for which construction geometry has been added.

Definition at line 215 of file construction_manager.h.

Referenced by acceptConstructionItems(), and InvolvesAllGivenRealItems().

◆ m_persistentConstructionBatch

std::optional<CONSTRUCTION_ITEM_BATCH> CONSTRUCTION_MANAGER::m_persistentConstructionBatch
private

Within one "operation", there is one set of construction items that are "persistent", and are always shown.

Usually the original item and any extensions.

Definition at line 209 of file construction_manager.h.

Referenced by acceptConstructionItems(), GetConstructionItems(), and HasActiveConstruction().

◆ m_temporaryConstructionBatches

std::deque<CONSTRUCTION_ITEM_BATCH> CONSTRUCTION_MANAGER::m_temporaryConstructionBatches
private

Temporary construction items are added and removed as needed.

Definition at line 212 of file construction_manager.h.

Referenced by acceptConstructionItems(), GetConstructionItems(), and HasActiveConstruction().

◆ m_viewHandler

CONSTRUCTION_VIEW_HANDLER& CONSTRUCTION_MANAGER::m_viewHandler
private

Definition at line 204 of file construction_manager.h.

Referenced by acceptConstructionItems().


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