/opt/ros/diamondback/stacks/graspit_simulator/graspit/graspit_source/src/mytools.cpp File Reference

Implements the load_pixmap() function. Other misc. functions could go here too. More...

#include <Q3MimeSourceFactory>
#include <qmime.h>
#include <q3dragobject.h>
#include <QPixmap>
#include "debug.h"
#include "mytools.h"
#include "tinyxml.h"
#include "matvec3D.h"
#include "matvecIO.h"
Include dependency graph for mytools.cpp:

Go to the source code of this file.

Functions

int countXmlElements (const TiXmlElement *root, QString defStr)
 Returns the number of chilren in the XML node root of the type specified in defStr.
std::list< const TiXmlElement * > findAllXmlElements (const TiXmlElement *root, QString defStr)
 Returns the children of the XML node root of the type specified in defStr.
int findString (QTextStream *stream, QString target)
 Finds a keyword on a line in a stream and positions the stream after it.
const TiXmlElementfindXmlElement (const TiXmlElement *root, QString defStr)
 Returns the child of the XML node root of the type specified in defStr.
bool getDouble (const TiXmlElement *root, QString defStr, double &val)
 Returns the double value in the child f the XML node root of the type specified in defStr.
bool getInt (const TiXmlElement *root, QString defStr, int &val)
 Returns the int value in the child f the XML node root of the type specified in defStr.
bool getPosition (const TiXmlElement *root, vec3 &pos)
 Returns the position vector specified by the XML node root.
bool getTransform (const TiXmlElement *root, transf &totalTran)
 Returns the total transformation specified by the XML node root.
QPixmap load_pixmap (const QString &name)
int nextCommentLine (QTextStream *stream, QString *line)
 Finds the next line that is an Inventor comment (starts with a #).
int nextValidLine (QTextStream *stream, QString *line)
 Finds the next line in a stream that is not blank or a comment.
QString relativePath (QString absolutePath, QString relativeToDir)
 Returns the path absolutePath made relative to the path relativeTo.

Detailed Description

Implements the load_pixmap() function. Other misc. functions could go here too.

Definition in file mytools.cpp.


Function Documentation

int countXmlElements ( const TiXmlElement root,
QString  defStr 
)

Returns the number of chilren in the XML node root of the type specified in defStr.

Given a pointer to an XML node root, this will cycle through all the children and count how many children whose definition string matches defStr. If no such child is found, returns 0.

Definition at line 188 of file mytools.cpp.

std::list<const TiXmlElement*> findAllXmlElements ( const TiXmlElement root,
QString  defStr 
)

Returns the children of the XML node root of the type specified in defStr.

Given a pointer to an XML node root, this will cycle through all the children and return all children whose definition string matches defStr. If no such child is found, returns NULL.

Definition at line 169 of file mytools.cpp.

int findString ( QTextStream *  stream,
QString  target 
)

Finds a keyword on a line in a stream and positions the stream after it.

Definition at line 77 of file mytools.cpp.

const TiXmlElement* findXmlElement ( const TiXmlElement root,
QString  defStr 
)

Returns the child of the XML node root of the type specified in defStr.

Given a pointer to an XML node root, this will cycle through all the children and return the first whose definition string matches defStr. If no such child is found, returns NULL.

Definition at line 152 of file mytools.cpp.

bool getDouble ( const TiXmlElement root,
QString  defStr,
double &  val 
)

Returns the double value in the child f the XML node root of the type specified in defStr.

Given a pointer to an XML node root, this will cycle through all the children and return true if such child whose definition string matches defStr exists. If such child exists, this will set val to the double value in the first child it found. If no such child is found, returns false.

Definition at line 206 of file mytools.cpp.

bool getInt ( const TiXmlElement root,
QString  defStr,
int &  val 
)

Returns the int value in the child f the XML node root of the type specified in defStr.

Given a pointer to an XML node root, this will cycle through all the children and return true if such child whose definition string matches defStr exists. If such child exists, this will set val to the int value in the first child it found. If no such child is found, returns false.

Definition at line 227 of file mytools.cpp.

bool getPosition ( const TiXmlElement root,
vec3 pos 
)

Returns the position vector specified by the XML node root.

Definition at line 239 of file mytools.cpp.

bool getTransform ( const TiXmlElement root,
transf totalTran 
)

Returns the total transformation specified by the XML node root.

Definition at line 271 of file mytools.cpp.

QPixmap load_pixmap ( const QString &  name  ) 

Read, decode, and return the pixmap of the given name from the QMimeSourceFactory.

Definition at line 45 of file mytools.cpp.

int nextCommentLine ( QTextStream *  stream,
QString *  line 
)

Finds the next line that is an Inventor comment (starts with a #).

Definition at line 66 of file mytools.cpp.

int nextValidLine ( QTextStream *  stream,
QString *  line 
)

Finds the next line in a stream that is not blank or a comment.

Definition at line 55 of file mytools.cpp.

QString relativePath ( QString  absolutePath,
QString  relativeToDir 
)

Returns the path absolutePath made relative to the path relativeTo.

If the two paths have no common root, the returned path is identical to absolutePath. Code adapted from; http://mrpmorris.blogspot.com/2007/05/convert-absolute-path-to-relative-path.html

Definition at line 94 of file mytools.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


graspit
Author(s):
autogenerated on Wed Jan 25 10:59:49 2012