#ifndef MAPXWIDGET_H
#define MAPXWIDGET_H

#include <QWidget>
#include <QSvgRenderer>

/**
* @brief 鹰眼图窗口
**/
class MapXWidget : public QWidget
{
    Q_OBJECT
public:
    MapXWidget(QWidget* parent = nullptr);

    void setViewpoint(QPointF p);
    void setViewArea(QPointF topLeft, QPointF bottomRight);

protected:
    void paintEvent(QPaintEvent* e);

    void mousePressEvent(QMouseEvent* e);
    void mouseMoveEvent(QMouseEvent* e);
    void mouseReleaseEvent(QMouseEvent* e);

private:
    QPointF mapLayerPointToMapXPoint(QPointF p);

private:
    bool mPressed;
    QWidget* mParent;
    QPoint mLastPoint;

    QPointF mViewpoint;
    QRectF mViewArea;

    QSvgRenderer   m_svgobj;
    QPixmap mPixmap;
};

#endif // MAPXWIDGET_H
