52 VIA* via = *vias.begin();
57 bool solidsOnly =
false;
59 if( via->
PushoutForce( node, lead, force, solidsOnly, 40 ) )
70 int w2 = aSeg->
Width() / 2;
86 else if( distB <= w2 )
163 if( aPrimitives.
Empty() )
166 ITEM* startItem = aPrimitives[0];
186 wxLogTrace(
"PNS",
"StartDragging: item %p [kind %d]", startItem, (
int) startItem->
Kind() );
188 switch( startItem->
Kind() )
197 return startDragArc( aP, static_cast<ARC*>( startItem ) );
278 if(
const LINE* l = dyn_cast<const LINE*>( item ) )
281 LINE draggedLine( *l );
291 else if (
VIA *via = dyn_cast<VIA*>( item ) )
293 auto nvia =
Clone( *via );
318 bool viaPropOk =
false;
323 if (
VIA *via = dyn_cast<VIA*>( item ) )
325 auto draggedVia =
Clone( *via );
327 draggedVia->SetPos( aP );
332 vias.insert( draggedVia.get() );
338 viaTargetPos = draggedVia->Pos();
351 if(
const LINE* l = dyn_cast<const LINE*>( item ) )
354 LINE draggedLine( *l );
392 if(
Settings().GetOptimizeDraggedTrack() )
496 draggedWalk = dragged;
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
int Find(const VECTOR2I &aP) const
Function Find()
const SHAPE_LINE_CHAIN & CLine() const
Base class for PNS router board items.
ITEM_SET m_draggedItems
If true, moves the connection lines without maintaining 45 degrees corners.
ROUTER * Router() const
Return current router settings.
long long int Length() const
Function Length()
bool Drag(const VECTOR2I &aP) override
Function Drag()
virtual void AddPoint(VECTOR2I aP, int aColor, int aSize=100000, const std::string aName="")
virtual void AddBox(BOX2I aB, int aColor, const std::string aName="")
bool tryWalkaround(NODE *aNode, LINE &aOrig, LINE &aWalk)
Keep the router "world" - i.e.
bool propagateViaForces(NODE *node, std::set< VIA * > &vias)
OPT_BOX2I ChangedArea(const LINE *aOther) const
void DragSegment(const VECTOR2I &aP, int aIndex, bool aFreeAngle=false)
const VIA_HANDLE MakeHandle() const
std::unique_ptr< SHOVE > m_shove
int Width() const override
WALKAROUND_STATUS statusCw
void SetRestrictArea(const BOX2I &aArea, bool aStrict=true)
virtual LOGGER * Logger()
bool PushoutForce(NODE *aNode, const VECTOR2I &aDirection, VECTOR2I &aForce, bool aSolidsOnly=true, int aMaxIterations=10)
void optimizeAndUpdateDraggedLine(LINE &aDragged, const LINE &aOrig, const VECTOR2I &aP)
bool startDragSegment(const VECTOR2D &aP, SEGMENT *aSeg)
virtual bool Start(const VECTOR2I &aP, ITEM_SET &aPrimitives) override
Function Start()
const ITEM_SET Traces() override
Function Traces()
WALKAROUND_STATUS Route(const LINE &aInitialPath, LINE &aWalkPath, bool aOptimize=true)
NODE * CurrentNode() const override
Function CurrentNode()
bool startDragArc(const VECTOR2D &aP, ARC *aArc)
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
virtual void Unmark(int aMarker=-1) const
void Add(const LINE &aLine)
NODE * Branch()
Create a lightweight copy (called branch) of self that tracks the changes (added/removed items) wrs t...
const VECTOR2I & Pos() const
bool startDragVia(VIA *aVia)
const VECTOR2I NearestPoint(const VECTOR2I &aP, bool aAllowInternalShapePoints=true) const
Finds a point on the line chain that is closest to point aP.
void Remove(ARC *aArc)
Remove an item from this branch.
ROUTING_SETTINGS & Settings() const
Return the logger object, allowing to dump geometry to a file.
bool dragViaMarkObstacles(const VIA_HANDLE &aHandle, NODE *aNode, const VECTOR2I &aP)
Represents a 2D point on a given set of layers and belonging to a certain net, that links together a ...
void Reverse()
Clip the line to the nearest obstacle, traversing from the line's start vertex (0).
const LINE AssembleLine(LINKED_ITEM *aSeg, int *aOriginSegmentIndex=NULL, bool aStopAtLockedJoints=false)
Follow the joint map to assemble a line connecting two non-trivial joints starting from segment aSeg.
int m_draggedSegmentIndex
static bool Optimize(LINE *aLine, int aEffortLevel, NODE *aWorld, const VECTOR2I aV=VECTOR2I(0, 0))
void SetPreserveVertex(const VECTOR2I &aV)
DEBUG_DECORATOR * Dbg() const
void AddTrailPoint(const VECTOR2I &aP)
bool SmoothDraggedSegments() const
Enable/disable smoothing segments during dragging.
PNS_MODE Mode() const
Set the routing mode.
void SetSolidsOnly(bool aSolidsOnly)
bool dragViaWalkaround(const VIA_HANDLE &aHandle, NODE *aNode, const VECTOR2I &aP)
const LINKED_ITEMS & LinkList() const
Reduce corner cost iteratively.
MOUSE_TRAIL_TRACER m_mouseTrailTracer
JOINT * FindJoint(const VECTOR2I &aPos, int aLayer, int aNet)
Search for a joint at a given position, layer and belonging to given net.
void SetPos(const VECTOR2I &aPos)
void DragCorner(const VECTOR2I &aP, int aIndex, bool aFreeAngle=false)
bool FixRoute() override
Function FixRoute()
Guess what's better, try to make least mess on the PCB.
const ITEM_SET findViaFanoutByHandle(NODE *aNode, const VIA_HANDLE &handle)
bool dragWalkaround(const VECTOR2I &aP)
Ignore collisions, mark obstacles.
bool dragShove(const VECTOR2I &aP)
std::unique_ptr< typename std::remove_const< T >::type > Clone(const T &aItem)
virtual void ClearLinks()
Return the number of segments that were assembled together to form this line.
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.
WALKAROUND_STATUS statusCcw
int Width() const
Return true if the line is geometrically identical as line aOther.
bool dragMarkObstacles(const VECTOR2I &aP)
void SetDebugDecorator(DEBUG_DECORATOR *aDecorator)
Assign a debug decorator allowing this algo to draw extra graphics for visual debugging.
PnsKind Kind() const
Return the type (kind) of the item.
Perform various optimizations of the lines being routed, attempting to make the lines shorter and les...
void SetEffortLevel(int aEffort)
Push and Shove diff pair dimensions (gap) settings dialog.
VECTOR2D m_lastValidPoint
Contains the list of items that are currently modified by the dragger.
void SetLogger(LOGGER *aLogger)
void SetMode(int aDragMode) override
bool Add(std::unique_ptr< SEGMENT > aSegment, bool aAllowRedundant=false)
Add an item to the current node.
VECTOR2I GetTrailLeadVector() const
void SetIterationLimit(const int aIterLimit)
virtual void Unmark(int aMarker=-1) const override
void SetSnapThreshhold(int aThreshhold)