QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgsraycastresult.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsraycastresult.h
3 ---------------------
4 begin : September 2025
5 copyright : (C) 2025 by Stefanos Natsis
6 email : uclaros at gmail dot com
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 QGSRAYCASTRESULT_H
17#define QGSRAYCASTRESULT_H
18
19#include "qgis_3d.h"
20#include "qgsraycasthit.h"
21
22#include <QHash>
23#include <QList>
24#include <QPointer>
25
26class QgsMapLayer;
27
28
36class _3D_EXPORT QgsRayCastResult
37{
38 public:
41
43 bool isEmpty() const;
44
46 bool hasLayerHits() const;
47
49 QList<QgsMapLayer *> layers() const;
50
52 QList<QgsRayCastHit> layerHits( QgsMapLayer *layer ) const;
53
55 bool hasTerrainHits() const;
56
58 QList<QgsRayCastHit> terrainHits() const;
59
61 QList<QgsRayCastHit> allHits() const;
62
64 void addLayerHits( QgsMapLayer *layer, const QList<QgsRayCastHit> &hits );
65
67 void addTerrainHits( const QList<QgsRayCastHit> &hits );
68
69 private:
70 QHash<QgsMapLayer *, QList<QgsRayCastHit>> mLayerResults;
71 QHash<QgsMapLayer *, QPointer<QgsMapLayer>> mLayerPointers;
72 QList<QgsRayCastHit> mTerrainResults;
73};
74
75#endif // QGSRAYCASTRESULT_H
Base class for all map layer types.
Definition qgsmaplayer.h:80
QList< QgsRayCastHit > terrainHits() const
Returns all terrain intersection hits.
QList< QgsRayCastHit > layerHits(QgsMapLayer *layer) const
Returns all hits from entities of the specific layer.
bool hasTerrainHits() const
Returns true is the ray intersected the terrain.
bool hasLayerHits() const
Returns true is ray hit at least one entity from a layer.
QList< QgsMapLayer * > layers() const
Returns pointers to the map layers of entities that were intersected by the ray.
QList< QgsRayCastHit > allHits() const
Returns all the hits from both layer and terrain intersections.
void addLayerHits(QgsMapLayer *layer, const QList< QgsRayCastHit > &hits)
Adds all hits from layer to the result.
void addTerrainHits(const QList< QgsRayCastHit > &hits)
Adds all terrain hits to the result.
bool isEmpty() const
Returns true is ray did not intersect any layer or terrain entity.