You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.2 KiB

11 years ago
11 years ago
11 years ago
  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. #ifndef __PNS_ALGO_BASE_H
  23. #define __PNS_ALGO_BASE_H
  24. #include <math/box2.h>
  25. #include "pns_routing_settings.h"
  26. namespace PNS {
  27. class ROUTER;
  28. class LOGGER;
  29. class DEBUG_DECORATOR;
  30. /**
  31. * Base class for all P&S algorithms (shoving, walkaround, line placement, dragging, etc.).
  32. *
  33. * Holds a bunch of objects commonly used by all algorithms (P&S settings, parent router
  34. * instance, logging).
  35. */
  36. class ALGO_BASE
  37. {
  38. public:
  39. ALGO_BASE( ROUTER* aRouter ) :
  40. m_debugDecorator( nullptr ),
  41. m_router( aRouter ),
  42. m_logger( nullptr )
  43. {}
  44. virtual ~ALGO_BASE() {}
  45. ///< Return the instance of our router
  46. ROUTER* Router() const
  47. {
  48. return m_router;
  49. }
  50. ///< Return current router settings
  51. ROUTING_SETTINGS& Settings() const;
  52. ///< Return the logger object, allowing to dump geometry to a file.
  53. virtual LOGGER* Logger();
  54. void SetLogger( LOGGER* aLogger )
  55. {
  56. m_logger = aLogger;
  57. }
  58. /**
  59. * Assign a debug decorator allowing this algo to draw extra graphics for visual debugging.
  60. */
  61. void SetDebugDecorator( DEBUG_DECORATOR* aDecorator )
  62. {
  63. m_debugDecorator = aDecorator;
  64. }
  65. DEBUG_DECORATOR* Dbg() const
  66. {
  67. return m_debugDecorator;
  68. }
  69. const BOX2I& VisibleViewArea() const;
  70. protected:
  71. DEBUG_DECORATOR *m_debugDecorator;
  72. ROUTER* m_router;
  73. LOGGER* m_logger;
  74. };
  75. }
  76. #endif