Helios++
Helios software for LiDAR simulations
XmlUtils.h
1 #pragma once
2 
3 #include <Color4f.h>
4 #include <typedef.h>
5 #include <NoiseSource.h>
6 #include <scene/dynamic/DynSequence.h>
7 #include <maths/rigidmotion/RigidMotion.h>
8 #include <DynMotion.h>
9 
10 #include <tinyxml2.h>
11 
12 #include <map>
13 #include <vector>
14 
15 using namespace rigidmotion;
16 
20 class XmlUtils{
21 public:
22  // *** CONSTRUCTION / DESTRUCTION *** //
23  // ************************************ //
24  XmlUtils() = delete;
25 
26  // *** STATIC METHODS *** //
27  // ************************ //
34  static Color4f createColorFromXml(tinyxml2::XMLElement* node);
35 
42  static std::map<std::string, ObjectT> createParamsFromXml(
43  tinyxml2::XMLElement* paramsNode
44  );
51  static Rotation createRotationFromXml(tinyxml2::XMLElement* rotGroupNode);
60  static glm::dvec3 createVec3dFromXml(
61  tinyxml2::XMLElement* node,
62  std::string attrPrefix
63  );
70  static std::shared_ptr<NoiseSource<double>>
71  createNoiseSource(tinyxml2::XMLElement *noise);
72 
82  static ObjectT getAttribute(
83  tinyxml2::XMLElement* element,
84  std::string attrName,
85  std::string type,
86  ObjectT defaultVal,
87  std::string const defaultMsg="Using default value for attribute"
88  );
89 
97  static bool hasAttribute(
98  tinyxml2::XMLElement *element,
99  std::string attrName
100  );
101 
119  static std::vector<std::shared_ptr<DynMotion>> createDynMotionsVector(
120  tinyxml2::XMLElement *element
121  );
122 
129  static void assertDocumentForAssetLoading(
130  tinyxml2::XMLDocument &doc,
131  std::string const &filename,
132  std::string const &path,
133  std::string const &type,
134  std::string const &id,
135  std::string const &caller
136  );
137 };
Class representing a color with 4 float components: RGBA.
Definition: Color4f.h:10
Definition: Rotation.h:80
Common utils for XML handling.
Definition: XmlUtils.h:20