Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
9483a2d9
Commit
9483a2d9
authored
Nov 17, 2012
by
Matthias Krebs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 3DMouse SDK for Windows
parent
6ff998a2
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
996 additions
and
0 deletions
+996
-0
I3dMouseParams.h
libs/thirdParty/3DMouse/win/I3dMouseParams.h
+84
-0
Mouse3DInput.cpp
libs/thirdParty/3DMouse/win/Mouse3DInput.cpp
+677
-0
Mouse3DInput.h
libs/thirdParty/3DMouse/win/Mouse3DInput.h
+98
-0
MouseParameters.cpp
libs/thirdParty/3DMouse/win/MouseParameters.cpp
+88
-0
MouseParameters.h
libs/thirdParty/3DMouse/win/MouseParameters.h
+49
-0
No files found.
libs/thirdParty/3DMouse/win/I3dMouseParams.h
0 → 100644
View file @
9483a2d9
#ifndef I3D_MOUSE_PARAMS_H
#define I3D_MOUSE_PARAMS_H
/*
Parameters for the 3D mouse based on the SDK from 3Dconnexion
*/
class
I3dMouseSensor
{
public:
enum
ESpeed
{
kLowSpeed
=
0
,
kMidSpeed
,
kHighSpeed
};
virtual
bool
IsPanZoom
()
const
=
0
;
virtual
bool
IsRotate
()
const
=
0
;
virtual
ESpeed
GetSpeed
()
const
=
0
;
virtual
void
SetPanZoom
(
bool
isPanZoom
)
=
0
;
virtual
void
SetRotate
(
bool
isRotate
)
=
0
;
virtual
void
SetSpeed
(
ESpeed
speed
)
=
0
;
protected:
virtual
~
I3dMouseSensor
()
{}
};
class
I3dMouseNavigation
{
public:
enum
EPivot
{
kManualPivot
=
0
,
kAutoPivot
,
kAutoPivotOverride
};
enum
ENavigation
{
kObjectMode
=
0
,
kCameraMode
,
kFlyMode
,
kWalkMode
,
kHelicopterMode
};
enum
EPivotVisibility
{
kHidePivot
=
0
,
kShowPivot
,
kShowMovingPivot
};
virtual
ENavigation
GetNavigationMode
()
const
=
0
;
virtual
EPivot
GetPivotMode
()
const
=
0
;
virtual
EPivotVisibility
GetPivotVisibility
()
const
=
0
;
virtual
bool
IsLockHorizon
()
const
=
0
;
virtual
void
SetLockHorizon
(
bool
bOn
)
=
0
;
virtual
void
SetNavigationMode
(
ENavigation
navigation
)
=
0
;
virtual
void
SetPivotMode
(
EPivot
pivot
)
=
0
;
virtual
void
SetPivotVisibility
(
EPivotVisibility
visibility
)
=
0
;
protected:
virtual
~
I3dMouseNavigation
(){}
};
class
I3dMouseParam
:
public
I3dMouseSensor
,
public
I3dMouseNavigation
{
public:
virtual
~
I3dMouseParam
()
{}
};
#endif
libs/thirdParty/3DMouse/win/Mouse3DInput.cpp
0 → 100644
View file @
9483a2d9
This diff is collapsed.
Click to expand it.
libs/thirdParty/3DMouse/win/Mouse3DInput.h
0 → 100644
View file @
9483a2d9
#ifndef T3DMOUSE_INPUT_H
#define T3DMOUSE_INPUT_H
#include "MouseParameters.h"
#include <QWidget>
#include <vector>
#include <map>
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501 //target at least windows XP
#endif
#include <windows.h>
/*
A class for connecting to and receiving data from a 3D Connexion 3D mouse
This helper class manages the connection to a 3D mouse, collecting WM_INPUT
messages from Windows and converting the data into 3D motion data.
This class is based on the SDK from 3D Connexion but is modified to work with Qt.
It is Windows only since it uses the WM_INPUT messages from windows directly
rather than Qt events.
Note that it needs to be compiled with _WIN32_WINNT defined as 0x0501 (windows XP)
or later because the raw input API was added in Windows XP. This also means that
Qt needs to be compiled with this enabled otherwise the QEventDispatcherWin32 blocks
in processEvents because the raw input messages do not cause the thread to be woken if
Qt is compiled for Win 2000 targets.
*/
class
Mouse3DInput
:
public
QObject
{
Q_OBJECT
public:
Mouse3DInput
(
QWidget
*
widget
);
~
Mouse3DInput
();
static
bool
Is3dmouseAttached
();
I3dMouseParam
&
MouseParams
();
const
I3dMouseParam
&
MouseParams
()
const
;
virtual
void
Move3d
(
HANDLE
device
,
std
::
vector
<
float
>&
motionData
);
virtual
void
On3dmouseKeyDown
(
HANDLE
device
,
int
virtualKeyCode
);
virtual
void
On3dmouseKeyUp
(
HANDLE
device
,
int
virtualKeyCode
);
signals:
void
Move3d
(
std
::
vector
<
float
>&
motionData
);
void
On3dmouseKeyDown
(
int
virtualKeyCode
);
void
On3dmouseKeyUp
(
int
virtualKeyCode
);
private:
bool
InitializeRawInput
(
HWND
hwndTarget
);
static
bool
RawInputEventFilter
(
void
*
msg
,
long
*
result
);
void
OnRawInput
(
UINT
nInputCode
,
HRAWINPUT
hRawInput
);
UINT
GetRawInputBuffer
(
PRAWINPUT
pData
,
PUINT
pcbSize
,
UINT
cbSizeHeader
);
bool
TranslateRawInputData
(
UINT
nInputCode
,
PRAWINPUT
pRawInput
);
void
On3dmouseInput
();
class
TInputData
{
public:
TInputData
()
:
fAxes
(
6
)
{}
bool
IsZero
()
{
return
(
0
.
==
fAxes
[
0
]
&&
0
.
==
fAxes
[
1
]
&&
0
.
==
fAxes
[
2
]
&&
0
.
==
fAxes
[
3
]
&&
0
.
==
fAxes
[
4
]
&&
0
.
==
fAxes
[
5
]);
}
int
fTimeToLive
;
// For telling if the device was unplugged while sending data
bool
fIsDirty
;
std
::
vector
<
float
>
fAxes
;
};
HWND
fWindow
;
// Data cache to handle multiple rawinput devices
std
::
map
<
HANDLE
,
TInputData
>
fDevice2Data
;
std
::
map
<
HANDLE
,
unsigned
long
>
fDevice2Keystate
;
// 3dmouse parameters
MouseParameters
f3dMouseParams
;
// Rotate, Pan Zoom etc.
// use to calculate distance traveled since last event
DWORD
fLast3dmouseInputTime
;
};
#endif
libs/thirdParty/3DMouse/win/MouseParameters.cpp
0 → 100644
View file @
9483a2d9
#include "MouseParameters.h"
MouseParameters
::
MouseParameters
()
:
fNavigation
(
kObjectMode
)
,
fPivot
(
kAutoPivot
)
,
fPivotVisibility
(
kShowPivot
)
,
fIsLockHorizon
(
true
)
,
fIsPanZoom
(
true
)
,
fIsRotate
(
true
)
,
fSpeed
(
kLowSpeed
)
{
}
MouseParameters
::~
MouseParameters
()
{
}
bool
MouseParameters
::
IsPanZoom
()
const
{
return
fIsPanZoom
;
}
bool
MouseParameters
::
IsRotate
()
const
{
return
fIsRotate
;
}
MouseParameters
::
ESpeed
MouseParameters
::
GetSpeed
()
const
{
return
fSpeed
;
}
void
MouseParameters
::
SetPanZoom
(
bool
isPanZoom
)
{
fIsPanZoom
=
isPanZoom
;
}
void
MouseParameters
::
SetRotate
(
bool
isRotate
)
{
fIsRotate
=
isRotate
;
}
void
MouseParameters
::
SetSpeed
(
ESpeed
speed
)
{
fSpeed
=
speed
;
}
MouseParameters
::
ENavigation
MouseParameters
::
GetNavigationMode
()
const
{
return
fNavigation
;
}
MouseParameters
::
EPivot
MouseParameters
::
GetPivotMode
()
const
{
return
fPivot
;
}
MouseParameters
::
EPivotVisibility
MouseParameters
::
GetPivotVisibility
()
const
{
return
fPivotVisibility
;
}
bool
MouseParameters
::
IsLockHorizon
()
const
{
return
fIsLockHorizon
;
}
void
MouseParameters
::
SetLockHorizon
(
bool
bOn
)
{
fIsLockHorizon
=
bOn
;
}
void
MouseParameters
::
SetNavigationMode
(
ENavigation
navigation
)
{
fNavigation
=
navigation
;
}
void
MouseParameters
::
SetPivotMode
(
EPivot
pivot
)
{
if
(
fPivot
!=
kManualPivot
||
pivot
!=
kAutoPivotOverride
)
fPivot
=
pivot
;
}
void
MouseParameters
::
SetPivotVisibility
(
EPivotVisibility
visibility
)
{
fPivotVisibility
=
visibility
;
}
libs/thirdParty/3DMouse/win/MouseParameters.h
0 → 100644
View file @
9483a2d9
#ifndef T3D_MOUSE_PARAMS_H
#define T3D_MOUSE_PARAMS_H
#include "I3dMouseParams.h"
class
MouseParameters
:
public
I3dMouseParam
{
public:
MouseParameters
();
~
MouseParameters
();
// I3dmouseSensor interface
bool
IsPanZoom
()
const
;
bool
IsRotate
()
const
;
ESpeed
GetSpeed
()
const
;
void
SetPanZoom
(
bool
isPanZoom
);
void
SetRotate
(
bool
isRotate
);
void
SetSpeed
(
ESpeed
speed
);
// I3dmouseNavigation interface
ENavigation
GetNavigationMode
()
const
;
EPivot
GetPivotMode
()
const
;
EPivotVisibility
GetPivotVisibility
()
const
;
bool
IsLockHorizon
()
const
;
void
SetLockHorizon
(
bool
bOn
);
void
SetNavigationMode
(
ENavigation
navigation
);
void
SetPivotMode
(
EPivot
pivot
);
void
SetPivotVisibility
(
EPivotVisibility
visibility
);
private:
MouseParameters
(
const
MouseParameters
&
);
const
MouseParameters
&
operator
=
(
const
MouseParameters
&
);
ENavigation
fNavigation
;
EPivot
fPivot
;
EPivotVisibility
fPivotVisibility
;
bool
fIsLockHorizon
;
bool
fIsPanZoom
;
bool
fIsRotate
;
ESpeed
fSpeed
;
};
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment