|
KiCad PCB EDA Suite
|
#include <algorithm>#include <constraints/constraint_copy.h>#include <constraints/pcb_constraint.h>#include <tools/pcb_selection.h>Go to the source code of this file.
Functions | |
| std::set< KIID > | CollectConstraintScopeIds (const PCB_SELECTION &aSelection) |
| Shared logic deciding which constraints follow items through copy paste or duplicate. | |
| bool | ConstraintFullySelected (const PCB_CONSTRAINT *aConstraint, const std::set< KIID > &aScopeIds) |
True when aConstraint has members and every one of them is present in aScopeIds, so the whole relation is being copied rather than left half dangling. | |
| std::vector< PCB_CONSTRAINT * > | CloneFullySelectedConstraints (const CONSTRAINTS &aSource, const std::map< KIID, KIID > &aIdMap) |
Clone the constraints in aSource that a duplicate should carry. | |
| std::vector< PCB_CONSTRAINT * > CloneFullySelectedConstraints | ( | const CONSTRAINTS & | aSource, |
| const std::map< KIID, KIID > & | aIdMap ) |
Clone the constraints in aSource that a duplicate should carry.
aIdMap maps each original item KIID to its duplicate KIID a constraint whose members are all keys is cloned with a fresh UUID and remapped to the duplicates one referencing an item outside the map is dropped Caller owns the returned constraints
Definition at line 59 of file constraint_copy.cpp.
References ConstraintFullySelected(), PCB_CONSTRAINT::RemapKIIDs(), and BOARD_ITEM::ResetUuid().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and EDIT_TOOL::Duplicate().
| std::set< KIID > CollectConstraintScopeIds | ( | const PCB_SELECTION & | aSelection | ) |
Shared logic deciding which constraints follow items through copy paste or duplicate.
A constraint references members by KIID so it travels only when every member is in the copy otherwise paste would resolve to a mix of new and stale items Copy and duplicate both filter on this rule so it lives here once The KIIDs of every selected item and all of its descendants, defining the scope a constraint must fall entirely within to travel with a copy.
Definition at line 27 of file constraint_copy.cpp.
References EDA_ITEM::m_Uuid, RECURSE, and BOARD_ITEM::RunOnChildren().
Referenced by CLIPBOARD_IO::SaveSelection().
| bool ConstraintFullySelected | ( | const PCB_CONSTRAINT * | aConstraint, |
| const std::set< KIID > & | aScopeIds ) |
True when aConstraint has members and every one of them is present in aScopeIds, so the whole relation is being copied rather than left half dangling.
Definition at line 46 of file constraint_copy.cpp.
References PCB_CONSTRAINT::GetMembers().
Referenced by CloneFullySelectedConstraints(), and CLIPBOARD_IO::SaveSelection().