29 : m_projConfig(config)
32 , m_doSaveClientInput(
true)
33 , m_doGenerateColData(
false)
38 void SetName(
const char* name) { m_name.assign(name); }
39 void SetGuid(
const Kaim::KyGuid& guid) { m_guid = guid; }
40 void SetDoBuild(
bool doBuild) { m_doBuild = doBuild; }
41 void SetDoSaveClientInput(
bool doSaveClientInput) { m_doSaveClientInput = doSaveClientInput; }
42 void SetDoGenerateColData(
bool doGenerateColData) { m_doGenerateColData = doGenerateColData; }
43 void SetCellBox(
const Kaim::CellBox& cellBox) { m_cellBox = cellBox; }
45 void AddObjFilePath(
const char* fileName)
47 ProjGeometry geometry;
48 geometry.SetFileName(fileName);
49 m_geometries.push_back(geometry);
52 void AddClientInputFilePath(
const char* fileName)
54 m_clientInputs.push_back(ProjClientInput(fileName));
57 void AddSeedPoint(
float x,
float y,
float z)
59 ProjSeedPoint seedPoint;
61 m_seedPoints.push_back(seedPoint);
64 KyResult AddTagVolume(
const Vec3f* polylinePoints,
int pointArraySize,
const Kaim::DynamicNavTag& navTag,
float minAltitude,
float maxAltitude)
66 std::unique_ptr<ProjTagVolume> projTagVolume(
new ProjTagVolume(&m_projConfig.m_coordSystem));
67 if (projTagVolume->m_tagVolume.InitInClientCoordinates(polylinePoints, pointArraySize, minAltitude, maxAltitude, navTag, m_projConfig.m_coordSystem) ==
KY_ERROR)
70 m_tagVolumes.push_back(std::move(projTagVolume));
74 int GetGeometryFileCount()
const {
return (
int)m_geometries.size(); }
75 std::string GetGeometryFileName(
int index) {
return m_geometries[index].m_fileName; }
77 int GetClientInputFileCount()
const {
return (
int)m_clientInputs.size(); }
78 std::string GetClientInputFileName(
int index) {
return m_clientInputs[index].m_fileName; }
80 void Write(XmlNode node)
const
82 node.WriteChild(
"name", m_name);
83 node.WriteChild(
"guid", m_guid);
85 node.WriteChild(
"doBuild", m_doBuild);
86 node.WriteChild(
"doSaveClientInput", m_doSaveClientInput);
87 node.WriteChild(
"doGenerateColData", m_doGenerateColData);
89 if (m_cellBox.IsValid())
90 node.WriteChild(
"cellBox", m_cellBox);
92 node.WriteChild(
"produceInputMask", m_produceInputMask);
95 if (m_geometries.size() > 0)
97 XmlNode n = node.CreateChild(
"geometries");
98 for (
const auto& e : m_geometries)
99 n.WriteChild(
"geometry", e);
103 if (m_clientInputs.size() > 0)
105 XmlNode n = node.CreateChild(
"clientInputs");
106 for (
const auto& e : m_clientInputs)
107 n.WriteChild(
"clientInput", e);
111 if (m_seedPoints.size() > 0)
113 XmlNode n = node.CreateChild(
"seedPoints");
114 for (
const auto& e : m_seedPoints)
115 n.WriteChild(
"seedPoint", e);
119 if (m_tagVolumes.size() > 0)
121 XmlNode tagVolumesNode = node.CreateChild(
"tagVolumes");
122 for (
const auto& e : m_tagVolumes)
123 Kaim::Write(tagVolumesNode.CreateChild(
"tagVolume"), *e);
127 bool Read(XmlNode node)
129 for (XmlNode child = node.FirstChild(); child; child = child.NextSibling())
131 if (child.IsElement() ==
false)
134 KY_READ_CHILD_VALUE(child,
"name", m_name);
135 KY_READ_CHILD_VALUE(child,
"guid", m_guid);
137 KY_READ_CHILD_VALUE(child,
"doBuild", m_doBuild);
138 KY_READ_CHILD_VALUE(child,
"doSaveClientInput", m_doSaveClientInput);
139 KY_READ_CHILD_VALUE(child,
"doGenerateColData", m_doGenerateColData);
141 KY_READ_CHILD_VALUE(child,
"cellBox", m_cellBox);
143 KY_READ_CHILD_VALUE(child,
"produceInputMask", m_produceInputMask);
145 KY_READ_CHILD_FUNC(child,
"geometries", ReadGeometries(child));
146 KY_READ_CHILD_FUNC(child,
"clientInputs", ReadClientInputs(child));
148 KY_READ_CHILD_FUNC(child,
"seedpoints", ReadSeedPoints(child));
149 KY_READ_CHILD_FUNC(child,
"tagVolumes", ReadTagVolumes(child));
151 KY_LOG_WARNING((
"[NavGenProj] unknown child <%s> in node <%s>", child.GetName(), node.GetName()));
159 bool ReadGeometries(XmlNode node)
161 for (XmlNode child = node.FirstChild(); child; child = child.NextSibling())
163 if (child.HasName(
"geometry") ==
false)
166 ProjGeometry geometry;
167 if (child.ReadNode(geometry) ==
false)
170 m_geometries.push_back(geometry);
175 bool ReadClientInputs(XmlNode node)
177 for (XmlNode child = node.FirstChild(); child; child = child.NextSibling())
179 if (child.HasName(
"clientInput") ==
false)
182 ProjClientInput projClientInput;
183 if (child.ReadNode(projClientInput) ==
false)
186 m_clientInputs.push_back(projClientInput);
191 bool ReadSeedPoints(XmlNode node)
193 for (XmlNode child = node.FirstChild(); child; child = child.NextSibling())
195 if (child.HasName(
"seedpoint") ==
false)
198 ProjSeedPoint projSeedPoint;
199 if (Kaim::Read(child, projSeedPoint) ==
false)
202 m_seedPoints.push_back(projSeedPoint);
207 bool ReadTagVolumes(XmlNode node)
209 for (XmlNode child = node.FirstChild(); child; child = child.NextSibling())
211 if (child.HasName(
"tagVolume") ==
false)
214 std::unique_ptr<ProjTagVolume> projTagVolume(
new ProjTagVolume(&m_projConfig.m_coordSystem));
215 if (child.ReadNode(*projTagVolume) ==
false)
218 m_tagVolumes.push_back(std::move(projTagVolume));
228 bool m_doSaveClientInput;
229 bool m_doGenerateColData;
230 ProjProduceInputMask m_produceInputMask;
231 std::vector<ProjGeometry> m_geometries;
232 std::vector<ProjClientInput> m_clientInputs;
233 std::vector<ProjSeedPoint> m_seedPoints;
234 std::vector<std::unique_ptr<ProjTagVolume>> m_tagVolumes;
239 inline bool Read(XmlNode node,
ProjSector& value) {
return value.Read(node); }
240 inline void Write(XmlNode node,
const ProjSector& value) { value.Write(node); }
This class is used by the NavGenProj to store configuration parameters required by the NavData genera...
Definition: ProjConfig.h:23
2d axis aligned box of 32bits integers. Very Important: CountX() returns m_max.x - m_min...
Definition: box2i.h:17
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:196
#define KyInt32MAXVAL
KyInt32 max value
Definition: types.h:60
Navigation return code class.
Definition: types.h:108
An instance of this class is used to represent each input geometry file in a NavGenProj.
Definition: ProjSector.h:24
2d vector using KyInt32
Definition: vec2i.h:18
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
The KyGuid class represents a globally unique ID.
Definition: kyguid.h:20
static const KyGuid & GetInvalidGuid()
Returns the invalid KyGuid value.
Definition: kyguid.cpp:21
#define KY_ERROR
use result == KY_ERROR to test for error
Definition: types.h:132
3d vector using 32bits floating points.
Definition: vec3f.h:16