9 #ifndef GwNavGen_NavGenProjSector_H
10 #define GwNavGen_NavGenProjSector_H
32 , m_doSaveClientInput(
true)
33 , m_doGenerateColData(
false)
34 , m_navGenProjConfig(config)
45 for (
unsigned int i = 0; i < m_clientInputs.size(); ++i)
46 delete m_clientInputs[i];
47 m_clientInputs.clear();
49 for (
unsigned int i = 0; i < m_tagVolumes.size(); ++i)
50 delete m_tagVolumes[i];
54 void SetName(
const char* name) { m_name.assign(name); }
55 void SetGuid(
const Kaim::KyGuid& guid) { m_guid = guid; }
56 void SetDoBuild(
bool doBuild) { m_doBuild = doBuild; }
57 void SetDoSaveClientInput(
bool doSaveClientInput) { m_doSaveClientInput = doSaveClientInput; }
58 void SetDoGenerateColData(
bool doGenerateColData) { m_doGenerateColData = doGenerateColData; }
59 void SetCellBox(
const Kaim::CellBox& cellBox) { m_cellBox = cellBox; }
64 geometry->SetFileName(fileName);
72 input->SetFileName(fileName);
73 m_clientInputs.push_back(input);
77 void AddSeedPoint(
float x,
float y,
float z)
81 m_seedPoints.push_back(seedPoint);
85 const Vec3f* polylinePoints,
int pointArraySize,
const Kaim::DynamicNavTag& navTag,
float minAltitude,
float maxAltitude)
88 if (navGenTagVolume->m_tagVolume.InitInClientCoordinates(
89 polylinePoints, pointArraySize, minAltitude, maxAltitude,
90 navTag, m_navGenProjConfig.m_coordSystem) ==
KY_ERROR)
92 delete navGenTagVolume;
96 m_tagVolumes.push_back(navGenTagVolume);
100 int GetGeometryFileCount()
const {
return (
int)
m_geometries.size(); }
101 std::string GetGeometryFileName(
int index) {
return m_geometries[index]->m_fileName; }
103 int GetClientInputFileCount()
const {
return (
int)m_clientInputs.size(); }
104 std::string GetClientInputFileName(
int index) {
return m_clientInputs[index]->m_fileName; }
106 bool Write(TiXmlNode* folderNode)
108 TiXmlElement* sectorNode =
new TiXmlElement(
"sector");
109 folderNode->LinkEndChild(sectorNode);
110 return WriteContent(sectorNode);
114 bool Read(TiXmlNode* node)
116 for (TiXmlNode* child = node->FirstChild(); child != 0; child = child->NextSibling())
118 NavGenProj::GetParam(child,
"name", m_name);
120 std::string guidAsString;
121 if (NavGenProj::GetParam(child,
"guid", guidAsString) ==
true)
124 NavGenProj::GetParam(child,
"doBuild", m_doBuild);
125 NavGenProj::GetParam(child,
"doSaveClientInput", m_doSaveClientInput);
126 NavGenProj::GetParam(child,
"doGenerateColData", m_doGenerateColData);
128 if (strcmp(child->Value(),
"geometries") == 0)
130 ReadGeometries(child);
133 if (strcmp(child->Value(),
"clientInputs") == 0)
135 ReadClientInputs(child);
138 if (strcmp(child->Value(),
"cellBox") == 0)
143 if (strcmp(child->Value(),
"seedpoints") == 0)
145 ReadSeedPoints(child);
148 if (strcmp(child->Value(),
"tagVolumes") == 0)
150 ReadTagVolumes(child);
159 bool ReadGeometry(TiXmlNode* node)
162 if (geometry->Read(node))
174 void ReadGeometries(TiXmlNode* node)
176 for (TiXmlNode* child = node->FirstChild(); child != 0; child = child->NextSibling())
178 if (strcmp(child->Value(),
"geometry") == 0)
185 bool ReadClientInput(TiXmlNode* node)
188 if (input->Read(node))
190 m_clientInputs.push_back(input);
200 void ReadClientInputs(TiXmlNode* node)
203 for (child = node->FirstChild(); child != 0; child = child->NextSibling())
205 if (strcmp(child->Value(),
"clientInput") == 0)
207 ReadClientInput(child);
212 void ReadCellBox(TiXmlNode* node)
216 bool foundMin =
false;
217 bool foundMax =
false;
218 for (TiXmlNode* child = node->FirstChild(); child != 0; child = child->NextSibling())
220 foundMin |= NavGenProj::GetParam(child,
"min", min);
221 foundMax |= NavGenProj::GetParam(child,
"max", max);
223 if (foundMax && foundMin)
227 void ReadSeedPoints(TiXmlNode* seedpointsNode)
229 for (TiXmlNode* pChild = seedpointsNode->FirstChild(); pChild != 0; pChild = pChild->NextSibling())
231 if (pChild->Type() != TiXmlNode::ELEMENT)
234 if (strcmp(pChild->Value(),
"seedpoint") == 0)
237 if (seedPoint.Read(pChild))
238 m_seedPoints.push_back(seedPoint);
243 void ReadTagVolumes(TiXmlNode* tagVolumesNode)
245 for (TiXmlNode* pChild = tagVolumesNode->FirstChild(); pChild != 0; pChild = pChild->NextSibling())
247 if (pChild->Type() != TiXmlNode::ELEMENT)
250 if (strcmp(pChild->Value(),
"tagVolume") == 0)
253 if (navGenProjTagVolume->Read(pChild))
254 m_tagVolumes.push_back(navGenProjTagVolume);
256 delete navGenProjTagVolume;
261 void WriteCellBox(TiXmlNode* node)
264 TiXmlNode* cellBoxFolderNode = NavGenProj::GetOrCreateFolderNode(node,
"cellBox");
267 TiXmlElement* minNode =
new TiXmlElement(
"min");
268 minNode->SetAttribute(
"x", m_cellBox.m_min.
x);
269 minNode->SetAttribute(
"y", m_cellBox.m_min.
y);
270 cellBoxFolderNode->LinkEndChild(minNode);
273 TiXmlElement* maxNode =
new TiXmlElement(
"max");
274 maxNode->SetAttribute(
"x", m_cellBox.m_max.
x);
275 maxNode->SetAttribute(
"y", m_cellBox.m_max.
y);
276 cellBoxFolderNode->LinkEndChild(maxNode);
279 bool WriteContent(TiXmlNode* sectorNode)
281 NavGenProj::SetParam(sectorNode,
"name", m_name);
285 NavGenProj::SetParam(sectorNode,
"guid", std::string(guidString));
287 NavGenProj::SetParam(sectorNode,
"doBuild", m_doBuild);
288 NavGenProj::SetParam(sectorNode,
"doSaveClientInput", m_doSaveClientInput);
289 NavGenProj::SetParam(sectorNode,
"doGenerateColData", m_doGenerateColData);
292 WriteCellBox(sectorNode);
302 for (
int i = 0; i < (int)m_clientInputs.size(); i++)
304 if (m_clientInputs[i]->Write(sectorNode) ==
false)
309 for (
int i = 0; i < (int)m_seedPoints.size(); i++)
311 if (m_seedPoints[i].Write(sectorNode) ==
false)
316 for (
int i = 0; i < (int)m_tagVolumes.size(); i++)
318 if (m_tagVolumes[i]->Write(sectorNode) ==
false)
330 bool m_doSaveClientInput;
331 bool m_doGenerateColData;
334 std::vector<NavGenProjClientInput*> m_clientInputs;
335 std::vector<NavGenProjSeedPoint> m_seedPoints;
336 std::vector<NavGenProjTagVolume*> m_tagVolumes;
This class represents a two-dimensional axis-aligned bounding box whose dimensions are stored using 3...
Definition: box2i.h:119
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
An instance of this class is used to represent each input geometry file in a NavGenProj.
Definition: NavGenProjGeometry.h:23
This class is used by the NavGenProj to store configuration parameters required by the NavData genera...
Definition: NavGenProjConfig.h:24
void SetSafe(const Vec2i &min_, const Vec2i &max_)
Sets the extents of the bounding box to the specified values.
Definition: box2i.h:169
An instance of this class is used to represent each seedpoint in a NavGenProj.
Definition: NavGenProjSeedPoint.h:23
KyInt32 x
The size of the vector along the X axis.
Definition: vec2i.h:283
KyInt32 y
The size of the vector along the Y axis.
Definition: vec2i.h:284
std::vector< NavGenProjGeometry * > m_geometries
Stores the list of input geometry files. Do not modify directly. Use AddObjFilePath().
Definition: NavGenProjSector.h:338
static const KyGuid & GetInvalidGuid()
Returns the invalid KyGuid value.
An instance of this class is used to represent each input geometry file in a NavGenProj.
Definition: NavGenProjSector.h:27
#define KyInt32MAXVAL
The maximum value that can be stored in the KyInt32 variable type.
Definition: types.h:224
This class defines a two-dimensional vector whose coordinates are stored using 32-bit integers...
Definition: vec2i.h:26
Definition: gamekitcrowddispersion.h:20
The KyGuid class represents a globally unique ID.
Definition: kyguid.h:22
#define KY_SUCCESS
Shorthand for Kaim::Result::Success.
Definition: types.h:273
#define KY_ERROR
Shorthand for Kaim::Result::Failure.
Definition: types.h:272
void InitFromString(const char guidString[])
Initializes this GUID using the specified string.
void ToString(char guidString[]) const
Converts this GUID to a string.
An instance of this class is used to represent each tag volume in a NavGenProj.
Definition: NavGenProjTagVolume.h:23
bool IsValid() const
Indicates whether or not the extents of the bounding box are valid.
Definition: box2i.h:154
void Clear()
Clears all information maintained by this object.
Definition: box2i.h:235
This class defines a three-dimensional vector whose coordinates are stored using floating-point numbe...
Definition: vec3f.h:23