76 QVector3D from3DTo2DLabelPosition(
const QVector3D &sourcePos, Qt3DRender::QCamera *sourceCamera, Qt3DRender::QCamera *destCamera );
82 void onViewportScaleFactorChanged(
double scaleFactor );
90 bool handleEvent( QEvent *event );
95 void onAxisSettingsChanged();
99 void onCameraUpdate();
100 void onAxisViewportSizeUpdate();
103 void onTouchedByRay(
const Qt3DRender::QAbstractRayCaster::Hits &hits );
105 void onCameraViewChange(
float pitch,
float yaw );
107 void onCameraViewChangeHome() { onCameraViewChange( 45.0f, 45.0f ); }
108 void onCameraViewChangeTop() { onCameraViewChange( 0.0f, 90.0f ); }
109 void onCameraViewChangeNorth() { onCameraViewChange( 90.0f, 180.0f ); }
110 void onCameraViewChangeEast() { onCameraViewChange( 90.0f, 90.0f ); }
111 void onCameraViewChangeSouth() { onCameraViewChange( 90.0f, 0.0f ); }
112 void onCameraViewChangeWest() { onCameraViewChange( 90.0f, -90.0f ); }
113 void onCameraViewChangeBottom() { onCameraViewChange( 180.0f, 0.0f ); }
116 void createAxisScene();
117 void createAxis( Qt::Axis axis );
119 void setEnableCube(
bool show );
120 void setEnableAxis(
bool show );
121 void updateAxisLabelPosition();
122 void updateAxisLabelText( Qt3DExtras::QText2DEntity *textEntity,
const QString &text );
123 QFont createFont(
int pointSize );
125 void constructAxisScene( Qt3DCore::QEntity *parent3DScene );
126 void constructLabelsScene( Qt3DCore::QEntity *parent3DScene );
128 Qt3DExtras::QText2DEntity *addCubeText(
const QString &text,
float textHeight,
float textWidth,
const QFont &font,
const QMatrix4x4 &rotation,
const QVector3D &translation );
131 void init3DObjectPicking();
132 bool handleKeyEvent( QKeyEvent *keyEvent );
135 void displayMenuAt(
const QPoint &position );
142 float mCylinderLength = 40.0f;
146 Qt3DCore::QEntity *mAxisSceneEntity =
nullptr;
147 Qt3DRender::QCamera *mAxisCamera =
nullptr;
149 Qt3DCore::QEntity *mAxisRoot =
nullptr;
150 Qt3DCore::QEntity *mCubeRoot =
nullptr;
151 QList<Qt3DExtras::QText2DEntity *> mCubeLabels;
153 Qt3DExtras::QText2DEntity *mTextX =
nullptr;
154 Qt3DExtras::QText2DEntity *mTextY =
nullptr;
155 Qt3DExtras::QText2DEntity *mTextZ =
nullptr;
156 QVector3D mTextCoordX;
157 QVector3D mTextCoordY;
158 QVector3D mTextCoordZ;
159 Qt3DCore::QTransform *mTextTransformX =
nullptr;
160 Qt3DCore::QTransform *mTextTransformY =
nullptr;
161 Qt3DCore::QTransform *mTextTransformZ =
nullptr;
163 QVector3D mPreviousVector;
164 double mAxisScaleFactor = 1.0;
166 Qt3DRender::QCamera *mTwoDLabelCamera =
nullptr;
167 Qt3DCore::QEntity *mTwoDLabelSceneEntity =
nullptr;
170 Qt3DRender::QScreenRayCaster *mScreenRayCaster =
nullptr;
171 bool mIsDragging =
false;
172 bool mHasClicked =
false;
173 QPoint mLastClickedPos;
174 Qt::MouseButton mLastClickedButton;
175 QCursor mPreviousCursor = Qt::ArrowCursor;
176 Qt3DRender::QPickingSettings::PickMethod mDefaultPickingMethod;
177 QMenu *mMenu =
nullptr;