KiCad PCB EDA Suite
Loading...
Searching...
No Matches
block_drag_pick.cpp File Reference

Go to the source code of this file.

Functions

bool BlockDragHandlePickable (const EDIT_POINTS &aCollection, const EDIT_POINT &aPoint)
 True when the user is allowed to pick this handle.
 
void BlockDragApplyPick (std::set< PCB_HANDLE_KEY > &aPicked, const PCB_HANDLE_KEY &aKey, bool aAccumulate)
 Add one clicked handle to the picked set.
 
SHAPE_LINE_CHAIN BlockDragPickRect (const VECTOR2I &aFirst, const VECTOR2I &aSecond)
 The closed rectangle a box pick covers, built from two opposite corners.
 
void BlockDragLassoPick (const std::vector< EDIT_POINTS * > &aCollections, const SHAPE_LINE_CHAIN &aLasso, bool aAccumulate, std::set< PCB_HANDLE_KEY > &aPicked)
 Add the handles a lasso surrounds to the picked set.
 

Function Documentation

◆ BlockDragApplyPick()

void BlockDragApplyPick ( std::set< PCB_HANDLE_KEY > & aPicked,
const PCB_HANDLE_KEY & aKey,
bool aAccumulate )

Add one clicked handle to the picked set.

A plain click keeps just that handle. Shift-click toggles it and leaves the rest of the set alone.

Definition at line 60 of file block_drag_pick.cpp.

Referenced by BLOCK_DRAG_SESSION::Begin(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PCB_POINT_EDITOR::pickHandleAt().

◆ BlockDragHandlePickable()

bool BlockDragHandlePickable ( const EDIT_POINTS & aCollection,
const EDIT_POINT & aPoint )

True when the user is allowed to pick this handle.

The parent item has to be DEFORMABLE. Corner handles can be picked. An edge handle can be picked on a zone, a graphic polygon or a polygon generator such as a via stitch, where dragging an edge is part of the normal point editor. Midpoints of rectangles and segments are left out, because the two corners they drive are the handles that really define the shape.

Pass an item's own handle collection. The scaling box drawn around a multi-selection borrows one member as its parent, so it does not belong here.

Definition at line 30 of file block_drag_pick.cpp.

References BlockDragCapability(), DEFORMABLE, EDIT_POINT::DrivesWholeShape(), EDIT_POINTS::GetParent(), KIGFX::VIEW_ITEM::IsBOARD_ITEM(), PCB_SHAPE_T, PCB_ZONE_T, POLY, and EDA_ITEM::Type().

Referenced by BLOCK_DRAG_SESSION::AreaPickStarts(), BLOCK_DRAG_SESSION::Begin(), BlockDragLassoPick(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), PCB_POINT_EDITOR::HasBlockHandle(), PCB_POINT_EDITOR::pickHandleAt(), and PCB_POINT_EDITOR::updateBlockHandleHover().

◆ BlockDragLassoPick()

void BlockDragLassoPick ( const std::vector< EDIT_POINTS * > & aCollections,
const SHAPE_LINE_CHAIN & aLasso,
bool aAccumulate,
std::set< PCB_HANDLE_KEY > & aPicked )

Add the handles a lasso surrounds to the picked set.

A plain lasso keeps just the corner handles it surrounds. Shift adds them and leaves the rest of the set alone. A lasso picks corners, and an edge comes along once both of its corners are picked.

A handle sitting right on the lasso line counts as inside. Handles are single points with no width, so the usual distinction between enclosing and touching a shape has nothing to act on.

Definition at line 81 of file block_drag_pick.cpp.

References BlockDragHandlePickable(), SHAPE_LINE_CHAIN::GenerateBBoxCache(), EDIT_POINT::GetPosition(), PCB_HANDLE_KEY::Make(), SHAPE_LINE_CHAIN::PointCount(), SHAPE_LINE_CHAIN::PointInside(), and SHAPE_LINE_CHAIN_BASE::PointOnEdge().

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(), BLOCK_DRAG_SESSION::runBox(), and BLOCK_DRAG_SESSION::runLasso().

◆ BlockDragPickRect()

SHAPE_LINE_CHAIN BlockDragPickRect ( const VECTOR2I & aFirst,
const VECTOR2I & aSecond )

The closed rectangle a box pick covers, built from two opposite corners.

Definition at line 74 of file block_drag_pick.cpp.

References VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BLOCK_DRAG_SESSION::runBox().