Change movement of Qgs3DMapToolPointCloudChangeAttributePolygon

Movement of camera is possible only before selection
This commit is contained in:
Withalion 2025-03-06 10:50:35 +01:00 committed by Martin Dobias
parent ea2988f1f5
commit 231723e1c7
2 changed files with 24 additions and 37 deletions

View File

@ -35,16 +35,11 @@ Qgs3DMapToolPointCloudChangeAttributePolygon::Qgs3DMapToolPointCloudChangeAttrib
Qgs3DMapToolPointCloudChangeAttributePolygon::~Qgs3DMapToolPointCloudChangeAttributePolygon() = default; Qgs3DMapToolPointCloudChangeAttributePolygon::~Qgs3DMapToolPointCloudChangeAttributePolygon() = default;
void Qgs3DMapToolPointCloudChangeAttributePolygon::mousePressEvent( QMouseEvent *event ) void Qgs3DMapToolPointCloudChangeAttributePolygon::mousePressEvent( QMouseEvent *event )
{
if ( !mIsMoving )
{ {
mClickPoint = event->pos(); mClickPoint = event->pos();
} }
}
void Qgs3DMapToolPointCloudChangeAttributePolygon::mouseMoveEvent( QMouseEvent *event ) void Qgs3DMapToolPointCloudChangeAttributePolygon::mouseMoveEvent( QMouseEvent *event )
{
if ( !mIsMoving )
{ {
if ( mToolType != Polygon && mScreenPoints.size() == 2 ) if ( mToolType != Polygon && mScreenPoints.size() == 2 )
return; return;
@ -64,7 +59,6 @@ void Qgs3DMapToolPointCloudChangeAttributePolygon::mouseMoveEvent( QMouseEvent *
} }
} }
} }
}
void Qgs3DMapToolPointCloudChangeAttributePolygon::keyPressEvent( QKeyEvent *event ) void Qgs3DMapToolPointCloudChangeAttributePolygon::keyPressEvent( QKeyEvent *event )
{ {
@ -90,17 +84,11 @@ void Qgs3DMapToolPointCloudChangeAttributePolygon::keyPressEvent( QKeyEvent *eve
{ {
restart(); restart();
} }
else if ( event->key() == Qt::Key_Space )
{
const bool newState = !mCanvas->cameraController()->hasInputHandlersEnabled();
mCanvas->cameraController()->setInputHandlersEnabled( newState );
mIsMoving = newState;
}
} }
void Qgs3DMapToolPointCloudChangeAttributePolygon::mouseReleaseEvent( QMouseEvent *event ) void Qgs3DMapToolPointCloudChangeAttributePolygon::mouseReleaseEvent( QMouseEvent *event )
{ {
if ( ( event->pos() - mClickPoint ).manhattanLength() > QApplication::startDragDistance() || mIsMoving ) if ( ( event->pos() - mClickPoint ).manhattanLength() > QApplication::startDragDistance() )
return; return;
const QgsPoint newPoint = Qgs3DUtils::screenPointToMapCoordinates( event->pos(), mCanvas->size(), mCanvas->cameraController(), mCanvas->mapSettings() ); const QgsPoint newPoint = Qgs3DUtils::screenPointToMapCoordinates( event->pos(), mCanvas->size(), mCanvas->cameraController(), mCanvas->mapSettings() );

View File

@ -61,7 +61,6 @@ class Qgs3DMapToolPointCloudChangeAttributePolygon : public Qgs3DMapToolPointClo
QgsRubberBand3D *mPolygonRubberBand = nullptr; QgsRubberBand3D *mPolygonRubberBand = nullptr;
QgsRubberBand3D *mLineRubberBand = nullptr; QgsRubberBand3D *mLineRubberBand = nullptr;
QPoint mClickPoint; QPoint mClickPoint;
bool mIsMoving = false;
ToolType mToolType; ToolType mToolType;
}; };