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 );
348 void updateOrthographicProjectionPlane();
350 void updateCameraFromPose();
352 QWindow *window()
const;
355 enum class MouseOperation
369 const QList<MouseOperation> mTranslateOrRotate = {
370 MouseOperation::Translation,
371 MouseOperation::RotationCamera,
372 MouseOperation::RotationCenter
377 bool isATranslationRotationSequence( MouseOperation newOperation )
const;
379 void setMouseParameters(
const MouseOperation &newOperation,
const QPoint &clickPoint = QPoint() );
386 void rotateToRespectingTerrain(
float pitch,
float yaw );
419 void onPositionChanged( Qt3DInput::QMouseEvent *mouse );
420 void onWheel( Qt3DInput::QWheelEvent *wheel );
421 void onMousePressed( Qt3DInput::QMouseEvent *mouse );
422 void onMouseReleased( Qt3DInput::QMouseEvent *mouse );
423 void applyFlyModeKeyMovements();
427 bool onKeyPressedFlyNavigation( QKeyEvent *event );
428 bool onKeyPressedTerrainNavigation( QKeyEvent *event );
429 bool onKeyPressedGlobeTerrainNavigation( QKeyEvent *event );
430 void onPositionChangedFlyNavigation( Qt3DInput::QMouseEvent *mouse );
431 void onPositionChangedTerrainNavigation( Qt3DInput::QMouseEvent *mouse );
432 void onPositionChangedGlobeTerrainNavigation( Qt3DInput::QMouseEvent *mouse );
434 void handleTerrainNavigationWheelZoom();
442 double sampleDepthBuffer(
int px,
int py );
445 double depthBufferNonVoidAverage();
449 bool screenPointToWorldPos( QPoint position,
double &depth, QVector3D &worldPosition );
459 Qt3DRender::QCamera *mCamera =
nullptr;
471 bool mDepthBufferIsReady =
false;
472 QImage mDepthBufferImage;
475 double mDepthBufferNonVoidAverage = -1;
477 std::unique_ptr<Qt3DRender::QCamera> mDepthBufferCamera;
479 std::unique_ptr<Qt3DRender::QCamera> mCameraBefore;
481 bool mRotationCenterCalculated =
false;
482 QVector3D mRotationCenter;
483 double mRotationDistanceFromCenter = 0;
484 float mRotationPitch = 0;
485 float mRotationYaw = 0;
487 bool mDragPointCalculated =
false;
488 QVector3D mDragPoint;
489 double mDragDepth = 0;
491 bool mZoomPointCalculated =
false;
492 QVector3D mZoomPoint;
498 Qt3DInput::QMouseHandler *mMouseHandler =
nullptr;
499 Qt3DInput::QKeyboardHandler *mKeyboardHandler =
nullptr;
500 bool mInputHandlersEnabled =
true;
503 double mCameraMovementSpeed = 5.0;
505 QSet<int> mDepressedKeys;
506 bool mCaptureFpsMouseMovements =
false;
507 bool mIgnoreNextMouseMove =
false;
508 QTimer *mFpsNavTimer =
nullptr;
510 double mCumulatedWheelY = 0;
512 MouseOperation mCurrentOperation = MouseOperation::None;
518 bool mCameraChanged =
false;