22 #ifndef __PNS_ROUTER_H
23 #define __PNS_ROUTER_H
28 #include <core/optional.h>
29 #include <boost/unordered_set.hpp>
32 #include <geometry/shape_line_chain.h>
34 #include "pns_routing_settings.h"
35 #include "pns_sizes_settings.h"
37 #include "pns_itemset.h"
39 #include "../wx_compat.h"
51 class DEBUG_DECORATOR;
53 class DIFF_PAIR_PLACER;
67 PNS_MODE_ROUTE_SINGLE = 1,
68 PNS_MODE_ROUTE_DIFF_PAIR,
70 PNS_MODE_TUNE_DIFF_PAIR,
71 PNS_MODE_TUNE_DIFF_PAIR_SKEW
94 virtual void SetRouter(
ROUTER* aRouter ) = 0;
95 virtual void SyncWorld(
NODE* aNode ) = 0;
96 virtual void AddItem(
ITEM* aItem ) = 0;
97 virtual void RemoveItem(
ITEM* aItem ) = 0;
98 virtual bool IsAnyLayerVisible(
const LAYER_RANGE& aLayer ) = 0;
99 virtual bool IsItemVisible(
const PNS::ITEM* aItem ) = 0;
100 virtual void DisplayItem(
const ITEM* aItem,
int aColor = -1,
int aClearance = -1,
bool aEdit =
false ) = 0;
101 virtual void HideItem(
ITEM* aItem ) = 0;
102 virtual void Commit() = 0;
105 virtual void EraseView() = 0;
106 virtual void UpdateNet(
int aNetCode ) = 0;
127 void SetMode ( ROUTER_MODE aMode );
128 ROUTER_MODE Mode()
const {
return m_mode; }
130 static ROUTER* GetInstance();
135 void SetView( KIGFX::VIEW* aView );
137 bool RoutingInProgress()
const;
138 bool StartRouting(
const VECTOR2I& aP,
ITEM* aItem,
int aLayer );
140 bool FixRoute(
const VECTOR2I& aP,
ITEM* aItem,
bool aForceFinish =
false );
145 int GetClearance(
const ITEM* aA,
const ITEM* aB )
const;
147 NODE* GetWorld()
const
149 return m_world.get();
154 void DisplayItem(
const ITEM* aItem,
int aColor = -1,
int aClearance = -1,
bool aEdit =
false );
155 void DisplayItems(
const ITEM_SET& aItems );
156 void DeleteTraces(
ITEM* aStartItem,
bool aWholeTrack );
157 void SwitchLayer(
int layer );
159 void ToggleViaPlacement();
160 void SetOrthoMode(
bool aEnable );
162 int GetCurrentLayer()
const;
163 const std::vector<int> GetCurrentNets()
const;
169 return m_iface->GetRuleResolver();
172 bool IsPlacingVia()
const;
177 bool StartDragging(
const VECTOR2I& aP,
ITEM* aItem,
int aDragMode = DM_ANY );
179 void SetIterLimit(
int aX ) { m_iterLimit = aX; }
180 int GetIterLimit()
const {
return m_iterLimit; };
182 void SetShowIntermediateSteps(
bool aX,
int aSnapshotIter = -1 )
184 m_showInterSteps = aX;
185 m_snapshotIter = aSnapshotIter;
188 bool GetShowIntermediateSteps()
const {
return m_showInterSteps; }
189 int GetShapshotIter()
const {
return m_snapshotIter; }
193 void CommitRouting(
NODE* aNode );
207 m_settings = aSettings;
215 void SetFailureReason(
const std::string& aReason ) { m_failureReason = aReason; }
216 const std::string& FailureReason()
const {
return m_failureReason; }
218 PLACEMENT_ALGO* Placer() {
return m_placer.get(); }
220 ROUTER_IFACE* GetInterface()
const
226 void movePlacing(
const VECTOR2I& aP, ITEM* aItem );
227 void moveDragging(
const VECTOR2I& aP, ITEM* aItem );
230 void updateView( NODE* aNode, ITEM_SET& aCurrent,
bool aDragging =
false );
232 void clearViewFlags();
236 ITEM* pickSingleItem( ITEM_SET& aItems )
const;
237 void splitAdjacentSegments( NODE* aNode, ITEM* aSeg,
const VECTOR2I& aP );
239 ITEM* syncPad( D_PAD* aPad );
240 ITEM* syncTrack( TRACK* aTrack );
241 ITEM* syncVia( VIA* aVia );
243 void commitPad( SOLID* aPad );
244 void commitSegment( SEGMENT* aTrack );
245 void commitVia( VIA* aVia );
247 void highlightCurrent(
bool enabled );
249 void markViolations( NODE* aNode, ITEM_SET& aCurrent, NODE::ITEM_VECTOR& aRemoved );
250 bool isStartingPointRoutable(
const VECTOR2I& aWhere,
int aLayer );
255 std::unique_ptr< NODE > m_world;
258 std::unique_ptr< PLACEMENT_ALGO > m_placer;
259 std::unique_ptr< DRAGGER > m_dragger;
260 std::unique_ptr< SHOVE > m_shove;
262 ROUTER_IFACE* m_iface;
265 bool m_showInterSteps;
268 bool m_forceMarkObstaclesMode =
false;
270 ROUTING_SETTINGS m_settings;
271 SIZES_SETTINGS m_sizes;
274 std::string m_toolStatusbarName;
275 std::string m_failureReason;
Class LAYER_RANGE.
Definition: pns_layerset.h:33
Definition: pns_debug_decorator.h:33
Definition: pns_itemset.h:40
Class ITEM.
Definition: pns_item.h:55
Class NODE.
Definition: pns_node.h:138
Class ROUTER.
Definition: pns_router.h:89
Definition: pns_router.h:113
void UpdateSizes(const SIZES_SETTINGS &aSizes)
Applies stored settings.
Definition: pns_router.cpp:319
void LoadSettings(const ROUTING_SETTINGS &aSettings)
Changes routing settings to ones passed in the parameter.
Definition: pns_router.h:205
Class ROUTING_SETTINGS.
Definition: pns_routing_settings.h:58
Class RULE_RESOLVER.
Definition: pns_node.h:58
Definition: pns_sizes_settings.h:37
Board layer functions and definitions.