KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eda_3d_controller.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) 2023 CERN
5 * Copyright (C) 2020-2023 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
25#ifndef _3D_VIEWER_CONTROL_H
26#define _3D_VIEWER_CONTROL_H
27
29
31class BOARD_ADAPTER;
32
33
41{
42public:
44 : TOOL_INTERACTIVE( "3DViewer.Control" ),
45 m_canvas( nullptr ),
46 m_boardAdapter( nullptr ),
47 m_camera( nullptr ),
49 { }
50
51 ~EDA_3D_CONTROLLER() override { }
52
54 bool Init() override;
55
57 void Reset( RESET_REASON aReason ) override;
58
59 int UpdateMenu( const TOOL_EVENT& aEvent );
60
61 int Main( const TOOL_EVENT& aEvent );
62
68 void SetRotationIncrement( double aRotIncrement )
69 {
70 m_rotationIncrement = aRotIncrement;
71 }
72
79 {
81 }
82
83 // View controls
84 int ZoomRedraw( const TOOL_EVENT& aEvent );
85 int ZoomInOut( const TOOL_EVENT& aEvent );
86 int ZoomInOutCenter( const TOOL_EVENT& aEvent );
87 int ZoomFitScreen( const TOOL_EVENT& aEvent );
88
89 int PanControl( const TOOL_EVENT& aEvent );
90 int ViewControl( const TOOL_EVENT& aEvent );
91 int RotateView( const TOOL_EVENT& aEvent );
92
93 int On3DGridSelection( const TOOL_EVENT& aEvent );
94
95 int SetMaterial( const TOOL_EVENT& aEvent );
96
97 int ToggleOrtho( const TOOL_EVENT& aEvent );
98 int ToggleVisibility( const TOOL_EVENT& aEvent );
99 int ToggleLayersManager( const TOOL_EVENT& aEvent );
100
101private:
103 void setTransitions() override;
104
105 int doZoomInOut( bool aDirection, bool aCenterOnCursor );
106
107private:
112};
113
114#endif
Helper class to handle information needed to display 3D board.
Definition: board_adapter.h:73
A class used to derive camera objects from.
Definition: camera.h:103
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:49
EDA_3D_CONTROLLER.
int On3DGridSelection(const TOOL_EVENT &aEvent)
double m_rotationIncrement
Rotation increment for the rotate actions (degrees)
int ZoomFitScreen(const TOOL_EVENT &aEvent)
double GetRotationIncrement()
Get the increment used by the RotateView actions.
void SetRotationIncrement(double aRotIncrement)
Set the increment used by the RotateView actions.
EDA_3D_CANVAS * m_canvas
int doZoomInOut(bool aDirection, bool aCenterOnCursor)
int ToggleLayersManager(const TOOL_EVENT &aEvent)
int Main(const TOOL_EVENT &aEvent)
~EDA_3D_CONTROLLER() override
BOARD_ADAPTER * m_boardAdapter
int ZoomRedraw(const TOOL_EVENT &aEvent)
int ToggleOrtho(const TOOL_EVENT &aEvent)
int PanControl(const TOOL_EVENT &aEvent)
bool Init() override
Init() is called once upon a registration of the tool.
int ToggleVisibility(const TOOL_EVENT &aEvent)
void setTransitions() override
< Sets up handlers for various events.
int RotateView(const TOOL_EVENT &aEvent)
int SetMaterial(const TOOL_EVENT &aEvent)
int UpdateMenu(const TOOL_EVENT &aEvent)
int ViewControl(const TOOL_EVENT &aEvent)
int ZoomInOutCenter(const TOOL_EVENT &aEvent)
int ZoomInOut(const TOOL_EVENT &aEvent)
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
RESET_REASON
Determine the reason of reset for a tool.
Definition: tool_base.h:78
Generic, UI-independent tool event.
Definition: tool_event.h:167
void Reset() override