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 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_H
23 #define __PNS_MEANDER_PLACER_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 #include "pns_meander_placer_base.h"
36 
37 namespace PNS {
38 
39 class ROUTER;
40 class SHOVE;
41 class OPTIMIZER;
42 
49 {
50 public:
51 
52  MEANDER_PLACER( ROUTER* aRouter );
53  virtual ~MEANDER_PLACER();
54 
56  virtual bool Start( const VECTOR2I& aP, ITEM* aStartItem ) override;
57 
59  virtual bool Move( const VECTOR2I& aP, ITEM* aEndItem ) override;
60 
62  virtual bool FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForceFinish = false ) override;
63 
65  NODE* CurrentNode( bool aLoopsRemoved = false ) const override;
66 
68  const ITEM_SET Traces() override;
69 
71  const VECTOR2I& CurrentEnd() const override;
72 
74  const std::vector<int> CurrentNets() const override
75  {
76  return std::vector<int> (1, m_originLine.Net() );
77  }
78 
80  int CurrentLayer() const override;
81 
83  virtual const std::string TuningInfo() const override;
84 
86  virtual TUNING_STATUS TuningStatus() const override;
87 
89  bool CheckFit ( MEANDER_SHAPE* aShape ) override;
90 
91 protected:
92 
93  bool doMove( const VECTOR2I& aP, ITEM* aEndItem, int aTargetLength );
94 
95  void setWorld( NODE* aWorld );
96 
97  virtual int origPathLength() const;
98 
101 
104 
107 
108  LINE m_originLine;
109  LINE m_currentTrace;
110  ITEM_SET m_tunedPath;
111 
112  SHAPE_LINE_CHAIN m_finalShape;
113  MEANDERED_LINE m_result;
114  SEGMENT* m_initialSegment;
115 
116  int m_lastLength;
117  TUNING_STATUS m_lastStatus;
118 };
119 
120 }
121 
122 #endif // __PNS_MEANDER_PLACER_H
PNS::MEANDER_PLACER::CurrentNode
NODE * CurrentNode(bool aLoopsRemoved=false) const override
Function CurrentNode()
Definition: pns_meander_placer.cpp:52
PNS::LINE
Definition: pns_line.h:60
PNS::MEANDER_SHAPE
Class MEANDER_SETTINGS.
Definition: pns_meander.h:104
PNS::MEANDERED_LINE
Class MEANDERED_LINE.
Definition: pns_meander.h:395
PNS::SEGMENT
Definition: pns_segment.h:38
PNS::ROUTER
Definition: pns_router.h:109
PNS::MEANDER_PLACER_BASE::TUNING_STATUS
TUNING_STATUS
Result of the length tuning operation
Definition: pns_meander_placer_base.h:52
PNS::MEANDER_PLACER::CurrentLayer
int CurrentLayer() const override
Function CurrentLayer()
Definition: pns_meander_placer.cpp:231
PNS::MEANDER_PLACER::TuningStatus
virtual TUNING_STATUS TuningStatus() const override
Function TuningStatus()
Definition: pns_meander_placer.cpp:264
PNS::ITEM::Net
int Net() const
Function Net()
Definition: pns_item.h:180
VECTOR2< int >
PNS::MEANDER_PLACER::Start
virtual bool Start(const VECTOR2I &aP, ITEM *aStartItem) override
Function Start()
Definition: pns_meander_placer.cpp:61
PNS::MEANDER_PLACER::CheckFit
bool CheckFit(MEANDER_SHAPE *aShape) override
Function CheckFit()
Definition: pns_meander_placer.cpp:205
PNS::MEANDER_PLACER_BASE
Class MEANDER_PLACER_BASE.
Definition: pns_meander_placer_base.h:48
PNS::MEANDER_PLACER::m_currentStart
VECTOR2I m_currentStart
current routing start point (end of tail, beginning of head)
Definition: pns_meander_placer.h:103
PNS::MEANDER_PLACER::m_world
NODE * m_world
pointer to world to search colliding items
Definition: pns_meander_placer.h:100
PNS::MEANDER_PLACER::m_currentNode
NODE * m_currentNode
Current world state
Definition: pns_meander_placer.h:106
PNS::MEANDER_PLACER::CurrentNets
const std::vector< int > CurrentNets() const override
Function CurrentNets()
Definition: pns_meander_placer.h:74
PNS::MEANDER_PLACER::CurrentEnd
const VECTOR2I & CurrentEnd() const override
Function CurrentEnd()
Definition: pns_meander_placer.cpp:226
PNS::ITEM_SET
Definition: pns_itemset.h:39
PNS::MEANDER_PLACER::Traces
const ITEM_SET Traces() override
Function Traces()
Definition: pns_meander_placer.cpp:219
PNS::ITEM
Class ITEM.
Definition: pns_item.h:54
PNS::MEANDER_PLACER::FixRoute
virtual bool FixRoute(const VECTOR2I &aP, ITEM *aEndItem, bool aForceFinish=false) override
Function FixRoute()
Definition: pns_meander_placer.cpp:192
PNS::NODE
Class NODE.
Definition: pns_node.h:136
PNS::MEANDER_PLACER::TuningInfo
virtual const std::string TuningInfo() const override
Function TuningInfo()
Definition: pns_meander_placer.cpp:237
SHAPE_LINE_CHAIN
Class SHAPE_LINE_CHAIN.
Definition: shape_line_chain.h:47
PNS::MEANDER_PLACER
Class MEANDER_PLACER.
Definition: pns_meander_placer.h:48
PNS::MEANDER_PLACER::Move
virtual bool Move(const VECTOR2I &aP, ITEM *aEndItem) override
Function Move()
Definition: pns_meander_placer.cpp:108