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

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2014 Calin Cruceru <crucerucalincristian@gmail.com>
0004 //
0005 
0006 #ifndef MERGINGPOLYGONNODESANIMATION_H
0007 #define MERGINGPOLYGONNODESANIMATION_H
0008 
0009 #include <QObject>
0010 #include <QTimer>
0011 
0012 #include "GeoDataCoordinates.h"
0013 
0014 
0015 namespace Marble {
0016 
0017 class AreaAnnotation;
0018 class GeoDataLinearRing;
0019 
0020 class MergingPolygonNodesAnimation : public QObject
0021 {
0022     Q_OBJECT
0023 
0024 public:
0025     explicit MergingPolygonNodesAnimation( AreaAnnotation *polygon );
0026     ~MergingPolygonNodesAnimation() override;
0027 
0028     enum NodesBoundary {
0029         InnerBoundary,
0030         OuterBoundary
0031     };
0032 
0033 public Q_SLOTS:
0034     void startAnimation();
0035 
0036 Q_SIGNALS:
0037     void nodesMoved();
0038     void animationFinished();
0039 
0040 private Q_SLOTS:
0041     void updateNodes();
0042 
0043 private:
0044     qreal nodesDistance();
0045     GeoDataCoordinates newCoords();
0046 
0047     const int first_i;
0048     const int first_j;
0049     const int second_i;
0050     const int second_j;
0051 
0052     QTimer         *m_timer;
0053     NodesBoundary   m_boundary;
0054 
0055     GeoDataLinearRing &outerRing;
0056     QVector<GeoDataLinearRing> &innerRings;
0057 
0058     GeoDataCoordinates m_firstInitialCoords;
0059     GeoDataCoordinates m_secondInitialCoords;
0060 };
0061 
0062 } // namespace Marble
0063 
0064 #endif // MERGINGPOLYGONNODESANIMATION_H