/*
    QAD - Qt ADvanced

    Ivan Pelipenko peri4ko@yandex.ru

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef mapview_types_h
#define mapview_types_h

#include "qad_map_export.h"

#include <QMetaType>
#include <QPixmap>

namespace MapViewTypes {

struct QAD_MAP_EXPORT TileIndex {
	int z;
	int x;
	int y;
	QString hashName() const;
	quint64 hash() const;
	QString cacheDir() const;
};

struct QAD_MAP_EXPORT TilePixmap {
	TileIndex index;
	QPixmap pixmap;
	bool obsolete = false;
	bool isEmpty() const;
	int pixmapBytes() const;
};

inline bool operator==(const TileIndex & v0, const TileIndex & v1) {
	return (v0.z == v1.z) && (v0.x == v1.x) && (v0.y == v1.y);
}

inline bool operator==(const TilePixmap & v0, const TilePixmap & v1) {
	return v0.index == v1.index;
}

} // namespace MapViewTypes

Q_DECLARE_METATYPE(MapViewTypes::TileIndex);
Q_DECLARE_METATYPE(MapViewTypes::TilePixmap);

#endif
