2014-05-14 13:53:54 +00:00
|
|
|
/*
|
|
|
|
* KiRouter - a push-and-(sometimes-)shove PCB router
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013-2014 CERN
|
2021-01-27 22:15:38 +00:00
|
|
|
* Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
2014-05-14 13:53:54 +00:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __PNS_ALGO_BASE_H
|
|
|
|
#define __PNS_ALGO_BASE_H
|
|
|
|
|
2021-02-17 21:01:09 +00:00
|
|
|
#include <math/box2.h>
|
|
|
|
|
2014-05-14 13:53:54 +00:00
|
|
|
#include "pns_routing_settings.h"
|
|
|
|
|
2016-08-29 14:38:11 +00:00
|
|
|
namespace PNS {
|
|
|
|
|
2016-08-29 17:31:13 +00:00
|
|
|
class ROUTER;
|
|
|
|
class LOGGER;
|
|
|
|
class DEBUG_DECORATOR;
|
2014-05-14 13:53:54 +00:00
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Base class for all P&S algorithms (shoving, walkaround, line placement, dragging, etc.).
|
2014-05-14 13:53:54 +00:00
|
|
|
*
|
2021-01-27 22:15:38 +00:00
|
|
|
* Holds a bunch of objects commonly used by all algorithms (P&S settings, parent router
|
|
|
|
* instance, logging).
|
2015-02-18 16:53:46 +00:00
|
|
|
*/
|
2016-08-29 17:31:13 +00:00
|
|
|
class ALGO_BASE
|
2014-05-16 11:37:31 +00:00
|
|
|
{
|
2014-05-14 13:53:54 +00:00
|
|
|
public:
|
2016-08-29 17:31:13 +00:00
|
|
|
ALGO_BASE( ROUTER* aRouter ) :
|
2021-01-27 22:15:38 +00:00
|
|
|
m_debugDecorator( nullptr ),
|
2020-02-19 17:21:56 +00:00
|
|
|
m_router( aRouter ),
|
|
|
|
m_logger( nullptr )
|
2015-02-18 16:53:46 +00:00
|
|
|
{}
|
2014-05-14 13:53:54 +00:00
|
|
|
|
2016-08-29 17:31:13 +00:00
|
|
|
virtual ~ALGO_BASE() {}
|
2014-05-14 13:53:54 +00:00
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Return the instance of our router
|
2016-08-29 17:31:13 +00:00
|
|
|
ROUTER* Router() const
|
2015-02-18 16:53:46 +00:00
|
|
|
{
|
|
|
|
return m_router;
|
|
|
|
}
|
2014-05-14 13:53:54 +00:00
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Return current router settings
|
2016-08-29 17:31:13 +00:00
|
|
|
ROUTING_SETTINGS& Settings() const;
|
2014-05-14 13:53:54 +00:00
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Return the logger object, allowing to dump geometry to a file.
|
2016-08-29 17:31:13 +00:00
|
|
|
virtual LOGGER* Logger();
|
2015-02-18 00:29:54 +00:00
|
|
|
|
2020-02-19 17:21:56 +00:00
|
|
|
void SetLogger( LOGGER* aLogger )
|
|
|
|
{
|
|
|
|
m_logger = aLogger;
|
|
|
|
}
|
|
|
|
|
2016-08-15 15:16:48 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Assign a debug decorator allowing this algo to draw extra graphics for visual debugging.
|
|
|
|
*/
|
2016-08-29 17:31:13 +00:00
|
|
|
void SetDebugDecorator( DEBUG_DECORATOR* aDecorator )
|
2016-08-15 15:16:48 +00:00
|
|
|
{
|
|
|
|
m_debugDecorator = aDecorator;
|
|
|
|
}
|
|
|
|
|
2016-08-29 17:31:13 +00:00
|
|
|
DEBUG_DECORATOR* Dbg() const
|
2016-08-15 15:16:48 +00:00
|
|
|
{
|
|
|
|
return m_debugDecorator;
|
|
|
|
}
|
|
|
|
|
2021-02-17 21:01:09 +00:00
|
|
|
const BOX2I& VisibleViewArea() const;
|
|
|
|
|
2020-02-19 17:21:56 +00:00
|
|
|
protected:
|
2016-08-29 17:31:13 +00:00
|
|
|
DEBUG_DECORATOR *m_debugDecorator;
|
|
|
|
ROUTER* m_router;
|
2020-02-19 17:21:56 +00:00
|
|
|
LOGGER* m_logger;
|
2014-05-14 13:53:54 +00:00
|
|
|
};
|
|
|
|
|
2016-08-29 14:38:11 +00:00
|
|
|
}
|
|
|
|
|
2014-05-14 13:53:54 +00:00
|
|
|
#endif
|