QGeoView  1.0
QGeoView documentation
QGVItem.h
1 /***************************************************************************
2  * QGeoView is a Qt / C ++ widget for visualizing geographic data.
3  * Copyright (C) 2018-2025 Andrey Yaroshenko.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program; if not, see https://www.gnu.org/licenses.
17  ****************************************************************************/
18 
19 #pragma once
20 
21 #include "QGVGlobal.h"
22 #include "QGVMap.h"
23 
24 class QGV_LIB_DECL QGVItem : public QObject
25 {
26  Q_OBJECT
27  Q_PROPERTY(quint16 zValue READ getZValue WRITE setZValue)
28  Q_PROPERTY(double opacity READ getOpacity WRITE setOpacity)
29  Q_PROPERTY(bool selected READ isSelected WRITE setSelected)
30  Q_PROPERTY(bool visible READ isVisible WRITE setVisible)
31 
32 public:
33  explicit QGVItem(QGVItem* parent = nullptr);
34  virtual ~QGVItem();
35 
36  void setParent(QGVItem* item);
37  QGVItem* getParent() const;
38 
39  virtual QGVMap* getMap() const;
40 
41  void addItem(QGVItem* item);
42  void removeItem(QGVItem* item);
43  void deleteItems();
44  int countItems() const;
45  QGVItem* getItem(int index) const;
46 
47  void setZValue(qint16 zValue);
48  qint16 getZValue() const;
49  void bringToFront();
50  void sendToBack();
51 
52  void setOpacity(double value);
53  double getOpacity() const;
54 
55  void setSelectable(bool allowed);
56  bool isSelectable() const;
57  void setSelected(bool selected);
58  bool isSelected() const;
59  void select();
60  void unselect();
61 
62  void setVisible(bool visible);
63  bool isVisible() const;
64 
65  void show();
66  void hide();
67 
68  double effectiveZValue() const;
69  double effectiveOpacity() const;
70  bool effectivelyVisible() const;
71 
72  void update();
73 
74  virtual void onProjection(QGVMap* geoMap);
75  virtual void onCamera(const QGVCameraState& oldState, const QGVCameraState& newState);
76  virtual void onUpdate();
77  virtual void onClean();
78 
79 private:
80  Q_DISABLE_COPY(QGVItem)
81  QGVItem* mParent;
82  qint16 mZValue;
83  double mOpacity;
84  bool mVisible;
85  bool mSelectable;
86  bool mSelected;
87  QList<QGVItem*> mChildrens;
88 };
Definition: QGVCamera.h:30
Definition: QGVItem.h:25
Definition: QGVMap.h:35