mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-12 00:06:54 -05:00
Change movement of Qgs3DMapToolPointCloudChangeAttributePolygon
Movement of camera is possible only before selection
This commit is contained in:
parent
ea2988f1f5
commit
231723e1c7
@ -36,32 +36,26 @@ Qgs3DMapToolPointCloudChangeAttributePolygon::~Qgs3DMapToolPointCloudChangeAttri
|
||||
|
||||
void Qgs3DMapToolPointCloudChangeAttributePolygon::mousePressEvent( QMouseEvent *event )
|
||||
{
|
||||
if ( !mIsMoving )
|
||||
{
|
||||
mClickPoint = event->pos();
|
||||
}
|
||||
mClickPoint = event->pos();
|
||||
}
|
||||
|
||||
void Qgs3DMapToolPointCloudChangeAttributePolygon::mouseMoveEvent( QMouseEvent *event )
|
||||
{
|
||||
if ( !mIsMoving )
|
||||
if ( mToolType != Polygon && mScreenPoints.size() == 2 )
|
||||
return;
|
||||
const QgsPoint movedPoint = Qgs3DUtils::screenPointToMapCoordinates( event->pos(), mCanvas->size(), mCanvas->cameraController(), mCanvas->mapSettings() );
|
||||
if ( mToolType == Polygon )
|
||||
{
|
||||
if ( mToolType != Polygon && mScreenPoints.size() == 2 )
|
||||
return;
|
||||
const QgsPoint movedPoint = Qgs3DUtils::screenPointToMapCoordinates( event->pos(), mCanvas->size(), mCanvas->cameraController(), mCanvas->mapSettings() );
|
||||
if ( mToolType == Polygon )
|
||||
mPolygonRubberBand->moveLastPoint( movedPoint );
|
||||
}
|
||||
else
|
||||
{
|
||||
mLineRubberBand->moveLastPoint( movedPoint );
|
||||
if ( !mPolygonRubberBand->isEmpty() )
|
||||
{
|
||||
mPolygonRubberBand->moveLastPoint( movedPoint );
|
||||
}
|
||||
else
|
||||
{
|
||||
mLineRubberBand->moveLastPoint( movedPoint );
|
||||
if ( !mPolygonRubberBand->isEmpty() )
|
||||
{
|
||||
mPolygonRubberBand->removeLastPoint();
|
||||
mPolygonRubberBand->moveLastPoint( Qgs3DUtils::screenPointToMapCoordinates( QPoint( event->x(), mToolType == AboveLinePolygon ? 0 : mCanvas->height() ), mCanvas->size(), mCanvas->cameraController(), mCanvas->mapSettings() ) );
|
||||
mPolygonRubberBand->addPoint( movedPoint );
|
||||
}
|
||||
mPolygonRubberBand->removeLastPoint();
|
||||
mPolygonRubberBand->moveLastPoint( Qgs3DUtils::screenPointToMapCoordinates( QPoint( event->x(), mToolType == AboveLinePolygon ? 0 : mCanvas->height() ), mCanvas->size(), mCanvas->cameraController(), mCanvas->mapSettings() ) );
|
||||
mPolygonRubberBand->addPoint( movedPoint );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -90,17 +84,11 @@ void Qgs3DMapToolPointCloudChangeAttributePolygon::keyPressEvent( QKeyEvent *eve
|
||||
{
|
||||
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 )
|
||||
{
|
||||
if ( ( event->pos() - mClickPoint ).manhattanLength() > QApplication::startDragDistance() || mIsMoving )
|
||||
if ( ( event->pos() - mClickPoint ).manhattanLength() > QApplication::startDragDistance() )
|
||||
return;
|
||||
|
||||
const QgsPoint newPoint = Qgs3DUtils::screenPointToMapCoordinates( event->pos(), mCanvas->size(), mCanvas->cameraController(), mCanvas->mapSettings() );
|
||||
|
||||
@ -28,19 +28,19 @@ class Qgs3DMapToolPointCloudChangeAttributePolygon : public Qgs3DMapToolPointClo
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/**
|
||||
/**
|
||||
* Tool types used by \a Qgs3DMapToolPolygon
|
||||
* \since QGIS 3.44
|
||||
*/
|
||||
enum ToolType
|
||||
{
|
||||
//! Polygon defined by vertices
|
||||
Polygon,
|
||||
//! Polygon defined by 2 vertices and canvas top edge
|
||||
AboveLinePolygon,
|
||||
//! Polygon defined by 2 vertices and canvas bottom edge
|
||||
BelowLinePolygon,
|
||||
};
|
||||
{
|
||||
//! Polygon defined by vertices
|
||||
Polygon,
|
||||
//! Polygon defined by 2 vertices and canvas top edge
|
||||
AboveLinePolygon,
|
||||
//! Polygon defined by 2 vertices and canvas bottom edge
|
||||
BelowLinePolygon,
|
||||
};
|
||||
Qgs3DMapToolPointCloudChangeAttributePolygon( Qgs3DMapCanvas *canvas, ToolType type );
|
||||
~Qgs3DMapToolPointCloudChangeAttributePolygon() override;
|
||||
|
||||
@ -61,7 +61,6 @@ class Qgs3DMapToolPointCloudChangeAttributePolygon : public Qgs3DMapToolPointClo
|
||||
QgsRubberBand3D *mPolygonRubberBand = nullptr;
|
||||
QgsRubberBand3D *mLineRubberBand = nullptr;
|
||||
QPoint mClickPoint;
|
||||
bool mIsMoving = false;
|
||||
ToolType mToolType;
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user