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

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2013 Adrian Draghici <draghici.adrian.b@gmail.com>
0004 //
0005 
0006 #ifndef MARBLE_GROUNDOVERLAYFRAME_H
0007 #define MARBLE_GROUNDOVERLAYFRAME_H
0008 
0009 #include "SceneGraphicsItem.h"
0010 #include "GeoDataCoordinates.h"
0011 
0012 namespace Marble
0013 {
0014 class TextureLayer;
0015 class GeoDataGroundOverlay;
0016 
0017 class GroundOverlayFrame : public SceneGraphicsItem
0018 {
0019 public:
0020     GroundOverlayFrame( GeoDataPlacemark *placemark, GeoDataGroundOverlay *overlay, TextureLayer *textureLayer );
0021 
0022     enum MovedRegion {
0023         NoRegion = -1,
0024         NorthWest = 0,
0025         SouthWest,
0026         SouthEast,
0027         NorthEast,
0028         North,
0029         South,
0030         East,
0031         West,
0032         Polygon
0033     };
0034 
0035     enum EditStatus {
0036         Resize,
0037         Rotate
0038     };
0039 
0040     void update();
0041 
0042     bool containsPoint( const QPoint &eventPos ) const override;
0043 
0044     void dealWithItemChange( const SceneGraphicsItem *other ) override;
0045 
0046     void move( const GeoDataCoordinates &source, const GeoDataCoordinates &destination ) override;
0047 
0048     /**
0049      * @brief Provides information for downcasting a SceneGraphicsItem.
0050      */
0051     const char *graphicType() const override;
0052 
0053 protected:
0054     void paint( GeoPainter *painter, const ViewportParams *viewport, const QString &layer, int tileZoomLevel ) override;
0055     bool mousePressEvent( QMouseEvent *event ) override;
0056     bool mouseMoveEvent( QMouseEvent *event ) override;
0057     bool mouseReleaseEvent( QMouseEvent *event ) override;
0058 
0059     void dealWithStateChange( SceneGraphicsItem::ActionState previousState ) override;
0060 private:
0061     GeoDataGroundOverlay *m_overlay;
0062     TextureLayer         *m_textureLayer;
0063 
0064     QVector<QRegion>   m_regionList;
0065     GeoDataCoordinates m_movedHandleGeoCoordinates;
0066     QPoint             m_movedHandleScreenCoordinates;
0067     int                m_movedHandle;
0068     int                m_hoveredHandle;
0069     int                m_editStatus;
0070     bool               m_editStatusChangeNeeded;
0071     qreal              m_previousRotation;
0072 
0073     QVector<QImage>    m_resizeIcons;
0074     QVector<QImage>    m_rotateIcons;
0075 
0076     const ViewportParams *m_viewport;
0077 };
0078 
0079 }
0080 
0081 #endif