mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-06 15:29:02 +00:00
Changed: #1301 Added checking for the overlaps when adding a new landscape. Added blackout inactive landscapes. Operations adding and removing landscapes work correctly.
This commit is contained in:
parent
eacb41e5b2
commit
712349f7f5
9 changed files with 232 additions and 97 deletions
|
@ -32,13 +32,14 @@
|
||||||
namespace LandscapeEditor
|
namespace LandscapeEditor
|
||||||
{
|
{
|
||||||
|
|
||||||
ZoneBuilder::ZoneBuilder(ListZonesWidget *listZonesWidget, LandscapeScene *landscapeScene, QUndoStack *undoStack)
|
ZoneBuilder::ZoneBuilder(LandscapeScene *landscapeScene, ListZonesWidget *listZonesWidget, QUndoStack *undoStack)
|
||||||
: m_currentZoneRegion(-1),
|
: m_currentZoneRegion(-1),
|
||||||
m_pixmapDatabase(0),
|
m_pixmapDatabase(0),
|
||||||
m_listZonesWidget(listZonesWidget),
|
m_listZonesWidget(listZonesWidget),
|
||||||
m_landscapeScene(landscapeScene),
|
m_landscapeScene(landscapeScene),
|
||||||
m_undoStack(undoStack)
|
m_undoStack(undoStack)
|
||||||
{
|
{
|
||||||
|
nlassert(m_landscapeScene);
|
||||||
m_pixmapDatabase = new PixmapDatabase();
|
m_pixmapDatabase = new PixmapDatabase();
|
||||||
m_lastPathName = "";
|
m_lastPathName = "";
|
||||||
}
|
}
|
||||||
|
@ -81,6 +82,9 @@ bool ZoneBuilder::init(const QString &pathName, bool makeAZone)
|
||||||
|
|
||||||
void ZoneBuilder::actionLigoTile(const LigoData &data, const ZonePosition &zonePos)
|
void ZoneBuilder::actionLigoTile(const LigoData &data, const ZonePosition &zonePos)
|
||||||
{
|
{
|
||||||
|
if (m_undoStack == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
checkBeginMacro();
|
checkBeginMacro();
|
||||||
nlinfo(QString("%1 %2 %3 (%4 %5)").arg(data.zoneName.c_str()).arg(zonePos.x).arg(zonePos.y).arg(data.posX).arg(data.posY).toStdString().c_str());
|
nlinfo(QString("%1 %2 %3 (%4 %5)").arg(data.zoneName.c_str()).arg(zonePos.x).arg(zonePos.y).arg(data.posX).arg(data.posY).toStdString().c_str());
|
||||||
m_zonePositionList.push_back(zonePos);
|
m_zonePositionList.push_back(zonePos);
|
||||||
|
@ -89,6 +93,9 @@ void ZoneBuilder::actionLigoTile(const LigoData &data, const ZonePosition &zoneP
|
||||||
|
|
||||||
void ZoneBuilder::actionLigoMove(uint index, sint32 deltaX, sint32 deltaY)
|
void ZoneBuilder::actionLigoMove(uint index, sint32 deltaX, sint32 deltaY)
|
||||||
{
|
{
|
||||||
|
if (m_undoStack == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
checkBeginMacro();
|
checkBeginMacro();
|
||||||
nlinfo("ligoMove");
|
nlinfo("ligoMove");
|
||||||
//m_undoStack->push(new LigoMoveCommand(index, deltaX, deltaY, this));
|
//m_undoStack->push(new LigoMoveCommand(index, deltaX, deltaY, this));
|
||||||
|
@ -96,6 +103,9 @@ void ZoneBuilder::actionLigoMove(uint index, sint32 deltaX, sint32 deltaY)
|
||||||
|
|
||||||
void ZoneBuilder::actionLigoResize(uint index, sint32 newMinX, sint32 newMaxX, sint32 newMinY, sint32 newMaxY)
|
void ZoneBuilder::actionLigoResize(uint index, sint32 newMinX, sint32 newMaxX, sint32 newMinY, sint32 newMaxY)
|
||||||
{
|
{
|
||||||
|
if (m_undoStack == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
checkBeginMacro();
|
checkBeginMacro();
|
||||||
nlinfo(QString("minX=%1 maxX=%2 minY=%3 maxY=%4").arg(newMinX).arg(newMaxX).arg(newMinY).arg(newMaxY).toStdString().c_str());
|
nlinfo(QString("minX=%1 maxX=%2 minY=%3 maxY=%4").arg(newMinX).arg(newMaxX).arg(newMinY).arg(newMaxY).toStdString().c_str());
|
||||||
m_undoStack->push(new LigoResizeCommand(index, newMinX, newMaxX, newMinY, newMaxY, this));
|
m_undoStack->push(new LigoResizeCommand(index, newMinX, newMaxX, newMinY, newMaxY, this));
|
||||||
|
@ -103,16 +113,20 @@ void ZoneBuilder::actionLigoResize(uint index, sint32 newMinX, sint32 newMaxX, s
|
||||||
|
|
||||||
void ZoneBuilder::addZone(sint32 posX, sint32 posY)
|
void ZoneBuilder::addZone(sint32 posX, sint32 posY)
|
||||||
{
|
{
|
||||||
if (m_builderZoneRegions.empty())
|
// Read-only mode
|
||||||
|
if ((m_listZonesWidget == 0) || (m_undoStack == 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (m_landscapeItems.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Check zone name
|
||||||
std::string zoneName = m_listZonesWidget->currentZoneName().toStdString();
|
std::string zoneName = m_listZonesWidget->currentZoneName().toStdString();
|
||||||
if (zoneName.empty())
|
if (zoneName.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::string error;
|
BuilderZoneRegion *builderZoneRegion = m_landscapeItems.at(m_currentZoneRegion).builderZoneRegion;
|
||||||
BuilderZoneRegion *builderZoneRegion = m_builderZoneRegions.at(m_currentZoneRegion);
|
builderZoneRegion->init(this);
|
||||||
builderZoneRegion->init(this, error);
|
|
||||||
|
|
||||||
uint8 rot = uint8(m_listZonesWidget->currentRot());
|
uint8 rot = uint8(m_listZonesWidget->currentRot());
|
||||||
uint8 flip = uint8(m_listZonesWidget->currentFlip());
|
uint8 flip = uint8(m_listZonesWidget->currentFlip());
|
||||||
|
@ -122,8 +136,6 @@ void ZoneBuilder::addZone(sint32 posX, sint32 posY)
|
||||||
m_titleAction = QString("Add zone %1,%2").arg(posX).arg(posY);
|
m_titleAction = QString("Add zone %1,%2").arg(posX).arg(posY);
|
||||||
m_createdAction = false;
|
m_createdAction = false;
|
||||||
m_zonePositionList.clear();
|
m_zonePositionList.clear();
|
||||||
|
|
||||||
nlinfo("---------");
|
|
||||||
if (m_listZonesWidget->isForce())
|
if (m_listZonesWidget->isForce())
|
||||||
{
|
{
|
||||||
builderZoneRegion->addForce(posX, posY, rot, flip, zoneBankElement);
|
builderZoneRegion->addForce(posX, posY, rot, flip, zoneBankElement);
|
||||||
|
@ -140,45 +152,95 @@ void ZoneBuilder::addZone(sint32 posX, sint32 posY)
|
||||||
|
|
||||||
void ZoneBuilder::addTransition(const sint32 posX, const sint32 posY)
|
void ZoneBuilder::addTransition(const sint32 posX, const sint32 posY)
|
||||||
{
|
{
|
||||||
|
if ((m_listZonesWidget == 0) || (m_undoStack == 0))
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneBuilder::delZone(const sint32 posX, const sint32 posY)
|
void ZoneBuilder::delZone(const sint32 posX, const sint32 posY)
|
||||||
{
|
{
|
||||||
if (m_builderZoneRegions.empty())
|
if ((m_listZonesWidget == 0) || (m_undoStack == 0))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (m_landscapeItems.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_titleAction = QString("Del zone %1,%2").arg(posX).arg(posY);
|
m_titleAction = QString("Del zone %1,%2").arg(posX).arg(posY);
|
||||||
m_createdAction = false;
|
m_createdAction = false;
|
||||||
|
|
||||||
BuilderZoneRegion *builderZoneRegion = m_builderZoneRegions.at(m_currentZoneRegion);
|
BuilderZoneRegion *builderZoneRegion = m_landscapeItems.at(m_currentZoneRegion).builderZoneRegion;
|
||||||
std::string error;
|
|
||||||
nlinfo("---------");
|
builderZoneRegion->init(this);
|
||||||
builderZoneRegion->init(this, error);
|
|
||||||
builderZoneRegion->del(posX, posY);
|
builderZoneRegion->del(posX, posY);
|
||||||
checkEndMacro();
|
checkEndMacro();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZoneBuilder::createZoneRegion()
|
int ZoneBuilder::createZoneRegion()
|
||||||
{
|
{
|
||||||
ZoneRegionObject *newZoneRegion = new ZoneRegionObject();
|
int newId = m_landscapeItems.size();
|
||||||
m_zoneRegions.push_back(newZoneRegion);
|
LandscapeItem landItem;
|
||||||
if (m_currentZoneRegion == -1)
|
landItem.zoneRegionObject = new ZoneRegionObject();
|
||||||
m_currentZoneRegion = m_zoneRegions.indexOf(newZoneRegion);
|
landItem.builderZoneRegion = new BuilderZoneRegion(newId);
|
||||||
|
landItem.builderZoneRegion->init(this);
|
||||||
|
landItem.rectItem = 0;
|
||||||
|
|
||||||
newZone();
|
newZone();
|
||||||
return m_zoneRegions.indexOf(newZoneRegion);
|
m_landscapeItems.push_back(landItem);
|
||||||
|
if (m_currentZoneRegion == -1)
|
||||||
|
setCurrentZoneRegion(newId);
|
||||||
|
|
||||||
|
return newId;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZoneBuilder::createZoneRegion(const QString &fileName)
|
||||||
|
{
|
||||||
|
int newId = m_landscapeItems.size();
|
||||||
|
LandscapeItem landItem;
|
||||||
|
landItem.zoneRegionObject = new ZoneRegionObject();
|
||||||
|
landItem.zoneRegionObject->load(fileName.toStdString());
|
||||||
|
|
||||||
|
if (!checkOverlaps(landItem.zoneRegionObject->ligoZoneRegion()))
|
||||||
|
{
|
||||||
|
delete landItem.zoneRegionObject;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
landItem.builderZoneRegion = new BuilderZoneRegion(newId);
|
||||||
|
landItem.builderZoneRegion->init(this);
|
||||||
|
|
||||||
|
newZone();
|
||||||
|
m_landscapeItems.push_back(landItem);
|
||||||
|
|
||||||
|
m_landscapeScene->addZoneRegion(landItem.zoneRegionObject->ligoZoneRegion());
|
||||||
|
m_landscapeItems.at(newId).rectItem = m_landscapeScene->createLayerBlackout(landItem.zoneRegionObject->ligoZoneRegion());
|
||||||
|
|
||||||
|
if (m_currentZoneRegion == -1)
|
||||||
|
setCurrentZoneRegion(newId);
|
||||||
|
|
||||||
|
return newId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneBuilder::deleteZoneRegion(int id)
|
void ZoneBuilder::deleteZoneRegion(int id)
|
||||||
{
|
{
|
||||||
if ((0 <= id) && (id < m_zoneRegions.size()))
|
if ((0 <= id) && (id < int(m_landscapeItems.size())))
|
||||||
delete m_zoneRegions.takeAt(id);
|
{
|
||||||
|
m_landscapeScene->delZoneRegion(m_landscapeItems.at(id).zoneRegionObject->ligoZoneRegion());
|
||||||
|
delete m_landscapeItems.at(id).zoneRegionObject;
|
||||||
|
delete m_landscapeItems.at(id).builderZoneRegion;
|
||||||
|
delete m_landscapeItems.at(id).rectItem;
|
||||||
|
m_landscapeItems.erase(m_landscapeItems.begin() + id);
|
||||||
|
calcMask();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneBuilder::setCurrentZoneRegion(int id)
|
void ZoneBuilder::setCurrentZoneRegion(int id)
|
||||||
{
|
{
|
||||||
if ((0 <= id) && (id < m_zoneRegions.size()))
|
if ((0 <= id) && (id < int(m_landscapeItems.size())))
|
||||||
|
{
|
||||||
|
if (currentIdZoneRegion() != -1)
|
||||||
|
m_landscapeItems.at(m_currentZoneRegion).rectItem = m_landscapeScene->createLayerBlackout(currentZoneRegion()->ligoZoneRegion());
|
||||||
m_currentZoneRegion = id;
|
m_currentZoneRegion = id;
|
||||||
|
delete m_landscapeItems.at(id).rectItem;
|
||||||
|
m_landscapeItems.at(id).rectItem = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZoneBuilder::currentIdZoneRegion() const
|
int ZoneBuilder::currentIdZoneRegion() const
|
||||||
|
@ -188,27 +250,27 @@ int ZoneBuilder::currentIdZoneRegion() const
|
||||||
|
|
||||||
ZoneRegionObject *ZoneBuilder::currentZoneRegion() const
|
ZoneRegionObject *ZoneBuilder::currentZoneRegion() const
|
||||||
{
|
{
|
||||||
return m_zoneRegions.at(m_currentZoneRegion);
|
return m_landscapeItems.at(m_currentZoneRegion).zoneRegionObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZoneBuilder::countZoneRegion() const
|
int ZoneBuilder::countZoneRegion() const
|
||||||
{
|
{
|
||||||
return m_zoneRegions.size();
|
return m_landscapeItems.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
ZoneRegionObject *ZoneBuilder::zoneRegion(int id) const
|
ZoneRegionObject *ZoneBuilder::zoneRegion(int id) const
|
||||||
{
|
{
|
||||||
return m_zoneRegions.at(id);
|
return m_landscapeItems.at(id).zoneRegionObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneBuilder::ligoData(LigoData &data, const ZonePosition &zonePos)
|
void ZoneBuilder::ligoData(LigoData &data, const ZonePosition &zonePos)
|
||||||
{
|
{
|
||||||
m_zoneRegions.at(zonePos.region)->ligoData(data, zonePos.x, zonePos.y);
|
m_landscapeItems.at(zonePos.region).zoneRegionObject->ligoData(data, zonePos.x, zonePos.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneBuilder::setLigoData(LigoData &data, const ZonePosition &zonePos)
|
void ZoneBuilder::setLigoData(LigoData &data, const ZonePosition &zonePos)
|
||||||
{
|
{
|
||||||
m_zoneRegions.at(zonePos.region)->setLigoData(data, zonePos.x, zonePos.y);
|
m_landscapeItems.at(zonePos.region).zoneRegionObject->setLigoData(data, zonePos.x, zonePos.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZoneBuilder::initZoneBank (const QString &pathName)
|
bool ZoneBuilder::initZoneBank (const QString &pathName)
|
||||||
|
@ -243,16 +305,13 @@ QString ZoneBuilder::dataPath() const
|
||||||
|
|
||||||
void ZoneBuilder::newZone()
|
void ZoneBuilder::newZone()
|
||||||
{
|
{
|
||||||
BuilderZoneRegion *builderZoneRegion = new BuilderZoneRegion(m_builderZoneRegions.size());
|
|
||||||
m_builderZoneRegions.push_back(builderZoneRegion);
|
|
||||||
|
|
||||||
// Select starting point for the moment 0,0
|
// Select starting point for the moment 0,0
|
||||||
sint32 x = 0, y = 0;
|
sint32 x = 0, y = 0;
|
||||||
|
|
||||||
// If there are some zone already present increase x until free
|
// If there are some zone already present increase x until free
|
||||||
for (int i = 0; i < m_zoneRegions.size(); ++i)
|
for (size_t i = 0; i < m_landscapeItems.size(); ++i)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion &zoneRegion = m_zoneRegions.at(i)->zoneRegion();
|
const NLLIGO::CZoneRegion &zoneRegion = m_landscapeItems.at(i).zoneRegionObject->ligoZoneRegion();
|
||||||
const std::string &zoneName = zoneRegion.getName (x, y);
|
const std::string &zoneName = zoneRegion.getName (x, y);
|
||||||
if ((zoneName != STRING_OUT_OF_BOUND) && (zoneName != STRING_UNUSED))
|
if ((zoneName != STRING_OUT_OF_BOUND) && (zoneName != STRING_UNUSED))
|
||||||
{
|
{
|
||||||
|
@ -278,18 +337,17 @@ bool ZoneBuilder::getZoneMask(sint32 x, sint32 y)
|
||||||
|
|
||||||
void ZoneBuilder::calcMask()
|
void ZoneBuilder::calcMask()
|
||||||
{
|
{
|
||||||
sint32 i;
|
|
||||||
sint32 x, y;
|
sint32 x, y;
|
||||||
|
|
||||||
m_minY = m_minX = 1000000;
|
m_minY = m_minX = 1000000;
|
||||||
m_maxY = m_maxX = -1000000;
|
m_maxY = m_maxX = -1000000;
|
||||||
|
|
||||||
if (m_builderZoneRegions.size() == 0)
|
if (m_landscapeItems.size() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < (sint32)m_builderZoneRegions.size(); ++i)
|
for (size_t i = 0; i < m_landscapeItems.size(); ++i)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion ®ion = zoneRegion(i)->zoneRegion();
|
const NLLIGO::CZoneRegion ®ion = m_landscapeItems.at(i).zoneRegionObject->ligoZoneRegion();
|
||||||
|
|
||||||
if (m_minX > region.getMinX())
|
if (m_minX > region.getMinX())
|
||||||
m_minX = region.getMinX();
|
m_minX = region.getMinX();
|
||||||
|
@ -308,10 +366,10 @@ void ZoneBuilder::calcMask()
|
||||||
{
|
{
|
||||||
m_zoneMask[x - m_minX + (y - m_minY) * stride] = true;
|
m_zoneMask[x - m_minX + (y - m_minY) * stride] = true;
|
||||||
|
|
||||||
for (i = 0; i < (sint32)m_builderZoneRegions.size(); ++i)
|
for (size_t i = 0; i < m_landscapeItems.size(); ++i)
|
||||||
if (i != m_currentZoneRegion)
|
if (int(i) != m_currentZoneRegion)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion ®ion = zoneRegion(i)->zoneRegion();
|
const NLLIGO::CZoneRegion ®ion = zoneRegion(i)->ligoZoneRegion();
|
||||||
|
|
||||||
const std::string &rSZone = region.getName (x, y);
|
const std::string &rSZone = region.getName (x, y);
|
||||||
if ((rSZone != STRING_OUT_OF_BOUND) && (rSZone != STRING_UNUSED))
|
if ((rSZone != STRING_OUT_OF_BOUND) && (rSZone != STRING_UNUSED))
|
||||||
|
@ -322,25 +380,24 @@ void ZoneBuilder::calcMask()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZoneBuilder::getZoneAmongRegions (ZonePosition &zonePos, BuilderZoneRegion *builderZoneRegionFrom, sint32 x, sint32 y)
|
bool ZoneBuilder::getZoneAmongRegions(ZonePosition &zonePos, BuilderZoneRegion *builderZoneRegionFrom, sint32 x, sint32 y)
|
||||||
{
|
{
|
||||||
Q_FOREACH(ZoneRegionObject *zoneRegion, m_zoneRegions)
|
for (size_t i = 0; i < m_landscapeItems.size(); ++i)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion ®ion = zoneRegion->zoneRegion();
|
const NLLIGO::CZoneRegion ®ion = m_landscapeItems.at(i).zoneRegionObject->ligoZoneRegion();
|
||||||
if ((x < region.getMinX()) || (x > region.getMaxX()) ||
|
if ((x < region.getMinX()) || (x > region.getMaxX()) ||
|
||||||
(y < region.getMinY()) || (y > region.getMaxY()))
|
(y < region.getMinY()) || (y > region.getMaxY()))
|
||||||
continue;
|
continue;
|
||||||
if (region.getName(x, y) != STRING_UNUSED)
|
if (region.getName(x, y) != STRING_UNUSED)
|
||||||
{
|
{
|
||||||
int index = m_zoneRegions.indexOf(zoneRegion);
|
builderZoneRegionFrom = m_landscapeItems.at(i).builderZoneRegion;
|
||||||
builderZoneRegionFrom = m_builderZoneRegions.at(index);
|
zonePos = ZonePosition(x, y, i);
|
||||||
zonePos = ZonePosition(x, y, index);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The zone is not present in other region so it is an empty or oob zone of the current region
|
// The zone is not present in other region so it is an empty or oob zone of the current region
|
||||||
const NLLIGO::CZoneRegion ®ion = zoneRegion(builderZoneRegionFrom->getRegionId())->zoneRegion();
|
const NLLIGO::CZoneRegion ®ion = zoneRegion(builderZoneRegionFrom->getRegionId())->ligoZoneRegion();
|
||||||
if ((x < region.getMinX()) || (x > region.getMaxX()) ||
|
if ((x < region.getMinX()) || (x > region.getMaxX()) ||
|
||||||
(y < region.getMinY()) || (y > region.getMaxY()))
|
(y < region.getMinY()) || (y > region.getMaxY()))
|
||||||
return false; // Out Of Bound
|
return false; // Out Of Bound
|
||||||
|
@ -372,4 +429,24 @@ void ZoneBuilder::checkEndMacro()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ZoneBuilder::checkOverlaps(const NLLIGO::CZoneRegion &newZoneRegion)
|
||||||
|
{
|
||||||
|
for (size_t j = 0; j < m_landscapeItems.size(); ++j)
|
||||||
|
{
|
||||||
|
const NLLIGO::CZoneRegion &zoneRegion = m_landscapeItems.at(j).zoneRegionObject->ligoZoneRegion();
|
||||||
|
for (sint32 y = zoneRegion.getMinY(); y <= zoneRegion.getMaxY(); ++y)
|
||||||
|
for (sint32 x = zoneRegion.getMinX(); x <= zoneRegion.getMaxX(); ++x)
|
||||||
|
{
|
||||||
|
const std::string &refZoneName = zoneRegion.getName(x, y);
|
||||||
|
if (refZoneName != STRING_UNUSED)
|
||||||
|
{
|
||||||
|
const std::string &zoneName = newZoneRegion.getName(x, y);
|
||||||
|
if ((zoneName != STRING_UNUSED) && (zoneName != STRING_OUT_OF_BOUND))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
} /* namespace LandscapeEditor */
|
} /* namespace LandscapeEditor */
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtGui/QPixmap>
|
#include <QtGui/QPixmap>
|
||||||
#include <QtGui/QUndoStack>
|
#include <QtGui/QUndoStack>
|
||||||
|
#include <QtGui/QGraphicsRectItem>
|
||||||
|
|
||||||
namespace LandscapeEditor
|
namespace LandscapeEditor
|
||||||
{
|
{
|
||||||
|
@ -77,7 +78,7 @@ PixmapDatabase contains the graphics for the zones
|
||||||
class ZoneBuilder
|
class ZoneBuilder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ZoneBuilder(ListZonesWidget *listZonesWidget, LandscapeScene *landscapeScene, QUndoStack *undoStack);
|
ZoneBuilder(LandscapeScene *landscapeScene, ListZonesWidget *listZonesWidget = 0, QUndoStack *undoStack = 0);
|
||||||
~ZoneBuilder();
|
~ZoneBuilder();
|
||||||
|
|
||||||
/// Init zoneBank and init zone pixmap database
|
/// Init zoneBank and init zone pixmap database
|
||||||
|
@ -88,18 +89,24 @@ public:
|
||||||
bool getZoneMask (sint32 x, sint32 y);
|
bool getZoneMask (sint32 x, sint32 y);
|
||||||
bool getZoneAmongRegions(ZonePosition &zonePos, BuilderZoneRegion *builderZoneRegionFrom, sint32 x, sint32 y);
|
bool getZoneAmongRegions(ZonePosition &zonePos, BuilderZoneRegion *builderZoneRegionFrom, sint32 x, sint32 y);
|
||||||
|
|
||||||
// Ligo Actions
|
/// Ligo Actions
|
||||||
|
/// @{
|
||||||
void actionLigoTile(const LigoData &data, const ZonePosition &zonePos);
|
void actionLigoTile(const LigoData &data, const ZonePosition &zonePos);
|
||||||
void actionLigoMove(uint index, sint32 deltaX, sint32 deltaY);
|
void actionLigoMove(uint index, sint32 deltaX, sint32 deltaY);
|
||||||
void actionLigoResize(uint index, sint32 newMinX, sint32 newMaxX, sint32 newMinY, sint32 newMaxY);
|
void actionLigoResize(uint index, sint32 newMinX, sint32 newMaxX, sint32 newMinY, sint32 newMaxY);
|
||||||
|
/// @}
|
||||||
|
|
||||||
// Zone Bricks
|
/// Zone Bricks
|
||||||
|
/// @{
|
||||||
void addZone(sint32 posX, sint32 posY);
|
void addZone(sint32 posX, sint32 posY);
|
||||||
void addTransition(const sint32 posX, const sint32 posY);
|
void addTransition(const sint32 posX, const sint32 posY);
|
||||||
void delZone(const sint32 posX, const sint32 posY);
|
void delZone(const sint32 posX, const sint32 posY);
|
||||||
|
/// @}
|
||||||
|
|
||||||
// Zone Region
|
/// Zone Region
|
||||||
|
/// @{
|
||||||
int createZoneRegion();
|
int createZoneRegion();
|
||||||
|
int createZoneRegion(const QString &fileName);
|
||||||
void deleteZoneRegion(int id);
|
void deleteZoneRegion(int id);
|
||||||
void setCurrentZoneRegion(int id);
|
void setCurrentZoneRegion(int id);
|
||||||
int currentIdZoneRegion() const;
|
int currentIdZoneRegion() const;
|
||||||
|
@ -108,6 +115,7 @@ public:
|
||||||
ZoneRegionObject *zoneRegion(int id) const;
|
ZoneRegionObject *zoneRegion(int id) const;
|
||||||
void ligoData(LigoData &data, const ZonePosition &zonePos);
|
void ligoData(LigoData &data, const ZonePosition &zonePos);
|
||||||
void setLigoData(LigoData &data, const ZonePosition &zonePos);
|
void setLigoData(LigoData &data, const ZonePosition &zonePos);
|
||||||
|
/// @}
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
NLLIGO::CZoneBank &getZoneBank()
|
NLLIGO::CZoneBank &getZoneBank()
|
||||||
|
@ -127,15 +135,22 @@ private:
|
||||||
void checkBeginMacro();
|
void checkBeginMacro();
|
||||||
void checkEndMacro();
|
void checkEndMacro();
|
||||||
|
|
||||||
|
bool checkOverlaps(const NLLIGO::CZoneRegion &newZoneRegion);
|
||||||
|
|
||||||
|
struct LandscapeItem
|
||||||
|
{
|
||||||
|
BuilderZoneRegion *builderZoneRegion;
|
||||||
|
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;
|
std::vector<bool> m_zoneMask;
|
||||||
|
|
||||||
QString m_lastPathName;
|
QString m_lastPathName;
|
||||||
|
|
||||||
QList<ZoneRegionObject *> m_zoneRegions;
|
|
||||||
int m_currentZoneRegion;
|
int m_currentZoneRegion;
|
||||||
|
std::vector<LandscapeItem> m_landscapeItems;
|
||||||
std::vector<BuilderZoneRegion *> m_builderZoneRegions;
|
|
||||||
|
|
||||||
bool m_createdAction;
|
bool m_createdAction;
|
||||||
QString m_titleAction;
|
QString m_titleAction;
|
||||||
|
|
|
@ -35,7 +35,7 @@ BuilderZoneRegion::BuilderZoneRegion(uint regionId)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BuilderZoneRegion::init(ZoneBuilder *zoneBuilder, std::string &error)
|
bool BuilderZoneRegion::init(ZoneBuilder *zoneBuilder)
|
||||||
{
|
{
|
||||||
if (m_firstInit)
|
if (m_firstInit)
|
||||||
return true;
|
return true;
|
||||||
|
@ -264,7 +264,7 @@ void BuilderZoneRegion::add(sint32 x, sint32 y, uint8 rot, uint8 flip, NLLIGO::C
|
||||||
|
|
||||||
void BuilderZoneRegion::invertCutEdge(sint32 x, sint32 y, uint8 cePos)
|
void BuilderZoneRegion::invertCutEdge(sint32 x, sint32 y, uint8 cePos)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->zoneRegion();
|
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->ligoZoneRegion();
|
||||||
if ((x < zoneRegion.getMinX ()) || (x > zoneRegion.getMaxX ()) ||
|
if ((x < zoneRegion.getMinX ()) || (x > zoneRegion.getMaxX ()) ||
|
||||||
(y < zoneRegion.getMinY ()) || (y > zoneRegion.getMaxY ()))
|
(y < zoneRegion.getMinY ()) || (y > zoneRegion.getMaxY ()))
|
||||||
return;
|
return;
|
||||||
|
@ -371,7 +371,7 @@ void BuilderZoneRegion::invertCutEdge(sint32 x, sint32 y, uint8 cePos)
|
||||||
|
|
||||||
void BuilderZoneRegion::cycleTransition(sint32 x, sint32 y)
|
void BuilderZoneRegion::cycleTransition(sint32 x, sint32 y)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->zoneRegion();
|
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->ligoZoneRegion();
|
||||||
if ((x < zoneRegion.getMinX ()) || (x > zoneRegion.getMaxX ()) ||
|
if ((x < zoneRegion.getMinX ()) || (x > zoneRegion.getMaxX ()) ||
|
||||||
(y < zoneRegion.getMinY ()) || (y > zoneRegion.getMaxY ()))
|
(y < zoneRegion.getMinY ()) || (y > zoneRegion.getMaxY ()))
|
||||||
return;
|
return;
|
||||||
|
@ -391,7 +391,7 @@ void BuilderZoneRegion::cycleTransition(sint32 x, sint32 y)
|
||||||
|
|
||||||
bool BuilderZoneRegion::addNotPropagate (sint32 x, sint32 y, uint8 rot, uint8 flip, NLLIGO::CZoneBankElement *zoneBankElement)
|
bool BuilderZoneRegion::addNotPropagate (sint32 x, sint32 y, uint8 rot, uint8 flip, NLLIGO::CZoneBankElement *zoneBankElement)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->zoneRegion();
|
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->ligoZoneRegion();
|
||||||
sint32 sizeX = zoneBankElement->getSizeX(), sizeY = zoneBankElement->getSizeY();
|
sint32 sizeX = zoneBankElement->getSizeX(), sizeY = zoneBankElement->getSizeY();
|
||||||
sint32 i, j;
|
sint32 i, j;
|
||||||
NLLIGO::SPiece sMask, sPosX, sPosY;
|
NLLIGO::SPiece sMask, sPosX, sPosY;
|
||||||
|
@ -472,7 +472,7 @@ bool BuilderZoneRegion::addNotPropagate (sint32 x, sint32 y, uint8 rot, uint8 fl
|
||||||
|
|
||||||
void BuilderZoneRegion::addForce (sint32 x, sint32 y, uint8 rot, uint8 flip, NLLIGO::CZoneBankElement *zoneBankElement)
|
void BuilderZoneRegion::addForce (sint32 x, sint32 y, uint8 rot, uint8 flip, NLLIGO::CZoneBankElement *zoneBankElement)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->zoneRegion();
|
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->ligoZoneRegion();
|
||||||
sint32 sizeX = zoneBankElement->getSizeX(), sizeY = zoneBankElement->getSizeY();
|
sint32 sizeX = zoneBankElement->getSizeX(), sizeY = zoneBankElement->getSizeY();
|
||||||
sint32 i, j;
|
sint32 i, j;
|
||||||
NLLIGO::SPiece sMask, sPosX, sPosY;
|
NLLIGO::SPiece sMask, sPosX, sPosY;
|
||||||
|
@ -636,7 +636,7 @@ uint8 TransToEdge[72][4] =
|
||||||
|
|
||||||
void BuilderZoneRegion::addTransition (sint32 x, sint32 y, uint8 rot, uint8 flip, NLLIGO::CZoneBankElement *zoneBankElement)
|
void BuilderZoneRegion::addTransition (sint32 x, sint32 y, uint8 rot, uint8 flip, NLLIGO::CZoneBankElement *zoneBankElement)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->zoneRegion();
|
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->ligoZoneRegion();
|
||||||
uint32 i;
|
uint32 i;
|
||||||
// Check that we write in an already defined place
|
// Check that we write in an already defined place
|
||||||
if ((x < zoneRegion.getMinX ()) || (x > zoneRegion.getMaxX ()) ||
|
if ((x < zoneRegion.getMinX ()) || (x > zoneRegion.getMaxX ()) ||
|
||||||
|
@ -806,7 +806,7 @@ void BuilderZoneRegion::addTransition (sint32 x, sint32 y, uint8 rot, uint8 flip
|
||||||
|
|
||||||
void BuilderZoneRegion::addToUpdateAndCreate(BuilderZoneRegion* builderZoneRegion, sint32 sharePos, sint32 x, sint32 y, const std::string &newMat, void *pInt1, void *pInt2)
|
void BuilderZoneRegion::addToUpdateAndCreate(BuilderZoneRegion* builderZoneRegion, sint32 sharePos, sint32 x, sint32 y, const std::string &newMat, void *pInt1, void *pInt2)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->zoneRegion();
|
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->ligoZoneRegion();
|
||||||
ToUpdate *ptCreate = reinterpret_cast<ToUpdate *>(pInt1);
|
ToUpdate *ptCreate = reinterpret_cast<ToUpdate *>(pInt1);
|
||||||
ToUpdate *ptUpdate = reinterpret_cast<ToUpdate *>(pInt2);
|
ToUpdate *ptUpdate = reinterpret_cast<ToUpdate *>(pInt2);
|
||||||
sint32 stride = (1 + zoneRegion.getMaxX() - zoneRegion.getMinX());
|
sint32 stride = (1 + zoneRegion.getMaxX() - zoneRegion.getMinX());
|
||||||
|
@ -831,7 +831,7 @@ void BuilderZoneRegion::addToUpdateAndCreate(BuilderZoneRegion* builderZoneRegio
|
||||||
void BuilderZoneRegion::putTransitions (sint32 inX, sint32 inY, const NLLIGO::SPiece &mask, const std::string &matName,
|
void BuilderZoneRegion::putTransitions (sint32 inX, sint32 inY, const NLLIGO::SPiece &mask, const std::string &matName,
|
||||||
void *pInternal)
|
void *pInternal)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->zoneRegion();
|
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->ligoZoneRegion();
|
||||||
ToUpdate tCreate; // Transition to create
|
ToUpdate tCreate; // Transition to create
|
||||||
ToUpdate *ptUpdate = reinterpret_cast<ToUpdate *>(pInternal); // Transition to update
|
ToUpdate *ptUpdate = reinterpret_cast<ToUpdate *>(pInternal); // Transition to update
|
||||||
|
|
||||||
|
@ -984,7 +984,7 @@ void BuilderZoneRegion::putTransitions (sint32 inX, sint32 inY, const NLLIGO::SP
|
||||||
// For all transition to update choose the cut edge
|
// For all transition to update choose the cut edge
|
||||||
for (m = 0; m < (sint32)tCreate.size(); ++m)
|
for (m = 0; m < (sint32)tCreate.size(); ++m)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion &zoneRegion2 = m_zoneBuilder->zoneRegion(tCreate.getBuilderZoneRegion(m)->getRegionId())->zoneRegion();
|
const NLLIGO::CZoneRegion &zoneRegion2 = m_zoneBuilder->zoneRegion(tCreate.getBuilderZoneRegion(m)->getRegionId())->ligoZoneRegion();
|
||||||
x = tCreate.getX(m);
|
x = tCreate.getX(m);
|
||||||
y = tCreate.getY(m);
|
y = tCreate.getY(m);
|
||||||
|
|
||||||
|
@ -1145,7 +1145,7 @@ void BuilderZoneRegion::putTransitions (sint32 inX, sint32 inY, const NLLIGO::SP
|
||||||
// Finally update all transition
|
// Finally update all transition
|
||||||
for (m = 0; m < (sint32)tCreate.size(); ++m)
|
for (m = 0; m < (sint32)tCreate.size(); ++m)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion &zoneRegion2 = m_zoneBuilder->zoneRegion(tCreate.getBuilderZoneRegion(m)->getRegionId())->zoneRegion();
|
const NLLIGO::CZoneRegion &zoneRegion2 = m_zoneBuilder->zoneRegion(tCreate.getBuilderZoneRegion(m)->getRegionId())->ligoZoneRegion();
|
||||||
x = tCreate.getX(m);
|
x = tCreate.getX(m);
|
||||||
y = tCreate.getY(m);
|
y = tCreate.getY(m);
|
||||||
|
|
||||||
|
@ -1155,7 +1155,7 @@ void BuilderZoneRegion::putTransitions (sint32 inX, sint32 inY, const NLLIGO::SP
|
||||||
}
|
}
|
||||||
for (m = 0; m < (sint32)ptUpdate->size(); ++m)
|
for (m = 0; m < (sint32)ptUpdate->size(); ++m)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion &zoneRegion2 = m_zoneBuilder->zoneRegion(tCreate.getBuilderZoneRegion(m)->getRegionId())->zoneRegion();
|
const NLLIGO::CZoneRegion &zoneRegion2 = m_zoneBuilder->zoneRegion(tCreate.getBuilderZoneRegion(m)->getRegionId())->ligoZoneRegion();
|
||||||
x = ptUpdate->getX(m);
|
x = ptUpdate->getX(m);
|
||||||
y = ptUpdate->getY(m);
|
y = ptUpdate->getY(m);
|
||||||
if ((x >= zoneRegion2.getMinX()) && (x <= zoneRegion2.getMaxX()) &&
|
if ((x >= zoneRegion2.getMinX()) && (x <= zoneRegion2.getMaxX()) &&
|
||||||
|
@ -1166,7 +1166,7 @@ void BuilderZoneRegion::putTransitions (sint32 inX, sint32 inY, const NLLIGO::SP
|
||||||
// Cross material
|
// Cross material
|
||||||
for (m = 0; m < (sint32)tCreate.size(); ++m)
|
for (m = 0; m < (sint32)tCreate.size(); ++m)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion &zoneRegion2 = m_zoneBuilder->zoneRegion(tCreate.getBuilderZoneRegion(m)->getRegionId())->zoneRegion();
|
const NLLIGO::CZoneRegion &zoneRegion2 = m_zoneBuilder->zoneRegion(tCreate.getBuilderZoneRegion(m)->getRegionId())->ligoZoneRegion();
|
||||||
x = tCreate.getX(m);
|
x = tCreate.getX(m);
|
||||||
y = tCreate.getY(m);
|
y = tCreate.getY(m);
|
||||||
|
|
||||||
|
@ -1363,7 +1363,7 @@ STrans TranConvTable[128] =
|
||||||
|
|
||||||
void BuilderZoneRegion::updateTrans (sint32 x, sint32 y, NLLIGO::CZoneBankElement *zoneBankElement)
|
void BuilderZoneRegion::updateTrans (sint32 x, sint32 y, NLLIGO::CZoneBankElement *zoneBankElement)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->zoneRegion();
|
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->ligoZoneRegion();
|
||||||
if ((x < zoneRegion.getMinX()) || (x > zoneRegion.getMaxX()) ||
|
if ((x < zoneRegion.getMinX()) || (x > zoneRegion.getMaxX()) ||
|
||||||
(y < zoneRegion.getMinY()) || (y > zoneRegion.getMaxY()))
|
(y < zoneRegion.getMinY()) || (y > zoneRegion.getMaxY()))
|
||||||
return;
|
return;
|
||||||
|
@ -1564,7 +1564,7 @@ void BuilderZoneRegion::updateTrans (sint32 x, sint32 y, NLLIGO::CZoneBankElemen
|
||||||
|
|
||||||
std::string BuilderZoneRegion::getNextMatInTree (const std::string &matA, const std::string &matB)
|
std::string BuilderZoneRegion::getNextMatInTree (const std::string &matA, const std::string &matB)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->zoneRegion();
|
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->ligoZoneRegion();
|
||||||
uint32 i, posA = 10000, posB = 10000;
|
uint32 i, posA = 10000, posB = 10000;
|
||||||
|
|
||||||
if (matA == matB)
|
if (matA == matB)
|
||||||
|
@ -1600,7 +1600,7 @@ struct SNode
|
||||||
|
|
||||||
void BuilderZoneRegion::tryPath(uint32 posA, uint32 posB, std::vector<uint32> &path)
|
void BuilderZoneRegion::tryPath(uint32 posA, uint32 posB, std::vector<uint32> &path)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->zoneRegion();
|
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->ligoZoneRegion();
|
||||||
|
|
||||||
// Build the adjascence matrix
|
// Build the adjascence matrix
|
||||||
std::vector<sint32> matAdj;
|
std::vector<sint32> matAdj;
|
||||||
|
@ -1662,7 +1662,7 @@ void BuilderZoneRegion::tryPath(uint32 posA, uint32 posB, std::vector<uint32> &p
|
||||||
|
|
||||||
void BuilderZoneRegion::del(sint32 x, sint32 y, bool transition, void *pInternal)
|
void BuilderZoneRegion::del(sint32 x, sint32 y, bool transition, void *pInternal)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->zoneRegion();
|
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->ligoZoneRegion();
|
||||||
if (!m_zoneBuilder->getZoneMask(x, y))
|
if (!m_zoneBuilder->getZoneMask(x, y))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1783,7 +1783,7 @@ void BuilderZoneRegion::move (sint32 x, sint32 y)
|
||||||
|
|
||||||
uint32 BuilderZoneRegion::countZones ()
|
uint32 BuilderZoneRegion::countZones ()
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->zoneRegion();
|
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->ligoZoneRegion();
|
||||||
sint32 x, y;
|
sint32 x, y;
|
||||||
|
|
||||||
uint32 counter = 0;
|
uint32 counter = 0;
|
||||||
|
@ -1799,7 +1799,7 @@ uint32 BuilderZoneRegion::countZones ()
|
||||||
void BuilderZoneRegion::set(sint32 x, sint32 y, sint32 posX, sint32 posY,
|
void BuilderZoneRegion::set(sint32 x, sint32 y, sint32 posX, sint32 posY,
|
||||||
const std::string &zoneName, bool transition)
|
const std::string &zoneName, bool transition)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->zoneRegion();
|
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->ligoZoneRegion();
|
||||||
|
|
||||||
// Do we need to resize ?
|
// Do we need to resize ?
|
||||||
if ((x < zoneRegion.getMinX()) || (x > zoneRegion.getMaxX()) ||
|
if ((x < zoneRegion.getMinX()) || (x > zoneRegion.getMaxX()) ||
|
||||||
|
@ -1988,7 +1988,7 @@ void BuilderZoneRegion::setFlip(sint32 x, sint32 y, uint8 flip)
|
||||||
|
|
||||||
void BuilderZoneRegion::reduceMin ()
|
void BuilderZoneRegion::reduceMin ()
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->zoneRegion();
|
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->ligoZoneRegion();
|
||||||
sint32 i, j;
|
sint32 i, j;
|
||||||
|
|
||||||
sint32 newMinX = zoneRegion.getMinX(), newMinY = zoneRegion.getMinY ();
|
sint32 newMinX = zoneRegion.getMinX(), newMinY = zoneRegion.getMinY ();
|
||||||
|
@ -2099,7 +2099,7 @@ uint BuilderZoneRegion::getRegionId() const
|
||||||
|
|
||||||
void BuilderZoneRegion::resize (sint32 newMinX, sint32 newMaxX, sint32 newMinY, sint32 newMaxY)
|
void BuilderZoneRegion::resize (sint32 newMinX, sint32 newMaxX, sint32 newMinY, sint32 newMaxY)
|
||||||
{
|
{
|
||||||
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->zoneRegion();
|
const NLLIGO::CZoneRegion &zoneRegion = m_zoneBuilder->zoneRegion(m_regionId)->ligoZoneRegion();
|
||||||
if ((zoneRegion.getMinX ()!= newMinX) ||
|
if ((zoneRegion.getMinX ()!= newMinX) ||
|
||||||
(zoneRegion.getMaxX ()!= newMaxX) ||
|
(zoneRegion.getMaxX ()!= newMaxX) ||
|
||||||
(zoneRegion.getMinY ()!= newMinY) ||
|
(zoneRegion.getMinY ()!= newMinY) ||
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
BuilderZoneRegion(uint regionId);
|
BuilderZoneRegion(uint regionId);
|
||||||
|
|
||||||
// New interface
|
// New interface
|
||||||
bool init(ZoneBuilder *zoneBuilder, std::string &error);
|
bool init(ZoneBuilder *zoneBuilder);
|
||||||
void add(sint32 x, sint32 y, uint8 rot, uint8 flip, NLLIGO::CZoneBankElement *zoneBankElement);
|
void add(sint32 x, sint32 y, uint8 rot, uint8 flip, NLLIGO::CZoneBankElement *zoneBankElement);
|
||||||
void invertCutEdge(sint32 x, sint32 y, uint8 cePos);
|
void invertCutEdge(sint32 x, sint32 y, uint8 cePos);
|
||||||
void cycleTransition(sint32 x, sint32 y);
|
void cycleTransition(sint32 x, sint32 y);
|
||||||
|
|
|
@ -114,7 +114,6 @@ void UndoScanRegionCommand::undo()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_zonePositionList.size(); ++i)
|
for (int i = 0; i < m_zonePositionList.size(); ++i)
|
||||||
m_scene->deleteItemZone(m_zonePositionList.at(i));
|
m_scene->deleteItemZone(m_zonePositionList.at(i));
|
||||||
nlinfo("------");
|
|
||||||
for (int i = 0; i < m_zonePositionList.size(); ++i)
|
for (int i = 0; i < m_zonePositionList.size(); ++i)
|
||||||
{
|
{
|
||||||
LigoData data;
|
LigoData data;
|
||||||
|
@ -152,7 +151,6 @@ void RedoScanRegionCommand::redo()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_zonePositionList.size(); ++i)
|
for (int i = 0; i < m_zonePositionList.size(); ++i)
|
||||||
m_scene->deleteItemZone(m_zonePositionList.at(i));
|
m_scene->deleteItemZone(m_zonePositionList.at(i));
|
||||||
nlinfo("------");
|
|
||||||
for (int i = 0; i < m_zonePositionList.size(); ++i)
|
for (int i = 0; i < m_zonePositionList.size(); ++i)
|
||||||
{
|
{
|
||||||
LigoData data;
|
LigoData data;
|
||||||
|
@ -174,7 +172,7 @@ LigoResizeCommand::LigoResizeCommand(int index, sint32 newMinX, sint32 newMaxX,
|
||||||
m_newMaxY = newMaxY;
|
m_newMaxY = newMaxY;
|
||||||
|
|
||||||
// Backup old region zone
|
// Backup old region zone
|
||||||
m_oldZoneRegion = m_zoneBuilder->zoneRegion(m_index)->zoneRegion();
|
m_oldZoneRegion = m_zoneBuilder->zoneRegion(m_index)->ligoZoneRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
LigoResizeCommand::~LigoResizeCommand()
|
LigoResizeCommand::~LigoResizeCommand()
|
||||||
|
@ -184,13 +182,13 @@ LigoResizeCommand::~LigoResizeCommand()
|
||||||
void LigoResizeCommand::undo ()
|
void LigoResizeCommand::undo ()
|
||||||
{
|
{
|
||||||
// Restore old region zone
|
// Restore old region zone
|
||||||
m_zoneBuilder->zoneRegion(m_index)->setZoneRegion(m_oldZoneRegion);
|
m_zoneBuilder->zoneRegion(m_index)->setLigoZoneRegion(m_oldZoneRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LigoResizeCommand::redo ()
|
void LigoResizeCommand::redo ()
|
||||||
{
|
{
|
||||||
// Get the zone region
|
// Get the zone region
|
||||||
NLLIGO::CZoneRegion ®ion = m_zoneBuilder->zoneRegion(m_index)->zoneRegion();
|
NLLIGO::CZoneRegion ®ion = m_zoneBuilder->zoneRegion(m_index)->ligoZoneRegion();
|
||||||
|
|
||||||
sint32 i, j;
|
sint32 i, j;
|
||||||
std::vector<LigoData> newZones;
|
std::vector<LigoData> newZones;
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
#include <QtGui/QFileDialog>
|
#include <QtGui/QFileDialog>
|
||||||
|
#include <QtGui/QMessageBox>
|
||||||
|
|
||||||
namespace LandscapeEditor
|
namespace LandscapeEditor
|
||||||
{
|
{
|
||||||
|
@ -51,7 +52,7 @@ LandscapeEditorWindow::LandscapeEditorWindow(QWidget *parent)
|
||||||
m_undoStack = new QUndoStack(this);
|
m_undoStack = new QUndoStack(this);
|
||||||
m_landscapeScene = new LandscapeScene(this);
|
m_landscapeScene = new LandscapeScene(this);
|
||||||
|
|
||||||
m_zoneBuilder = new ZoneBuilder(m_ui.zoneListWidget, m_landscapeScene, m_undoStack);
|
m_zoneBuilder = new ZoneBuilder(m_landscapeScene, m_ui.zoneListWidget, m_undoStack);
|
||||||
m_zoneBuilder->init("e:/-nel-/install/continents/newbieland", true);
|
m_zoneBuilder->init("e:/-nel-/install/continents/newbieland", true);
|
||||||
m_ui.zoneListWidget->setZoneBuilder(m_zoneBuilder);
|
m_ui.zoneListWidget->setZoneBuilder(m_zoneBuilder);
|
||||||
m_ui.zoneListWidget->updateUi();
|
m_ui.zoneListWidget->updateUi();
|
||||||
|
@ -96,12 +97,15 @@ void LandscapeEditorWindow::open()
|
||||||
_lastDir = QFileInfo(list.front()).absolutePath();
|
_lastDir = QFileInfo(list.front()).absolutePath();
|
||||||
Q_FOREACH(QString fileName, fileNames)
|
Q_FOREACH(QString fileName, fileNames)
|
||||||
{
|
{
|
||||||
int id = m_zoneBuilder->createZoneRegion();
|
int id = m_zoneBuilder->createZoneRegion(fileName);
|
||||||
|
if (id == -1)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, "Landscape Editor", "Cannot add this zone because it overlaps existing ones");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
ZoneRegionObject *zoneRegion = m_zoneBuilder->zoneRegion(id);
|
ZoneRegionObject *zoneRegion = m_zoneBuilder->zoneRegion(id);
|
||||||
zoneRegion->load(fileName.toStdString());
|
m_ui.graphicsView->centerOn(zoneRegion->ligoZoneRegion().getMinX() * m_landscapeScene->cellSize(),
|
||||||
m_landscapeScene->processZoneRegion(zoneRegion->zoneRegion());
|
abs(zoneRegion->ligoZoneRegion().getMinY()) * m_landscapeScene->cellSize());
|
||||||
m_ui.graphicsView->centerOn(zoneRegion->zoneRegion().getMinX() * m_landscapeScene->cellSize(),
|
|
||||||
abs(zoneRegion->zoneRegion().getMinY()) * m_landscapeScene->cellSize());
|
|
||||||
|
|
||||||
m_zoneBuilder->setCurrentZoneRegion(id);
|
m_zoneBuilder->setCurrentZoneRegion(id);
|
||||||
}
|
}
|
||||||
|
@ -157,6 +161,7 @@ void LandscapeEditorWindow::openSnapshotDialog()
|
||||||
void LandscapeEditorWindow::showEvent(QShowEvent *showEvent)
|
void LandscapeEditorWindow::showEvent(QShowEvent *showEvent)
|
||||||
{
|
{
|
||||||
QMainWindow::showEvent(showEvent);
|
QMainWindow::showEvent(showEvent);
|
||||||
|
if (m_oglWidget != 0)
|
||||||
m_oglWidget->makeCurrent();
|
m_oglWidget->makeCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "landscape_scene.h"
|
#include "landscape_scene.h"
|
||||||
|
#include "pixmap_database.h"
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
#include <nel/misc/debug.h>
|
#include <nel/misc/debug.h>
|
||||||
|
@ -29,7 +30,10 @@
|
||||||
namespace LandscapeEditor
|
namespace LandscapeEditor
|
||||||
{
|
{
|
||||||
|
|
||||||
static const int ZoneName = 0;
|
static const int ZONE_NAME = 0;
|
||||||
|
static const int LAYER_ZONES = 2;
|
||||||
|
static const int LAYER_EMPTY_ZONES = 3;
|
||||||
|
static const int LAYER_BLACKOUT = 4;
|
||||||
|
|
||||||
LandscapeScene::LandscapeScene(QObject *parent)
|
LandscapeScene::LandscapeScene(QObject *parent)
|
||||||
: QGraphicsScene(parent),
|
: QGraphicsScene(parent),
|
||||||
|
@ -78,19 +82,18 @@ QGraphicsItem *LandscapeScene::createItemZone(const LigoData &data, const ZonePo
|
||||||
|
|
||||||
if (data.flip == 0)
|
if (data.flip == 0)
|
||||||
{
|
{
|
||||||
item = new QGraphicsPixmapItem(pixmap->transformed(matrix, Qt::SmoothTransformation), 0, this);
|
item = addPixmap(pixmap->transformed(matrix, Qt::SmoothTransformation));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// mirror image
|
// mirror image
|
||||||
QImage mirrorImage = pixmap->toImage();
|
QImage mirrorImage = pixmap->toImage();
|
||||||
QPixmap mirrorPixmap = QPixmap::fromImage(mirrorImage.mirrored(true, false));
|
QPixmap mirrorPixmap = QPixmap::fromImage(mirrorImage.mirrored(true, false));
|
||||||
item = new QGraphicsPixmapItem(mirrorPixmap.transformed(matrix, Qt::SmoothTransformation), 0, this);
|
item = addPixmap(mirrorPixmap.transformed(matrix, Qt::SmoothTransformation));
|
||||||
}
|
}
|
||||||
// Enable bilinear filtering
|
// Enable bilinear filtering
|
||||||
item->setTransformationMode(Qt::SmoothTransformation);
|
item->setTransformationMode(Qt::SmoothTransformation);
|
||||||
|
|
||||||
// Set position graphics item with offset for large piece
|
|
||||||
NLLIGO::CZoneBankElement *zoneBankItem = m_zoneBuilder->getZoneBank().getElementByZoneName(data.zoneName);
|
NLLIGO::CZoneBankElement *zoneBankItem = m_zoneBuilder->getZoneBank().getElementByZoneName(data.zoneName);
|
||||||
|
|
||||||
sint32 deltaX = 0, deltaY = 0;
|
sint32 deltaX = 0, deltaY = 0;
|
||||||
|
@ -145,16 +148,16 @@ QGraphicsItem *LandscapeScene::createItemZone(const LigoData &data, const ZonePo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set position graphics item with taking into account the offset
|
// Set position graphics item with offset for large piece
|
||||||
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_zoneBuilder->pixmapDatabase()->textureSize());
|
||||||
|
|
||||||
item->setData(ZoneName, QString(data.zoneName.c_str()));
|
//item->setData(ZONE_NAME, QString(data.zoneName.c_str()));
|
||||||
|
|
||||||
// for not full item zone
|
// for not full item zone
|
||||||
item->setZValue(0);
|
item->setZValue(LAYER_ZONES);
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
@ -169,7 +172,7 @@ QGraphicsItem *LandscapeScene::createItemEmptyZone(const ZonePosition &zonePos)
|
||||||
if (pixmap == 0)
|
if (pixmap == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
QGraphicsPixmapItem *item = new QGraphicsPixmapItem(*pixmap, 0, this);
|
QGraphicsPixmapItem *item = addPixmap(*pixmap);
|
||||||
|
|
||||||
// Enable bilinear filtering
|
// Enable bilinear filtering
|
||||||
item->setTransformationMode(Qt::SmoothTransformation);
|
item->setTransformationMode(Qt::SmoothTransformation);
|
||||||
|
@ -181,11 +184,23 @@ QGraphicsItem *LandscapeScene::createItemEmptyZone(const ZonePosition &zonePos)
|
||||||
item->setScale(float(m_cellSize) / m_zoneBuilder->pixmapDatabase()->textureSize());
|
item->setScale(float(m_cellSize) / m_zoneBuilder->pixmapDatabase()->textureSize());
|
||||||
|
|
||||||
// for not full item zone
|
// for not full item zone
|
||||||
item->setZValue(1);
|
item->setZValue(LAYER_EMPTY_ZONES);
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QGraphicsRectItem *LandscapeScene::createLayerBlackout(const NLLIGO::CZoneRegion &zoneRegion)
|
||||||
|
{
|
||||||
|
QGraphicsRectItem *rectItem = addRect(zoneRegion.getMinX() * m_cellSize,
|
||||||
|
abs(zoneRegion.getMaxY()) * m_cellSize,
|
||||||
|
(abs(zoneRegion.getMaxX() - zoneRegion.getMinX()) + 1) * m_cellSize,
|
||||||
|
(abs(zoneRegion.getMaxY() - zoneRegion.getMinY()) + 1) * m_cellSize,
|
||||||
|
Qt::NoPen, QBrush(QColor(0, 0, 0, 50)));
|
||||||
|
|
||||||
|
rectItem->setZValue(LAYER_BLACKOUT);
|
||||||
|
return rectItem;
|
||||||
|
}
|
||||||
|
|
||||||
void LandscapeScene::deleteItemZone(const ZonePosition &zonePos)
|
void LandscapeScene::deleteItemZone(const ZonePosition &zonePos)
|
||||||
{
|
{
|
||||||
QGraphicsItem *item = itemAt(zonePos.x * m_cellSize, abs(zonePos.y) * m_cellSize);
|
QGraphicsItem *item = itemAt(zonePos.x * m_cellSize, abs(zonePos.y) * m_cellSize);
|
||||||
|
@ -196,12 +211,13 @@ void LandscapeScene::deleteItemZone(const ZonePosition &zonePos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LandscapeScene::processZoneRegion(const NLLIGO::CZoneRegion &zoneRegion)
|
void LandscapeScene::addZoneRegion(const NLLIGO::CZoneRegion &zoneRegion)
|
||||||
{
|
{
|
||||||
for (sint32 i = zoneRegion.getMinX(); i <= zoneRegion.getMaxX(); ++i)
|
for (sint32 i = zoneRegion.getMinX(); i <= zoneRegion.getMaxX(); ++i)
|
||||||
{
|
{
|
||||||
for (sint32 j = zoneRegion.getMinY(); j <= zoneRegion.getMaxY(); ++j)
|
for (sint32 j = zoneRegion.getMinY(); j <= zoneRegion.getMaxY(); ++j)
|
||||||
{
|
{
|
||||||
|
|
||||||
//nlinfo(QString("%1 %2 %3").arg(i).arg(j).arg(zoneRegion.getName(i, j).c_str()).toStdString().c_str());
|
//nlinfo(QString("%1 %2 %3").arg(i).arg(j).arg(zoneRegion.getName(i, j).c_str()).toStdString().c_str());
|
||||||
std::string zoneName = zoneRegion.getName(i, j);
|
std::string zoneName = zoneRegion.getName(i, j);
|
||||||
if (zoneName == STRING_UNUSED)
|
if (zoneName == STRING_UNUSED)
|
||||||
|
@ -224,6 +240,17 @@ void LandscapeScene::processZoneRegion(const NLLIGO::CZoneRegion &zoneRegion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LandscapeScene::delZoneRegion(const NLLIGO::CZoneRegion &zoneRegion)
|
||||||
|
{
|
||||||
|
for (sint32 i = zoneRegion.getMinX(); i <= zoneRegion.getMaxX(); ++i)
|
||||||
|
{
|
||||||
|
for (sint32 j = zoneRegion.getMinY(); j <= zoneRegion.getMaxY(); ++j)
|
||||||
|
{
|
||||||
|
deleteItemZone(ZonePosition(i, -j, -1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LandscapeScene::snapshot(const QString &fileName, int sizeSource)
|
void LandscapeScene::snapshot(const QString &fileName, int sizeSource)
|
||||||
{
|
{
|
||||||
/* if (m_zoneRegion == 0)
|
/* if (m_zoneRegion == 0)
|
||||||
|
@ -305,7 +332,9 @@ bool LandscapeScene::checkUnderZone(const int posX, const int posY)
|
||||||
{
|
{
|
||||||
QGraphicsItem *item = itemAt((posX * m_cellSize), abs(posY) * m_cellSize);
|
QGraphicsItem *item = itemAt((posX * m_cellSize), abs(posY) * m_cellSize);
|
||||||
if (item != 0)
|
if (item != 0)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "zone_region_editor.h"
|
#include "zone_region_editor.h"
|
||||||
#include "builder_zone.h"
|
#include "builder_zone.h"
|
||||||
|
#include "landscape_editor_global.h"
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
#include <nel/ligo/zone_region.h>
|
#include <nel/ligo/zone_region.h>
|
||||||
|
@ -32,7 +33,12 @@
|
||||||
namespace LandscapeEditor
|
namespace LandscapeEditor
|
||||||
{
|
{
|
||||||
|
|
||||||
class LandscapeScene : public QGraphicsScene
|
/**
|
||||||
|
@class LandscapeScene
|
||||||
|
@brief
|
||||||
|
@details
|
||||||
|
*/
|
||||||
|
class LANDSCAPE_EDITOR_EXPORT LandscapeScene : public QGraphicsScene
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -45,15 +51,18 @@ public:
|
||||||
|
|
||||||
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);
|
||||||
|
QGraphicsRectItem *createLayerBlackout(const NLLIGO::CZoneRegion &zoneRegion);
|
||||||
void deleteItemZone(const ZonePosition &zonePos);
|
void deleteItemZone(const ZonePosition &zonePos);
|
||||||
void processZoneRegion(const NLLIGO::CZoneRegion &zoneRegion);
|
|
||||||
|
void addZoneRegion(const NLLIGO::CZoneRegion &zoneRegion);
|
||||||
|
void delZoneRegion(const NLLIGO::CZoneRegion &zoneRegion);
|
||||||
|
|
||||||
void snapshot(const QString &fileName, int sizeSource);
|
void snapshot(const QString &fileName, int sizeSource);
|
||||||
void snapshot(const QString &fileName, int width, int height);
|
void snapshot(const QString &fileName, int width, int height);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent);
|
virtual void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent);
|
||||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * mouseEvent);
|
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent);
|
||||||
virtual void drawForeground(QPainter *painter, const QRectF &rect);
|
virtual void drawForeground(QPainter *painter, const QRectF &rect);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -41,6 +41,7 @@ LandscapeView::LandscapeView(QWidget *parent)
|
||||||
setBackgroundBrush(QBrush(Qt::lightGray));
|
setBackgroundBrush(QBrush(Qt::lightGray));
|
||||||
//setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
|
//setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
|
||||||
//setRenderHints(QPainter::Antialiasing);
|
//setRenderHints(QPainter::Antialiasing);
|
||||||
|
//setCacheMode(QGraphicsView::CacheBackground);
|
||||||
m_cellSize = 160;
|
m_cellSize = 160;
|
||||||
m_numSteps = 0;
|
m_numSteps = 0;
|
||||||
m_maxSteps = 20;
|
m_maxSteps = 20;
|
||||||
|
@ -83,6 +84,7 @@ void LandscapeView::wheelEvent(QWheelEvent *event)
|
||||||
--m_numSteps;
|
--m_numSteps;
|
||||||
}
|
}
|
||||||
scale(factor, factor);
|
scale(factor, factor);
|
||||||
|
QGraphicsView::wheelEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LandscapeView::mousePressEvent(QMouseEvent *event)
|
void LandscapeView::mousePressEvent(QMouseEvent *event)
|
||||||
|
|
Loading…
Reference in a new issue