133 if( item->Net() == aJoint->
Net() && item->Layers().Overlaps( aJoint->
Layers() ) )
182 chain.Append(
static_cast<ARC*
>( aLink )->Arc() );
211 bool carriedA = !jointA || !
isPinned( jointA, line );
212 bool carriedB = !jointB || !
isPinned( jointB, line );
214 if( carriedA && jointA )
217 if( carriedB && jointB )
220 if( carriedA && carriedB )
222 else if( carriedA || carriedB )
223 m_conns.push_back( { line, carriedA ? start :
end } );
227 m_conns.push_back( { line, ( start +
end ) / 2,
true } );
234 const int last =
chain.PointCount() - 1;
235 const int entry =
chain.Find( aEntry );
237 const int other =
chain.Find( otherEnd );
239 if( entry < 0 || other < 0 || other == entry || last < 1 )
253 for( hi = entry + 1; hi < last; hi++ )
263 for( lo = entry - 1; lo > 0; lo-- )
270 if( lo == 0 && hi == last )
301 const JOINT* farJoint =
m_world->FindJoint( start == aJoint->
Pos() ?
end : start, aLink );
303 bool farCarried =
false;
349 std::vector<JOINT*> joints;
352 for(
JOINT* joint : joints )
354 if( joint->Net() != solid->
Net() || joint->LinkCount() != 1 )
361 if( padShape->Collide( joint->Pos() ) )
370 switch( aItem->
Kind() )
375 std::unique_ptr<SOLID> clone(
static_cast<SOLID*
>( solid->
Clone() ) );
377 clone->SetPos( solid->
Pos() + aDelta );
387 std::unique_ptr<VIA> clone(
static_cast<VIA*
>(
via->Clone() ) );
389 clone->SetPos(
via->Pos() + aDelta );
401 std::unique_ptr<SEGMENT> clone( seg->
Clone() );
405 clone->SetEnds( orig.
A + aDelta, orig.
B + aDelta );
416 ARC* arc =
static_cast<ARC*
>( aItem );
417 std::unique_ptr<ARC> clone( arc->
Clone() );
418 ARC* raw = clone.get();
420 clone->Arc().Move( aDelta );
429 default: wxFAIL;
break;
454 LINE l_new( cn.origLine );
463 PNS_DBG(
Dbg(), AddItem, &l_new,
BLUE, 0, wxT(
"bdrag-new-fanout" ) );
466 LINE l_orig( cn.origLine );
ROUTER * Router() const
Return the instance of our router.
ROUTING_SETTINGS & Settings() const
Return current router settings.
DEBUG_DECORATOR * Dbg() const
ARC * Clone() const override
Return a deep copy of the item.
void clipToBlock(LINE &aLine, const VECTOR2I &aEntry, LINKED_ITEM *aLink) const
Cut an assembled line back to the stretch between aEntry and the first block joint.
BLOCK_DRAGGER(ROUTER *aRouter)
std::set< const JOINT * > m_carriedJoints
Ends of selected copper that travel.
bool Start(const VECTOR2I &aP, ITEM_SET &aPrimitives) override
Sort the selection and the unselected copper touching it.
bool isBlockBoundary(const JOINT *aJoint) const
Copper at this joint is already sorted, so a walk stops here.
void scanRigidItem(ITEM *aItem)
Sort the copper touching a selected pad or via.
bool isHeldByBlock(const JOINT *aJoint) const
A selected pad or via sits on this joint.
bool isPinned(const JOINT *aJoint, const LINE &aOwnLine) const
Held in place by something outside the block. Links of aOwnLine do not count.
std::vector< DRAGGED_CONNECTION > m_conns
Copper rerouted to follow the block.
std::unordered_set< ITEM * > m_selectedLinks
Selected segments and arcs.
std::vector< LINE > m_anchoredLines
Selected arcs that cannot move.
static LINE wrapLink(LINKED_ITEM *aLink)
A one link line, so no unselected copper is assembled into a selected segment.
void classifyNeighbour(const JOINT *aJoint, LINKED_ITEM *aLink)
Sort unselected copper that touches the block at aJoint.
std::set< ITEM * > m_bridgeItems
Copper displaced whole with the block.
bool isFixedByLock(ITEM *aItem) const
Unselected and locked, so it neither moves nor is rerouted.
bool Drag(const VECTOR2I &aP) override
Rebuild the block at aP: displace rigid and bridge items, reroute connections.
void displaceItem(ITEM *aItem, const VECTOR2I &aDelta)
Replace aItem in the current branch with a copy moved by aDelta.
NODE * CurrentNode() const override
The current branch, or the world before the first Drag().
std::set< ITEM * > m_rigidItems
Selected pads and vias.
void classifySelectedLink(LINKED_ITEM *aLink)
Sort a selected segment or arc by what holds its ends.
const ITEM_SET Traces() override
Everything displaced or rerouted by the last Drag().
void scanJoint(const JOINT *aJoint)
Sort every unselected segment and arc on a joint.
std::unordered_set< LINKED_ITEM * > m_seenLinks
Already sorted.
bool FixRoute(bool aForceCommit) override
Commit the current branch if it is collision free or aForceCommit is set.
bool coveredBySolid(const JOINT *aJoint, bool aSelected) const
A pad covers more than its anchor, so ask what really sits on the joint.
DRAG_ALGO(ROUTER *aRouter)
std::vector< ITEM * > & Items()
const std::vector< ITEM * > & CItems() const
Base class for PNS router board items.
void SetLayers(const PNS_LAYER_RANGE &aLayers)
void SetSourceItem(BOARD_ITEM *aSourceItem)
const PNS_LAYER_RANGE & Layers() const
virtual NET_HANDLE Net() const
PnsKind Kind() const
Return the type (kind) of the item.
void SetNet(NET_HANDLE aNet)
BOARD_ITEM * GetSourceItem() const
virtual int Layer() const
virtual VECTOR2I Anchor(int n) const
A 2D point on a given set of layers and belonging to a certain net, that links together a number of b...
const std::vector< ITEM * > & LinkList() const
NET_HANDLE Net() const override
const VECTOR2I & Pos() const
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
void ClipVertexRange(int aStart, int aEnd)
Clip the line to a given range of vertices.
void SetShape(const SHAPE_LINE_CHAIN &aLine)
Assign a shape to the line (a polyline/line chain).
const SHAPE_LINE_CHAIN & CLine() const
void DragCorner(const VECTOR2I &aP, int aIndex, bool aFreeAngle=false, DIRECTION_45 aPreferredEndingDirection=DIRECTION_45())
virtual void Unmark(int aMarker=-1) const override
void SetWidth(int aWidth)
Set line width.
void DragSegment(const VECTOR2I &aP, int aIndex, bool aFreeAngle=false)
void Reverse()
Reverse the point/vertex order.
virtual int Width() const
void Link(LINKED_ITEM *aLink)
Add a reference to an item registered in a NODE that is a part of this line.
bool ContainsLink(const LINKED_ITEM *aItem) const
Check if the segment aLink is a part of the line.
std::vector< LINKED_ITEM * > & Links()
Return the list of links from the owning node that constitute this line (or NULL if the line is not l...
virtual void ClearLinks()
Erase the linking information. Used to detach the line from the owning node.
Keep the router "world" - i.e.
OPT_OBSTACLE CheckColliding(const ITEM *aItem, int aKindMask=ITEM::ANY_T)
Check if the item collides with anything else in the world, and if found, returns the obstacle.
SEGMENT * Clone() const override
Return a deep copy of the item.
const SHAPE_LINE_CHAIN Hull(int aClearance=0, int aWalkaroundThickness=0, int aLayer=-1) const override
const VECTOR2I & Pos() const
ITEM * Clone() const override
Return a deep copy of the item.
const SHAPE * Shape(int aLayer) const override
Return the geometrical shape of the item.
const VECTOR2I & Pos() const
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
const VECTOR2I & CLastPoint() const
Return the last point in the line chain.
int Find(const VECTOR2I &aP, int aThreshold=0) const
Search for point aP.
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
An abstract shape on 2D plane.
Push and Shove diff pair dimensions (gap) settings dialog.
#define PNS_DBG(dbg, method,...)
const SHAPE_LINE_CHAIN chain
VECTOR2< int32_t > VECTOR2I