#ifndef HEIGHTMAP_PREVIEW_H
#define HEIGHTMAP_PREVIEW_H

#include <QtGui/QWidget>
#include <QLabel>
#include <QImage>
#include "enginepreview.h"


namespace Ui {
    class heightmap_preview;
}

class MyLabel : public QLabel
{
    Q_OBJECT
    public:
        MyLabel() : QLabel() {};
        void mousePressEvent ( QMouseEvent * event );
        void mouseMoveEvent ( QMouseEvent * event );
    signals:
        void mouseMove(QMouseEvent*);
};


class heightmap_preview : public QWidget {
    Q_OBJECT
public:
    heightmap_preview(QWidget *parent = 0);
    ~heightmap_preview();
    void set_engine_preview(EnginePreview *engine);
    QRectF get_selected_rect();

protected:
    void changeEvent(QEvent *e);

signals:
    void mouseMove(QMouseEvent*);

public slots:
    void update_preview(QPixmap pixmap);
    void update_preview();
    void on_MouseMove(QMouseEvent *event);

private:
    Ui::heightmap_preview *m_ui;
    MyLabel ImageLabel;
    void draw_borders();
    void draw_camera();
    void draw_objects();
    void draw_cam_path();
    QPixmap clean_pixmap;
    EnginePreview *engine_preview;

private slots:
    void on_VEnd_sliderMoved(int position);
    void on_HStart_sliderMoved(int position);
    void on_HEnd_sliderMoved(int position);
    void on_VStart_sliderMoved(int position);
};

#endif // HEIGHTMAP_PREVIEW_H
