Horizon
pns_algo_base.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_ALGO_BASE_H
24 #define __PNS_ALGO_BASE_H
25 
26 #include <math/box2.h>
27 
28 #include "pns_routing_settings.h"
29 
30 namespace PNS {
31 
32 class ROUTER;
33 class LOGGER;
34 class DEBUG_DECORATOR;
35 
42 class ALGO_BASE
43 {
44 public:
45  ALGO_BASE( ROUTER* aRouter ) :
46  m_debugDecorator( nullptr ),
47  m_router( aRouter ),
48  m_logger( nullptr )
49  {}
50 
51  virtual ~ALGO_BASE() {}
52 
54  ROUTER* Router() const
55  {
56  return m_router;
57  }
58 
60  ROUTING_SETTINGS& Settings() const;
61 
63  virtual LOGGER* Logger();
64 
65  void SetLogger( LOGGER* aLogger )
66  {
67  m_logger = aLogger;
68  }
69 
73  void SetDebugDecorator( DEBUG_DECORATOR* aDecorator )
74  {
75  m_debugDecorator = aDecorator;
76  }
77 
78  DEBUG_DECORATOR* Dbg() const
79  {
80  return m_debugDecorator;
81  }
82 
83  const BOX2I& VisibleViewArea() const;
84 
85 protected:
86  DEBUG_DECORATOR *m_debugDecorator;
87  ROUTER* m_router;
88  LOGGER* m_logger;
89 };
90 
91 }
92 
93 #endif
Base class for all P&S algorithms (shoving, walkaround, line placement, dragging, etc....
Definition: pns_algo_base.h:43
virtual ~ALGO_BASE()
Return the instance of our router.
Definition: pns_algo_base.h:51
void SetDebugDecorator(DEBUG_DECORATOR *aDecorator)
Assign a debug decorator allowing this algo to draw extra graphics for visual debugging.
Definition: pns_algo_base.h:73
ROUTER * Router() const
Return current router settings.
Definition: pns_algo_base.h:54
ROUTING_SETTINGS & Settings() const
Return the logger object, allowing to dump geometry to a file.
Definition: pns_algo_base.cpp:28
Definition: pns_debug_decorator.h:35
Definition: pns_logger.h:42
Definition: pns_router.h:116
Contain all persistent settings of the router, such as the mode, optimization effort,...
Definition: pns_routing_settings.h:58