|
KiCad PCB EDA Suite
|
#include "block_drag_capability.h"#include <algorithm>#include <functional>#include <unordered_set>#include <board.h>#include <footprint.h>#include <pcb_base_frame.h>#include <pcbnew_settings.h>#include <pcb_generator.h>#include <generators/pcb_tuning_pattern.h>#include <generators/pcb_via_stack.h>#include <generators/pcb_via_stitch.h>#include <pcb_group.h>#include <pcb_shape.h>#include <constraints/constraint_builder.h>#include <constraints/pcb_constraint.h>Go to the source code of this file.
Functions | |
| bool | BlockDragAnchorEditingEnabled (const PCB_BASE_FRAME *aFrame) |
| Whether the user has turned on editing anchor points on a multi-selection. | |
| bool | BlockDragIsConstraintMember (const BOARD_ITEM &aItem) |
| True when the item belongs to any geometric constraint on its board or inside one of its footprints. | |
| BLOCK_DRAG_CAPABILITY | BlockDragCapability (const BOARD_ITEM &aItem) |
| Classify one board item for a block drag. | |
| std::vector< BOARD_ITEM * > | BlockDragExpandSelection (const std::vector< BOARD_ITEM * > &aSelection) |
| Replace group containers with their members, through nested groups, and drop duplicates. | |
| bool BlockDragAnchorEditingEnabled | ( | const PCB_BASE_FRAME * | aFrame | ) |
Whether the user has turned on editing anchor points on a multi-selection.
Both editors read the board editor's copy of the setting, the way the footprint editor already reads the flip direction from there. One reader so the two tools cannot drift.
Definition at line 40 of file block_drag_capability.cpp.
References PCB_BASE_FRAME::GetPcbNewSettings(), and PCBNEW_SETTINGS::m_AreaAnchorPointSelection.
Referenced by PCB_POINT_EDITOR::blockAnchorEditingEnabled().
| BLOCK_DRAG_CAPABILITY BlockDragCapability | ( | const BOARD_ITEM & | aItem | ) |
Classify one board item for a block drag.
A footprint holder board has no router, which is how the footprint editor is told apart. Pads are RIGID there, and copper and whole footprints are UNSUPPORTED. Those last rows are a guard, since that selection cannot hold them. On a board, the graphics and zones inside a footprint are RIGID, so they travel without deforming.
Expand groups with BlockDragExpandSelection() first. A group container on its own is UNSUPPORTED. A generator is RIGID only when its Move() takes all of its members with it. A via stitch is DEFORMABLE, since it is an outline whose vias are re-placed by the regeneration that follows the drag.
Definition at line 68 of file block_drag_capability.cpp.
References ARC, BEZIER, CIRCLE, DEFORMABLE, ELLIPSE, ELLIPSE_ARC, PCB_TUNING_PATTERN::GENERATOR_TYPE, PCB_VIA_STACK::GENERATOR_TYPE, PCB_VIA_STITCH::GENERATOR_TYPE, BOARD_ITEM::GetBoard(), BOARD_ITEM::GetParentFootprint(), BOARD::IsFootprintHolder(), PCB_ARC_T, PCB_BARCODE_T, PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_DIM_LEADER_T, PCB_DIM_ORTHOGONAL_T, PCB_DIM_RADIAL_T, PCB_DRILL_CHART_T, PCB_DRILL_MAP_T, PCB_FIELD_T, PCB_FOOTPRINT_T, PCB_GENERATOR_T, PCB_GRID_ITEM_T, PCB_PAD_T, PCB_POINT_T, PCB_REFERENCE_IMAGE_T, PCB_SHAPE_T, PCB_TABLE_T, PCB_TABLECELL_T, PCB_TARGET_T, PCB_TEXT_T, PCB_TEXTBOX_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_T, POLY, RECTANGLE, RIGID, ROUTER, SEGMENT, EDA_ITEM::Type(), and UNSUPPORTED.
Referenced by BLOCK_DRAG_SESSION::Begin(), BlockDragHandlePickable(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PCB_POINT_EDITOR::buildBlockHandles().
| std::vector< BOARD_ITEM * > BlockDragExpandSelection | ( | const std::vector< BOARD_ITEM * > & | aSelection | ) |
Replace group containers with their members, through nested groups, and drop duplicates.
The result holds no group containers and no markers, which no tool moves. A generator is a kind of group but travels as one object, so it stays whole. An item selected both on its own and through a group appears once. Directly selected items keep their order, and a group's members follow the place the group held. A footprint's own child is dropped when the footprint is in the result too, because the footprint carries it.
Definition at line 156 of file block_drag_capability.cpp.
References BOARD_ITEM::GetParentFootprint(), PCB_GROUP_T, and PCB_MARKER_T.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PCB_POINT_EDITOR::buildBlockHandles().
| bool BlockDragIsConstraintMember | ( | const BOARD_ITEM & | aItem | ) |
True when the item belongs to any geometric constraint on its board or inside one of its footprints.
Plain membership, so every kind of constraint counts. It tells the gesture which moved shapes need their clusters solved again. Walks every constraint on each call.
Definition at line 48 of file block_drag_capability.cpp.
References CollectResolvedConstraints(), BOARD_ITEM::GetBoard(), and EDA_ITEM::m_Uuid.
Referenced by BLOCK_DRAG_SESSION::Begin(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().