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 KiCad Developers, see AUTHORS.txt for contributors.
6  * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
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_MEANDER_PLACER_BASE_H
23 #define __PNS_MEANDER_PLACER_BASE_H
24 
25 #include <math/vector2d.h>
26 
27 #include <geometry/shape.h>
28 #include <geometry/shape_line_chain.h>
29 
30 #include "pns_node.h"
31 #include "pns_via.h"
32 #include "pns_line.h"
33 #include "pns_placement_algo.h"
34 #include "pns_meander.h"
35 
36 namespace PNS {
37 
38 class ROUTER;
39 class SHOVE;
40 class OPTIMIZER;
41 
48 class MEANDER_PLACER_BASE : public PLACEMENT_ALGO
49 {
50 public:
53  TOO_SHORT = 0,
54  TOO_LONG,
55  TUNED
56  };
57 
58  MEANDER_PLACER_BASE( ROUTER* aRouter );
59  virtual ~MEANDER_PLACER_BASE();
60 
67  virtual const std::string TuningInfo() const = 0;
68 
75  virtual TUNING_STATUS TuningStatus() const = 0;
76 
83  virtual void AmplitudeStep( int aSign );
84 
91  virtual void SpacingStep( int aSign );
92 
99  virtual const MEANDER_SETTINGS& MeanderSettings() const;
100 
101  /*
102  * Function UpdateSettings()
103  *
104  * Sets the current meandering configuration.
105  * @param aSettings the settings
106  */
107  virtual void UpdateSettings( const MEANDER_SETTINGS& aSettings);
108 
118  virtual bool CheckFit( MEANDER_SHAPE* aShape )
119  {
120  return false;
121  }
122 
123 protected:
124 
137  void cutTunedLine( const SHAPE_LINE_CHAIN& aOrigin,
138  const VECTOR2I& aTuneStart,
139  const VECTOR2I& aCursorPos,
140  SHAPE_LINE_CHAIN& aPre,
141  SHAPE_LINE_CHAIN& aTuned,
142  SHAPE_LINE_CHAIN& aPost );
143 
150  void tuneLineLength( MEANDERED_LINE& aTuned, int aElongation );
151 
157  int compareWithTolerance ( int aValue, int aExpected, int aTolerance = 0 ) const;
158 
160  int m_currentWidth;
165 };
166 
167 }
168 
169 #endif // __PNS_MEANDER_PLACER_BASE_H
PNS::MEANDER_SHAPE
Class MEANDER_SETTINGS.
Definition: pns_meander.h:105
PNS::MEANDERED_LINE
Class MEANDERED_LINE.
Definition: pns_meander.h:396
PNS::MEANDER_PLACER_BASE::compareWithTolerance
int compareWithTolerance(int aValue, int aExpected, int aTolerance=0) const
Function compareWithTolerance()
PNS::MEANDER_PLACER_BASE::m_currentWidth
int m_currentWidth
width of the meandered trace(s)
Definition: pns_meander_placer_base.h:160
PNS::MEANDER_PLACER_BASE::TuningStatus
virtual TUNING_STATUS TuningStatus() const =0
Function TuningStatus()
PNS::ROUTER
Definition: pns_router.h:113
PNS::MEANDER_PLACER_BASE::TUNING_STATUS
TUNING_STATUS
Result of the length tuning operation
Definition: pns_meander_placer_base.h:52
PNS::MEANDER_PLACER_BASE::m_currentEnd
VECTOR2I m_currentEnd
current end point
Definition: pns_meander_placer_base.h:164
VECTOR2< int >
PNS::MEANDER_PLACER_BASE::SpacingStep
virtual void SpacingStep(int aSign)
Function SpacingStep()
PNS::MEANDER_PLACER_BASE
Class MEANDER_PLACER_BASE.
Definition: pns_meander_placer_base.h:49
PNS::MEANDER_PLACER_BASE::tuneLineLength
void tuneLineLength(MEANDERED_LINE &aTuned, int aElongation)
Function tuneLineLength()
PNS::MEANDER_PLACER_BASE::MeanderSettings
virtual const MEANDER_SETTINGS & MeanderSettings() const
Function MeanderSettings()
PNS::MEANDER_PLACER_BASE::CheckFit
virtual bool CheckFit(MEANDER_SHAPE *aShape)
Function CheckFit()
Definition: pns_meander_placer_base.h:118
PNS::MEANDER_SETTINGS
Class MEANDER_SETTINGS.
Definition: pns_meander.h:58
PNS::MEANDER_PLACER_BASE::cutTunedLine
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)
Function cutTunedLine()
PNS::MEANDER_PLACER_BASE::m_settings
MEANDER_SETTINGS m_settings
meandering settings
Definition: pns_meander_placer_base.h:162
PNS::MEANDER_PLACER_BASE::AmplitudeStep
virtual void AmplitudeStep(int aSign)
Function AmplitudeStep()
SHAPE_LINE_CHAIN
Class SHAPE_LINE_CHAIN.
Definition: shape_line_chain.h:50
PNS::MEANDER_PLACER_BASE::TuningInfo
virtual const std::string TuningInfo() const =0
Function TuningInfo()