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 )
|
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 )
|
||||||
|
return;
|
||||||
|
const QgsPoint movedPoint = Qgs3DUtils::screenPointToMapCoordinates( event->pos(), mCanvas->size(), mCanvas->cameraController(), mCanvas->mapSettings() );
|
||||||
|
if ( mToolType == Polygon )
|
||||||
{
|
{
|
||||||
if ( mToolType != Polygon && mScreenPoints.size() == 2 )
|
mPolygonRubberBand->moveLastPoint( movedPoint );
|
||||||
return;
|
}
|
||||||
const QgsPoint movedPoint = Qgs3DUtils::screenPointToMapCoordinates( event->pos(), mCanvas->size(), mCanvas->cameraController(), mCanvas->mapSettings() );
|
else
|
||||||
if ( mToolType == Polygon )
|
{
|
||||||
|
mLineRubberBand->moveLastPoint( movedPoint );
|
||||||
|
if ( !mPolygonRubberBand->isEmpty() )
|
||||||
{
|
{
|
||||||
mPolygonRubberBand->moveLastPoint( movedPoint );
|
mPolygonRubberBand->removeLastPoint();
|
||||||
}
|
mPolygonRubberBand->moveLastPoint( Qgs3DUtils::screenPointToMapCoordinates( QPoint( event->x(), mToolType == AboveLinePolygon ? 0 : mCanvas->height() ), mCanvas->size(), mCanvas->cameraController(), mCanvas->mapSettings() ) );
|
||||||
else
|
mPolygonRubberBand->addPoint( movedPoint );
|
||||||
{
|
|
||||||
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 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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() );
|
||||||
|
|||||||
@ -28,19 +28,19 @@ class Qgs3DMapToolPointCloudChangeAttributePolygon : public Qgs3DMapToolPointClo
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Tool types used by \a Qgs3DMapToolPolygon
|
* Tool types used by \a Qgs3DMapToolPolygon
|
||||||
* \since QGIS 3.44
|
* \since QGIS 3.44
|
||||||
*/
|
*/
|
||||||
enum ToolType
|
enum ToolType
|
||||||
{
|
{
|
||||||
//! Polygon defined by vertices
|
//! Polygon defined by vertices
|
||||||
Polygon,
|
Polygon,
|
||||||
//! Polygon defined by 2 vertices and canvas top edge
|
//! Polygon defined by 2 vertices and canvas top edge
|
||||||
AboveLinePolygon,
|
AboveLinePolygon,
|
||||||
//! Polygon defined by 2 vertices and canvas bottom edge
|
//! Polygon defined by 2 vertices and canvas bottom edge
|
||||||
BelowLinePolygon,
|
BelowLinePolygon,
|
||||||
};
|
};
|
||||||
Qgs3DMapToolPointCloudChangeAttributePolygon( Qgs3DMapCanvas *canvas, ToolType type );
|
Qgs3DMapToolPointCloudChangeAttributePolygon( Qgs3DMapCanvas *canvas, ToolType type );
|
||||||
~Qgs3DMapToolPointCloudChangeAttributePolygon() override;
|
~Qgs3DMapToolPointCloudChangeAttributePolygon() override;
|
||||||
|
|
||||||
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user