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#pragma once
26
28
30class BOARD_ADAPTER;
31
32
36
38{
39public:
41 TOOL_INTERACTIVE( "3DViewer.Control" ),
42 m_canvas( nullptr ),
43 m_boardAdapter( nullptr ),
44 m_camera( nullptr ),
46 { }
47
48 ~EDA_3D_CONTROLLER() override { }
49
51 bool Init() override;
52
54 void Reset( RESET_REASON aReason ) override;
55
56 int UpdateMenu( const TOOL_EVENT& aEvent );
57
58 int Main( const TOOL_EVENT& aEvent );
59
65 void SetRotationIncrement( double aRotIncrement ) { m_rotationIncrement = aRotIncrement; }
67
68 // View controls
69 int ZoomRedraw( const TOOL_EVENT& aEvent );
70 int ZoomInOut( const TOOL_EVENT& aEvent );
71 int ZoomInOutCenter( const TOOL_EVENT& aEvent );
72 int ZoomFitScreen( const TOOL_EVENT& aEvent );
73
74 int PanControl( const TOOL_EVENT& aEvent );
75 int ViewControl( const TOOL_EVENT& aEvent );
76 int RotateView( const TOOL_EVENT& aEvent );
77
78 int On3DGridSelection( const TOOL_EVENT& aEvent );
79
80 int SetMaterial( const TOOL_EVENT& aEvent );
81
82 int ToggleOrtho( const TOOL_EVENT& aEvent );
83 int ToggleVisibility( const TOOL_EVENT& aEvent );
84 int ToggleLayersManager( const TOOL_EVENT& aEvent );
85
86 int ReloadBoard( const TOOL_EVENT& aEvent );
87 int ToggleRaytracing( const TOOL_EVENT& aEvent );
88 int ExportImage( const TOOL_EVENT& aEvent );
89
90private:
92 void setTransitions() override;
93
94 int doZoomInOut( bool aDirection, bool aCenterOnCursor );
95
96private:
101};
Helper class to handle information needed to display 3D board.
A class used to derive camera objects from.
Definition camera.h:103
Implement a canvas based on a wxGLCanvas.
int On3DGridSelection(const TOOL_EVENT &aEvent)
double m_rotationIncrement
Rotation increment for the rotate actions (degrees)
int ZoomFitScreen(const TOOL_EVENT &aEvent)
void SetRotationIncrement(double aRotIncrement)
Set the increment used by the RotateView actions.
EDA_3D_CANVAS * m_canvas
int ExportImage(const TOOL_EVENT &aEvent)
int doZoomInOut(bool aDirection, bool aCenterOnCursor)
int ToggleLayersManager(const TOOL_EVENT &aEvent)
int ToggleRaytracing(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 ReloadBoard(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:171
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Create a tool with given id & name.
void Reset() override