VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
makVrv::DtOsgEarthFile Class Reference

DtOsgEarthFile.

Represent an earth file and functionalities to update the file.

Classes

class  XmlElementKey
 

Public Types

typedef std::vector
< osgEarth::Util::XmlText * > 
XmlTextList
 
typedef std::vector
< DtOsgEarthFile * > 
ExternalFileList
 

Public Member Functions

 DtOsgEarthFile (const DtUnicode &fileName)
 
virtual ~DtOsgEarthFile ()
 
void load ()
 
void parseTextAndElements ()
 
void update (const XmlElementKey &key, const osgEarth::Config &config)
 
void updateName (const XmlElementKey &key, const std::string &newName)
 
void modify (const XmlElementKey &key, const osgEarth::Config &config)
 
void add (const XmlElementKey &key, const osgEarth::Config &config)
 
void remove (const XmlElementKey &key)
 
void move (const XmlElementKey &key, int newIndex)
 
void addTextNode (const XmlElementKey &key, const std::string &text)
 
osgEarth::Util::XmlElement * findChildElement (osgEarth::Util::XmlElement *element, const XmlElementKey &key)
 
osgEarth::Util::XmlElement * findParentElement (osgEarth::Util::XmlElement *element, const XmlElementKey &key)
 
void updateConfig (size_t startPos, osgEarth::Util::XmlElement *element, const osgEarth::Config &config)
 
void modifyConfig (size_t startPos, osgEarth::Util::XmlElement *element, const osgEarth::Config &config)
 
void updateXmlText (size_t startPos, osgEarth::Util::XmlElement *element, const std::string &text)
 
osgEarth::Util::XmlText * findXmlTextNode (osgEarth::Util::XmlElement *element)
 
void modifyTextNode (osgEarth::XmlElement *element, const std::string &text)
 
std::set< std::string > getUniqueChildKeysOfConfig (const osgEarth::Config &config) const
 
std::set< std::string > getUniqueChildKeysOfElement (const osgEarth::Util::XmlElement *element) const
 
std::string findNameOfConfig (const osgEarth::Config &config)
 
virtual bool checkExternalReference (const std::string &text)
 
virtual bool findUrl (const std::string &text, std::string &url)
 
virtual void parseExternalReference (const std::string &text)
 
DtUnicode fileName () const
 
const ExternalFileListexternalFileList () const
 
virtual const DtOsgEarthFilefindOsgEarthFileByFileName (const DtUnicode &fileName) const
 
std::vector< std::pair
< std::string, std::string > > 
getXmlElementNodes () const
 
virtual XmlElementKey getXmlElementKey (const osgEarth::XmlElement *parent, const osgEarth::XmlElement *element) const
 
virtual osgEarth::XmlElement * root ()
 
virtual bool findXmlElementKey (const std::string &type, const std::string &name, DtOsgEarthFile::XmlElementKey &key) const
 
virtual bool findXmlElementKey (osgEarth::Util::XmlElement *element, const std::string &type, const std::string &name, DtOsgEarthFile::XmlElementKey &key, int currentDepth=0, int maxDepth=2) const
 
virtual void setFileName (const DtUnicode &fileName)
 
virtual void save ()
 
virtual void save (const DtUnicode &fileName)
 
virtual std::string getXmlElementType (const osgEarth::Util::XmlElement *element) const
 
virtual int getXmlElementIndex (const osgEarth::Util::XmlElement *parent, const osgEarth::Util::XmlElement *element) const
 
virtual std::string getXmlElementName (const osgEarth::Util::XmlElement *element) const
 
DtOsgEarthFilefindOsgEarthFile (const std::string &type, const std::string &name)
 

Protected Member Functions

virtual void processXmlNode (const osgEarth::Util::XmlNode *node)
 
virtual void processXmlElement (const osgEarth::Util::XmlElement *element)
 
virtual void processXmlText (const osgEarth::Util::XmlText *text)
 
void addOrModifyConfig (size_t startPos, osgEarth::XmlElement *element, const osgEarth::Config &config, int index)
 
void addOrModifySimpleConfig (size_t startPos, osgEarth::Util::XmlElement *element, const std::string &key, const std::string &value, int index)
 
void addOrModifyNonSimpleConfig (size_t startPos, osgEarth::Util::XmlElement *element, const osgEarth::Config &config, int index)
 
virtual bool modifyXmlAttribute (size_t startPos, osgEarth::Util::XmlElement *element, const std::string &key, const std::string &newValue)
 
virtual bool removeXmlAttribute (size_t startPos, osgEarth::Util::XmlElement *element, const std::string &key)
 
virtual bool removeXmlElement (size_t startPos, osgEarth::Util::XmlElement *parent, const std::string &key, int index)
 
virtual bool moveXmlElement (size_t startPos, osgEarth::Util::XmlElement *parent, const std::string &key, int index, int newIndex)
 
virtual bool modifyXmlSimpleElement (size_t startPos, osgEarth::Util::XmlElement *element, const std::string &key, const std::string &newValue, int index)
 
virtual bool addXmlAttribute (size_t startPos, osgEarth::Util::XmlElement *element, const std::string &key, const std::string &newValue)
 
virtual bool addXmlSimpleElement (size_t startPos, osgEarth::Util::XmlElement *element, const std::string &key, const std::string &newValue, int index)
 
virtual bool addXmlNonSimpleElement (size_t startPos, osgEarth::Util::XmlElement *element, const osgEarth::Config &config, int index)
 
virtual bool addXmlTextNode (size_t startPos, osgEarth::Util::XmlElement *element, const std::string &text)
 
virtual std::string getConfigString (const osgEarth::Config &config)
 
virtual std::string getXmlAttributeString (const std::string &key, const std::string &value)
 
virtual std::string getSimpleConfigString (const std::string &key, const std::string &value)
 
virtual void updateAttribute (osgEarth::Util::XmlElement *element, const std::string &key, const std::string &newValue)
 
virtual void removeAttribute (osgEarth::Util::XmlElement *element, const std::string &key)
 
virtual void removeElement (osgEarth::Util::XmlElement *element, const std::string &key, int index)
 
virtual void updateSimpleElement (osgEarth::Util::XmlElement *element, const std::string &key, const std::string &newValue, int index)
 
virtual void addAttribute (osgEarth::Util::XmlElement *element, const std::string &key, const std::string &value)
 
virtual void addSimpleElement (osgEarth::Util::XmlElement *element, const std::string &key, const std::string &newValue)
 
virtual void addNonSimpleElement (osgEarth::Util::XmlElement *element, osgEarth::Util::XmlElement *child)
 
virtual void addTextNode (osgEarth::Util::XmlElement *element, const std::string &text)
 
virtual bool hasAttribute (const osgEarth::Util::XmlElement *element, const std::string &key)
 
virtual osgEarth::XmlElement * findSubElement (const osgEarth::Util::XmlElement *element, const std::string &key, int index)
 
virtual int findSubElementMaximumIndex (const osgEarth::XmlElement *element, const std::string &key)
 
virtual bool hasChild (const osgEarth::Config &config, const std::string &key, int index)
 
virtual size_t findStartPos (size_t startPos, const osgEarth::Util::XmlElement *element, const XmlElementKey &key)
 
virtual std::string getElementStartPattern (const std::string &key) const
 
virtual std::string getElementEndPattern (const osgEarth::Util::XmlElement *element) const
 
virtual std::string getElementEndPattern (const std::string &key) const
 
virtual std::string getAttributeStartPattern (const std::string &key) const
 
virtual bool getAttributeValue (size_t startPos, size_t endPos, const std::string &key, std::string &value) const
 
virtual bool getElementValue (size_t startPos, size_t endPos, const std::string &key, std::string &value) const
 
std::string formatValue (const std::string &value) const
 
virtual bool isReservedKeyWord (const std::string &key) const
 
virtual bool ifElementHasChild (osgEarth::Util::XmlElement *root, const std::string &type, const std::string &name, int currentDepth=0, int maxDepth=2)
 

Protected Attributes

osgEarth::Util::XmlElement * myRoot
 
ExternalFileList myExternalFileList
 
std::string myModifiedText
 
std::string myOriginalText
 
DtUnicode myFileName
 

Private Member Functions

 DtOsgEarthFile ()
 
 DtOsgEarthFile (const DtOsgEarthFile &)
 
DtOsgEarthFileoperator= (const DtOsgEarthFile &)
 

Member Typedef Documentation

typedef std::vector<osgEarth::Util::XmlText*> makVrv::DtOsgEarthFile::XmlTextList

Constructor & Destructor Documentation

makVrv::DtOsgEarthFile::DtOsgEarthFile ( const DtUnicode fileName)

The default constructor.

Parameters
fileNameThe file name of the earth file.
virtual makVrv::DtOsgEarthFile::~DtOsgEarthFile ( )
virtual

Destructor.

makVrv::DtOsgEarthFile::DtOsgEarthFile ( )
private

Private default constructor not implimented.

makVrv::DtOsgEarthFile::DtOsgEarthFile ( const DtOsgEarthFile )
private

Copy Constructor not implemented – Copy not allowed.

Member Function Documentation

void makVrv::DtOsgEarthFile::load ( )

Loads the earth file and parse the elements.

void makVrv::DtOsgEarthFile::parseTextAndElements ( )

Parse the elements and text nodes in the earth file.

void makVrv::DtOsgEarthFile::update ( const XmlElementKey key,
const osgEarth::Config &  config 
)

Updates an element in the earth file with the given config option.

Parameters
keyThe key of the element.
configThe config used to update the element, must have the same key type.
void makVrv::DtOsgEarthFile::updateName ( const XmlElementKey key,
const std::string &  newName 
)

Updates the name attribute in the config option.

void makVrv::DtOsgEarthFile::modify ( const XmlElementKey key,
const osgEarth::Config &  config 
)
void makVrv::DtOsgEarthFile::add ( const XmlElementKey key,
const osgEarth::Config &  config 
)

Adds a config under the element specified by the key.

Parameters
keyThe key of the element.
configThe config to add.
void makVrv::DtOsgEarthFile::remove ( const XmlElementKey key)

Removes an element specified by the key.

void makVrv::DtOsgEarthFile::move ( const XmlElementKey key,
int  newIndex 
)

Moves an element specified by the key to the new index.

void makVrv::DtOsgEarthFile::addTextNode ( const XmlElementKey key,
const std::string &  text 
)

Adds a text node under the element specified by the key.

osgEarth::Util::XmlElement* makVrv::DtOsgEarthFile::findChildElement ( osgEarth::Util::XmlElement *  element,
const XmlElementKey key 
)

Finds the child element with the given key.

Parameters
elementThe parent element.
keyThe key of child element.
osgEarth::Util::XmlElement* makVrv::DtOsgEarthFile::findParentElement ( osgEarth::Util::XmlElement *  element,
const XmlElementKey key 
)

Finds the direct parent element with the given key.

Parameters
elementThe top level parent element.
keyThe key of child element.
void makVrv::DtOsgEarthFile::updateConfig ( size_t  startPos,
osgEarth::Util::XmlElement *  element,
const osgEarth::Config &  config 
)

Updates the element with the config.

Parameters
startPosThe start string location to search for the element in the earth file.
elementThe element to update.
configThe config used to update.
void makVrv::DtOsgEarthFile::modifyConfig ( size_t  startPos,
osgEarth::Util::XmlElement *  element,
const osgEarth::Config &  config 
)
void makVrv::DtOsgEarthFile::updateXmlText ( size_t  startPos,
osgEarth::Util::XmlElement *  element,
const std::string &  text 
)

Updates the text node in the element.

Parameters
startPosThe start string location to search for the element in the earth file. Usually the the start position of the parent config.
elementThe element to update.
textThe text to update.
osgEarth::Util::XmlText* makVrv::DtOsgEarthFile::findXmlTextNode ( osgEarth::Util::XmlElement *  element)

Finds the text node child of the element if any.

Parameters
elementThe parent element of the text node if any.
Returns
Return NULL if no text node found.
void makVrv::DtOsgEarthFile::modifyTextNode ( osgEarth::XmlElement *  element,
const std::string &  text 
)

Modified the first text node found under element.

Parameters
elementThe parent element of the textn node.
std::set<std::string> makVrv::DtOsgEarthFile::getUniqueChildKeysOfConfig ( const osgEarth::Config &  config) const

Gets a list of unique keys of the children under the config.

std::set<std::string> makVrv::DtOsgEarthFile::getUniqueChildKeysOfElement ( const osgEarth::Util::XmlElement *  element) const

Gets a list of unique keys of the children under the element.

std::string makVrv::DtOsgEarthFile::findNameOfConfig ( const osgEarth::Config &  config)

Finds the name attribute of the config.

Parameters
configThe config to find.
virtual bool makVrv::DtOsgEarthFile::checkExternalReference ( const std::string &  text)
virtual

Check if the string contains any external files.

virtual bool makVrv::DtOsgEarthFile::findUrl ( const std::string &  text,
std::string &  url 
)
virtual

Finds the url contained in the string.

Parameters
textThe string to search for url.
virtual void makVrv::DtOsgEarthFile::parseExternalReference ( const std::string &  text)
virtual

Parses the external include file from a string.

DtUnicode makVrv::DtOsgEarthFile::fileName ( ) const

Gets the file name of this earth file.

const ExternalFileList& makVrv::DtOsgEarthFile::externalFileList ( ) const

Gets the list of external files in this earth file.

virtual const DtOsgEarthFile* makVrv::DtOsgEarthFile::findOsgEarthFileByFileName ( const DtUnicode fileName) const
virtual

Finds the earth file with the file name.

std::vector< std::pair<std::string, std::string> > makVrv::DtOsgEarthFile::getXmlElementNodes ( ) const

Finds all the elements in this earth file.

Returns
A list of pair<element type, element name> representing the elements.
virtual XmlElementKey makVrv::DtOsgEarthFile::getXmlElementKey ( const osgEarth::XmlElement *  parent,
const osgEarth::XmlElement *  element 
) const
virtual

Gets the key of the element.

Parameters
parentThe parent of element.
elementThe element.
virtual osgEarth::XmlElement* makVrv::DtOsgEarthFile::root ( )
virtual

Gets the root node of the earth file.

virtual bool makVrv::DtOsgEarthFile::findXmlElementKey ( const std::string &  type,
const std::string &  name,
DtOsgEarthFile::XmlElementKey key 
) const
virtual

Checks if the file contains the element with the given type and name.

Parameters
typeThe type of the element.
nameThe name of the element.
Returns
Return true if the element is found.
virtual bool makVrv::DtOsgEarthFile::findXmlElementKey ( osgEarth::Util::XmlElement *  element,
const std::string &  type,
const std::string &  name,
DtOsgEarthFile::XmlElementKey key,
int  currentDepth = 0,
int  maxDepth = 2 
) const
virtual

Recursively finds the element with the given type and name. Constrain max recursive depth to save performance.

Parameters
elementThe root element to start searching.
typeThe type of the element.
nameThe name of the element.
currentDepthThe current depth of the recursion.
maxDepthThe max depth of the recursion, recurstion stops at this level.
Returns
Return true if the element is found.
virtual void makVrv::DtOsgEarthFile::setFileName ( const DtUnicode fileName)
virtual

Sets the directory of the file.

virtual void makVrv::DtOsgEarthFile::save ( )
virtual

Saves the content of this earth file.

virtual void makVrv::DtOsgEarthFile::save ( const DtUnicode fileName)
virtual

Saves the content of this earth file to the directory specified.

virtual std::string makVrv::DtOsgEarthFile::getXmlElementType ( const osgEarth::Util::XmlElement *  element) const
virtual

Gets the type of the element.

virtual int makVrv::DtOsgEarthFile::getXmlElementIndex ( const osgEarth::Util::XmlElement *  parent,
const osgEarth::Util::XmlElement *  element 
) const
virtual

Gets the index of the element under its parent.

Parameters
parentThe parent element.
elementThe element.
Returns
Index is the index of the same type child under the parent. For example, "composite" image layer driver may contains multipe image layers, the index is the sequence as they appear in the earth file.
virtual std::string makVrv::DtOsgEarthFile::getXmlElementName ( const osgEarth::Util::XmlElement *  element) const
virtual

Gets the name attribute of the element if any.

DtOsgEarthFile* makVrv::DtOsgEarthFile::findOsgEarthFile ( const std::string &  type,
const std::string &  name 
)

Finds the earth file that contains element with the given type and name.

virtual void makVrv::DtOsgEarthFile::processXmlNode ( const osgEarth::Util::XmlNode *  node)
protectedvirtual

Processes the XmlNode, used to find the external reference file.

virtual void makVrv::DtOsgEarthFile::processXmlElement ( const osgEarth::Util::XmlElement *  element)
protectedvirtual

Processes the XmlElement, used to find the external reference file.

virtual void makVrv::DtOsgEarthFile::processXmlText ( const osgEarth::Util::XmlText *  text)
protectedvirtual

Processes the XmlText, used to find the external reference file.

void makVrv::DtOsgEarthFile::addOrModifyConfig ( size_t  startPos,
osgEarth::XmlElement *  element,
const osgEarth::Config &  config,
int  index 
)
protected

Adds or modifies an element with the given config.

Parameters
startPosThe start string location to search for the element in the earth file. Usually the start position of the parent config.
elementThe element to modify.
configThe config used to update the element.
indexThe index of the config.
void makVrv::DtOsgEarthFile::addOrModifySimpleConfig ( size_t  startPos,
osgEarth::Util::XmlElement *  element,
const std::string &  key,
const std::string &  value,
int  index 
)
protected

Adds or modifies an element with a simple config(config with no children).

Parameters
startPosThe start string location to search for the element in the earth file. Usually the start position of the parent config.
elementThe element to modify.
keyThe key of the config.
valueThe value of the config.
indexThe index of the config.
void makVrv::DtOsgEarthFile::addOrModifyNonSimpleConfig ( size_t  startPos,
osgEarth::Util::XmlElement *  element,
const osgEarth::Config &  config,
int  index 
)
protected

Adds or modifies an element with a non simple config(at least one child).

Parameters
startPosThe start string location to search for the element in the earth file. Usually the start position of the parent config.
elementThe element to modify.
configThe config used to update the element.
indexThe index of the config.
virtual bool makVrv::DtOsgEarthFile::modifyXmlAttribute ( size_t  startPos,
osgEarth::Util::XmlElement *  element,
const std::string &  key,
const std::string &  newValue 
)
protectedvirtual

Modifies the attribute of an element.

Parameters
startPosThe start string location to search for the element in the earth file. Usually the start position of the parent config.
elementThe element whose attribute to modify.
keyThe key of the attribute.
newValueThe new value of the attribute.
virtual bool makVrv::DtOsgEarthFile::removeXmlAttribute ( size_t  startPos,
osgEarth::Util::XmlElement *  element,
const std::string &  key 
)
protectedvirtual

Removes the attribute of an element.

Parameters
startPosThe start string location to search for the element in the earth file. Usually the start position of the parent config.
elementThe element whose attribute to remove.
keyThe key of the attribute.
virtual bool makVrv::DtOsgEarthFile::removeXmlElement ( size_t  startPos,
osgEarth::Util::XmlElement *  parent,
const std::string &  key,
int  index 
)
protectedvirtual

Removes the child element of an element.

Parameters
startPosThe start string location to search for the element in the earth file. Usually the start position of the parent config.
elementThe element whose child element to remove.
keyThe key of the child element.
indexThe index of the child element.
virtual bool makVrv::DtOsgEarthFile::moveXmlElement ( size_t  startPos,
osgEarth::Util::XmlElement *  parent,
const std::string &  key,
int  index,
int  newIndex 
)
protectedvirtual

Moves the child element of an element to a new position.

Parameters
startPosThe start string location to search for the element in the earth file. Usually the start position of the parent config.
elementThe element whose child element to move.
keyThe key of the child element.
indexThe index of the child element.
indexThe new index of the child element.
virtual bool makVrv::DtOsgEarthFile::modifyXmlSimpleElement ( size_t  startPos,
osgEarth::Util::XmlElement *  element,
const std::string &  key,
const std::string &  newValue,
int  index 
)
protectedvirtual

Modified the child simple element(config with no children) of an element.

Parameters
startPosThe start string location to search for the element in the earth file. Usually the start position of the parent config.
elementThe element whose child element to modify.
keyThe key of the child element.
newValueThe new value of the simple element.
indexThe index of the child element.
virtual bool makVrv::DtOsgEarthFile::addXmlAttribute ( size_t  startPos,
osgEarth::Util::XmlElement *  element,
const std::string &  key,
const std::string &  newValue 
)
protectedvirtual

Addes an attribute to the element.

Parameters
startPosThe start string location to search for the element in the earth file. Usually the start position of the parent config.
elementThe element to add attribute.
keyThe key of the attribute.
newValueThe new value of the simple element.
virtual bool makVrv::DtOsgEarthFile::addXmlSimpleElement ( size_t  startPos,
osgEarth::Util::XmlElement *  element,
const std::string &  key,
const std::string &  newValue,
int  index 
)
protectedvirtual

Addes a simple config(element with no children) to the element.

Parameters
startPosThe start string location to search for the element in the earth file. Usually the start position of the parent config.
elementThe element to add a child simple config(config with no children).
keyThe key of the attribute.
newValueThe new value of the simple element.
virtual bool makVrv::DtOsgEarthFile::addXmlNonSimpleElement ( size_t  startPos,
osgEarth::Util::XmlElement *  element,
const osgEarth::Config &  config,
int  index 
)
protectedvirtual

Adds a non simple config(element has at least 1 child) to the element.

Parameters
startPosThe start string location to search for the element in the earth file. Usually the start position of the parent config.
elementThe element to add a non simple config(config has at least 1 child).
keyThe key of the attribute.
indexThe index of the child element.
virtual bool makVrv::DtOsgEarthFile::addXmlTextNode ( size_t  startPos,
osgEarth::Util::XmlElement *  element,
const std::string &  text 
)
protectedvirtual

Adds a text node to the element.

Parameters
startPosThe start string location to search for the element in the earth file. Usually the start position of the parent config.
elementThe element to add a non simple config(config has at least 1 child).
textThe content of the text node.
virtual std::string makVrv::DtOsgEarthFile::getConfigString ( const osgEarth::Config &  config)
protectedvirtual

Serialize the config to a string.

Parameters
configThe config to serialize.
virtual std::string makVrv::DtOsgEarthFile::getXmlAttributeString ( const std::string &  key,
const std::string &  value 
)
protectedvirtual

Serialize the attribute to a string.

Parameters
keyThe key of the attribute.
valueThe value of the attribute.
virtual std::string makVrv::DtOsgEarthFile::getSimpleConfigString ( const std::string &  key,
const std::string &  value 
)
protectedvirtual

Serialize the simple config(config with no children) to a string.

Parameters
keyThe key of the config.
valueThe value of the config.
virtual void makVrv::DtOsgEarthFile::updateAttribute ( osgEarth::Util::XmlElement *  element,
const std::string &  key,
const std::string &  newValue 
)
protectedvirtual

Updates the attribute of a xml element.

Parameters
elementThe parent element.
keyThe key of the attribute.
newValueThe new value of the attribute.
virtual void makVrv::DtOsgEarthFile::removeAttribute ( osgEarth::Util::XmlElement *  element,
const std::string &  key 
)
protectedvirtual

Removes the attribute of a xml element.

Parameters
elementThe parent element.
keyThe key of the attribute.
newValueThe new value of the attribute.
virtual void makVrv::DtOsgEarthFile::removeElement ( osgEarth::Util::XmlElement *  element,
const std::string &  key,
int  index 
)
protectedvirtual

Removes an element with the given key and index.

Parameters
elementThe parent element.
keyThe key of the element.
indexThe index of the element.
virtual void makVrv::DtOsgEarthFile::updateSimpleElement ( osgEarth::Util::XmlElement *  element,
const std::string &  key,
const std::string &  newValue,
int  index 
)
protectedvirtual

Updates the simple element(element with no children).

Parameters
elementThe parent element.
keyThe key of the element.
newValueThe new value of the element.
indexThe index of the element.
virtual void makVrv::DtOsgEarthFile::addAttribute ( osgEarth::Util::XmlElement *  element,
const std::string &  key,
const std::string &  value 
)
protectedvirtual

Adds an attribute to the element.

Parameters
elementThe element to add attribute.
keyThe key of the attribute.
valueThe value of the attribute.
virtual void makVrv::DtOsgEarthFile::addSimpleElement ( osgEarth::Util::XmlElement *  element,
const std::string &  key,
const std::string &  newValue 
)
protectedvirtual

Adds a simple element(element with no children) to the element.

Parameters
elementThe parent element.
keyThe key of the simple element.
valueThe value of the simple element.
virtual void makVrv::DtOsgEarthFile::addNonSimpleElement ( osgEarth::Util::XmlElement *  element,
osgEarth::Util::XmlElement *  child 
)
protectedvirtual

Adds a non simple element to the element.

Parameters
elementThe parent element.
childThe element to be added.
valueThe value of the simple element.
virtual void makVrv::DtOsgEarthFile::addTextNode ( osgEarth::Util::XmlElement *  element,
const std::string &  text 
)
protectedvirtual

Adds a text node to the element.

Parameters
elementThe parent element.
textThe content of the text node.
virtual bool makVrv::DtOsgEarthFile::hasAttribute ( const osgEarth::Util::XmlElement *  element,
const std::string &  key 
)
protectedvirtual

Checks if an element has an attribute.

Parameters
keyThe key of the attribute.
Returns
return true if the element has the attribute.
virtual osgEarth::XmlElement* makVrv::DtOsgEarthFile::findSubElement ( const osgEarth::Util::XmlElement *  element,
const std::string &  key,
int  index 
)
protectedvirtual

Finds the sub element with the given key and index.

Parameters
elementThe parent element.
keyThe key of the sub element.
indexThe index of the sub element.
Returns
Return NULL if not found.
virtual int makVrv::DtOsgEarthFile::findSubElementMaximumIndex ( const osgEarth::XmlElement *  element,
const std::string &  key 
)
protectedvirtual

Finds the maximum index of a sub element.

Parameters
elementThe parent element.
keyThe key of the sub element.
virtual bool makVrv::DtOsgEarthFile::hasChild ( const osgEarth::Config &  config,
const std::string &  key,
int  index 
)
protectedvirtual

Checks if a config has child with the given key and index.

Parameters
configThe config.
keyThe key of the child.
indexThe index of the child.
virtual size_t makVrv::DtOsgEarthFile::findStartPos ( size_t  startPos,
const osgEarth::Util::XmlElement *  element,
const XmlElementKey key 
)
protectedvirtual

Finds the start position of the element.

Parameters
startPosThe start string location of the parent element.
elementThe element to find.
keyThe key of the element.
virtual std::string makVrv::DtOsgEarthFile::getElementStartPattern ( const std::string &  key) const
protectedvirtual

Gets ths start string pattern of the element, ""<key" etc.

virtual std::string makVrv::DtOsgEarthFile::getElementEndPattern ( const osgEarth::Util::XmlElement *  element) const
protectedvirtual

Gets ths end string pattern of the element.

virtual std::string makVrv::DtOsgEarthFile::getElementEndPattern ( const std::string &  key) const
protectedvirtual

Gets ths end string pattern of the element.

virtual std::string makVrv::DtOsgEarthFile::getAttributeStartPattern ( const std::string &  key) const
protectedvirtual

Gets the start string pattern of the attribute.

virtual bool makVrv::DtOsgEarthFile::getAttributeValue ( size_t  startPos,
size_t  endPos,
const std::string &  key,
std::string &  value 
) const
protectedvirtual

Gets the value of an attribute.

Parameters
startPosThe start string location to search for the attribute in the earth file. Usually the start position of the parent config.
endPosThe end string location to search for the attribute in the earth file.
keyThe key of the attribute.
valueThe value of the attribute.
virtual bool makVrv::DtOsgEarthFile::getElementValue ( size_t  startPos,
size_t  endPos,
const std::string &  key,
std::string &  value 
) const
protectedvirtual

Gets the value of an element.

Parameters
startPosThe start string location to search for the attribute in the earth file. Usually the start position of the parent config.
endPosThe end string location to search for the attribute in the earth file.
keyThe key of the element.
valueThe value of the element.
std::string makVrv::DtOsgEarthFile::formatValue ( const std::string &  value) const
protected

Formalizes the value.

Parameters
valueThe value to formalize.
virtual bool makVrv::DtOsgEarthFile::isReservedKeyWord ( const std::string &  key) const
protectedvirtual

Checks if the key is reserved, reserved keys are ignored.

Parameters
keyThe key of the config.
virtual bool makVrv::DtOsgEarthFile::ifElementHasChild ( osgEarth::Util::XmlElement *  root,
const std::string &  type,
const std::string &  name,
int  currentDepth = 0,
int  maxDepth = 2 
)
protectedvirtual

Recursively checks if the child with the given type and name exists. Constrain max recursive depth to save performance.

Parameters
rootThe root element to start searching.
typeThe type of the element.
nameThe name of the element.
currentDepthThe current depth of the recursion.
maxDepthThe max depth of the recursion, recurstion stops at this level.
Returns
Return true if the element has the child.
DtOsgEarthFile& makVrv::DtOsgEarthFile::operator= ( const DtOsgEarthFile )
private

Assignment Operator not implemented – Copy not allowed.

Member Data Documentation

osgEarth::Util::XmlElement* makVrv::DtOsgEarthFile::myRoot
protected
ExternalFileList makVrv::DtOsgEarthFile::myExternalFileList
protected
std::string makVrv::DtOsgEarthFile::myModifiedText
protected
std::string makVrv::DtOsgEarthFile::myOriginalText
protected
DtUnicode makVrv::DtOsgEarthFile::myFileName
protected

The documentation for this class was generated from the following file:

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)