#ifndef ARMYICONLAYER_H
#define ARMYICONLAYER_H

#include <QObject>
#include <QTimer>

#include "GraphicsOverlay.h"
#include "MapGraphicsView.h"
#include "SimpleMarkerSymbol.h"

#include "databasestruct.h"

class ArmyIconLayer : public Esri::ArcGISRuntime::GraphicsOverlay
{
    Q_OBJECT
public:
    explicit ArmyIconLayer(QObject* parent = nullptr);
    ~ArmyIconLayer();

    void setData(const QString& data);

    void setMapView(Esri::ArcGISRuntime::MapGraphicsView* view);

signals:
    void selectedEntity(const QString& id, const QString& name, QImage image);

public slots:
    void setEntityList(QList<Entity> list);
    void moveEntityList(QList<MoveEntity> list);
    void setEntityVisible(const QString& id, bool visible);

    void setEntityLocation(const QString& id);
    void setEntityRouteVisible(const QString& id);
    void setEntityNameVisible(const QString& id);
    void setEntityFocusing(const QString& id);


private slots:
    void focusEntity();
    float rotateAngle(QGeoCoordinate position1, QGeoCoordinate position2);

private:
    Esri::ArcGISRuntime::MapGraphicsView* mMapView;
    QList<Entity> mEntityList;
    Esri::ArcGISRuntime::Graphic* m_selectedGraphic = nullptr;
    QTimer mFocusTimer;
    QString mFocusID;
};

#endif // ARMYICONLAYER_H
