Helios++
Helios software for LiDAR simulations
|
Survey loader from XML. More...
#include <XmlSurveyLoader.h>
Public Member Functions | |
XmlSurveyLoader (std::string &filePath, std::string &assetsDir) | |
XML survey loader constructor. More... | |
std::shared_ptr< Leg > | createLegFromXML (tinyxml2::XMLElement *legNode, std::unordered_set< std::string > *scannerFields, std::unordered_set< std::string > *platformFields) |
Create a leg from a XML element/node. More... | |
std::shared_ptr< Survey > | createSurveyFromXml (tinyxml2::XMLElement *surveyNode, bool legNoiseDisabled=false, bool rebuildScene=false) |
Create a survey form a XML element/node. More... | |
std::shared_ptr< Survey > | load (bool legNoiseDisabled=false, bool rebuildScene=false) |
Load a full survey from XML. More... | |
![]() | |
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, void *extraOutput=nullptr) |
Get asset by its identifier. More... | |
std::shared_ptr< Asset > | getAssetByLocation (std::string type, std::string location, void *extraOutput=nullptr) |
Get asset by location. More... | |
std::shared_ptr< Asset > | createAssetFromXml (std::string type, tinyxml2::XMLElement *assetNode, void *extraOutput=nullptr) |
Create an asset from given XML element (node) More... | |
std::shared_ptr< Asset > | createProceduralAssetFromXml (std::string const &type, std::string const &id, void *extraOutput=nullptr) |
Like XmlAssetsLoader::createAssetFromXml but creating the asset procedurally instead of simply loading it. 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, std::unordered_set< std::string > *fields=nullptr) |
Create platform settings from given XML element (node) More... | |
std::shared_ptr< Platform > | procedurallyCreatePlatformFromXml (string const &type, string const &id) |
Procedurally create the platform from given XML specification. More... | |
std::shared_ptr< Platform > | createInterpolatedMovingPlatform () |
Procedurally create an InterpolatedMovingPlatform. More... | |
std::shared_ptr< Scanner > | createScannerFromXml (tinyxml2::XMLElement *scannerNode) |
Create scanner from given XML element (node) More... | |
std::shared_ptr< AbstractBeamDeflector > | createBeamDeflectorFromXml (tinyxml2::XMLElement *scannerNode) |
Create a beam deflector from given XML element (node) More... | |
std::shared_ptr< AbstractDetector > | createDetectorFromXml (tinyxml2::XMLElement *scannerNode, std::shared_ptr< Scanner > scanner) |
Create a pulse detector from given XML element (node) More... | |
std::shared_ptr< ScannerHead > | createScannerHeadFromXml (tinyxml2::XMLElement *scannerNode) |
Create a scanner head from given XML element (node) More... | |
std::shared_ptr< ScannerSettings > | createScannerSettingsFromXml (tinyxml2::XMLElement *node, std::unordered_set< std::string > *fields=nullptr) |
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< TrajectorySettings > | createTrajectorySettingsFromXml (tinyxml2::XMLElement *legNode, std::shared_ptr< TrajectorySettings > settings=nullptr) |
Create TrajectorySettings from given XML element (node) More... | |
void | fillScanningDevicesFromChannels (std::shared_ptr< Scanner > scanner, tinyxml2::XMLElement *scannerNode, tinyxml2::XMLElement *channels, std::shared_ptr< AbstractBeamDeflector > deflec, std::shared_ptr< AbstractDetector > detec, std::shared_ptr< ScannerHead > scanHead, std::shared_ptr< FWFSettings > fwfSettings) |
Fill vector of scanning devices with channel data. More... | |
Protected Member Functions | |
void | reinitLoader () override |
Call the reinitLoader from XmlAssetsLoader and then also assure that the map of scanning strips is empty. The last serial leg identifier is also setted to -1. More... | |
std::shared_ptr< Scene > | loadScene (std::string sceneString, bool rebuildScene=false) |
Load scene from XML. More... | |
void | loadSurveyCore (tinyxml2::XMLElement *surveyNode, std::shared_ptr< Survey > survey) |
Load the core components of the survey. It is, its name, the source file path, the scanner and the platform. More... | |
void | handleCoreOverloading (tinyxml2::XMLElement *surveyNode, std::shared_ptr< Survey > survey) |
Handle overloading of survey's core components. More... | |
void | loadLegs (tinyxml2::XMLElement *legNodes, std::shared_ptr< ScannerSettings > scannerSettings, std::shared_ptr< Platform > platform, std::vector< std::shared_ptr< Leg >> &legs) |
Load all legs defining the survey. More... | |
void | applySceneShift (tinyxml2::XMLElement *surveyNode, bool const legNoiseDisabled, std::shared_ptr< Survey > survey) |
Apply scene geometry shift to platform waypoints. More... | |
void | loadPlatformNoise (tinyxml2::XMLElement *surveyNode, std::shared_ptr< Platform > platform) |
Load plataform noise, overriding what is specified in platform.xml if necessary. More... | |
![]() | |
void | makeDefaultTemplates () |
void | trackNonDefaultScannerSettings (std::shared_ptr< ScannerSettings > base, std::shared_ptr< ScannerSettings > ref, std::string const defaultTemplateId, std::unordered_set< std::string > &fields) |
Track non default values at base. It is, those values which are in base distinct than the reference (ref) More... | |
void | trackNonDefaultPlatformSettings (std::shared_ptr< PlatformSettings > base, std::shared_ptr< PlatformSettings > ref, std::string const defaultTemplateId, std::unordered_set< std::string > &fields) |
Track non default values at base. It is, those values which are in base distinct than the reference (ref) More... | |
Static Protected Member Functions | |
static void | configureDefaultRandomnessGenerator (tinyxml2::XMLElement *surveyNode) |
Configure the default randomness generador. If a seed was specified through XML survey node, then it will replace the previous one. More... | |
static void | integrateSurveyAndLegs (std::shared_ptr< Survey > survey) |
Integrating survey and legs means fitting survey attributes from legs and leg attributes from survey whenever it is necessary. More... | |
static void | validateSurvey (std::shared_ptr< Survey > survey) |
Validate given survey is free from inconsistencies. Otherwise, proper logging and forced exit (if needed) will be applied. More... | |
Protected Attributes | |
std::unordered_map< std::string, std::shared_ptr< ScanningStrip > > | strips |
Map of scanning strips. More... | |
int | lastLegSerialId = -1 |
Serial identifier for last created leg. It is initialized as -1, so the first leg has 0 as serial id. | |
![]() | |
std::string | assetsDir |
Assets directory. | |
std::string | xmlDocFilename = "unknown.xml" |
Name of the XML file. | |
std::string | xmlDocFilePath = "" |
Path to the XML file. | |
std::shared_ptr< ScannerSettings > | defaultScannerTemplate |
The default scanner settings template. | |
std::shared_ptr< PlatformSettings > | defaultPlatformTemplate |
The default platform settings template. | |
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... | |
std::unordered_map< std::string, std::shared_ptr< PlatformSettings > > | platformTemplates |
Map containing all platform templates that were loading while building from XML file. No repetitions, each template appears only one time. More... | |
std::unordered_map< std::string, std::unordered_set< std::string > > | scannerTemplatesFields |
Map containing the set of fields that have been overloaded by each scanner template. More... | |
std::unordered_map< std::string, std::unordered_set< std::string > > | platformTemplatesFields |
Map containing the set of fields that have been overloaded by each platform template. More... | |
Additional Inherited Members | |
![]() | |
static bool | isProceduralAsset (std::string const &type, std::string const &id) |
Check whether the given asset is a procedural asset or not. More... | |
![]() | |
XmlSceneLoader | sceneLoader |
The scene loader. It is used to load scenes from XML files. | |
tinyxml2::XMLDocument | doc |
XML file through tinyxml2 library. | |
![]() | |
static std::string const | defaultScannerSettingsMsg |
The message to be shown when default value is loaded for scanner settings. More... | |
static std::string const | defaultPlatformSettingsMsg |
The message to be shown when default value is loaded for platform settings. More... | |
Survey loader from XML.
This class strongly depends on its parent class XmlAssetsLoader
|
inline |
XML survey loader constructor.
filePath | Path to the XML File |
assetsDir | Path to the assets directory |
|
protected |
Apply scene geometry shift to platform waypoints.
surveyNode | XML element/node containing survey data |
legNoiseDisabled | Flag to disable leg noise @sparam survey The survey containing all legs and scene data |
|
staticprotected |
Configure the default randomness generador. If a seed was specified through XML survey node, then it will replace the previous one.
surveyNode | XML elemetn/node containing survey data |
shared_ptr< Leg > XmlSurveyLoader::createLegFromXML | ( | tinyxml2::XMLElement * | legNode, |
std::unordered_set< std::string > * | scannerFields, | ||
std::unordered_set< std::string > * | platformFields | ||
) |
Create a leg from a XML element/node.
legNode | XML element/node containing leg data | |
[in] | scannerFields | Unordered set to track which scanner settings have been overloaded |
[in] | platformFields | Unordered set to track which platform settings have been overloaded |
shared_ptr< Survey > XmlSurveyLoader::createSurveyFromXml | ( | tinyxml2::XMLElement * | surveyNode, |
bool | legNoiseDisabled = false , |
||
bool | rebuildScene = false |
||
) |
Create a survey form a XML element/node.
Notice that calling this method will reinitialize the loader by calling XmlSurveyLoader::reinitLoader
surveyNode | XML element/node containing survey data |
legNoiseDisabled | Flag to disable leg noise |
rebuildScene | Flag to specify scene must be rebuild even when a previously built one is found (true) or not (false) |
|
protected |
Handle overloading of survey's core components.
surveyNode | XML element/node containing survey data |
survey | The survey to be loaded |
|
staticprotected |
Integrating survey and legs means fitting survey attributes from legs and leg attributes from survey whenever it is necessary.
For example, it is used to scale the vertical resolution when the deflector has an effective max scan angle.
survey | The survey that must be integrated with respect to the legs composing it |
shared_ptr< Survey > XmlSurveyLoader::load | ( | bool | legNoiseDisabled = false , |
bool | rebuildScene = false |
||
) |
Load a full survey from XML.
legNoiseDisabled | Flag to disable leg noise |
rebuildScene | Flag to specify scene must be rebuild even when a previously built one is found (true) or not (false) |
|
protected |
Load all legs defining the survey.
legNodes | First leg node |
scannerSettings | The scanner settings of the survey scanner itself |
platform | The platform of the survey itself |
legs | Vector where loaded legs must be inserted |
|
protected |
Load plataform noise, overriding what is specified in platform.xml if necessary.
surveyNode | XML element/node containing survey data |
platform | The platform which noise must be loaded |
|
protected |
Load scene from XML.
sceneString | String from XML scene attribute at survey element/node |
rebuildScene | Flag to specify scene must be rebuild even when a previously built one is found (true) or not (false) |
|
protected |
Load the core components of the survey. It is, its name, the source file path, the scanner and the platform.
surveyNode | XML element/node containing survey data |
survey | The survey to be loaded |
|
overrideprotectedvirtual |
Call the reinitLoader from XmlAssetsLoader and then also assure that the map of scanning strips is empty. The last serial leg identifier is also setted to -1.
Reimplemented from XmlAssetsLoader.
|
staticprotected |
Validate given survey is free from inconsistencies. Otherwise, proper logging and forced exit (if needed) will be applied.
survey | The survey to be validated |
|
protected |
Map of scanning strips.