KiCad PCB EDA Suite
pns_meander_placer_base.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  *
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_MEANDER_PLACER_BASE_H
24 #define __PNS_MEANDER_PLACER_BASE_H
25 
26 #include <math/vector2d.h>
27 
29 
30 #include "pns_node.h"
31 #include "pns_line.h"
32 #include "pns_placement_algo.h"
33 #include "pns_meander.h"
34 
35 namespace PNS {
36 
37 class ROUTER;
38 class SHOVE;
39 class OPTIMIZER;
40 
46 {
47 public:
50  TOO_SHORT = 0,
53  };
54 
55  MEANDER_PLACER_BASE( ROUTER* aRouter );
56  virtual ~MEANDER_PLACER_BASE();
57 
61  virtual const wxString TuningInfo( EDA_UNITS aUnits ) const = 0;
62 
66  virtual TUNING_STATUS TuningStatus() const = 0;
67 
73  virtual void AmplitudeStep( int aSign );
74 
80  virtual void SpacingStep( int aSign );
81 
87  virtual int Clearance();
88 
94  virtual const MEANDER_SETTINGS& MeanderSettings() const;
95 
96  /*
97  * Set the current meandering configuration.
98  *
99  * @param aSettings the settings.
100  */
101  virtual void UpdateSettings( const MEANDER_SETTINGS& aSettings);
102 
110  virtual bool CheckFit( MEANDER_SHAPE* aShape )
111  {
112  return false;
113  }
114 
115  int GetTotalPadToDieLength( const LINE& aLine ) const;
116 
117 protected:
129  void cutTunedLine( const SHAPE_LINE_CHAIN& aOrigin, const VECTOR2I& aTuneStart,
130  const VECTOR2I& aCursorPos, SHAPE_LINE_CHAIN& aPre, SHAPE_LINE_CHAIN& aTuned,
131  SHAPE_LINE_CHAIN& aPost );
132 
137  void tuneLineLength( MEANDERED_LINE& aTuned, long long int aElongation );
138 
142  int compareWithTolerance( long long int aValue, long long int aExpected,
143  long long int aTolerance = 0 ) const;
144 
145  VECTOR2I getSnappedStartPoint( LINKED_ITEM* aStartItem, VECTOR2I aStartPoint );
146 
152  long long int lineLength( const ITEM_SET& aLine ) const;
153 
156 
159 
162 
165 
168 };
169 
170 }
171 
172 #endif // __PNS_MEANDER_PLACER_BASE_H
int GetTotalPadToDieLength(const LINE &aLine) const
Base class for Single trace & Differential pair meandering tools, as both of them share a lot of code...
Keep the router "world" - i.e.
Definition: pns_node.h:144
The geometry of a single meander.
Definition: pns_meander.h:109
virtual const wxString TuningInfo(EDA_UNITS aUnits) const =0
Return a string describing the status and length of the tuned traces.
virtual int Clearance()
Return the clearance of the track(s) being length tuned.
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
Definition: pns_line.h:60
Dimensions for the meandering algorithm.
Definition: pns_meander.h:57
virtual bool CheckFit(MEANDER_SHAPE *aShape)
Checks if it's OK to place the shape aShape (i.e.
virtual void UpdateSettings(const MEANDER_SETTINGS &aSettings)
TUNING_STATUS
< Result of the length tuning operation
virtual TUNING_STATUS TuningStatus() const =0
Return the tuning status (too short, too long, etc.) of the trace(s) being tuned.
int m_currentWidth
Meander settings.
int m_padToDieLength
Width of the meandered trace(s).
long long int lineLength(const ITEM_SET &aLine) const
Calculate the total length of the line represented by an item set (tracks and vias)
NODE * m_world
Total length added by pad to die size.
void tuneLineLength(MEANDERED_LINE &aTuned, long long int aElongation)
Take a set of meanders in aTuned and tunes their length to extend the original line length by aElonga...
virtual void SpacingStep(int aSign)
Increase/decrease the current meandering spacing by one step.
VECTOR2I getSnappedStartPoint(LINKED_ITEM *aStartItem, VECTOR2I aStartPoint)
Represent a set of meanders fitted over a single or two lines.
Definition: pns_meander.h:375
EDA_UNITS
Definition: eda_units.h:38
MEANDER_SETTINGS m_settings
The current end point.
Represent a polyline (an zero-thickness chain of connected line segments).
int compareWithTolerance(long long int aValue, long long int aExpected, long long int aTolerance=0) const
Compare aValue against aExpected with given tolerance.
virtual void AmplitudeStep(int aSign)
Increase/decreases the current meandering amplitude by one step.
Push and Shove diff pair dimensions (gap) settings dialog.
virtual const MEANDER_SETTINGS & MeanderSettings() const
Return the current meandering configuration.
void cutTunedLine(const SHAPE_LINE_CHAIN &aOrigin, const VECTOR2I &aTuneStart, const VECTOR2I &aCursorPos, SHAPE_LINE_CHAIN &aPre, SHAPE_LINE_CHAIN &aTuned, SHAPE_LINE_CHAIN &aPost)
Extract the part of a track to be meandered, depending on the starting point and the cursor position.