Horizon
pns_meander_placer_base.h
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 
28 #include <geometry/shape_line_chain.h>
29 
30 #include "pns_node.h"
31 #include "pns_line.h"
32 #include "pns_placement_algo.h"
33 #include "pns_meander.h"
34 #include "eda_units.h"
35 
36 namespace PNS {
37 
38 class ROUTER;
39 class SHOVE;
40 class OPTIMIZER;
41 
47 {
48 public:
51  TOO_SHORT = 0,
52  TOO_LONG,
53  TUNED
54  };
55 
56  MEANDER_PLACER_BASE( ROUTER* aRouter );
57  virtual ~MEANDER_PLACER_BASE();
58 
62  virtual const wxString TuningInfo( EDA_UNITS aUnits ) const = 0;
63 
67  virtual TUNING_STATUS TuningStatus() const = 0;
68 
74  virtual void AmplitudeStep( int aSign );
75 
81  virtual void SpacingStep( int aSign );
82 
88  virtual int Clearance();
89 
95  virtual const MEANDER_SETTINGS& MeanderSettings() const;
96 
97  /*
98  * Set the current meandering configuration.
99  *
100  * @param aSettings the settings.
101  */
102  virtual void UpdateSettings( const MEANDER_SETTINGS& aSettings);
103 
111  virtual bool CheckFit( MEANDER_SHAPE* aShape )
112  {
113  return false;
114  }
115 
116  int GetTotalPadToDieLength( const LINE& aLine ) const;
117 
118 protected:
130  void cutTunedLine( const SHAPE_LINE_CHAIN& aOrigin, const VECTOR2I& aTuneStart,
131  const VECTOR2I& aCursorPos, SHAPE_LINE_CHAIN& aPre, SHAPE_LINE_CHAIN& aTuned,
132  SHAPE_LINE_CHAIN& aPost );
133 
138  void tuneLineLength( MEANDERED_LINE& aTuned, long long int aElongation );
139 
143  int compareWithTolerance( long long int aValue, long long int aExpected,
144  long long int aTolerance = 0 ) const;
145 
146  VECTOR2I getSnappedStartPoint( LINKED_ITEM* aStartItem, VECTOR2I aStartPoint );
147 
153  long long int lineLength( const ITEM_SET& aLine ) const;
154 
157 
160 
163 
166 
168  VECTOR2I m_currentEnd;
169 };
170 
171 }
172 
173 #endif // __PNS_MEANDER_PLACER_BASE_H
Definition: pns_itemset.h:37
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
Definition: pns_line.h:61
Definition: pns_linked_item.h:30
Represent a set of meanders fitted over a single or two lines.
Definition: pns_meander.h:386
Base class for Single trace & Differential pair meandering tools, as both of them share a lot of code...
Definition: pns_meander_placer_base.h:47
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...
Definition: pns_meander_placer_base.cpp:131
TUNING_STATUS
< Result of the length tuning operation
Definition: pns_meander_placer_base.h:50
virtual const wxString TuningInfo(EDA_UNITS aUnits) const =0
Return a string describing the status and length of the tuned traces.
virtual void SpacingStep(int aSign)
Increase/decrease the current meandering spacing by one step.
Definition: pns_meander_placer_base.cpp:53
int m_currentWidth
Meander settings.
Definition: pns_meander_placer_base.h:162
int m_padToDieLength
Width of the meandered trace(s).
Definition: pns_meander_placer_base.h:159
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.
Definition: pns_meander_placer_base.cpp:85
virtual bool CheckFit(MEANDER_SHAPE *aShape)
Checks if it's OK to place the shape aShape (i.e.
Definition: pns_meander_placer_base.h:111
MEANDER_SETTINGS m_settings
The current end point.
Definition: pns_meander_placer_base.h:165
int compareWithTolerance(long long int aValue, long long int aExpected, long long int aTolerance=0) const
Compare aValue against aExpected with given tolerance.
Definition: pns_meander_placer_base.cpp:245
virtual int Clearance()
Return the clearance of the track(s) being length tuned.
Definition: pns_meander_placer_base.cpp:62
virtual TUNING_STATUS TuningStatus() const =0
Return the tuning status (too short, too long, etc.) of the trace(s) being tuned.
long long int lineLength(const ITEM_SET &aLine) const
Calculate the total length of the line represented by an item set (tracks and vias)
Definition: pns_meander_placer_base.cpp:281
virtual const MEANDER_SETTINGS & MeanderSettings() const
Return the current meandering configuration.
Definition: pns_meander_placer_base.cpp:239
NODE * m_world
Total length added by pad to die size.
Definition: pns_meander_placer_base.h:156
virtual void AmplitudeStep(int aSign)
Increase/decreases the current meandering amplitude by one step.
Definition: pns_meander_placer_base.cpp:44
Dimensions for the meandering algorithm.
Definition: pns_meander.h:59
The geometry of a single meander.
Definition: pns_meander.h:111
Keep the router "world" - i.e.
Definition: pns_node.h:148
PLACEMENT_ALGO.
Definition: pns_placement_algo.h:46
Definition: pns_router.h:116
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Definition: shape_line_chain.h:81
Definition: wx_compat.h:13