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 The 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
39{
40public:
42 : TOOL_INTERACTIVE( "3DViewer.Control" ),
43 m_canvas( nullptr ),
44 m_boardAdapter( nullptr ),
45 m_camera( nullptr ),
47 { }
48
49 ~EDA_3D_CONTROLLER() override { }
50
52 bool Init() override;
53
55 void Reset( RESET_REASON aReason ) override;
56
57 int UpdateMenu( const TOOL_EVENT& aEvent );
58
59 int Main( const TOOL_EVENT& aEvent );
60
66 void SetRotationIncrement( double aRotIncrement )
67 {
68 m_rotationIncrement = aRotIncrement;
69 }
70
77 {
79 }
80
81 // View controls
82 int ZoomRedraw( const TOOL_EVENT& aEvent );
83 int ZoomInOut( const TOOL_EVENT& aEvent );
84 int ZoomInOutCenter( const TOOL_EVENT& aEvent );
85 int ZoomFitScreen( const TOOL_EVENT& aEvent );
86
87 int PanControl( const TOOL_EVENT& aEvent );
88 int ViewControl( const TOOL_EVENT& aEvent );
89 int RotateView( const TOOL_EVENT& aEvent );
90
91 int On3DGridSelection( const TOOL_EVENT& aEvent );
92
93 int SetMaterial( const TOOL_EVENT& aEvent );
94
95 int ToggleOrtho( const TOOL_EVENT& aEvent );
96 int ToggleVisibility( const TOOL_EVENT& aEvent );
97 int ToggleLayersManager( const TOOL_EVENT& aEvent );
98
99private:
101 void setTransitions() override;
102
103 int doZoomInOut( bool aDirection, bool aCenterOnCursor );
104
105private:
110};
111
112#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:51
Handle view actions for various 3D canvases.
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
Set 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:168
void Reset() override