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
36namespace PNS {
37
38class ROUTER;
39class SHOVE;
40class OPTIMIZER;
41
49{
50public:
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
123protected:
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
165};
166
167}
168
169#endif // __PNS_MEANDER_PLACER_BASE_H
Class MEANDERED_LINE.
Definition: pns_meander.h:396
Class MEANDER_PLACER_BASE.
Definition: pns_meander_placer_base.h:49
int compareWithTolerance(int aValue, int aExpected, int aTolerance=0) const
Function compareWithTolerance()
Definition: pns_meander_placer_base.cpp:182
TUNING_STATUS
‍Result of the length tuning operation
Definition: pns_meander_placer_base.h:52
virtual void SpacingStep(int aSign)
Function SpacingStep()
Definition: pns_meander_placer_base.cpp:49
int m_currentWidth
‍width of the meandered trace(s)
Definition: pns_meander_placer_base.h:160
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()
Definition: pns_meander_placer_base.cpp:64
VECTOR2I m_currentEnd
‍current end point
Definition: pns_meander_placer_base.h:164
virtual bool CheckFit(MEANDER_SHAPE *aShape)
Function CheckFit()
Definition: pns_meander_placer_base.h:118
MEANDER_SETTINGS m_settings
‍meandering settings
Definition: pns_meander_placer_base.h:162
virtual const std::string TuningInfo() const =0
Function TuningInfo()
void tuneLineLength(MEANDERED_LINE &aTuned, int aElongation)
Function tuneLineLength()
Definition: pns_meander_placer_base.cpp:109
virtual TUNING_STATUS TuningStatus() const =0
Function TuningStatus()
virtual const MEANDER_SETTINGS & MeanderSettings() const
Function MeanderSettings()
Definition: pns_meander_placer_base.cpp:176
virtual void AmplitudeStep(int aSign)
Function AmplitudeStep()
Definition: pns_meander_placer_base.cpp:40
Class MEANDER_SETTINGS.
Definition: pns_meander.h:58
Class MEANDER_SETTINGS.
Definition: pns_meander.h:105
Class PLACEMENT_ALGO.
Definition: pns_placement_algo.h:46
Definition: pns_router.h:113
Class SHAPE_LINE_CHAIN.
Definition: shape_line_chain.h:50