Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Jan 13, 2021
1 parent d136c3e commit 398144e
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 9 deletions.
Expand Up @@ -88,7 +88,7 @@ the number of points returned to ``pointsLimit`` points
}
}
%End
QVector<IndexedPointCloudNode> getNodesIntersectingWithRay( const QgsPointCloudIndex *pc, IndexedPointCloudNode n, double maxError, double nodeError, double cameraFov, int screenSizePx, const QVector3D &rayOrigin, const QVector3D &rayDirection );


virtual QgsPointCloudDataProvider::Capabilities capabilities() const;
%Docstring
Expand Down
6 changes: 6 additions & 0 deletions src/3d/qgs3dmapscene.h
Expand Up @@ -122,6 +122,12 @@ class _3D_EXPORT Qgs3DMapScene : public Qt3DCore::QEntity
//! Exports the scene according to the scene export settings
void exportScene( const Qgs3DMapExportSettings &exportSettings );

/**
* Identifies the points that are positioned on the ray specified in world coordinates as a point \a rayOrigin and direction \a rayDirection
* for every point cloud layer and returns the identified points in \a selectedPoints vector
*
* \since QGIS 3.18
*/
void identifyPointCloudOnRay( QVector<QPair<QgsMapLayer *, QVector<QVariantMap>>> &selectedPoints, const QVector3D &rayOrigin, const QVector3D &rayDirection );

signals:
Expand Down
2 changes: 1 addition & 1 deletion src/app/3d/qgs3dmapcanvas.cpp
Expand Up @@ -254,7 +254,7 @@ void Qgs3DMapCanvas::updateTemporalRange( const QgsDateTimeRange &temporalrange
mScene->updateTemporal();
}

bool Qgs3DMapCanvas::identifyPointCloudOnMouseEvent( QVector<QPair<QgsMapLayer *, QVector<QVariantMap>>> &result, QMouseEvent *event )
void Qgs3DMapCanvas::identifyPointCloudOnMouseEvent( QVector<QPair<QgsMapLayer *, QVector<QVariantMap>>> &result, QMouseEvent *event )
{
QVector3D deviceCoords( event->x(), event->y(), 0.0 );
QSize windowSize = mEngine->size();
Expand Down
9 changes: 6 additions & 3 deletions src/app/3d/qgs3dmapcanvas.h
Expand Up @@ -86,8 +86,12 @@ class Qgs3DMapCanvas : public QWidget
*/
void setTemporalController( QgsTemporalController *temporalController );

//
bool identifyPointCloudOnMouseEvent( QVector<QPair<QgsMapLayer *, QVector<QVariantMap>>> &result, QMouseEvent *event );
/**
* Identifies point cloud using mouse event
*
* \since QGIS 3.18
*/
void identifyPointCloudOnMouseEvent( QVector<QPair<QgsMapLayer *, QVector<QVariantMap>>> &result, QMouseEvent *event );

signals:
//! Emitted when the 3D map canvas was successfully saved as image
Expand All @@ -100,7 +104,6 @@ class Qgs3DMapCanvas : public QWidget
void fpsCountChanged( float fpsCount );
//! Emitted when the FPS counter is enabled or disabeld
void fpsCounterEnabledChanged( bool enabled );
public slots:
private slots:
void updateTemporalRange( const QgsDateTimeRange &timeRange );

Expand Down
1 change: 1 addition & 0 deletions src/app/3d/qgs3dmaptoolidentify.cpp
Expand Up @@ -85,6 +85,7 @@ void Qgs3DMapToolIdentify::mouseReleaseEvent( QMouseEvent *event )
if ( event->button() != Qt::MouseButton::LeftButton )
return;

// point cloud identification
QVector<QPair<QgsMapLayer *, QVector<QVariantMap>>> layerPoints;
canvas()->identifyPointCloudOnMouseEvent( layerPoints, event );

Expand Down
4 changes: 2 additions & 2 deletions src/core/pointcloud/qgspointclouddataprovider.cpp
Expand Up @@ -409,9 +409,9 @@ QVector<IndexedPointCloudNode> QgsPointCloudDataProvider::traverseTree(
return nodes;
}

QVector<QMap<QString, QVariant>> QgsPointCloudDataProvider::getPointsOnRay( const QVector3D &rayOrigin, const QVector3D &rayDirection, double maxScreenError, double cameraFov, int screenSizePx, double pointAngle )
QVector<QVariantMap> QgsPointCloudDataProvider::getPointsOnRay( const QVector3D &rayOrigin, const QVector3D &rayDirection, double maxScreenError, double cameraFov, int screenSizePx, double pointAngle )
{
QVector<QMap<QString, QVariant>> points;
QVector<QVariantMap> points;
QgsPointCloudIndex *index = this->index();
IndexedPointCloudNode root = index->root();
QgsRectangle rootNodeExtentMapCoords = index->nodeMapExtent( root );
Expand Down
18 changes: 16 additions & 2 deletions src/core/pointcloud/qgspointclouddataprovider.h
Expand Up @@ -121,8 +121,21 @@ class CORE_EXPORT QgsPointCloudDataProvider: public QgsDataProvider
}
% End
#endif
QVector<QMap<QString, QVariant>> getPointsOnRay( const QVector3D &rayOrigin, const QVector3D &rayDirection, double maxScreenError, double cameraFov, int screenSizePx, double pointAngle ) SIP_SKIP;
QVector<IndexedPointCloudNode> getNodesIntersectingWithRay( const QgsPointCloudIndex *pc, IndexedPointCloudNode n, double maxError, double nodeError, double cameraFov, int screenSizePx, const QVector3D &rayOrigin, const QVector3D &rayDirection );

/**
* Returns the Points that are on a ray
*
* \param rayOrigin : The origin of the ray in layer coordinates
* \param rayDirection : The direction of the ray in layer coordinates
* \param maxScreenError : Maximum screen error (as taken from the 3D point cloud layer renderer)
* \param cameraFov : The field of view of the camera in degrees
* \param screenSizePx : The size of the screen's viewport in pixels
* \param pointAngle : the maximum accepted angle between the point and it's projected point on the ray in degrees
* \return a vector of the identified points
*
* \since QGIS 3.18
*/
QVector<QVariantMap> getPointsOnRay( const QVector3D &rayOrigin, const QVector3D &rayDirection, double maxScreenError, double cameraFov, int screenSizePx, double pointAngle ) SIP_SKIP;

/**
* Returns flags containing the supported capabilities for the data provider.
Expand Down Expand Up @@ -346,6 +359,7 @@ class CORE_EXPORT QgsPointCloudDataProvider: public QgsDataProvider

private:
QVector<IndexedPointCloudNode> traverseTree( const QgsPointCloudIndex *pc, IndexedPointCloudNode n, double maxError, double nodeError, const QgsGeometry &extentGeometry, const QgsDoubleRange &extentZRange );
QVector<IndexedPointCloudNode> getNodesIntersectingWithRay( const QgsPointCloudIndex *pc, IndexedPointCloudNode n, double maxError, double nodeError, double cameraFov, int screenSizePx, const QVector3D &rayOrigin, const QVector3D &rayDirection );
};

#endif // QGSMESHDATAPROVIDER_H

0 comments on commit 398144e

Please sign in to comment.