fix sip and add Nyall suggestions

This commit is contained in:
Belgacem 2021-01-12 02:58:54 +01:00 committed by Martin Dobias
parent 6caf1bfe32
commit fa7e3d4f7d
8 changed files with 81 additions and 15 deletions

View File

@ -0,0 +1,74 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geometry/qgsray3d.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsRay3D
{
%Docstring
A representation of a ray in 3D.
A ray is composed of an origin point (the start of the ray) and a direction vector.
.. versionadded:: 3.18
%End
%TypeHeaderCode
#include "qgsray3d.h"
%End
public:
QgsRay3D( const QVector3D &origin, const QVector3D &direction );
%Docstring
Constructor
%End
QVector3D origin() const;
%Docstring
Returns the origin of the ray
%End
QVector3D direction() const;
%Docstring
Returns the direction of the ray
%End
void setOrigin( const QVector3D &origin );
%Docstring
Sets the origin of the ray
%End
void setDirection( const QVector3D direction );
%Docstring
Sets the direction of the ray
%End
QVector3D projectedPoint( const QVector3D &point ) const;
%Docstring
Returns the projection of the point on the ray
(which is the closest point of the ray to ``point``)
%End
bool intersectsWith( const QgsBox3d &box ) const;
%Docstring
Checks whether the ray intersects with ``box``
%End
bool isInFront( const QVector3D &point ) const;
%Docstring
Checks whether the point is in front of the ray
%End
double angleToPoint( const QVector3D &point ) const;
%Docstring
Returns the angle between the ray and the vector from the ray's origin and the point ``point``
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geometry/qgsray3d.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -316,6 +316,7 @@
%Include auto_generated/geometry/qgstriangle.sip
%Include auto_generated/geometry/qgswkbptr.sip
%Include auto_generated/geometry/qgswkbtypes.sip
%Include auto_generated/geometry/qgsray3d.sip
%Include auto_generated/gps/qgsgpsconnection.sip
%Include auto_generated/gps/qgsgpsdconnection.sip
%Include auto_generated/gps/qgsgpsdetector.sip

View File

@ -130,16 +130,6 @@ Returns a pointer to the identify menu which will be used in layer selection mod
this menu can also be customized
%End
static void fromPointCloudIdentificationToIdentifyResults( QgsPointCloudLayer *layer, const QVector<QVariantMap> &identified, QList<QgsMapToolIdentify::IdentifyResult> &results );
%Docstring
Converts point cloud identification results from variant maps to QgsMapToolIdentify.IdentifyResult and apply some formatting
.. note::
: the converted variant maps are pushed at the back of ``results`` without cleaning what's in it previously
.. versionadded:: 3.18
%End
public slots:
void formatChanged( QgsRasterLayer *layer );

View File

@ -1120,12 +1120,12 @@ void Qgs3DMapScene::identifyPointCloudOnRay( QVector<QPair<QgsMapLayer *, QVecto
{
if ( layer->type() != QgsMapLayerType::PointCloudLayer )
continue;
if ( QgsPointCloudLayer *pc = dynamic_cast<QgsPointCloudLayer *>( layer ) )
if ( QgsPointCloudLayer *pc = qobject_cast<QgsPointCloudLayer *>( layer ) )
{
QgsPointCloudLayer3DRenderer *renderer = dynamic_cast<QgsPointCloudLayer3DRenderer *>( pc->renderer3D() );
const QgsPointCloud3DSymbol *symbol = renderer->symbol();
// Symbol can be null in case of no rendering enabled
if ( symbol == nullptr )
if ( !symbol )
continue;
double maxScreenError = renderer->maximumScreenError();
double pointSize = symbol->pointSize();

View File

@ -98,7 +98,7 @@ void Qgs3DMapToolIdentify::mouseReleaseEvent( QMouseEvent *event )
QList<QgsMapToolIdentify::IdentifyResult> identifyResults;
for ( int i = 0; i < layerPoints.size(); ++i )
{
QgsPointCloudLayer *pcLayer = dynamic_cast< QgsPointCloudLayer * >( layerPoints[i].first );
QgsPointCloudLayer *pcLayer = qobject_cast< QgsPointCloudLayer * >( layerPoints[i].first );
QgsMapToolIdentify::fromPointCloudIdentificationToIdentifyResults( pcLayer, layerPoints[i].second, identifyResults );
}

View File

@ -30,6 +30,7 @@
class CORE_EXPORT QgsRay3D
{
public:
//! Constructor
QgsRay3D( const QVector3D &origin, const QVector3D &direction );
//! Returns the origin of the ray

View File

@ -457,7 +457,7 @@ QVector<QVariantMap> QgsPointCloudDataProvider::getPointsOnRay( const QgsRay3D &
pointAttr[ QStringLiteral( "X" ) ] = x;
pointAttr[ QStringLiteral( "Y" ) ] = y;
pointAttr[ QStringLiteral( "Z" ) ] = z;
pointAttr[ QStringLiteral( "Distance to camera" ) ] = ( point - ray.origin() ).length();
pointAttr[ tr( "Distance to camera" ) ] = ( point - ray.origin() ).length();
points.push_back( pointAttr );
}
}

View File

@ -152,7 +152,7 @@ class GUI_EXPORT QgsMapToolIdentify : public QgsMapTool
* \note : the converted variant maps are pushed at the back of \a results without cleaning what's in it previously
* \since QGIS 3.18
*/
static void fromPointCloudIdentificationToIdentifyResults( QgsPointCloudLayer *layer, const QVector<QVariantMap> &identified, QList<QgsMapToolIdentify::IdentifyResult> &results );
static void fromPointCloudIdentificationToIdentifyResults( QgsPointCloudLayer *layer, const QVector<QVariantMap> &identified, QList<QgsMapToolIdentify::IdentifyResult> &results ) SIP_SKIP;
public slots:
void formatChanged( QgsRasterLayer *layer );