Skip to content

Commit

Permalink
rename vars, remove colons, use QgsPointXY, const
Browse files Browse the repository at this point in the history
  • Loading branch information
uclaros committed Jan 16, 2025
1 parent 5323bc8 commit d665c3e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/app/3d/qgs3dmapcanvaswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ Qgs3DMapCanvasWidget::Qgs3DMapCanvasWidget( const QString &name, bool isDocked )
QAction *actionPointCloudChangeAttributeTool = mEditingToolBar->addAction( QIcon( QgsApplication::iconPath( "mActionSelectPolygon.svg" ) ), tr( "Change Point Cloud Attribute" ), this, &Qgs3DMapCanvasWidget::changePointCloudAttribute );
actionPointCloudChangeAttributeTool->setCheckable( true );

mEditingToolBar->addWidget( new QLabel( tr( "Attribute:" ) ) );
mEditingToolBar->addWidget( new QLabel( tr( "Attribute" ) ) );
mCboChangeAttribute = new QComboBox();
mEditingToolBar->addWidget( mCboChangeAttribute );
mSpinChangeAttributeValue = new QgsDoubleSpinBox();
mEditingToolBar->addWidget( new QLabel( tr( "Value:" ) ) );
mEditingToolBar->addWidget( new QLabel( tr( "Value" ) ) );
mEditingToolBar->addWidget( mSpinChangeAttributeValue );
QAction *actionEditingToolbar = toolBar->addAction( QIcon( QgsApplication::iconPath( "mIconPointCloudLayer.svg" ) ), tr( "Show Editing Toolbar" ), this, [this] { mEditingToolBar->setVisible( !mEditingToolBar->isVisible() ); } );
actionEditingToolbar->setCheckable( true );
Expand Down
10 changes: 5 additions & 5 deletions src/app/3d/qgs3dmaptoolpointcloudchangeattribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void Qgs3DMapToolPointCloudChangeAttribute::mouseReleaseEvent( QMouseEvent *even
if ( ( event->pos() - mClickPoint ).manhattanLength() > QApplication::startDragDistance() )
return;

QgsPoint newPoint = screenPointToMap( event->pos() );
const QgsPoint newPoint = screenPointToMap( event->pos() );

if ( event->button() == Qt::LeftButton )
{
Expand All @@ -89,7 +89,7 @@ void Qgs3DMapToolPointCloudChangeAttribute::mouseReleaseEvent( QMouseEvent *even
mCanvas->cameraController()->setInputHandlersEnabled( false );
}
mPolygonRubberBand->addPoint( newPoint );
mScreenPoints.append( QgsPoint( event->x(), event->y() ) );
mScreenPoints.append( QgsPointXY( event->x(), event->y() ) );
}
else if ( event->button() == Qt::RightButton )
{
Expand Down Expand Up @@ -160,11 +160,11 @@ QgsPoint Qgs3DMapToolPointCloudChangeAttribute::screenPointToMap( const QPoint &

// pick an arbitrary point mid-way between near and far plane
const float pointDistance = ( mCanvas->cameraController()->camera()->farPlane() + mCanvas->cameraController()->camera()->nearPlane() ) / 2;
const QVector3D aa = ray.origin() + pointDistance * ray.direction().normalized();
const QVector3D pointWorld = ray.origin() + pointDistance * ray.direction().normalized();

const QgsVector3D origin = mCanvas->mapSettings()->origin();
const QgsPoint newPoint( aa.x() + origin.x(), aa.y() + origin.y(), aa.z() + origin.z() );
return newPoint;
const QgsPoint pointMap( pointWorld.x() + origin.x(), pointWorld.y() + origin.y(), pointWorld.z() + origin.z() );
return pointMap;
}

QgsGeometry Qgs3DMapToolPointCloudChangeAttribute::box3DToPolygonInScreenSpace( QgsBox3D box, const MapToPixel3D &mapToPixel3D )
Expand Down

0 comments on commit d665c3e

Please sign in to comment.