#ifndef TEXTURESHEET_H
#define TEXTURESHEET_H

#include <QObject>
#include <QGraphicsScene>
#include <QPicture>
#include <QPainter>
#include <QMainWindow>
#include <QFileDialog>
#include <QMessageBox>
#include "boost/shared_ptr.hpp"
#include <map>

struct TexCoordRect
{
    float texCoordFromX;
    float texCoordFromY;
    float texCoordToX;
    float texCoordToY;

    TexCoordRect()
        : texCoordFromX(0)
        , texCoordFromY(0)
        , texCoordToX(0)
        , texCoordToY(0)
    {

    }

    TexCoordRect(float itexCoordFromX, float itexCoordFromY, float itexCoordToX, float itexCoordToY)
        : texCoordFromX(itexCoordFromX)
        , texCoordFromY(itexCoordFromY)
        , texCoordToX(itexCoordToX)
        , texCoordToY(itexCoordToY)
    {

    }
};

struct SpaceArea
{
    int posX;
    int posY;
    int Width;
    int Height;

    SpaceArea()
        : posX(0)
        , posY(0)
        , Width(0)
        , Height(0)
    {

    }

    SpaceArea(int iposX, int iposY, int iWidth, int iHeight)
        : posX(iposX)
        , posY(iposY)
        , Width(iWidth)
        , Height(iHeight)
    {

    }
};

class TextureSheet
{
protected:

public:
    std::vector<std::pair<QString, boost::shared_ptr<QPixmap>>> pixmapArray;
    std::vector<QString> imageNamesArray;

    boost::shared_ptr<QPixmap> resultPixmap;
    std::vector<std::pair<QString, TexCoordRect>> resultTexturePositions;

    std::vector<SpaceArea> spaceAreaArr;

    void Calculate(int width, int height);
    QString GetCalculatedXml();

    void Clear();

};



#endif // TEXTURESHEET_H
