76 Qt3DRender::QCamera *
camera()
const {
return mCamera; }
95 void setCameraMovementSpeed(
double movementSpeed );
110 void frameTriggered(
float dt );
113 void resetView(
float distance );
116 void setViewFromTop(
float worldX,
float worldY,
float distance,
float yaw = 0 );
127 void setLookingAtPoint(
const QgsVector3D &point,
float distance,
float pitch,
float yaw );
139 void setLookingAtMapPoint(
const QgsVector3D &point,
float distance,
float pitch,
float yaw );
145 void setCameraPose(
const QgsCameraPose &camPose,
bool force =
false );
158 float distance()
const {
return mCameraPose.distanceFromCenterPoint(); }
165 float pitch()
const {
return mCameraPose.pitchAngle(); }
172 float yaw()
const {
return mCameraPose.headingAngle(); }
175 QDomElement writeXml( QDomDocument &doc )
const;
177 void readXml(
const QDomElement &elem,
QgsVector3D savedOrigin );
180 void zoom(
float factor );
182 void tiltUpAroundViewCenter(
float deltaPitch );
184 void rotateAroundViewCenter(
float deltaYaw );
186 void setCameraHeadingAngle(
float angle );
188 void moveView(
float tx,
float ty );
194 void walkView(
double tx,
double ty,
double tz );
202 void rotateCamera(
float diffPitch,
float diffYaw );
209 void rotateCameraAroundPivot(
float newPitch,
float newHeading,
const QVector3D &pivotPoint );
218 Q_DECL_DEPRECATED
void zoomCameraAroundPivot(
const QVector3D &oldCameraPosition,
double zoomFactor,
const QVector3D &pivotPoint )
SIP_DEPRECATED;
226 void zoomCameraAroundPivot(
const QVector3D &oldCameraPosition,
double oldDistanceFromCenterPoint,
double zoomFactor,
const QVector3D &pivotPoint );
232 bool keyboardEventFilter( QKeyEvent *event );
260 void globeMoveCenterPoint(
double latDiff,
double lonDiff );
267 void globeZoom(
float factor );
273 void globeUpdatePitchAngle(
float angleDiff );
279 void globeUpdateHeadingAngle(
float angleDiff );
286 void resetGlobe(
float distance,
double lat = 0,
double lon = 0 );
322 void depthBufferCaptured(
const QImage &depthImage );
330 void updateCameraFromPose();
331 void moveCameraPositionBy(
const QVector3D &posDiff );
333 QWindow *window()
const;
336 enum class MouseOperation
349 const QList<MouseOperation> mTranslateOrRotate = {
350 MouseOperation::Translation,
351 MouseOperation::RotationCamera,
352 MouseOperation::RotationCenter
356 bool isATranslationRotationSequence( MouseOperation newOperation )
const;
358 void setMouseParameters(
const MouseOperation &newOperation,
const QPoint &clickPoint = QPoint() );
365 void rotateToRespectingTerrain(
float pitch,
float yaw );
398 void onPositionChanged( Qt3DInput::QMouseEvent *mouse );
399 void onWheel( Qt3DInput::QWheelEvent *wheel );
400 void onMousePressed( Qt3DInput::QMouseEvent *mouse );
401 void onMouseReleased( Qt3DInput::QMouseEvent *mouse );
402 void applyFlyModeKeyMovements();
406 bool onKeyPressedFlyNavigation( QKeyEvent *event );
407 bool onKeyPressedTerrainNavigation( QKeyEvent *event );
408 bool onKeyPressedGlobeTerrainNavigation( QKeyEvent *event );
409 void onPositionChangedFlyNavigation( Qt3DInput::QMouseEvent *mouse );
410 void onPositionChangedTerrainNavigation( Qt3DInput::QMouseEvent *mouse );
411 void onPositionChangedGlobeTerrainNavigation( Qt3DInput::QMouseEvent *mouse );
413 void handleTerrainNavigationWheelZoom();
421 double sampleDepthBuffer(
int px,
int py );
424 double depthBufferNonVoidAverage();
428 bool screenPointToWorldPos( QPoint position,
double &depth, QVector3D &worldPosition );
438 Qt3DRender::QCamera *mCamera =
nullptr;
450 bool mDepthBufferIsReady =
false;
451 QImage mDepthBufferImage;
454 double mDepthBufferNonVoidAverage = -1;
456 std::unique_ptr<Qt3DRender::QCamera> mDepthBufferCamera;
458 std::unique_ptr<Qt3DRender::QCamera> mCameraBefore;
460 bool mRotationCenterCalculated =
false;
461 QVector3D mRotationCenter;
462 double mRotationDistanceFromCenter = 0;
463 float mRotationPitch = 0;
464 float mRotationYaw = 0;
466 bool mDragPointCalculated =
false;
467 QVector3D mDragPoint;
468 double mDragDepth = 0;
470 bool mZoomPointCalculated =
false;
471 QVector3D mZoomPoint;
477 Qt3DInput::QMouseHandler *mMouseHandler =
nullptr;
478 Qt3DInput::QKeyboardHandler *mKeyboardHandler =
nullptr;
479 bool mInputHandlersEnabled =
true;
482 double mCameraMovementSpeed = 5.0;
484 QSet<int> mDepressedKeys;
485 bool mCaptureFpsMouseMovements =
false;
486 bool mIgnoreNextMouseMove =
false;
487 QTimer *mFpsNavTimer =
nullptr;
489 double mCumulatedWheelY = 0;
491 MouseOperation mCurrentOperation = MouseOperation::None;
497 bool mCameraChanged =
false;