1 /*
2  Copyright (C) 2010-2014 Kristian Duske
3 
4  This file is part of TrenchBroom.
5 
6  TrenchBroom is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  TrenchBroom is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with TrenchBroom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef TrenchBroom_ModelTypes_h
21 #define TrenchBroom_ModelTypes_h
22 
23 #include "TrenchBroom.h"
24 #include "VecMath.h"
25 #include "StringUtils.h"
26 #include "SharedPointer.h"
27 #include "Model/BrushGeometry.h"
28 
29 #include <map>
30 #include <set>
31 #include <vector>
32 
33 namespace TrenchBroom {
34     namespace Model {
35         typedef size_t IdType;
36 
37         class Node;
38         typedef std::set<Node*> NodeSet;
39         typedef std::vector<Node*> NodeList;
40         static const NodeList EmptyNodeList(0);
41 
42         typedef std::map<Node*, Node*> NodeMap;
43         typedef std::map<Node*, NodeList> ParentChildrenMap;
44 
45         typedef enum {
46             Visibility_Inherited = 1,
47             Visibility_Hidden    = 2,
48             Visibility_Shown     = 4
49         } VisibilityState;
50 
51         typedef enum {
52             Lock_Inherited = 1,
53             Lock_Locked    = 2,
54             Lock_Unlocked  = 4
55         } LockState;
56 
57         typedef std::map<Node*, VisibilityState> VisibilityMap;
58         typedef std::map<Node*, LockState> LockStateMap;
59 
60         class NodeVisitor;
61         class ConstNodeVisitor;
62 
63         class World;
64 
65         class AttributableNode;
66         typedef std::set<AttributableNode*> AttributableNodeSet;
67         static const AttributableNodeSet EmptyAttributableNodeSet;
68         typedef std::vector<AttributableNode*> AttributableNodeList;
69         static const AttributableNodeList EmptyAttributableNodeList(0);
70 
71         class Layer;
72         typedef std::vector<Layer*> LayerList;
73         static const LayerList EmptyLayerList(0);
74 
75         class Group;
76         typedef std::vector<Group*> GroupList;
77         static const GroupList EmptyGroupList(0);
78         typedef std::set<Group*> GroupSet;
79         typedef std::map<Group*, String> GroupNameMap;
80 
81         class Entity;
82         typedef std::vector<Entity*> EntityList;
83         static const EntityList EmptyEntityList(0);
84         typedef std::set<Entity*> EntitySet;
85 
86         class Brush;
87         typedef std::vector<Brush*> BrushList;
88         static const BrushList EmptyBrushList(0);
89         typedef std::set<Brush*> BrushSet;
90         static const BrushSet EmptyBrushSet;
91 
92         class Object;
93 
94         class BrushFace;
95         typedef std::set<BrushFace*> BrushFaceSet;
96         static const BrushFaceSet EmptyBrushFaceSet;
97         typedef std::vector<BrushFace*> BrushFaceList;
98         static const BrushFaceList EmptyBrushFaceList(0);
99 
100         typedef String AttributeName;
101         typedef std::vector<AttributeName> AttributeNameList;
102         typedef std::set<AttributeName> AttributeNameSet;
103         typedef String AttributeValue;
104         typedef std::vector<AttributeValue> AttributeValueList;
105 
106         typedef std::set<BrushEdge*> BrushEdgeSet;
107         static const BrushEdgeSet EmptyBrushEdgeSet;
108 
109         typedef std::map<Vec3, BrushSet, Vec3::LexicographicOrder> VertexToBrushesMap;
110         typedef std::map<Vec3, BrushEdgeSet, Vec3::LexicographicOrder> VertexToEdgesMap;
111         typedef std::map<Vec3, BrushFaceSet, Vec3::LexicographicOrder> VertexToFacesMap;
112         typedef std::map<Model::Brush*, Vec3::List> BrushVerticesMap;
113         typedef std::map<Model::Brush*, Edge3::List> BrushEdgesMap;
114         typedef std::map<Model::Brush*, Polygon3::List> BrushFacesMap;
115 
116         class BrushFaceSnapshot;
117         typedef std::vector<BrushFaceSnapshot*> BrushFaceSnapshotList;
118 
119         class NodeSnapshot;
120         typedef std::vector<NodeSnapshot*> NodeSnapshotList;
121 
122         typedef int IssueType;
123 
124         class Issue;
125         typedef std::vector<Issue*> IssueList;
126         static const IssueList EmptyIssueList(0);
127 
128         class IssueQuickFix;
129         typedef std::vector<IssueQuickFix*> IssueQuickFixList;
130 
131         class IssueGenerator;
132         typedef std::vector<IssueGenerator*> IssueGeneratorList;
133 
134         class Game;
135         typedef std::shared_ptr<Game> GamePtr;
136     }
137 }
138 
139 #endif
140