Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3d] Do not include private header from public header #57295

Merged
merged 2 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/3d/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ set(QGIS_3D_SRCS
qgsimagetexture.cpp
qgslayoutitem3dmap.cpp
qgsoffscreen3dengine.cpp
qgsraycastingutils_p.cpp
qgsraycastingutils.cpp
qgsrulebased3drenderer.cpp
qgsrulebasedchunkloader_p.cpp
qgstessellatedpolygongeometry.cpp
Expand Down Expand Up @@ -131,6 +131,7 @@ set(QGIS_3D_HDRS
qgslayoutitem3dmap.h
qgsmeshlayer3drenderer.h
qgsoffscreen3dengine.h
qgsraycastingutils.h
qgsrulebased3drenderer.h
qgstessellatedpolygongeometry.h
qgstiledscenechunkloader_p.h
Expand Down
2 changes: 1 addition & 1 deletion src/3d/qgs3dutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace Qt3DExtras
#include "qgs3dtypes.h"
#include "qgsaabb.h"
#include "qgsray3d.h"
#include "qgsraycastingutils_p.h"
#include "qgsraycastingutils.h"

#include <QSize>
#include <Qt3DRender/QCamera>
Expand Down
File renamed without changes.
69 changes: 69 additions & 0 deletions src/3d/qgsraycastingutils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/***************************************************************************
qgsraycastingutils.h
--------------------------------------
Date : April 2024
Copyright : (C) 2024 by Matthias Kuhn
Email : matthias@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSRAYCASTINGUTILS_H
#define QGSRAYCASTINGUTILS_H

#include "qgsfeatureid.h"
#include <QVariantMap>
#include <QVector3D>
#include <QSize>

#define SIP_NO_FILE

namespace QgsRayCastingUtils
{

/**
* Helper struct to store ray casting results.
*/
struct RayHit
{
//! Creates a new hit
RayHit( const float distance, const QVector3D pos, const QgsFeatureId fid = FID_NULL, const QVariantMap attributes = QVariantMap() )
: distance( distance )
, pos( pos )
, fid( fid )
, attributes( attributes )
{
}
float distance; //!< Distance from ray's origin
QVector3D pos; //!< Hit position in world coordinates
QgsFeatureId fid; //!< Fid of feature hit closest to ray origin, FID_NULL if no features hit
QVariantMap attributes; //!< Point cloud point attributes, empty map if no point cloud points hit
};

/**
* Helper struct to store ray casting parameters.
*/
struct RayCastContext
{
RayCastContext( bool singleResult = true, QSize screenSize = QSize(), float maxDistance = 0.f )
: singleResult( singleResult )
, screenSize( screenSize )
, maxDistance( maxDistance )
{}
bool singleResult; //!< If set to TRUE, only the closest point cloud hit will be returned (other entities always return only closest hit)
QSize screenSize; //!< QSize of the 3d engine window

/**
* The maximum distance from ray origin to look for hits when casting a ray.
* Should be normally set to far plane, to ignore data that will not get displayed in the 3D view
*/
float maxDistance;
};
}

#endif // QGSRAYCASTINGUTILS_H
43 changes: 1 addition & 42 deletions src/3d/qgsraycastingutils_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@
// version without notice, or even be removed.
//

#include "qgsfeatureid.h"
#include <QSize>
#include <QVariantMap>
#include <QVector3D>
#include "qgsraycastingutils.h"

#define SIP_NO_FILE

Expand Down Expand Up @@ -121,44 +118,6 @@ namespace QgsRayCastingUtils
QVector3D &intPt,
int &triangleIndex );

/**
* Helper struct to store ray casting results.
*/
struct RayHit
{
//! Constructor
RayHit( const float distance, const QVector3D pos, const QgsFeatureId fid = FID_NULL, const QVariantMap attributes = QVariantMap() )
: distance( distance )
, pos( pos )
, fid( fid )
, attributes( attributes )
{
}
float distance; //!< Distance from ray's origin
QVector3D pos; //!< Hit position in world coordinates
QgsFeatureId fid; //!< Fid of feature hit closest to ray origin, FID_NULL if no features hit
QVariantMap attributes; //!< Point cloud point attributes, empty map if no point cloud points hit
};

/**
* Helper struct to store ray casting parameters.
*/
struct RayCastContext
{
RayCastContext( bool singleResult = true, QSize screenSize = QSize(), float maxDistance = 0.f )
: singleResult( singleResult )
, screenSize( screenSize )
, maxDistance( maxDistance )
{}
bool singleResult; //!< If set to TRUE, only the closest point cloud hit will be returned (other entities always return only closest hit)
QSize screenSize; //!< QSize of the 3d engine window

/**
* The maximum distance from ray origin to look for hits when casting a ray.
* Should be normally set to far plane, to ignore data that will not get displayed in the 3D view
*/
float maxDistance;
};
}

/// @endcond
Expand Down