mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-08 00:09:02 +00:00
Changed: #1301 Updated LandscapeSceneBase and ZoneBuilderBase classes for world editor plugin.
This commit is contained in:
parent
106633c46a
commit
3846555e85
6 changed files with 72 additions and 185 deletions
|
@ -17,8 +17,9 @@
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "builder_zone_base.h"
|
#include "builder_zone_base.h"
|
||||||
#include "list_zones_widget.h"
|
#include "landscape_scene_base.h"
|
||||||
#include "landscape_actions.h"
|
#include "zone_region_editor.h"
|
||||||
|
#include "pixmap_database.h"
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
#include <nel/misc/debug.h>
|
#include <nel/misc/debug.h>
|
||||||
|
@ -32,12 +33,11 @@ namespace LandscapeEditor
|
||||||
{
|
{
|
||||||
int NewLandId = 0;
|
int NewLandId = 0;
|
||||||
|
|
||||||
ZoneBuilderBase::ZoneBuilderBase(LandscapeScene *landscapeScene)
|
ZoneBuilderBase::ZoneBuilderBase(LandscapeSceneBase *landscapeScene)
|
||||||
: m_currentZoneRegion(-1),
|
: m_pixmapDatabase(0),
|
||||||
m_pixmapDatabase(0),
|
m_landscapeSceneBase(landscapeScene)
|
||||||
m_landscapeScene(landscapeScene)
|
|
||||||
{
|
{
|
||||||
nlassert(m_landscapeScene);
|
nlassert(m_landscapeSceneBase);
|
||||||
m_pixmapDatabase = new PixmapDatabase();
|
m_pixmapDatabase = new PixmapDatabase();
|
||||||
m_lastPathName = "";
|
m_lastPathName = "";
|
||||||
}
|
}
|
||||||
|
@ -77,23 +77,7 @@ bool ZoneBuilderBase::init(const QString &pathName, bool displayProgress)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZoneBuilderBase::createZoneRegion()
|
int ZoneBuilderBase::loadZoneRegion(const QString &fileName)
|
||||||
{
|
|
||||||
LandscapeItem landItem;
|
|
||||||
landItem.zoneRegionObject = new ZoneRegionObject();
|
|
||||||
// landItem.builderZoneRegion = new BuilderZoneRegion(LandCounter);
|
|
||||||
// landItem.builderZoneRegion->init(this);
|
|
||||||
landItem.rectItem = m_landscapeScene->createLayerBlackout(landItem.zoneRegionObject->ligoZoneRegion());
|
|
||||||
|
|
||||||
m_landscapeMap.insert(NewLandId, landItem);
|
|
||||||
if (m_currentZoneRegion == -1)
|
|
||||||
setCurrentZoneRegion(NewLandId);
|
|
||||||
|
|
||||||
calcMask();
|
|
||||||
return NewLandId++;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ZoneBuilderBase::createZoneRegion(const QString &fileName)
|
|
||||||
{
|
{
|
||||||
LandscapeItem landItem;
|
LandscapeItem landItem;
|
||||||
landItem.zoneRegionObject = new ZoneRegionObject();
|
landItem.zoneRegionObject = new ZoneRegionObject();
|
||||||
|
@ -107,13 +91,10 @@ int ZoneBuilderBase::createZoneRegion(const QString &fileName)
|
||||||
// landItem.builderZoneRegion = new BuilderZoneRegion(LandCounter);
|
// landItem.builderZoneRegion = new BuilderZoneRegion(LandCounter);
|
||||||
// landItem.builderZoneRegion->init(this);
|
// landItem.builderZoneRegion->init(this);
|
||||||
|
|
||||||
m_landscapeScene->addZoneRegion(landItem.zoneRegionObject->ligoZoneRegion());
|
m_landscapeSceneBase->addZoneRegion(landItem.zoneRegionObject->ligoZoneRegion());
|
||||||
landItem.rectItem = m_landscapeScene->createLayerBlackout(landItem.zoneRegionObject->ligoZoneRegion());
|
// landItem.rectItem = m_landscapeScene->createLayerBlackout(landItem.zoneRegionObject->ligoZoneRegion());
|
||||||
m_landscapeMap.insert(NewLandId, landItem);
|
m_landscapeMap.insert(NewLandId, landItem);
|
||||||
|
|
||||||
if (m_currentZoneRegion == -1)
|
|
||||||
setCurrentZoneRegion(NewLandId);
|
|
||||||
|
|
||||||
calcMask();
|
calcMask();
|
||||||
return NewLandId++;
|
return NewLandId++;
|
||||||
}
|
}
|
||||||
|
@ -122,9 +103,7 @@ void ZoneBuilderBase::deleteZoneRegion(int id)
|
||||||
{
|
{
|
||||||
if (m_landscapeMap.contains(id))
|
if (m_landscapeMap.contains(id))
|
||||||
{
|
{
|
||||||
if (m_landscapeMap.value(id).rectItem != 0)
|
m_landscapeSceneBase->delZoneRegion(m_landscapeMap.value(id).zoneRegionObject->ligoZoneRegion());
|
||||||
delete m_landscapeMap.value(id).rectItem;
|
|
||||||
m_landscapeScene->delZoneRegion(m_landscapeMap.value(id).zoneRegionObject->ligoZoneRegion());
|
|
||||||
delete m_landscapeMap.value(id).zoneRegionObject;
|
delete m_landscapeMap.value(id).zoneRegionObject;
|
||||||
// delete m_landscapeMap.value(id).builderZoneRegion;
|
// delete m_landscapeMap.value(id).builderZoneRegion;
|
||||||
m_landscapeMap.remove(id);
|
m_landscapeMap.remove(id);
|
||||||
|
@ -134,34 +113,6 @@ void ZoneBuilderBase::deleteZoneRegion(int id)
|
||||||
nlwarning("Landscape (id %i) not found", id);
|
nlwarning("Landscape (id %i) not found", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneBuilderBase::setCurrentZoneRegion(int id)
|
|
||||||
{
|
|
||||||
if (m_landscapeMap.contains(id))
|
|
||||||
{
|
|
||||||
if (currentIdZoneRegion() != -1)
|
|
||||||
{
|
|
||||||
NLLIGO::CZoneRegion &ligoRegion = m_landscapeMap.value(m_currentZoneRegion).zoneRegionObject->ligoZoneRegion();
|
|
||||||
m_landscapeMap[m_currentZoneRegion].rectItem = m_landscapeScene->createLayerBlackout(ligoRegion);
|
|
||||||
}
|
|
||||||
delete m_landscapeMap.value(id).rectItem;
|
|
||||||
m_landscapeMap[id].rectItem = 0;
|
|
||||||
m_currentZoneRegion = id;
|
|
||||||
calcMask();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
nlwarning("Landscape (id %i) not found", id);
|
|
||||||
}
|
|
||||||
|
|
||||||
int ZoneBuilderBase::currentIdZoneRegion() const
|
|
||||||
{
|
|
||||||
return m_currentZoneRegion;
|
|
||||||
}
|
|
||||||
|
|
||||||
ZoneRegionObject *ZoneBuilderBase::currentZoneRegion() const
|
|
||||||
{
|
|
||||||
return m_landscapeMap.value(m_currentZoneRegion).zoneRegionObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ZoneBuilderBase::countZoneRegion() const
|
int ZoneBuilderBase::countZoneRegion() const
|
||||||
{
|
{
|
||||||
return m_landscapeMap.size();
|
return m_landscapeMap.size();
|
||||||
|
@ -172,16 +123,6 @@ ZoneRegionObject *ZoneBuilderBase::zoneRegion(int id) const
|
||||||
return m_landscapeMap.value(id).zoneRegionObject;
|
return m_landscapeMap.value(id).zoneRegionObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneBuilderBase::ligoData(LigoData &data, const ZonePosition &zonePos)
|
|
||||||
{
|
|
||||||
m_landscapeMap.value(zonePos.region).zoneRegionObject->ligoData(data, zonePos.x, zonePos.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ZoneBuilderBase::setLigoData(LigoData &data, const ZonePosition &zonePos)
|
|
||||||
{
|
|
||||||
m_landscapeMap.value(zonePos.region).zoneRegionObject->setLigoData(data, zonePos.x, zonePos.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ZoneBuilderBase::initZoneBank (const QString &pathName)
|
bool ZoneBuilderBase::initZoneBank (const QString &pathName)
|
||||||
{
|
{
|
||||||
QDir *dir = new QDir(pathName);
|
QDir *dir = new QDir(pathName);
|
||||||
|
@ -212,23 +153,8 @@ QString ZoneBuilderBase::dataPath() const
|
||||||
return m_lastPathName;
|
return m_lastPathName;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZoneBuilderBase::getZoneMask(sint32 x, sint32 y)
|
|
||||||
{
|
|
||||||
if ((x < m_minX) || (x > m_maxX) ||
|
|
||||||
(y < m_minY) || (y > m_maxY))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return m_zoneMask[(x - m_minX) + (y - m_minY) * (1 + m_maxX - m_minX)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ZoneBuilderBase::calcMask()
|
void ZoneBuilderBase::calcMask()
|
||||||
{
|
{
|
||||||
sint32 x, y;
|
|
||||||
|
|
||||||
m_minY = m_minX = 1000000;
|
m_minY = m_minX = 1000000;
|
||||||
m_maxY = m_maxX = -1000000;
|
m_maxY = m_maxX = -1000000;
|
||||||
|
|
||||||
|
@ -250,30 +176,6 @@ void ZoneBuilderBase::calcMask()
|
||||||
if (m_maxY < region.getMaxY())
|
if (m_maxY < region.getMaxY())
|
||||||
m_maxY = region.getMaxY();
|
m_maxY = region.getMaxY();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_zoneMask.resize ((1 + m_maxX - m_minX) * (1 + m_maxY - m_minY));
|
|
||||||
sint32 stride = (1 + m_maxX - m_minX);
|
|
||||||
for (y = m_minY; y <= m_maxY; ++y)
|
|
||||||
for (x = m_minX; x <= m_maxX; ++x)
|
|
||||||
{
|
|
||||||
m_zoneMask[x - m_minX + (y - m_minY) * stride] = true;
|
|
||||||
|
|
||||||
QMapIterator<int, LandscapeItem> it(m_landscapeMap);
|
|
||||||
while (it.hasNext())
|
|
||||||
{
|
|
||||||
it.next();
|
|
||||||
if (int(it.key()) != m_currentZoneRegion)
|
|
||||||
{
|
|
||||||
const NLLIGO::CZoneRegion ®ion = it.value().zoneRegionObject->ligoZoneRegion();
|
|
||||||
|
|
||||||
const std::string &rSZone = region.getName (x, y);
|
|
||||||
if ((rSZone != STRING_OUT_OF_BOUND) && (rSZone != STRING_UNUSED))
|
|
||||||
{
|
|
||||||
m_zoneMask[x - m_minX + (y - m_minY) * stride] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZoneBuilderBase::checkOverlaps(const NLLIGO::CZoneRegion &newZoneRegion)
|
bool ZoneBuilderBase::checkOverlaps(const NLLIGO::CZoneRegion &newZoneRegion)
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
#define BUILDER_ZONE_BASE_H
|
#define BUILDER_ZONE_BASE_H
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "zone_region_editor.h"
|
|
||||||
#include "pixmap_database.h"
|
|
||||||
#include "landscape_editor_global.h"
|
#include "landscape_editor_global.h"
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
|
@ -41,7 +39,9 @@
|
||||||
|
|
||||||
namespace LandscapeEditor
|
namespace LandscapeEditor
|
||||||
{
|
{
|
||||||
class LandscapeScene;
|
class LandscapeSceneBase;
|
||||||
|
class PixmapDatabase;
|
||||||
|
class ZoneRegionObject;
|
||||||
|
|
||||||
// Data
|
// Data
|
||||||
struct ZonePosition
|
struct ZonePosition
|
||||||
|
@ -75,27 +75,18 @@ PixmapDatabase contains the graphics for the zones
|
||||||
class LANDSCAPE_EDITOR_EXPORT ZoneBuilderBase
|
class LANDSCAPE_EDITOR_EXPORT ZoneBuilderBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ZoneBuilderBase(LandscapeScene *landscapeScene);
|
ZoneBuilderBase(LandscapeSceneBase *landscapeScene);
|
||||||
virtual ~ZoneBuilderBase();
|
virtual ~ZoneBuilderBase();
|
||||||
|
|
||||||
/// Init zoneBank and init zone pixmap database
|
/// Init zoneBank and init zone pixmap database
|
||||||
bool init(const QString &pathName, bool displayProgress = false);
|
bool init(const QString &pathName, bool displayProgress = false);
|
||||||
|
|
||||||
void calcMask();
|
|
||||||
bool getZoneMask (sint32 x, sint32 y);
|
|
||||||
|
|
||||||
/// Zone Region
|
/// Zone Region
|
||||||
/// @{
|
/// @{
|
||||||
int createZoneRegion();
|
int loadZoneRegion(const QString &fileName);
|
||||||
int createZoneRegion(const QString &fileName);
|
|
||||||
void deleteZoneRegion(int id);
|
void deleteZoneRegion(int id);
|
||||||
void setCurrentZoneRegion(int id);
|
|
||||||
int currentIdZoneRegion() const;
|
|
||||||
ZoneRegionObject *currentZoneRegion() const;
|
|
||||||
int countZoneRegion() const;
|
int countZoneRegion() const;
|
||||||
ZoneRegionObject *zoneRegion(int id) const;
|
ZoneRegionObject *zoneRegion(int id) const;
|
||||||
void ligoData(LigoData &data, const ZonePosition &zonePos);
|
|
||||||
void setLigoData(LigoData &data, const ZonePosition &zonePos);
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
|
@ -113,25 +104,24 @@ private:
|
||||||
/// Scan ./zoneligos dir and add all *.ligozone files to zoneBank
|
/// Scan ./zoneligos dir and add all *.ligozone files to zoneBank
|
||||||
bool initZoneBank (const QString &path);
|
bool initZoneBank (const QString &path);
|
||||||
|
|
||||||
|
void calcMask();
|
||||||
|
|
||||||
bool checkOverlaps(const NLLIGO::CZoneRegion &newZoneRegion);
|
bool checkOverlaps(const NLLIGO::CZoneRegion &newZoneRegion);
|
||||||
|
|
||||||
struct LandscapeItem
|
struct LandscapeItem
|
||||||
{
|
{
|
||||||
ZoneRegionObject *zoneRegionObject;
|
ZoneRegionObject *zoneRegionObject;
|
||||||
QGraphicsRectItem *rectItem;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
sint32 m_minX, m_maxX, m_minY, m_maxY;
|
sint32 m_minX, m_maxX, m_minY, m_maxY;
|
||||||
std::vector<bool> m_zoneMask;
|
|
||||||
|
|
||||||
QString m_lastPathName;
|
QString m_lastPathName;
|
||||||
|
|
||||||
int m_currentZoneRegion;
|
|
||||||
QMap<int, LandscapeItem> m_landscapeMap;
|
QMap<int, LandscapeItem> m_landscapeMap;
|
||||||
|
|
||||||
PixmapDatabase *m_pixmapDatabase;
|
PixmapDatabase *m_pixmapDatabase;
|
||||||
NLLIGO::CZoneBank m_zoneBank;
|
NLLIGO::CZoneBank m_zoneBank;
|
||||||
LandscapeScene *m_landscapeScene;
|
LandscapeSceneBase *m_landscapeSceneBase;
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace LandscapeEditor */
|
} /* namespace LandscapeEditor */
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
|
|
||||||
namespace LandscapeEditor
|
namespace LandscapeEditor
|
||||||
{
|
{
|
||||||
|
|
||||||
static const int ZONE_NAME = 0;
|
static const int ZONE_NAME = 0;
|
||||||
static const int LAYER_ZONES = 2;
|
static const int LAYER_ZONES = 2;
|
||||||
static const int LAYER_EMPTY_ZONES = 3;
|
static const int LAYER_EMPTY_ZONES = 3;
|
||||||
|
@ -43,7 +42,7 @@ const int MAX_SCENE_HEIGHT = 256;
|
||||||
LandscapeSceneBase::LandscapeSceneBase(int sizeCell, QObject *parent)
|
LandscapeSceneBase::LandscapeSceneBase(int sizeCell, QObject *parent)
|
||||||
: QGraphicsScene(parent),
|
: QGraphicsScene(parent),
|
||||||
m_cellSize(sizeCell),
|
m_cellSize(sizeCell),
|
||||||
m_zoneBuilder(0)
|
m_zoneBuilderBase(0)
|
||||||
{
|
{
|
||||||
setSceneRect(QRectF(0, m_cellSize, MAX_SCENE_WIDTH * m_cellSize, MAX_SCENE_HEIGHT * m_cellSize));
|
setSceneRect(QRectF(0, m_cellSize, MAX_SCENE_WIDTH * m_cellSize, MAX_SCENE_HEIGHT * m_cellSize));
|
||||||
}
|
}
|
||||||
|
@ -57,9 +56,9 @@ int LandscapeSceneBase::cellSize() const
|
||||||
return m_cellSize;
|
return m_cellSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LandscapeSceneBase::setZoneBuilder(ZoneBuilder *zoneBuilder)
|
void LandscapeSceneBase::setZoneBuilder(ZoneBuilderBase *zoneBuilder)
|
||||||
{
|
{
|
||||||
m_zoneBuilder = zoneBuilder;
|
m_zoneBuilderBase = zoneBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsItem *LandscapeSceneBase::createItemZone(const LigoData &data, const ZonePosition &zonePos)
|
QGraphicsItem *LandscapeSceneBase::createItemZone(const LigoData &data, const ZonePosition &zonePos)
|
||||||
|
@ -70,11 +69,11 @@ QGraphicsItem *LandscapeSceneBase::createItemZone(const LigoData &data, const Zo
|
||||||
if (data.zoneName == STRING_UNUSED)
|
if (data.zoneName == STRING_UNUSED)
|
||||||
return createItemEmptyZone(zonePos);
|
return createItemEmptyZone(zonePos);
|
||||||
|
|
||||||
if ((m_zoneBuilder == 0) || (data.zoneName.empty()))
|
if ((m_zoneBuilderBase == 0) || (data.zoneName.empty()))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Get image from pixmap database
|
// Get image from pixmap database
|
||||||
QPixmap *pixmap = m_zoneBuilder->pixmapDatabase()->pixmap(QString(data.zoneName.c_str()));
|
QPixmap *pixmap = m_zoneBuilderBase->pixmapDatabase()->pixmap(QString(data.zoneName.c_str()));
|
||||||
if (pixmap == 0)
|
if (pixmap == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -98,7 +97,7 @@ QGraphicsItem *LandscapeSceneBase::createItemZone(const LigoData &data, const Zo
|
||||||
// Enable bilinear filtering
|
// Enable bilinear filtering
|
||||||
item->setTransformationMode(Qt::SmoothTransformation);
|
item->setTransformationMode(Qt::SmoothTransformation);
|
||||||
|
|
||||||
NLLIGO::CZoneBankElement *zoneBankItem = m_zoneBuilder->getZoneBank().getElementByZoneName(data.zoneName);
|
NLLIGO::CZoneBankElement *zoneBankItem = m_zoneBuilderBase->getZoneBank().getElementByZoneName(data.zoneName);
|
||||||
|
|
||||||
sint32 deltaX = 0, deltaY = 0;
|
sint32 deltaX = 0, deltaY = 0;
|
||||||
|
|
||||||
|
@ -156,7 +155,7 @@ QGraphicsItem *LandscapeSceneBase::createItemZone(const LigoData &data, const Zo
|
||||||
item->setPos((zonePos.x + deltaX) * m_cellSize, (abs(int(zonePos.y + deltaY))) * m_cellSize);
|
item->setPos((zonePos.x + deltaX) * m_cellSize, (abs(int(zonePos.y + deltaY))) * m_cellSize);
|
||||||
|
|
||||||
// The size graphics item should be equal or proportional m_cellSize
|
// The size graphics item should be equal or proportional m_cellSize
|
||||||
item->setScale(float(m_cellSize) / m_zoneBuilder->pixmapDatabase()->textureSize());
|
item->setScale(float(m_cellSize) / m_zoneBuilderBase->pixmapDatabase()->textureSize());
|
||||||
|
|
||||||
item->setData(ZONE_NAME, QString(data.zoneName.c_str()));
|
item->setData(ZONE_NAME, QString(data.zoneName.c_str()));
|
||||||
|
|
||||||
|
@ -168,14 +167,14 @@ QGraphicsItem *LandscapeSceneBase::createItemZone(const LigoData &data, const Zo
|
||||||
|
|
||||||
QGraphicsItem *LandscapeSceneBase::createItemEmptyZone(const ZonePosition &zonePos)
|
QGraphicsItem *LandscapeSceneBase::createItemEmptyZone(const ZonePosition &zonePos)
|
||||||
{
|
{
|
||||||
if (m_zoneBuilder == 0)
|
if (m_zoneBuilderBase == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (checkUnderZone(zonePos.x, zonePos.y))
|
if (checkUnderZone(zonePos.x, zonePos.y))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Get image from pixmap database
|
// Get image from pixmap database
|
||||||
QPixmap *pixmap = m_zoneBuilder->pixmapDatabase()->pixmap(QString(STRING_UNUSED));
|
QPixmap *pixmap = m_zoneBuilderBase->pixmapDatabase()->pixmap(QString(STRING_UNUSED));
|
||||||
if (pixmap == 0)
|
if (pixmap == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -188,7 +187,7 @@ QGraphicsItem *LandscapeSceneBase::createItemEmptyZone(const ZonePosition &zoneP
|
||||||
item->setPos(zonePos.x * m_cellSize, abs(int(zonePos.y)) * m_cellSize);
|
item->setPos(zonePos.x * m_cellSize, abs(int(zonePos.y)) * m_cellSize);
|
||||||
|
|
||||||
// The size graphics item should be equal or proportional m_cellSize
|
// The size graphics item should be equal or proportional m_cellSize
|
||||||
item->setScale(float(m_cellSize) / m_zoneBuilder->pixmapDatabase()->textureSize());
|
item->setScale(float(m_cellSize) / m_zoneBuilderBase->pixmapDatabase()->textureSize());
|
||||||
|
|
||||||
// for not full item zone
|
// for not full item zone
|
||||||
item->setZValue(LAYER_EMPTY_ZONES);
|
item->setZValue(LAYER_EMPTY_ZONES);
|
||||||
|
@ -249,7 +248,7 @@ void LandscapeSceneBase::delZoneRegion(const NLLIGO::CZoneRegion &zoneRegion)
|
||||||
|
|
||||||
void LandscapeSceneBase::snapshot(const QString &fileName, int width, int height, const QRectF &landRect)
|
void LandscapeSceneBase::snapshot(const QString &fileName, int width, int height, const QRectF &landRect)
|
||||||
{
|
{
|
||||||
if (m_zoneBuilder == 0)
|
if (m_zoneBuilderBase == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Create image
|
// Create image
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
#define LANDSCAPE_SCENE_BASE_H
|
#define LANDSCAPE_SCENE_BASE_H
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "zone_region_editor.h"
|
|
||||||
#include "builder_zone.h"
|
|
||||||
#include "landscape_editor_global.h"
|
#include "landscape_editor_global.h"
|
||||||
|
#include "builder_zone_base.h"
|
||||||
|
#include "zone_region_editor.h"
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
#include <nel/ligo/zone_region.h>
|
#include <nel/ligo/zone_region.h>
|
||||||
|
@ -46,7 +46,7 @@ public:
|
||||||
virtual ~LandscapeSceneBase();
|
virtual ~LandscapeSceneBase();
|
||||||
|
|
||||||
int cellSize() const;
|
int cellSize() const;
|
||||||
virtual void setZoneBuilder(ZoneBuilder *zoneBuilder);
|
void setZoneBuilder(ZoneBuilderBase *zoneBuilder);
|
||||||
|
|
||||||
QGraphicsItem *createItemZone(const LigoData &data, const ZonePosition &zonePos);
|
QGraphicsItem *createItemZone(const LigoData &data, const ZonePosition &zonePos);
|
||||||
QGraphicsItem *createItemEmptyZone(const ZonePosition &zonePos);
|
QGraphicsItem *createItemEmptyZone(const ZonePosition &zonePos);
|
||||||
|
@ -73,7 +73,7 @@ private:
|
||||||
qreal m_mouseX, m_mouseY;
|
qreal m_mouseX, m_mouseY;
|
||||||
sint32 m_posX, m_posY;
|
sint32 m_posX, m_posY;
|
||||||
Qt::MouseButton m_mouseButton;
|
Qt::MouseButton m_mouseButton;
|
||||||
ZoneBuilder *m_zoneBuilder;
|
ZoneBuilderBase *m_zoneBuilderBase;
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace LandscapeEditor */
|
} /* namespace LandscapeEditor */
|
||||||
|
|
|
@ -30,40 +30,6 @@
|
||||||
namespace LandscapeEditor
|
namespace LandscapeEditor
|
||||||
{
|
{
|
||||||
|
|
||||||
LigoData::LigoData()
|
|
||||||
{
|
|
||||||
posX = 0;
|
|
||||||
posY = 0;
|
|
||||||
zoneName = "";
|
|
||||||
rot = 0;
|
|
||||||
flip = 0;
|
|
||||||
sharingMatNames[0] = "";
|
|
||||||
sharingMatNames[1] = "";
|
|
||||||
sharingMatNames[2] = "";
|
|
||||||
sharingMatNames[3] = "";
|
|
||||||
sharingCutEdges[0] = 0;
|
|
||||||
sharingCutEdges[1] = 0;
|
|
||||||
sharingCutEdges[2] = 0;
|
|
||||||
sharingCutEdges[3] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool LigoData::operator!= (const LigoData& other) const
|
|
||||||
{
|
|
||||||
return (posX != other.posX) ||
|
|
||||||
(posY != other.posY) ||
|
|
||||||
(rot != other.rot) ||
|
|
||||||
(flip != other.flip) ||
|
|
||||||
(zoneName != other.zoneName) ||
|
|
||||||
(sharingMatNames[0] != other.sharingMatNames[0]) ||
|
|
||||||
(sharingMatNames[1] != other.sharingMatNames[1]) ||
|
|
||||||
(sharingMatNames[2] != other.sharingMatNames[2]) ||
|
|
||||||
(sharingMatNames[3] != other.sharingMatNames[3]) ||
|
|
||||||
(sharingCutEdges[0] != other.sharingCutEdges[0]) ||
|
|
||||||
(sharingCutEdges[1] != other.sharingCutEdges[1]) ||
|
|
||||||
(sharingCutEdges[2] != other.sharingCutEdges[2]) ||
|
|
||||||
(sharingCutEdges[3] != other.sharingCutEdges[3]);
|
|
||||||
}
|
|
||||||
|
|
||||||
ZoneRegionObject::ZoneRegionObject()
|
ZoneRegionObject::ZoneRegionObject()
|
||||||
{
|
{
|
||||||
m_fileName = "";
|
m_fileName = "";
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#define LANDSCAPE_EDITOR_H
|
#define LANDSCAPE_EDITOR_H
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
|
#include "landscape_editor_global.h"
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
#include <nel/ligo/zone_bank.h>
|
#include <nel/ligo/zone_bank.h>
|
||||||
|
@ -43,9 +44,38 @@ struct LigoData
|
||||||
std::string sharingMatNames[4];
|
std::string sharingMatNames[4];
|
||||||
uint8 sharingCutEdges[4];
|
uint8 sharingCutEdges[4];
|
||||||
|
|
||||||
LigoData();
|
LigoData()
|
||||||
|
{
|
||||||
bool operator!= (const LigoData& other) const;
|
posX = 0;
|
||||||
|
posY = 0;
|
||||||
|
zoneName = "";
|
||||||
|
rot = 0;
|
||||||
|
flip = 0;
|
||||||
|
sharingMatNames[0] = "";
|
||||||
|
sharingMatNames[1] = "";
|
||||||
|
sharingMatNames[2] = "";
|
||||||
|
sharingMatNames[3] = "";
|
||||||
|
sharingCutEdges[0] = 0;
|
||||||
|
sharingCutEdges[1] = 0;
|
||||||
|
sharingCutEdges[2] = 0;
|
||||||
|
sharingCutEdges[3] = 0;
|
||||||
|
}
|
||||||
|
bool operator!= (const LigoData &other) const
|
||||||
|
{
|
||||||
|
return (posX != other.posX) ||
|
||||||
|
(posY != other.posY) ||
|
||||||
|
(rot != other.rot) ||
|
||||||
|
(flip != other.flip) ||
|
||||||
|
(zoneName != other.zoneName) ||
|
||||||
|
(sharingMatNames[0] != other.sharingMatNames[0]) ||
|
||||||
|
(sharingMatNames[1] != other.sharingMatNames[1]) ||
|
||||||
|
(sharingMatNames[2] != other.sharingMatNames[2]) ||
|
||||||
|
(sharingMatNames[3] != other.sharingMatNames[3]) ||
|
||||||
|
(sharingCutEdges[0] != other.sharingCutEdges[0]) ||
|
||||||
|
(sharingCutEdges[1] != other.sharingCutEdges[1]) ||
|
||||||
|
(sharingCutEdges[2] != other.sharingCutEdges[2]) ||
|
||||||
|
(sharingCutEdges[3] != other.sharingCutEdges[3]);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,7 +83,7 @@ struct LigoData
|
||||||
@brief
|
@brief
|
||||||
@details
|
@details
|
||||||
*/
|
*/
|
||||||
class ZoneRegionObject
|
class LANDSCAPE_EDITOR_EXPORT ZoneRegionObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ZoneRegionObject();
|
ZoneRegionObject();
|
||||||
|
|
Loading…
Reference in a new issue