KiCad PCB EDA Suite
render_3d_base.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
5  * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
29 #ifndef RENDER_3D_BASE_H
30 #define RENDER_3D_BASE_H
31 
32 
33 #include <pcb_base_frame.h>
35 #include <reporter.h>
36 
37 #include <widgets/busy_indicator.h>
38 
43 {
44 public:
45  explicit RENDER_3D_BASE( BOARD_ADAPTER& aBoardAdapter, CAMERA& aCamera );
46 
47  virtual ~RENDER_3D_BASE() = 0;
48 
55  virtual void SetCurWindowSize( const wxSize& aSize ) = 0;
56 
64  virtual bool Redraw( bool aIsMoving, REPORTER* aStatusReporter = nullptr,
65  REPORTER* aWarningReporter = nullptr ) = 0;
66 
70  void ReloadRequest() { m_reloadRequested = true; }
71 
77  bool IsReloadRequestPending() const { return m_reloadRequested; }
78 
85  virtual int GetWaitForEditingTimeOut() = 0;
86 
94 
95 protected:
99  std::unique_ptr<BUSY_INDICATOR> CreateBusyIndicator() const;
100 
103 
105 
108 
111 
113  wxSize m_windowSize;
114 
121  static const wxChar* m_logTrace;
122 
123 private:
126 };
127 
128 #endif // RENDER_3D_BASE_H
virtual ~RENDER_3D_BASE()=0
BOARD_ADAPTER & m_boardAdapter
bool IsReloadRequestPending() const
Query if there is a pending reload request.
void ReloadRequest()
virtual void SetCurWindowSize(const wxSize &aSize)=0
Before each render, the canvas will tell the render what is the size of its windows,...
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:64
Classes used in Pcbnew, CvPcb and GerbView.
std::function< std::unique_ptr< BUSY_INDICATOR >()> FACTORY
A factory function that returns a new busy indicator.
A class used to derive camera objects from.
Definition: camera.h:77
virtual int GetWaitForEditingTimeOut()=0
Give the interface the time (in ms) that it should wait for editing or movements before (this works f...
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
RENDER_3D_BASE(BOARD_ADAPTER &aBoardAdapter, CAMERA &aCamera)
virtual bool Redraw(bool aIsMoving, REPORTER *aStatusReporter=nullptr, REPORTER *aWarningReporter=nullptr)=0
Redraw the view.
This is a base class to hold data and functions for render targets.
void SetBusyIndicatorFactory(BUSY_INDICATOR::FACTORY aNewFactory)
Set a new busy indicator factory.
BUSY_INDICATOR::FACTORY m_busyIndicatorFactory
< Factory that returns a suitable busy indicator for the context.
bool m_is_opengl_initialized
std::unique_ptr< BUSY_INDICATOR > CreateBusyIndicator() const
Return a created busy indicator, if a factory has been set, else a null pointer.
bool m_reloadRequested
The window size that this camera is working.
CAMERA & m_camera
Flag if the opengl specific for this render was already initialized.
Helper class to handle information needed to display 3D board.
Definition: board_adapter.h:67