QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
qgsraycastingutils.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsraycastingutils.h
3 --------------------------------------
4 Date : April 2024
5 Copyright : (C) 2024 by Matthias Kuhn
6 Email : matthias@opengis.ch
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSRAYCASTINGUTILS_H
17#define QGSRAYCASTINGUTILS_H
18
19#include "qgsfeatureid.h"
20#include <QVariantMap>
21#include <QVector3D>
22#include <QSize>
23
24#define SIP_NO_FILE
25
27{
28
32 struct RayHit
33 {
35 RayHit( const float distance, const QVector3D pos, const QgsFeatureId fid = FID_NULL, const QVariantMap attributes = QVariantMap() )
37 , pos( pos )
38 , fid( fid )
40 {
41 }
42 float distance;
43 QVector3D pos;
45 QVariantMap attributes;
46 };
47
52 {
53 RayCastContext( bool singleResult = true, QSize screenSize = QSize(), float maxDistance = 0.f )
57 {}
59 QSize screenSize;
60
66 };
67}
68
69#endif // QGSRAYCASTINGUTILS_H
#define FID_NULL
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
Helper struct to store ray casting parameters.
QSize screenSize
QSize of the 3d engine window.
float maxDistance
The maximum distance from ray origin to look for hits when casting a ray.
bool singleResult
If set to true, only the closest point cloud hit will be returned (other entities always return only ...
RayCastContext(bool singleResult=true, QSize screenSize=QSize(), float maxDistance=0.f)
Helper struct to store ray casting results.
QVariantMap attributes
Point cloud point attributes, empty map if no point cloud points hit.
RayHit(const float distance, const QVector3D pos, const QgsFeatureId fid=FID_NULL, const QVariantMap attributes=QVariantMap())
Creates a new hit.
float distance
Distance from ray's origin.
QgsFeatureId fid
Fid of feature hit closest to ray origin, FID_NULL if no features hit.
QVector3D pos
Hit position in world coordinates.