-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add possibility to shift origin of 3D map scenes #59468
Conversation
🪟 Windows buildsDownload Windows builds of this PR for testing. 🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. |
50ac9a6
to
4793118
Compare
@wonder-sk this is marked as a draft -- is it ready for a review as is? |
@nyalldawson yeah I think it is good for review now - originally I wanted to include automatic origin shifts in the PR, but it has already enough content on its own, so I would do the automatic shifts as a followup... |
This introduces a new class QgsGeoTransform (derived from QTransform) that keeps chunk's translation vector as a QgsVector3D (i.e. in double coordinates) and if there is a shift of the origin, 3D map scene and chunk entities react to it by adjusting the underlying QTransform.
4793118
to
b203813
Compare
@@ -513,7 +513,11 @@ void Qgs3DMapSettings::setOrigin( const QgsVector3D &origin ) | |||
{ | |||
QGIS_PROTECT_QOBJECT_THREAD_ACCESS | |||
|
|||
if ( origin == mOrigin ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QgsVector3D== operator uses double == comparison. I think we should change that to use qgsDoubleNear so that this early-exit path has greater chance of being hit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I quite like the idea of having exact comparison here - and we should rather try not to request any small origin shifts - e.g. skip origin rebase as long as the magnitude is less than 1000 or so - to avoid recalculation of transforms.
This introduces a new class QgsGeoTransform (derived from QTransform) that keeps chunk's translation vector as a QgsVector3D (i.e. in double coordinates) and if there is a shift of the origin, 3D map scene and chunk entities react to it by adjusting the underlying QTransform.