Helios++
Helios software for LiDAR simulations
|
Class for asset loading from XML file. More...
#include <XmlAssetsLoader.h>
Public Member Functions | |
XmlAssetsLoader (std::string &filePath, std::string &assetsDir) | |
Build a XmlAssetsLoader for given XML file and assets directory. More... | |
std::shared_ptr< Asset > | getAssetById (std::string type, std::string id) |
Get asset by its identifier. More... | |
std::shared_ptr< Asset > | getAssetByLocation (std::string type, std::string location) |
Get asset by location. More... | |
std::shared_ptr< Asset > | createAssetFromXml (std::string type, tinyxml2::XMLElement *assetNode) |
Create an asset from given XML element (node) More... | |
Color4f | createColorFromXml (tinyxml2::XMLElement *node) |
Create a color from given XML element (node) More... | |
std::map< std::string, ObjectT > | createParamsFromXml (tinyxml2::XMLElement *paramsNode) |
Create a map of parameters from given XML element (node) More... | |
std::shared_ptr< Platform > | createPlatformFromXml (tinyxml2::XMLElement *platformNode) |
Create a platform from given XML element (node) More... | |
std::shared_ptr< PlatformSettings > | createPlatformSettingsFromXml (tinyxml2::XMLElement *node) |
Create platform settings from given XML element (node) More... | |
std::shared_ptr< Scanner > | createScannerFromXml (tinyxml2::XMLElement *scannerNode) |
Create scanner from given XML element (node) More... | |
std::shared_ptr< ScannerSettings > | createScannerSettingsFromXml (tinyxml2::XMLElement *node) |
Create scanner settings from given XML element (node) More... | |
std::shared_ptr< FWFSettings > | createFWFSettingsFromXml (tinyxml2::XMLElement *node, std::shared_ptr< FWFSettings > settings=nullptr) |
Create FWF settings from given XML element (node) More... | |
std::shared_ptr< Scene > | createSceneFromXml (tinyxml2::XMLElement *sceneNode, std::string path) |
Create scene from given XML element (node) More... | |
Rotation | createRotationFromXml (tinyxml2::XMLElement *rotGroupNode) |
Create a rotation from given XML element (node) More... | |
glm::dvec3 | createVec3dFromXml (tinyxml2::XMLElement *node, std::string attrPrefix) |
Create a 3D vector from given XML element (node) More... | |
Static Public Member Functions | |
static std::shared_ptr< NoiseSource< double > > | createNoiseSource (tinyxml2::XMLElement *noise) |
Create a noise source from given XML element (node) More... | |
Public Attributes | |
tinyxml2::XMLDocument | doc |
XML file through tinyxml2 library. | |
SceneLoadingSpecification | sceneSpec |
Scene loading specification. More... | |
Protected Member Functions | |
ObjectT | getAttribute (tinyxml2::XMLElement *element, std::string attrName, std::string type, ObjectT defaultVal) |
Obtain attribute from XML. More... | |
Protected Attributes | |
std::string | assetsDir |
Assets directory. | |
std::string | xmlDocFilename = "unknown.xml" |
Name of the XML file. | |
std::string | xmlDocFilePath = "" |
Path to the XML file. | |
std::unordered_map< std::string, std::shared_ptr< ScannerSettings > > | scannerTemplates |
Map containing all scanner templates that were loading while building from XML file. No repetitions, each template appears only one time. More... | |
Class for asset loading from XML file.
XmlAssetsLoader::XmlAssetsLoader | ( | std::string & | filePath, |
std::string & | assetsDir | ||
) |
Build a XmlAssetsLoader for given XML file and assets directory.
filePath | Path to XML File |
assetsDir | Path to assets directory |
std::shared_ptr< Asset > XmlAssetsLoader::createAssetFromXml | ( | std::string | type, |
tinyxml2::XMLElement * | assetNode | ||
) |
Color4f XmlAssetsLoader::createColorFromXml | ( | tinyxml2::XMLElement * | node | ) |
Create a color from given XML element (node)
node | XML element (node) containing color data |
std::shared_ptr< FWFSettings > XmlAssetsLoader::createFWFSettingsFromXml | ( | tinyxml2::XMLElement * | node, |
std::shared_ptr< FWFSettings > | settings = nullptr |
||
) |
Create FWF settings from given XML element (node)
node | XML element (node) containing FWF settings data |
settings | Specify the FWFSettings instance to use as output. If nullptr is specified, then a new instance of FWFSettings is used |
|
static |
Create a noise source from given XML element (node)
noise | XML element (node) containing noise source specification |
std::map< std::string, ObjectT > XmlAssetsLoader::createParamsFromXml | ( | tinyxml2::XMLElement * | paramsNode | ) |
Create a map of parameters from given XML element (node)
paramsNode | XML element (node) containing parameters |
std::shared_ptr< Platform > XmlAssetsLoader::createPlatformFromXml | ( | tinyxml2::XMLElement * | platformNode | ) |
Create a platform from given XML element (node)
platformNode | XML element (node) containing platform data |
std::shared_ptr< PlatformSettings > XmlAssetsLoader::createPlatformSettingsFromXml | ( | tinyxml2::XMLElement * | node | ) |
Create platform settings from given XML element (node)
node | XML element (node) containing platform settings data |
Rotation XmlAssetsLoader::createRotationFromXml | ( | tinyxml2::XMLElement * | rotGroupNode | ) |
Create a rotation from given XML element (node)
rotGroupNode | XML element (node) containing rotation data |
std::shared_ptr< Scanner > XmlAssetsLoader::createScannerFromXml | ( | tinyxml2::XMLElement * | scannerNode | ) |
Create scanner from given XML element (node)
scannerNode | XML element (node) containing scanner data |
std::shared_ptr< ScannerSettings > XmlAssetsLoader::createScannerSettingsFromXml | ( | tinyxml2::XMLElement * | node | ) |
Create scanner settings from given XML element (node)
node | XML element (node) containing scanner settings data |
std::shared_ptr< Scene > XmlAssetsLoader::createSceneFromXml | ( | tinyxml2::XMLElement * | sceneNode, |
std::string | path | ||
) |
Create scene from given XML element (node)
sceneNode | XML element (node) containing scene data |
path | Path to scene file |
glm::dvec3 XmlAssetsLoader::createVec3dFromXml | ( | tinyxml2::XMLElement * | node, |
std::string | attrPrefix | ||
) |
Create a 3D vector from given XML element (node)
node | XML element (node) containing 3D vector data |
attrPrefix | Attribute prefix. It will be used so x component is "attrPrefix" + "x" and so on for y and z components too. |
std::shared_ptr< Asset > XmlAssetsLoader::getAssetById | ( | std::string | type, |
std::string | id | ||
) |
Get asset by its identifier.
type | Type of the asset |
id | Identifier of the asset |
std::shared_ptr< Asset > XmlAssetsLoader::getAssetByLocation | ( | std::string | type, |
std::string | location | ||
) |
Get asset by location.
type | Type of the asset |
location | Location of the asset |
|
protected |
Obtain attribute from XML.
element | XML element (node) where the attribute must be taken from |
attrName | Name of the attribute to be obtained |
type | Type of the attribute to be obtained |
defaultVal | Default value to be used in case attribute was not found |
|
protected |
Map containing all scanner templates that were loading while building from XML file. No repetitions, each template appears only one time.
The id of the template is used as the key, while the template itself is the value (ScannerSettings object)
SceneLoadingSpecification XmlAssetsLoader::sceneSpec |
Scene loading specification.