Waterflow
Visualize water in terrain
src/xmlParsing.cpp File Reference

Implementations of functions xmlParsing.h. More...

#include "xmlParsing.h"

Go to the source code of this file.

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.

Detailed Description

Implementations of functions xmlParsing.h.

Definition in file xmlParsing.cpp.


Function Documentation

void deleteAllFlows ( std::vector< FlowSource * >  srces)

This function removes flowSources to free up memory.

Parameters:
srcesVector 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.

Parameters:
flowsVector with pointers to flowSource objects to be updated and and checked for changes.
dtTime unit to advance the internal source time with given as a foat.
Returns:
If any source has changed is pressure this function will return true. Otherwise the return will be false.

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.

Parameters:
stra string with comma separated float values e.g. "1 , 2.5, -8.3"
Returns:
vector of floats with the values from the input string.

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.

Parameters:
stra string with comma separated int values e.g. "1 , 2, 8"
Returns:
vector of ints with the values from the input string.

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.

Parameters:
xmlFileRelative path to the XML file containing the floods to fill the terrain with.
Returns:
A vector containing pointers to Flood_Fill_Data objects created from flood nodes.

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.

Parameters:
xmlFilerelative path to an xml file containing flow sources data.
Returns:
A vector filled with pointers to flowSource objects containing data given by an XML file.

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.

Parameters:
xmlFilerelative path to the XML file containing the height.
Returns:
string containing relative path to the data file to be saved.

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.

Parameters:
xmlFilerelative path to the XML file containing the filepath for the file to be saved.
Returns:
string containing relative path to the height data file used for saving.

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.

Parameters:
xmlFilerelative path to the XML file containing the terrain map to be loaded.
Returns:
string containing relative path to the dem data file used for terrain generatrion.

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.

Parameters:
xmlFilerelative path to the XML file containing the velocity.
Returns:
string containing relative path to the data file to be saved.

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.

Parameters:
xmlFilerelative path to the XML file containing the filepath for the file to be saved.
Returns:
string containing relative path to the velocity data file used for saving.

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.

Parameters:
objpointer to FlowSource object that normal data will be writen to.
normxml node with child nodes containing normals defined by the attributes: "x", "y" and "z".
timexml 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.

Parameters:
objpointer to FlowSource object that position data will be writen to.
nodexml 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.

Parameters:
objpointer to FlowSource object that pressure data will be writen to.
presxml node containing pressure values as CSV in attribute "p".
timexml 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.

Parameters:
objpointer to FlowSource object that Radius value will be writen to.
nodexml 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.

Parameters:
objpointer to FlowSource object that totalWater value will be writen to.
nodexml node containing the totalWater value in the "tot" attribute.

Definition at line 95 of file xmlParsing.cpp.

 All Classes Files Functions Variables Enumerations