78 Qt3DRender::QCamera *
camera()
const {
return mCamera; }
97 void setCameraMovementSpeed(
double movementSpeed );
112 void frameTriggered(
float dt );
115 void resetView(
float distance );
118 void setViewFromTop(
float worldX,
float worldY,
float distance,
float yaw = 0 );
129 void setLookingAtPoint(
const QgsVector3D &point,
float distance,
float pitch,
float yaw );
141 void setLookingAtMapPoint(
const QgsVector3D &point,
float distance,
float pitch,
float yaw );
147 void setCameraPose(
const QgsCameraPose &camPose,
bool force =
false );
160 float distance()
const {
return mCameraPose.distanceFromCenterPoint(); }
167 float pitch()
const {
return mCameraPose.pitchAngle(); }
174 float yaw()
const {
return mCameraPose.headingAngle(); }
177 QDomElement writeXml( QDomDocument &doc )
const;
179 void readXml(
const QDomElement &elem,
QgsVector3D savedOrigin );
182 void zoom(
float factor );
184 void tiltUpAroundViewCenter(
float deltaPitch );
186 void rotateAroundViewCenter(
float deltaYaw );
188 void setCameraHeadingAngle(
float angle );
190 void moveView(
float tx,
float ty );
196 void walkView(
double tx,
double ty,
double tz );
204 void rotateCamera(
float diffPitch,
float diffYaw );
211 void rotateCameraAroundPivot(
float newPitch,
float newHeading,
const QVector3D &pivotPoint );
220 Q_DECL_DEPRECATED
void zoomCameraAroundPivot(
const QVector3D &oldCameraPosition,
double zoomFactor,
const QVector3D &pivotPoint )
SIP_DEPRECATED;
228 void zoomCameraAroundPivot(
const QVector3D &oldCameraPosition,
double oldDistanceFromCenterPoint,
double zoomFactor,
const QVector3D &pivotPoint );
234 bool keyboardEventFilter( QKeyEvent *event );
262 void globeMoveCenterPoint(
double latDiff,
double lonDiff );
269 void globeZoom(
float factor );
275 void globeUpdatePitchAngle(
float angleDiff );
281 void globeUpdateHeadingAngle(
float angleDiff );
288 void resetGlobe(
float distance,
double lat = 0,
double lon = 0 );
331 void depthBufferCaptured(
const QImage &depthImage );
337 void moveCenterPoint(
const QVector3D &posDiff );
346 double sampleDepthBuffer(
int px,
int py );
359 void updateOrthographicProjectionPlane();
361 void updateCameraFromPose();
363 QWindow *window()
const;
366 enum class MouseOperation
380 const QList<MouseOperation> mTranslateOrRotate = {
381 MouseOperation::Translation,
382 MouseOperation::RotationCamera,
383 MouseOperation::RotationCenter
388 bool isATranslationRotationSequence( MouseOperation newOperation )
const;
390 void setMouseParameters(
const MouseOperation &newOperation,
const QPoint &clickPoint = QPoint() );
397 void rotateToRespectingTerrain(
float pitch,
float yaw );
436 void onPositionChanged( Qt3DInput::QMouseEvent *mouse );
437 void onWheel( Qt3DInput::QWheelEvent *wheel );
438 void onMousePressed( Qt3DInput::QMouseEvent *mouse );
439 void onMouseReleased( Qt3DInput::QMouseEvent *mouse );
440 void applyFlyModeKeyMovements();
444 bool onKeyPressedFlyNavigation( QKeyEvent *event );
445 bool onKeyPressedTerrainNavigation( QKeyEvent *event );
446 bool onKeyPressedGlobeTerrainNavigation( QKeyEvent *event );
447 void onPositionChangedFlyNavigation( Qt3DInput::QMouseEvent *mouse );
448 void onPositionChangedTerrainNavigation( Qt3DInput::QMouseEvent *mouse );
449 void onPositionChangedGlobeTerrainNavigation( Qt3DInput::QMouseEvent *mouse );
451 void handleTerrainNavigationWheelZoom();
454 double depthBufferNonVoidAverage();
458 bool screenPointToWorldPos( QPoint position,
double &depth, QVector3D &worldPosition );
464 void applyRelativePointerRotation(
double dx,
double dy );
470 Qt3DRender::QCamera *mCamera =
nullptr;
482 bool mDepthBufferIsReady =
false;
483 QImage mDepthBufferImage;
486 double mDepthBufferNonVoidAverage = -1;
488 std::unique_ptr<Qt3DRender::QCamera> mDepthBufferCamera;
490 std::unique_ptr<Qt3DRender::QCamera> mCameraBefore;
492 bool mRotationCenterCalculated =
false;
493 QVector3D mRotationCenter;
494 double mRotationDistanceFromCenter = 0;
495 float mRotationPitch = 0;
496 float mRotationYaw = 0;
498 bool mDragPointCalculated =
false;
499 QVector3D mDragPoint;
500 double mDragDepth = 0;
502 bool mZoomPointCalculated =
false;
503 QVector3D mZoomPoint;
509 Qt3DInput::QMouseHandler *mMouseHandler =
nullptr;
510 Qt3DInput::QKeyboardHandler *mKeyboardHandler =
nullptr;
511 bool mInputHandlersEnabled =
true;
514 double mCameraMovementSpeed = 5.0;
516 QSet<int> mDepressedKeys;
517 bool mCaptureFpsMouseMovements =
false;
518 bool mIgnoreNextMouseMove =
false;
519 QTimer *mFpsNavTimer =
nullptr;
521 double mCumulatedWheelY = 0;
523 MouseOperation mCurrentOperation = MouseOperation::None;
529 bool mCameraChanged =
false;
531 QgsPointerLocker *mPointerLocker =
nullptr;