File indexing completed on 2024-05-05 03:50:39

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2009 Andrew Manson <g.real.ate@gmail.com>
0004 // SPDX-FileCopyrightText: 2013 Thibaut Gridel <tgridel@free.fr>
0005 // SPDX-FileCopyrightText: 2014 Calin Cruceru <crucerucalincristian@gmail.com>
0006 //
0007 
0008 #ifndef PLACEMARKTEXTANNOTATION_H
0009 #define PLACEMARKTEXTANNOTATION_H
0010 
0011 #include <QColor>
0012 #include "SceneGraphicsItem.h"
0013 
0014 namespace Marble
0015 {
0016 
0017 class PlacemarkTextAnnotation : public SceneGraphicsItem
0018 {
0019 public:
0020     explicit PlacemarkTextAnnotation( GeoDataPlacemark *placemark );
0021     ~PlacemarkTextAnnotation() override;
0022 
0023     void paint(GeoPainter *painter, const ViewportParams *viewport, const QString &layer, int tileZoomLevel) override;
0024 
0025     bool containsPoint( const QPoint &eventPos ) const override;
0026 
0027     void dealWithItemChange( const SceneGraphicsItem *other ) override;
0028 
0029     void move( const GeoDataCoordinates &source, const GeoDataCoordinates &destination ) override;
0030 
0031     /**
0032      * @brief Provides information for downcasting a SceneGraphicsItem.
0033      */
0034     const char *graphicType() const override;
0035 
0036     /**
0037      * @brief Real label color, which is being hidden when placemark has focus
0038      */
0039     QColor labelColor() const;
0040 
0041 protected:
0042     bool mousePressEvent( QMouseEvent *event ) override;
0043     bool mouseMoveEvent( QMouseEvent *event ) override;
0044     bool mouseReleaseEvent( QMouseEvent *event ) override;
0045 
0046     void dealWithStateChange( SceneGraphicsItem::ActionState previousState ) override;
0047 
0048 private:
0049     const ViewportParams *m_viewport;
0050     bool m_movingPlacemark;
0051     QColor m_labelColor;
0052 
0053     QRegion m_region;
0054 };
0055 
0056 }
0057 
0058 #endif // PLACEMARKTEXTANNOTATION_H