1 // Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2011 Dzmitry KAMIAHIN (dnk-88) <dnk-88@tut.by>
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2010 Winch Gate Property Limited
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef LANDSCAPE_SCENE_H
21 #define LANDSCAPE_SCENE_H
24 #include "zone_region_editor.h"
25 #include "builder_zone.h"
26 #include "landscape_editor_global.h"
29 #include <nel/ligo/zone_region.h>
32 #include <QtGui/QGraphicsScene>
33 #include <QtGui/QGraphicsSceneMouseEvent>
35 namespace LandscapeEditor
43 class LandscapeScene
: public QGraphicsScene
48 LandscapeScene(int sizeCell
= 160, QObject
*parent
= 0);
49 virtual ~LandscapeScene();
52 void setZoneBuilder(ZoneBuilder
*zoneBuilder
);
54 QGraphicsItem
*createItemZone(const LigoData
&data
, const ZonePosition
&zonePos
);
55 QGraphicsItem
*createItemEmptyZone(const ZonePosition
&zonePos
);
56 QGraphicsRectItem
*createLayerBlackout(const NLLIGO::CZoneRegion
&zoneRegion
);
57 void deleteItemZone(const ZonePosition
&zonePos
);
59 void addZoneRegion(const NLLIGO::CZoneRegion
&zoneRegion
);
60 void delZoneRegion(const NLLIGO::CZoneRegion
&zoneRegion
);
62 void snapshot(const QString
&fileName
, int width
, int height
, const QRectF
&landRect
);
64 QString
zoneNameFromMousePos() const;
65 bool transitionMode() const;
68 void setTransitionMode(bool enabled
);
71 virtual void mousePressEvent(QGraphicsSceneMouseEvent
*mouseEvent
);
72 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent
*mouseEvent
);
73 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent
*mouseEvent
);
74 virtual void drawForeground(QPainter
*painter
, const QRectF
&rect
);
76 void drawTransition(QPainter
*painter
, const QRectF
&rect
);
79 bool checkUnderZone(const int posX
, const int posY
);
82 bool m_transitionMode
;
83 qreal m_mouseX
, m_mouseY
;
84 sint32 m_posX
, m_posY
;
85 Qt::MouseButton m_mouseButton
;
86 ZoneBuilder
*m_zoneBuilder
;
89 } /* namespace LandscapeEditor */
91 #endif // LANDSCAPE_SCENE_H