Horizon
pns_meander_placer.h
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_MEANDER_PLACER_H
24 #define __PNS_MEANDER_PLACER_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 "pns_meander_placer_base.h"
35 
36 namespace PNS {
37 
38 class ROUTER;
39 class SHOVE;
40 class OPTIMIZER;
41 
46 {
47 public:
48 
49  MEANDER_PLACER( ROUTER* aRouter );
50  virtual ~MEANDER_PLACER();
51 
53  virtual bool Start( const VECTOR2I& aP, ITEM* aStartItem ) override;
54 
56  virtual bool Move( const VECTOR2I& aP, ITEM* aEndItem ) override;
57 
59  virtual bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinish = false ) override;
60 
62  bool CommitPlacement() override;
63 
65  bool AbortPlacement() override;
66 
68  bool HasPlacedAnything() const override;
69 
71  NODE* CurrentNode( bool aLoopsRemoved = false ) const override;
72 
74  const ITEM_SET Traces() override;
75 
77  const VECTOR2I& CurrentEnd() const override;
78 
80  const std::vector<int> CurrentNets() const override
81  {
82  return std::vector<int> (1, m_originLine.Net() );
83  }
84 
86  int CurrentLayer() const override;
87 
89  virtual const wxString TuningInfo( EDA_UNITS aUnits ) const override;
90 
92  virtual TUNING_STATUS TuningStatus() const override;
93 
95  bool CheckFit ( MEANDER_SHAPE* aShape ) override;
96 
97 protected:
98  bool doMove( const VECTOR2I& aP, ITEM* aEndItem, long long int aTargetLength );
99 
100  void setWorld( NODE* aWorld );
101 
102  virtual long long int origPathLength() const;
103 
106 
108  NODE* m_currentNode;
109 
110  LINE m_originLine;
111  LINE m_currentTrace;
112  ITEM_SET m_tunedPath;
113 
114  SHAPE_LINE_CHAIN m_finalShape;
115  MEANDERED_LINE m_result;
116  LINKED_ITEM* m_initialSegment;
117 
118  long long int m_lastLength;
119  TUNING_STATUS m_lastStatus;
120 };
121 
122 }
123 
124 #endif // __PNS_MEANDER_PLACER_H
Definition: pns_itemset.h:37
Base class for PNS router board items.
Definition: pns_item.h:57
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
TUNING_STATUS
< Result of the length tuning operation
Definition: pns_meander_placer_base.h:50
Single track length matching/meandering tool.
Definition: pns_meander_placer.h:46
virtual const wxString TuningInfo(EDA_UNITS aUnits) const override
Return a string describing the status and length of the tuned traces.
Definition: pns_meander_placer.cpp:270
virtual bool FixRoute(const VECTOR2I &aP, ITEM *aEndItem, bool aForceFinish=false) override
Function FixRoute()
Definition: pns_meander_placer.cpp:202
virtual bool Move(const VECTOR2I &aP, ITEM *aEndItem) override
Function Move()
Definition: pns_meander_placer.cpp:104
const std::vector< int > CurrentNets() const override
Function CurrentNets()
Definition: pns_meander_placer.h:80
virtual long long int origPathLength() const
current routing start point (end of tail, beginning of head)
Definition: pns_meander_placer.cpp:98
int CurrentLayer() const override
Function CurrentLayer()
Definition: pns_meander_placer.cpp:264
const VECTOR2I & CurrentEnd() const override
Function CurrentEnd()
Definition: pns_meander_placer.cpp:259
bool AbortPlacement() override
Definition: pns_meander_placer.cpp:215
bool HasPlacedAnything() const override
Definition: pns_meander_placer.cpp:222
NODE * CurrentNode(bool aLoopsRemoved=false) const override
Function CurrentNode()
Definition: pns_meander_placer.cpp:51
const ITEM_SET Traces() override
Function Traces()
Definition: pns_meander_placer.cpp:252
bool CheckFit(MEANDER_SHAPE *aShape) override
Checks if it's OK to place the shape aShape (i.e.
Definition: pns_meander_placer.cpp:238
VECTOR2I m_currentStart
Current world state.
Definition: pns_meander_placer.h:105
virtual TUNING_STATUS TuningStatus() const override
Return the tuning status (too short, too long, etc.) of the trace(s) being tuned.
Definition: pns_meander_placer.cpp:297
virtual bool Start(const VECTOR2I &aP, ITEM *aStartItem) override
Function Start()
Definition: pns_meander_placer.cpp:60
bool CommitPlacement() override
Definition: pns_meander_placer.cpp:228
The geometry of a single meander.
Definition: pns_meander.h:111
Keep the router "world" - i.e.
Definition: pns_node.h:148
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