77 Qt3DRender::QCamera *
camera()
const {
return mCamera; }
96 void setCameraMovementSpeed(
double movementSpeed );
111 void frameTriggered(
float dt );
114 void resetView(
float distance );
117 void setViewFromTop(
float worldX,
float worldY,
float distance,
float yaw = 0 );
128 void setLookingAtPoint(
const QgsVector3D &point,
float distance,
float pitch,
float yaw );
140 void setLookingAtMapPoint(
const QgsVector3D &point,
float distance,
float pitch,
float yaw );
146 void setCameraPose(
const QgsCameraPose &camPose,
bool force =
false );
159 float distance()
const {
return mCameraPose.distanceFromCenterPoint(); }
166 float pitch()
const {
return mCameraPose.pitchAngle(); }
173 float yaw()
const {
return mCameraPose.headingAngle(); }
176 QDomElement writeXml( QDomDocument &doc )
const;
178 void readXml(
const QDomElement &elem,
QgsVector3D savedOrigin );
181 void zoom(
float factor );
183 void tiltUpAroundViewCenter(
float deltaPitch );
185 void rotateAroundViewCenter(
float deltaYaw );
187 void setCameraHeadingAngle(
float angle );
189 void moveView(
float tx,
float ty );
195 void walkView(
double tx,
double ty,
double tz );
203 void rotateCamera(
float diffPitch,
float diffYaw );
210 void rotateCameraAroundPivot(
float newPitch,
float newHeading,
const QVector3D &pivotPoint );
219 Q_DECL_DEPRECATED
void zoomCameraAroundPivot(
const QVector3D &oldCameraPosition,
double zoomFactor,
const QVector3D &pivotPoint )
SIP_DEPRECATED;
227 void zoomCameraAroundPivot(
const QVector3D &oldCameraPosition,
double oldDistanceFromCenterPoint,
double zoomFactor,
const QVector3D &pivotPoint );
233 bool keyboardEventFilter( QKeyEvent *event );
261 void globeMoveCenterPoint(
double latDiff,
double lonDiff );
268 void globeZoom(
float factor );
274 void globeUpdatePitchAngle(
float angleDiff );
280 void globeUpdateHeadingAngle(
float angleDiff );
287 void resetGlobe(
float distance,
double lat = 0,
double lon = 0 );
330 void depthBufferCaptured(
const QImage &depthImage );
336 void moveCenterPoint(
const QVector3D &posDiff );
345 double sampleDepthBuffer(
int px,
int py );
358 void updateOrthographicProjectionPlane();
360 void updateCameraFromPose();
362 QWindow *window()
const;
365 enum class MouseOperation
379 const QList<MouseOperation> mTranslateOrRotate = {
380 MouseOperation::Translation,
381 MouseOperation::RotationCamera,
382 MouseOperation::RotationCenter
387 bool isATranslationRotationSequence( MouseOperation newOperation )
const;
389 void setMouseParameters(
const MouseOperation &newOperation,
const QPoint &clickPoint = QPoint() );
396 void rotateToRespectingTerrain(
float pitch,
float yaw );
435 void onPositionChanged( Qt3DInput::QMouseEvent *mouse );
436 void onWheel( Qt3DInput::QWheelEvent *wheel );
437 void onMousePressed( Qt3DInput::QMouseEvent *mouse );
438 void onMouseReleased( Qt3DInput::QMouseEvent *mouse );
439 void applyFlyModeKeyMovements();
443 bool onKeyPressedFlyNavigation( QKeyEvent *event );
444 bool onKeyPressedTerrainNavigation( QKeyEvent *event );
445 bool onKeyPressedGlobeTerrainNavigation( QKeyEvent *event );
446 void onPositionChangedFlyNavigation( Qt3DInput::QMouseEvent *mouse );
447 void onPositionChangedTerrainNavigation( Qt3DInput::QMouseEvent *mouse );
448 void onPositionChangedGlobeTerrainNavigation( Qt3DInput::QMouseEvent *mouse );
450 void handleTerrainNavigationWheelZoom();
453 double depthBufferNonVoidAverage();
457 bool screenPointToWorldPos( QPoint position,
double &depth, QVector3D &worldPosition );
467 Qt3DRender::QCamera *mCamera =
nullptr;
479 bool mDepthBufferIsReady =
false;
480 QImage mDepthBufferImage;
483 double mDepthBufferNonVoidAverage = -1;
485 std::unique_ptr<Qt3DRender::QCamera> mDepthBufferCamera;
487 std::unique_ptr<Qt3DRender::QCamera> mCameraBefore;
489 bool mRotationCenterCalculated =
false;
490 QVector3D mRotationCenter;
491 double mRotationDistanceFromCenter = 0;
492 float mRotationPitch = 0;
493 float mRotationYaw = 0;
495 bool mDragPointCalculated =
false;
496 QVector3D mDragPoint;
497 double mDragDepth = 0;
499 bool mZoomPointCalculated =
false;
500 QVector3D mZoomPoint;
506 Qt3DInput::QMouseHandler *mMouseHandler =
nullptr;
507 Qt3DInput::QKeyboardHandler *mKeyboardHandler =
nullptr;
508 bool mInputHandlersEnabled =
true;
511 double mCameraMovementSpeed = 5.0;
513 QSet<int> mDepressedKeys;
514 bool mCaptureFpsMouseMovements =
false;
515 bool mIgnoreNextMouseMove =
false;
516 QTimer *mFpsNavTimer =
nullptr;
518 double mCumulatedWheelY = 0;
520 MouseOperation mCurrentOperation = MouseOperation::None;
526 bool mCameraChanged =
false;