Changed: #1301 Improved ZoneBuilderBase for using in undo/redo commands.
This commit is contained in:
parent
e4305e7d95
commit
d442652461
5 changed files with 21 additions and 11 deletions
|
@ -77,7 +77,7 @@ bool ZoneBuilderBase::init(const QString &pathName, bool displayProgress)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZoneBuilderBase::loadZoneRegion(const QString &fileName)
|
int ZoneBuilderBase::loadZoneRegion(const QString &fileName, int defaultId)
|
||||||
{
|
{
|
||||||
LandscapeItem landItem;
|
LandscapeItem landItem;
|
||||||
landItem.zoneRegionObject = new ZoneRegionObject();
|
landItem.zoneRegionObject = new ZoneRegionObject();
|
||||||
|
@ -88,15 +88,18 @@ int ZoneBuilderBase::loadZoneRegion(const QString &fileName)
|
||||||
delete landItem.zoneRegionObject;
|
delete landItem.zoneRegionObject;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
int id = defaultId;
|
||||||
|
if (id == -1)
|
||||||
|
id = NewLandId++;
|
||||||
// landItem.builderZoneRegion = new BuilderZoneRegion(LandCounter);
|
// landItem.builderZoneRegion = new BuilderZoneRegion(LandCounter);
|
||||||
// landItem.builderZoneRegion->init(this);
|
// landItem.builderZoneRegion->init(this);
|
||||||
|
|
||||||
m_landscapeSceneBase->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(id, landItem);
|
||||||
|
|
||||||
calcMask();
|
calcMask();
|
||||||
return NewLandId++;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneBuilderBase::deleteZoneRegion(int id)
|
void ZoneBuilderBase::deleteZoneRegion(int id)
|
||||||
|
|
|
@ -83,7 +83,7 @@ public:
|
||||||
|
|
||||||
/// Zone Region
|
/// Zone Region
|
||||||
/// @{
|
/// @{
|
||||||
int loadZoneRegion(const QString &fileName);
|
int loadZoneRegion(const QString &fileName, int defaultId = -1);
|
||||||
void deleteZoneRegion(int id);
|
void deleteZoneRegion(int id);
|
||||||
int countZoneRegion() const;
|
int countZoneRegion() const;
|
||||||
ZoneRegionObject *zoneRegion(int id) const;
|
ZoneRegionObject *zoneRegion(int id) const;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -34,9 +33,10 @@ namespace LandscapeEditor
|
||||||
LandscapeView::LandscapeView(QWidget *parent)
|
LandscapeView::LandscapeView(QWidget *parent)
|
||||||
: QGraphicsView(parent),
|
: QGraphicsView(parent),
|
||||||
m_visibleGrid(true),
|
m_visibleGrid(true),
|
||||||
|
m_visibleText(true),
|
||||||
m_moveMouse(false)
|
m_moveMouse(false)
|
||||||
{
|
{
|
||||||
setDragMode(ScrollHandDrag);
|
//setDragMode(ScrollHandDrag);
|
||||||
setTransformationAnchor(AnchorUnderMouse);
|
setTransformationAnchor(AnchorUnderMouse);
|
||||||
setBackgroundBrush(QBrush(Qt::lightGray));
|
setBackgroundBrush(QBrush(Qt::lightGray));
|
||||||
//setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
|
//setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
|
||||||
|
@ -62,6 +62,12 @@ void LandscapeView::setVisibleGrid(bool visible)
|
||||||
scene()->update();
|
scene()->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LandscapeView::setVisibleText(bool visible)
|
||||||
|
{
|
||||||
|
m_visibleText = visible;
|
||||||
|
scene()->update();
|
||||||
|
}
|
||||||
|
|
||||||
void LandscapeView::wheelEvent(QWheelEvent *event)
|
void LandscapeView::wheelEvent(QWheelEvent *event)
|
||||||
{
|
{
|
||||||
double numDegrees = event->delta() / 8.0;
|
double numDegrees = event->delta() / 8.0;
|
||||||
|
@ -118,6 +124,9 @@ void LandscapeView::drawForeground(QPainter *painter, const QRectF &rect)
|
||||||
painter->setPen(QPen(Qt::white, 0, Qt::SolidLine));
|
painter->setPen(QPen(Qt::white, 0, Qt::SolidLine));
|
||||||
drawGrid(painter, rect);
|
drawGrid(painter, rect);
|
||||||
|
|
||||||
|
if (!m_visibleText)
|
||||||
|
return;
|
||||||
|
|
||||||
if (m_numSteps > -m_maxSteps / 4)
|
if (m_numSteps > -m_maxSteps / 4)
|
||||||
{
|
{
|
||||||
painter->setPen(QPen(Qt::white, 0.5, Qt::SolidLine));
|
painter->setPen(QPen(Qt::white, 0.5, Qt::SolidLine));
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -40,6 +39,7 @@ public:
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void setVisibleGrid(bool visible);
|
void setVisibleGrid(bool visible);
|
||||||
|
void setVisibleText(bool visible);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
protected:
|
protected:
|
||||||
|
@ -53,7 +53,7 @@ protected:
|
||||||
void drawZoneNames(QPainter *painter, const QRectF &rect);
|
void drawZoneNames(QPainter *painter, const QRectF &rect);
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool m_visibleGrid;
|
bool m_visibleGrid, m_visibleText;
|
||||||
int m_numSteps, m_maxSteps;
|
int m_numSteps, m_maxSteps;
|
||||||
int m_cellSize;
|
int m_cellSize;
|
||||||
bool m_moveMouse;
|
bool m_moveMouse;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
|
||||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -52,9 +51,8 @@ bool PixmapDatabase::loadPixmaps(const QString &zonePath, NLLIGO::CZoneBank &zon
|
||||||
zoneBank.getCategoryValues ("zone", listNames);
|
zoneBank.getCategoryValues ("zone", listNames);
|
||||||
if (displayProgress)
|
if (displayProgress)
|
||||||
{
|
{
|
||||||
progressDialog = new QProgressDialog();
|
progressDialog = new QProgressDialog("Loading ligo zones.", "Cancel", 0, listNames.size());
|
||||||
progressDialog->show();
|
progressDialog->show();
|
||||||
progressDialog->setRange(0, listNames.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint i = 0; i < listNames.size(); ++i)
|
for (uint i = 0; i < listNames.size(); ++i)
|
||||||
|
|
Loading…
Reference in a new issue