Skip to content

Commit

Permalink
fix sip and add Nyall suggestions
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 6caf1bf commit fa7e3d4
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 15 deletions.
74 changes: 74 additions & 0 deletions python/core/auto_generated/geometry/qgsray3d.sip.in
@@ -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 *
************************************************************************/
1 change: 1 addition & 0 deletions python/core/core_auto.sip
Expand Up @@ -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
Expand Down
10 changes: 0 additions & 10 deletions python/gui/auto_generated/qgsmaptoolidentify.sip.in
Expand Up @@ -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 );
Expand Down
4 changes: 2 additions & 2 deletions src/3d/qgs3dmapscene.cpp
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/app/3d/qgs3dmaptoolidentify.cpp
Expand Up @@ -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 );
}

Expand Down
1 change: 1 addition & 0 deletions src/core/geometry/qgsray3d.h
Expand Up @@ -30,6 +30,7 @@
class CORE_EXPORT QgsRay3D
{
public:
//! Constructor
QgsRay3D( const QVector3D &origin, const QVector3D &direction );

//! Returns the origin of the ray
Expand Down
2 changes: 1 addition & 1 deletion src/core/pointcloud/qgspointclouddataprovider.cpp
Expand Up @@ -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 );
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmaptoolidentify.h
Expand Up @@ -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 );
Expand Down

0 comments on commit fa7e3d4

Please sign in to comment.