KiCad PCB EDA Suite
pns_dp_meander_placer.h
Go to the documentation of this file.
1 /*
2  * KiRouter - a push-and-(sometimes-)shove PCB router
3  *
4  * Copyright (C) 2013-2014 CERN
5  * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
8  *
9  * This program is free software: you can redistribute it and/or modify it
10  * under the terms of the GNU General Public License as published by the
11  * Free Software Foundation, either version 3 of the License, or (at your
12  * option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef __PNS_DP_MEANDER_PLACER_H
24 #define __PNS_DP_MEANDER_PLACER_H
25 
26 #include <math/vector2d.h>
27 
28 #include <geometry/shape.h>
30 
31 #include "pns_node.h"
32 #include "pns_via.h"
33 #include "pns_line.h"
34 #include "pns_placement_algo.h"
35 #include "pns_meander.h"
37 #include "pns_diff_pair.h"
38 #include "pns_debug_decorator.h"
39 
40 namespace PNS {
41 
42 class ROUTER;
43 
49 {
50 public:
51  DP_MEANDER_PLACER( ROUTER* aRouter );
53 
58  bool Start( const VECTOR2I& aP, ITEM* aStartItem ) override;
59 
64  bool Move( const VECTOR2I& aP, ITEM* aEndItem ) override;
65 
74  bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinish = false ) override;
75 
77  bool CommitPlacement() override;
78 
80  bool AbortPlacement() override;
81 
83  bool HasPlacedAnything() const override;
84 
85  const LINE Trace() const;
86 
90  NODE* CurrentNode( bool aLoopsRemoved = false ) const override;
91 
92  const ITEM_SET Traces() override;
93 
94  const VECTOR2I& CurrentEnd() const override;
95 
97  const std::vector<int> CurrentNets() const override;
98 
99  int CurrentLayer() const override;
100 
101  long long int totalLength();
102 
103  const wxString TuningInfo( EDA_UNITS aUnits ) const override;
104  TUNING_STATUS TuningStatus() const override;
105 
106  bool CheckFit( MEANDER_SHAPE* aShape ) override;
107 
108 
109 private:
110  friend class MEANDER_SHAPE;
111 
112  void meanderSegment( const SEG& aBase );
113 
114 // void addMeander ( PNS_MEANDER *aM );
115 // void addCorner ( const VECTOR2I& aP );
116 
117  const SEG baselineSegment( const DIFF_PAIR::COUPLED_SEGMENTS& aCoupledSegs );
118  bool pairOrientation( const DIFF_PAIR::COUPLED_SEGMENTS& aPair );
119 
120  void setWorld( NODE* aWorld );
121  void release();
122 
123  long long int origPathLength() const;
124 
127 
130 
133 
136 
140 
141  long long int m_lastLength;
145 };
146 
147 }
148 
149 #endif // __PNS_DP_MEANDER_PLACER_H
Base class for PNS router board items.
Definition: pns_item.h:55
Base class for Single trace & Differential pair meandering tools, as both of them share a lot of code...
bool FixRoute(const VECTOR2I &aP, ITEM *aEndItem, bool aForceFinish=false) override
Commit the currently routed track to the parent node, taking aP as the final end point and aEndItem a...
Keep the router "world" - i.e.
Definition: pns_node.h:144
The geometry of a single meander.
Definition: pns_meander.h:109
void meanderSegment(const SEG &aBase)
const std::vector< int > CurrentNets() const override
Function CurrentNets()
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
Definition: pns_line.h:60
VECTOR2I m_currentStart
Current world state.
TUNING_STATUS
< Result of the length tuning operation
bool Start(const VECTOR2I &aP, ITEM *aStartItem) override
Start routing a single track at point aP, taking item aStartItem as anchor (unless NULL).
bool CheckFit(MEANDER_SHAPE *aShape) override
Checks if it's OK to place the shape aShape (i.e.
bool pairOrientation(const DIFF_PAIR::COUPLED_SEGMENTS &aPair)
const SEG baselineSegment(const DIFF_PAIR::COUPLED_SEGMENTS &aCoupledSegs)
const ITEM_SET Traces() override
Function Traces()
const VECTOR2I & CurrentEnd() const override
Function CurrentEnd()
std::vector< COUPLED_SEGMENTS > COUPLED_SEGMENTS_VEC
NODE * CurrentNode(bool aLoopsRemoved=false) const override
Return the most recent world state.
long long int origPathLength() const
Current routing start point (end of tail, beginning of head).
void setWorld(NODE *aWorld)
long long int totalLength()
Represent a set of meanders fitted over a single or two lines.
Definition: pns_meander.h:375
Definition: seg.h:40
EDA_UNITS
Definition: eda_units.h:38
Basic class for a differential pair.
const wxString TuningInfo(EDA_UNITS aUnits) const override
Return a string describing the status and length of the tuned traces.
TUNING_STATUS TuningStatus() const override
Return the tuning status (too short, too long, etc.) of the trace(s) being tuned.
Represent a polyline (an zero-thickness chain of connected line segments).
Differential Pair length-matching/meandering tool.
bool Move(const VECTOR2I &aP, ITEM *aEndItem) override
Move the end of the currently routed trace to the point aP, taking aEndItem as anchor (if not NULL).
int CurrentLayer() const override
Function CurrentLayer()
DP_MEANDER_PLACER(ROUTER *aRouter)
bool HasPlacedAnything() const override
Push and Shove diff pair dimensions (gap) settings dialog.
DIFF_PAIR::COUPLED_SEGMENTS_VEC m_coupledSegments