KOSMIndoorMap

hitdetector.h
1 /*
2  SPDX-FileCopyrightText: 2020 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef KOSMINDOORMAP_HITDETECTOR_H
8 #define KOSMINDOORMAP_HITDETECTOR_H
9 
10 #include "kosmindoormap_export.h"
11 
12 #include <vector>
13 
14 class QPointF;
15 
16 namespace KOSMIndoorMap {
17 
18 class LabelItem;
19 class MultiPolygonItem;
20 class PolygonItem;
21 class PolylineItem;
22 class SceneGraph;
23 class SceneGraphItem;
24 class View;
25 
26 /** Picking hit detector.
27  * Ie. find scene graph items at a given screen position.
28  */
29 class KOSMINDOORMAP_EXPORT HitDetector
30 {
31 public:
32  /** Highest (in z-order) item at the given screen position. */
33  const SceneGraphItem* itemAt(QPointF pos, const SceneGraph &sg, const View *view) const;
34 
35  /** All items (in z-order) at the given screen position. */
36  std::vector<const SceneGraphItem*> itemsAt(QPointF pos, const SceneGraph &sg, const View *view) const;
37 
38 private:
39  /** Precise bounds check for @p item. */
40  bool itemContainsPoint(const SceneGraphItem &item, QPointF screenPos, const View *view) const;
41  bool itemContainsPoint(const MultiPolygonItem *item, QPointF scenePos) const;
42  bool itemContainsPoint(const PolygonItem *item, QPointF scenePos) const;
43  bool itemContainsPoint(const PolylineItem *item, QPointF scenePos, const View *view) const;
44  bool itemContainsPoint(const LabelItem *item, QPointF screenPos, const View *view) const;
45 
46  float itemFillAlpha(const SceneGraphItem *item) const;
47 };
48 
49 }
50 
51 #endif // KOSMINDOORMAP_HITDETECTOR_H
OSM-based multi-floor indoor maps for buildings.
A path/way/line item in the scenegraph.
Scene graph of the currently displayed level.
Definition: scenegraph.h:28
Scene graph item description and handle for its content.
View transformations and transformation manipulation.
Definition: view.h:39
A text or item label.
Multi-polygon item, used for polygons with "holes" in them.
Picking hit detector.
Definition: hitdetector.h:29
A single filled polygon.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Oct 25 2021 23:04:00 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.