KiCad PCB EDA Suite
Loading...
Searching...
No Matches
nl_3d_viewer_plugin_impl.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) 2024 3Dconnexion
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
26#ifndef NL_3D_VIEWER_PLUGIN_IMPL_H_
27#define NL_3D_VIEWER_PLUGIN_IMPL_H_
28
29// TDxWare SDK.
30#include <SpaceMouse/CNavigation3D.hpp>
31
32// KiCad
34
35// wx
36#include <wx/chartype.h>
37
38// glm
39#include <glm/glm.hpp>
40
41// Forward declarations.
42class EDA_3D_CANVAS;
43class TRACK_BALL;
44
45// temporary store for the categories
46typedef std::map<std::string, TDx::CCommandTreeNode*> CATEGORY_STORE;
47
57CATEGORY_STORE::iterator add_category( std::string aCategoryPath, CATEGORY_STORE& aCategoryStore );
58
59// Convenience typedef.
60typedef TDx::SpaceMouse::Navigation3D::CNavigation3D NAV_3D;
61
67{
68public:
75 NL_3D_VIEWER_PLUGIN_IMPL( EDA_3D_CANVAS* aCanvas, const std::string& aProfileHint );
76
78
85 void SetFocus( bool aFocus = true );
86
90 EDA_3D_CANVAS* GetCanvas() const;
91
95 void Connect();
96
97private:
101 virtual void exportCommandsAndImages();
102
103 long GetCameraMatrix( navlib::matrix_t& aMatrix ) const override;
104 long GetPointerPosition( navlib::point_t& aPosition ) const override;
105 long GetViewExtents( navlib::box_t& aExtents ) const override;
106 long GetViewFOV( double& aFov ) const override;
107 long GetViewFrustum( navlib::frustum_t& aFrustum ) const override;
108 long GetIsViewPerspective( navlib::bool_t& aPerspective ) const override;
109 long SetCameraMatrix( const navlib::matrix_t& aMatrix ) override;
110 long SetViewExtents( const navlib::box_t& aExtents ) override;
111 long SetViewFOV( double aFov ) override;
112 long SetViewFrustum( const navlib::frustum_t& aFrustum ) override;
113 long GetModelExtents( navlib::box_t& aExtents ) const override;
114 long GetSelectionExtents( navlib::box_t& aExtents ) const override;
115 long GetSelectionTransform( navlib::matrix_t& aTransform ) const override;
116 long GetIsSelectionEmpty( navlib::bool_t& aEmpty ) const override;
117 long SetSelectionTransform( const navlib::matrix_t& aMatrix ) override;
118 long GetPivotPosition( navlib::point_t& aPosition ) const override;
119 long IsUserPivot( navlib::bool_t& aUserPivot ) const override;
120 long SetPivotPosition( const navlib::point_t& aPosition ) override;
121 long GetPivotVisible( navlib::bool_t& aVisible ) const override;
122 long SetPivotVisible( bool aVisible ) override;
123 long GetHitLookAt( navlib::point_t& aPosition ) const override;
124 long SetHitAperture( double aAperture ) override;
125 long SetHitDirection( const navlib::vector_t& aDirection ) override;
126 long SetHitLookFrom( const navlib::point_t& aPosition ) override;
127 long SetHitSelectionOnly( bool aSelectionOnly ) override;
128 long SetActiveCommand( std::string aCommandId ) override;
129
130 long SetSettingsChanged( long aChangeNumber ) override;
131 long SetMotionFlag( bool aValue ) override;
132 long SetTransaction( long aValue ) override;
133 long SetCameraTarget( const navlib::point_t& aPosition ) override;
134
135 long GetFrontView( navlib::matrix_t& aMatrix ) const override;
136 long GetCoordinateSystem( navlib::matrix_t& aMatrix ) const override;
137 long GetIsViewRotatable( navlib::bool_t& isRotatable ) const override;
138
139
140private:
147
148 // The cached CAMERA affine matrix. This is used to determine if the camera has been
149 // moved. The camera matrix is the world to camera affine.
150 mutable glm::mat4 m_cameraMatrix;
151
152
159 static const wxChar* m_logTrace;
160};
161
162#endif // NL_3D_VIEWER_PLUGIN_IMPL_H_
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:51
The class that implements the accessors and mutators required for 3D navigation in an EDA_3D_CANVAS u...
long GetViewExtents(navlib::box_t &aExtents) const override
long GetCameraMatrix(navlib::matrix_t &aMatrix) const override
void Connect()
Connect plugin implementation to the driver.
long SetHitLookFrom(const navlib::point_t &aPosition) override
long SetActiveCommand(std::string aCommandId) override
EDA_3D_CANVAS * GetCanvas() const
Get the m_canvas pointer.
long GetPivotPosition(navlib::point_t &aPosition) const override
long GetModelExtents(navlib::box_t &aExtents) const override
long GetPointerPosition(navlib::point_t &aPosition) const override
long SetPivotVisible(bool aVisible) override
long SetTransaction(long aValue) override
long SetViewFOV(double aFov) override
long SetMotionFlag(bool aValue) override
long SetCameraMatrix(const navlib::matrix_t &aMatrix) override
long GetHitLookAt(navlib::point_t &aPosition) const override
long SetHitAperture(double aAperture) override
long SetPivotPosition(const navlib::point_t &aPosition) override
long SetHitDirection(const navlib::vector_t &aDirection) override
long GetSelectionTransform(navlib::matrix_t &aTransform) const override
long SetSelectionTransform(const navlib::matrix_t &aMatrix) override
long SetSettingsChanged(long aChangeNumber) override
long SetHitSelectionOnly(bool aSelectionOnly) override
long GetIsSelectionEmpty(navlib::bool_t &aEmpty) const override
long GetSelectionExtents(navlib::box_t &aExtents) const override
long GetCoordinateSystem(navlib::matrix_t &aMatrix) const override
long IsUserPivot(navlib::bool_t &aUserPivot) const override
long GetViewFOV(double &aFov) const override
long GetPivotVisible(navlib::bool_t &aVisible) const override
long GetFrontView(navlib::matrix_t &aMatrix) const override
long GetViewFrustum(navlib::frustum_t &aFrustum) const override
long GetIsViewPerspective(navlib::bool_t &aPerspective) const override
long SetViewFrustum(const navlib::frustum_t &aFrustum) override
long SetViewExtents(const navlib::box_t &aExtents) override
virtual void exportCommandsAndImages()
Export the invocable actions and images to the 3Dconnexion UI.
void SetFocus(bool aFocus=true)
Set the connection to the 3Dconnexion driver to the focus state so that 3DMouse data is routed here.
long GetIsViewRotatable(navlib::bool_t &isRotatable) const override
long SetCameraTarget(const navlib::point_t &aPosition) override
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
std::map< std::string, TDx::CCommandTreeNode * > CATEGORY_STORE
CATEGORY_STORE::iterator add_category(std::string aCategoryPath, CATEGORY_STORE &aCategoryStore)
Add a category to the store.
TDx::SpaceMouse::Navigation3D::CNavigation3D NAV_3D
glm::vec3 SFVEC3F
Definition: xv3d_types.h:44