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 );
344 void updateCameraFromPose();
346 QWindow *window()
const;
349 enum class MouseOperation
363 const QList<MouseOperation> mTranslateOrRotate = {
364 MouseOperation::Translation,
365 MouseOperation::RotationCamera,
366 MouseOperation::RotationCenter
371 bool isATranslationRotationSequence( MouseOperation newOperation )
const;
373 void setMouseParameters(
const MouseOperation &newOperation,
const QPoint &clickPoint = QPoint() );
380 void rotateToRespectingTerrain(
float pitch,
float yaw );
413 void onPositionChanged( Qt3DInput::QMouseEvent *mouse );
414 void onWheel( Qt3DInput::QWheelEvent *wheel );
415 void onMousePressed( Qt3DInput::QMouseEvent *mouse );
416 void onMouseReleased( Qt3DInput::QMouseEvent *mouse );
417 void applyFlyModeKeyMovements();
421 bool onKeyPressedFlyNavigation( QKeyEvent *event );
422 bool onKeyPressedTerrainNavigation( QKeyEvent *event );
423 bool onKeyPressedGlobeTerrainNavigation( QKeyEvent *event );
424 void onPositionChangedFlyNavigation( Qt3DInput::QMouseEvent *mouse );
425 void onPositionChangedTerrainNavigation( Qt3DInput::QMouseEvent *mouse );
426 void onPositionChangedGlobeTerrainNavigation( Qt3DInput::QMouseEvent *mouse );
428 void handleTerrainNavigationWheelZoom();
436 double sampleDepthBuffer(
int px,
int py );
439 double depthBufferNonVoidAverage();
443 bool screenPointToWorldPos( QPoint position,
double &depth, QVector3D &worldPosition );
453 Qt3DRender::QCamera *mCamera =
nullptr;
465 bool mDepthBufferIsReady =
false;
466 QImage mDepthBufferImage;
469 double mDepthBufferNonVoidAverage = -1;
471 std::unique_ptr<Qt3DRender::QCamera> mDepthBufferCamera;
473 std::unique_ptr<Qt3DRender::QCamera> mCameraBefore;
475 bool mRotationCenterCalculated =
false;
476 QVector3D mRotationCenter;
477 double mRotationDistanceFromCenter = 0;
478 float mRotationPitch = 0;
479 float mRotationYaw = 0;
481 bool mDragPointCalculated =
false;
482 QVector3D mDragPoint;
483 double mDragDepth = 0;
485 bool mZoomPointCalculated =
false;
486 QVector3D mZoomPoint;
492 Qt3DInput::QMouseHandler *mMouseHandler =
nullptr;
493 Qt3DInput::QKeyboardHandler *mKeyboardHandler =
nullptr;
494 bool mInputHandlersEnabled =
true;
497 double mCameraMovementSpeed = 5.0;
499 QSet<int> mDepressedKeys;
500 bool mCaptureFpsMouseMovements =
false;
501 bool mIgnoreNextMouseMove =
false;
502 QTimer *mFpsNavTimer =
nullptr;
504 double mCumulatedWheelY = 0;
506 MouseOperation mCurrentOperation = MouseOperation::None;
512 bool mCameraChanged =
false;