/
PortableMapWriter.h
49 lines (36 loc) · 1.34 KB
/
PortableMapWriter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once
#include "imapformat.h"
#include "xmlutil/Document.h"
namespace map
{
/**
* Exporter class writing the map data into an XML-based file format.
*/
class PortableMapWriter :
public IMapWriter
{
protected:
// The counters for numbering the comments
std::size_t _entityCount;
std::size_t _primitiveCount;
xml::Document _document;
xml::Node _map;
xml::Node _curEntityPrimitives;
public:
PortableMapWriter();
virtual void beginWriteMap(std::ostream& stream) override;
virtual void endWriteMap(std::ostream& stream) override;
// Entity export methods
virtual void beginWriteEntity(const IEntityNodePtr& entity, std::ostream& stream) override;
virtual void endWriteEntity(const IEntityNodePtr& entity, std::ostream& stream) override;
// Brush export methods
virtual void beginWriteBrush(const IBrushNodePtr& brush, std::ostream& stream) override;
virtual void endWriteBrush(const IBrushNodePtr& brush, std::ostream& stream) override;
// Patch export methods
virtual void beginWritePatch(const IPatchNodePtr& patch, std::ostream& stream) override;
virtual void endWritePatch(const IPatchNodePtr& patch, std::ostream& stream) override;
private:
void appendLayerInformation(xml::Node& xmlNode, const scene::INodePtr& sceneNode);
void appendSelectionGroupInformation(xml::Node& xmlNode, const scene::INodePtr& sceneNode);
};
} // namespace