|
KiCad PCB EDA Suite
|
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. | |
| void | Clear () |
| Clear all construction items. | |
| 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) |
| unsigned | getMaxTemporaryBatches () const |
| How many batches of temporary construction items can be active at once. | |
Private Attributes | |
| CONSTRUCTION_VIEW_HANDLER & | m_viewHandler |
| std::optional< CONSTRUCTION_ITEM_BATCH > | m_persistentConstructionBatch |
| Within one "operation", there is one set of construction items that are "persistent", and are always shown. | |
| std::deque< CONSTRUCTION_ITEM_BATCH > | m_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. | |
A class that manages "construction" objects and geometry.
These are things like line extensions, arc centers, etc.
Definition at line 154 of file construction_manager.h.
| using CONSTRUCTION_MANAGER::CONSTRUCTION_ITEM_BATCH = std::vector<CONSTRUCTION_ITEM> |
Definition at line 190 of file construction_manager.h.
|
strong |
| Enumerator | |
|---|---|
| FROM_ITEMS | |
| FROM_SNAP_LINE | |
Definition at line 160 of file construction_manager.h.
| CONSTRUCTION_MANAGER::CONSTRUCTION_MANAGER | ( | CONSTRUCTION_VIEW_HANDLER & | aViewHandler | ) |
Definition at line 170 of file construction_manager.cpp.
References acceptConstructionItems(), ADVANCED_CFG::GetCfg(), m_activationHelper, m_batchesMutex, m_involvedItems, m_persistentConstructionBatch, m_temporaryConstructionBatches, and m_viewHandler.
| CONSTRUCTION_MANAGER::~CONSTRUCTION_MANAGER | ( | ) |
Definition at line 193 of file construction_manager.cpp.
|
private |
Definition at line 264 of file construction_manager.cpp.
References KIGFX::CONSTRUCTION_GEOM::AddDrawable(), KIGFX::CONSTRUCTION_GEOM::ClearDrawables(), CONSTRUCTION_MANAGER::CONSTRUCTION_ITEM::DRAWABLE_ENTRY::Drawable, getMaxTemporaryBatches(), CONSTRUCTION_MANAGER::CONSTRUCTION_ITEM::Item, CONSTRUCTION_MANAGER::CONSTRUCTION_ITEM::DRAWABLE_ENTRY::LineWidth, m_batchesMutex, m_involvedItems, m_persistentConstructionBatch, m_temporaryConstructionBatches, and m_viewHandler.
Referenced by CONSTRUCTION_MANAGER().
| void CONSTRUCTION_MANAGER::CancelProposal | ( | ) |
Cancel outstanding proposals for new geometry.
Definition at line 250 of file construction_manager.cpp.
References m_activationHelper.
Referenced by PCB_GRID_HELPER::BestSnapAnchor(), and Clear().
| void CONSTRUCTION_MANAGER::Clear | ( | ) |
Clear all construction items.
Definition at line 870 of file construction_manager.cpp.
References CancelProposal(), m_batchesMutex, m_involvedItems, m_persistentConstructionBatch, and m_temporaryConstructionBatches.
| 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 371 of file construction_manager.cpp.
References m_batchesMutex, m_persistentConstructionBatch, and m_temporaryConstructionBatches.
|
private |
How many batches of temporary construction items can be active at once.
This is to prevent too much clutter.
Definition at line 256 of file construction_manager.cpp.
Referenced by acceptConstructionItems(), and ProposeConstructionItems().
| bool CONSTRUCTION_MANAGER::HasActiveConstruction | ( | ) | const |
Definition at line 387 of file construction_manager.cpp.
References m_batchesMutex, m_persistentConstructionBatch, and m_temporaryConstructionBatches.
| 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 356 of file construction_manager.cpp.
References m_involvedItems.
Referenced by PCB_GRID_HELPER::nearestAnchor().
| void CONSTRUCTION_MANAGER::ProposeConstructionItems | ( | std::unique_ptr< CONSTRUCTION_ITEM_BATCH > | aBatch, |
| bool | aIsPersistent ) |
Add a batch of construction items to the helper.
| aBatch | The batch of construction items to add. |
| aIsPersistent | If 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 215 of file construction_manager.cpp.
References getMaxTemporaryBatches(), HashConstructionBatchSources(), m_activationHelper, m_batchesMutex, and m_temporaryConstructionBatches.
Referenced by PCB_GRID_HELPER::AddConstructionItems().
|
private |
Definition at line 251 of file construction_manager.h.
Referenced by CancelProposal(), CONSTRUCTION_MANAGER(), and ProposeConstructionItems().
|
mutableprivate |
Protects the persistent and temporary construction batches.
Definition at line 254 of file construction_manager.h.
Referenced by acceptConstructionItems(), Clear(), CONSTRUCTION_MANAGER(), GetConstructionItems(), HasActiveConstruction(), and ProposeConstructionItems().
|
private |
Set of all items for which construction geometry has been added.
Definition at line 249 of file construction_manager.h.
Referenced by acceptConstructionItems(), Clear(), CONSTRUCTION_MANAGER(), and InvolvesAllGivenRealItems().
|
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 243 of file construction_manager.h.
Referenced by acceptConstructionItems(), Clear(), CONSTRUCTION_MANAGER(), GetConstructionItems(), and HasActiveConstruction().
|
private |
Temporary construction items are added and removed as needed.
Definition at line 246 of file construction_manager.h.
Referenced by acceptConstructionItems(), Clear(), CONSTRUCTION_MANAGER(), GetConstructionItems(), HasActiveConstruction(), and ProposeConstructionItems().
|
private |
Definition at line 238 of file construction_manager.h.
Referenced by acceptConstructionItems(), and CONSTRUCTION_MANAGER().