|
Waterflow
Visualize water in terrain
|
This file implement all the parsing functions for the XML file contents and an generating function for the Flowsource class. More...
#include "pugixml.h"#include "flowSource.h"#include <fstream>#include <iostream>#include <sstream>#include <string>Go to the source code of this file.
Classes | |
| struct | Flood_Fill_data |
| Struct that contains information about a location to be filled. More... | |
| struct | init_Data_struct |
| Encapsulating struct for all objects read from XML file. More... | |
Functions | |
| void | deleteAllFlows (std::vector< FlowSource * > srces) |
| This function removes flowSources to free up memory. | |
| bool | flowChange (std::vector< FlowSource * > flows, float dt) |
| This function progresses the pressure time for the flowsources provided and checks if there has ocured a change in pressure. | |
| std::vector< float > | fStrToVector (std::string str) |
| Converts a string with CSV to a vector with floats. | |
| std::vector< int > | iStrToVector (std::string str) |
| Converts a string with CSV to a vector with int. | |
| std::vector< Flood_Fill_data * > | loadFFData (const char *xmlFile) |
| Loads all flood objects given in the floods node from a XML file to a vector. | |
| std::vector< FlowSource * > | loadFlows (const char *xmlFile) |
| This function creates and populates FlowSource objects from a given XML file. | |
| std::string | loadHeightLoadPath (const char *xmlFile) |
| Loads a path given in the data node from a XML file. | |
| std::string | loadHeightSavePath (const char *xmlFile) |
| Loads a path given in the data node from a XML file. | |
| std::string | loadMapPath (const char *xmlFile) |
| Loads a path given in the data node from a XML file. | |
| std::string | loadVelLoadPath (const char *xmlFile) |
| Loads a path given in the data node from a XML file. | |
| std::string | loadVelSavePath (const char *xmlFile) |
| Loads a path given in the data node from a XML file. | |
| void | parseNormal (FlowSource *obj, pugi::xml_node norm, pugi::xml_node time) |
| This function parses the normals data in the given xml nodes. | |
| void | parsePosition (FlowSource *obj, pugi::xml_node node) |
| This function parses the position data in the given xml node. | |
| void | parsePressure (FlowSource *obj, pugi::xml_node pres, pugi::xml_node time) |
| This function parses the pressure data in the given xml nodes. | |
| void | parseRadius (FlowSource *obj, pugi::xml_node node) |
| This function parses the radius value in the given xml node. | |
| void | parseTotalWater (FlowSource *obj, pugi::xml_node node) |
| This function parses the total water value in the given xml node. | |
This file implement all the parsing functions for the XML file contents and an generating function for the Flowsource class.
Definition in file xmlParsing.h.
| void deleteAllFlows | ( | std::vector< FlowSource * > | srces | ) |
This function removes flowSources to free up memory.
| srces | Vector with pointers to flowSource objects to be deleted. |
Definition at line 188 of file xmlParsing.cpp.
| bool flowChange | ( | std::vector< FlowSource * > | flows, |
| float | dt | ||
| ) |
This function progresses the pressure time for the flowsources provided and checks if there has ocured a change in pressure.
| flows | Vector with pointers to flowSource objects to be updated and and checked for changes. |
| dt | Time unit to advance the internal source time with given as a foat. |
Definition at line 126 of file xmlParsing.cpp.
| std::vector<float> fStrToVector | ( | std::string | str | ) |
Converts a string with CSV to a vector with floats.
| str | a string with comma separated float values e.g. "1 , 2.5, -8.3" |
Definition at line 30 of file xmlParsing.cpp.
| std::vector<int> iStrToVector | ( | std::string | str | ) |
Converts a string with CSV to a vector with int.
| str | a string with comma separated int values e.g. "1 , 2, 8" |
Definition at line 45 of file xmlParsing.cpp.
| std::vector<Flood_Fill_data*> loadFFData | ( | const char * | xmlFile | ) |
Loads all flood objects given in the floods node from a XML file to a vector.
| xmlFile | Relative path to the XML file containing the floods to fill the terrain with. |
Definition at line 172 of file xmlParsing.cpp.
| std::vector<FlowSource*> loadFlows | ( | const char * | xmlFile | ) |
This function creates and populates FlowSource objects from a given XML file.
The XML file is expected to be formated and contain pre defined nodes and attributes.
| xmlFile | relative path to an xml file containing flow sources data. |
Definition at line 108 of file xmlParsing.cpp.
| std::string loadHeightLoadPath | ( | const char * | xmlFile | ) |
Loads a path given in the data node from a XML file.
| xmlFile | relative path to the XML file containing the height. |
Definition at line 151 of file xmlParsing.cpp.
| std::string loadHeightSavePath | ( | const char * | xmlFile | ) |
Loads a path given in the data node from a XML file.
| xmlFile | relative path to the XML file containing the filepath for the file to be saved. |
Definition at line 165 of file xmlParsing.cpp.
| std::string loadMapPath | ( | const char * | xmlFile | ) |
Loads a path given in the data node from a XML file.
| xmlFile | relative path to the XML file containing the terrain map to be loaded. |
Definition at line 136 of file xmlParsing.cpp.
| std::string loadVelLoadPath | ( | const char * | xmlFile | ) |
Loads a path given in the data node from a XML file.
| xmlFile | relative path to the XML file containing the velocity. |
Definition at line 144 of file xmlParsing.cpp.
| std::string loadVelSavePath | ( | const char * | xmlFile | ) |
Loads a path given in the data node from a XML file.
| xmlFile | relative path to the XML file containing the filepath for the file to be saved. |
Definition at line 158 of file xmlParsing.cpp.
| void parseNormal | ( | FlowSource * | obj, |
| pugi::xml_node | norm, | ||
| pugi::xml_node | time | ||
| ) |
This function parses the normals data in the given xml nodes.
| obj | pointer to FlowSource object that normal data will be writen to. |
| norm | xml node with child nodes containing normals defined by the attributes: "x", "y" and "z". |
| time | xml node containing time values as CSV in attribute "t". |
Definition at line 78 of file xmlParsing.cpp.
| void parsePosition | ( | FlowSource * | obj, |
| pugi::xml_node | node | ||
| ) |
This function parses the position data in the given xml node.
| obj | pointer to FlowSource object that position data will be writen to. |
| node | xml node containing xyz positions in attributes: "x", "y" and "z". |
Definition at line 69 of file xmlParsing.cpp.
| void parsePressure | ( | FlowSource * | obj, |
| pugi::xml_node | pres, | ||
| pugi::xml_node | time | ||
| ) |
This function parses the pressure data in the given xml nodes.
| obj | pointer to FlowSource object that pressure data will be writen to. |
| pres | xml node containing pressure values as CSV in attribute "p". |
| time | xml node containing time values as CSV in attribute "t". |
Definition at line 60 of file xmlParsing.cpp.
| void parseRadius | ( | FlowSource * | obj, |
| pugi::xml_node | node | ||
| ) |
This function parses the radius value in the given xml node.
| obj | pointer to FlowSource object that Radius value will be writen to. |
| node | xml node containing the Radius value in the "r" attribute. |
Definition at line 101 of file xmlParsing.cpp.
| void parseTotalWater | ( | FlowSource * | obj, |
| pugi::xml_node | node | ||
| ) |
This function parses the total water value in the given xml node.
| obj | pointer to FlowSource object that totalWater value will be writen to. |
| node | xml node containing the totalWater value in the "tot" attribute. |
Definition at line 95 of file xmlParsing.cpp.