KiCad PCB EDA Suite
pns_topology.h
Go to the documentation of this file.
1/*
2 * KiRouter - a push-and-(sometimes-)shove PCB router
3 *
4 * Copyright (C) 2013-2015 CERN
5 * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
6 * Author: Tomasz Wlostowski <[email protected]>
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef __PNS_TOPOLOGY_H
23#define __PNS_TOPOLOGY_H
24
25#include <vector>
26#include <set>
27
28#include "pns_itemset.h"
29
30namespace PNS {
31
32class NODE;
33class SEGMENT;
34class JOINT;
35class ITEM;
36class SOLID;
37class DIFF_PAIR;
38
40{
41public:
42 typedef std::set<JOINT*> JOINT_SET;
43
44 TOPOLOGY( NODE* aNode ):
45 m_world( aNode ) {};
46
48
49 bool SimplifyLine( LINE *aLine );
50 ITEM* NearestUnconnectedItem( JOINT* aStart, int* aAnchor = nullptr,
51 int aKindMask = ITEM::ANY_T );
52 bool LeadingRatLine( const LINE* aTrack, SHAPE_LINE_CHAIN& aRatLine );
53
54 const JOINT_SET ConnectedJoints( JOINT* aStart );
55 const ITEM_SET ConnectedItems( JOINT* aStart, int aKindMask = ITEM::ANY_T );
56 const ITEM_SET ConnectedItems( ITEM* aStart, int aKindMask = ITEM::ANY_T );
57 int64_t ShortestConnectionLength( ITEM* aFrom, ITEM* aTo );
58
67 const ITEM_SET AssembleTrivialPath( ITEM* aStart,
68 std::pair<JOINT*, JOINT*>* aTerminalJoints = nullptr,
69 bool aFollowLockedSegments = false );
70
83 const ITEM_SET AssembleTuningPath( ITEM* aStart, SOLID** aStartPad = nullptr,
84 SOLID** aEndPad = nullptr );
85
87
88 bool AssembleDiffPair( ITEM* aStart, DIFF_PAIR& aPair );
89
90 const std::set<ITEM*> AssembleCluster( ITEM* aStart, int aLayer );
91
92private:
94
95 bool followTrivialPath( LINE* aLine, bool aLeft, ITEM_SET& aSet, std::set<ITEM*>& aVisited,
96 JOINT** aTerminalJoint = nullptr );
97
99};
100
101}
102
103#endif
Basic class for a differential pair.
Base class for PNS router board items.
Definition: pns_item.h:56
A 2D point on a given set of layers and belonging to a certain net, that links together a number of b...
Definition: pns_joint.h:43
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
Definition: pns_line.h:61
Keep the router "world" - i.e.
Definition: pns_node.h:150
bool LeadingRatLine(const LINE *aTrack, SHAPE_LINE_CHAIN &aRatLine)
const DIFF_PAIR AssembleDiffPair(SEGMENT *aStart)
NODE * m_world
Definition: pns_topology.h:98
const ITEM_SET ConnectedItems(JOINT *aStart, int aKindMask=ITEM::ANY_T)
ITEM * NearestUnconnectedItem(JOINT *aStart, int *aAnchor=nullptr, int aKindMask=ITEM::ANY_T)
bool followTrivialPath(LINE *aLine, bool aLeft, ITEM_SET &aSet, std::set< ITEM * > &aVisited, JOINT **aTerminalJoint=nullptr)
const JOINT_SET ConnectedJoints(JOINT *aStart)
int64_t ShortestConnectionLength(ITEM *aFrom, ITEM *aTo)
std::set< JOINT * > JOINT_SET
Definition: pns_topology.h:42
const ITEM_SET AssembleTrivialPath(ITEM *aStart, std::pair< JOINT *, JOINT * > *aTerminalJoints=nullptr, bool aFollowLockedSegments=false)
Assemble a trivial path between two joints given a starting item.
const int DP_PARALLELITY_THRESHOLD
Definition: pns_topology.h:93
TOPOLOGY(NODE *aNode)
Definition: pns_topology.h:44
const std::set< ITEM * > AssembleCluster(ITEM *aStart, int aLayer)
bool SimplifyLine(LINE *aLine)
const ITEM_SET AssembleTuningPath(ITEM *aStart, SOLID **aStartPad=nullptr, SOLID **aEndPad=nullptr)
Like AssembleTrivialPath, but follows the track length algorithm, which discards segments that are fu...
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Push and Shove diff pair dimensions (gap) settings dialog.