OpenSim  OpenSim 3.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
OpenSim::ModelVisualizer Class Reference

This class manages runtime visualization of a Model that is being manipulated through the OpenSim API. More...

#include <ModelVisualizer.h>

Public Member Functions

Drawing methods

Currently there is just a single method for generating a frame.

void show (const SimTK::State &state) const
 Evaluate the geometry needed to visualize the given state and use it to generate a new image in the Visualizer window. More...
 
Access to SimTK::Visualizer features

These methods provide access to lower-level SimTK::Visualizer objects that are used in the implementation of this ModelVisualizer.

const
SimTK::Visualizer::InputSilo & 
getInputSilo () const
 If you want to poll for user input, you'll need access to the SimTK::Visualizer::InputSilo maintained here. More...
 
SimTK::Visualizer::InputSilo & updInputSilo ()
 Get writable access to the InputSilo so you can remove user input from the queues. More...
 
const SimTK::Visualizer & getSimbodyVisualizer () const
 If you want access to the underlying Simbody SimTK::Visualizer, you can get a const reference here. More...
 
SimTK::Visualizer & updSimbodyVisualizer ()
 If you want writable access to the underlying Simbody SimTK::Visualizer, you can get a non-const reference here, provided that you have non-const access to the ModelVisualizer. More...
 
Miscellaneous utilities

Most users will not need to use these methods.

SimTK::DefaultGeometrygetGeometryDecorationGenerator ()
 Return a pointer to the DefaultGeometry decoration generator used by this ModelVisualizer. More...
 
const ModelgetModel () const
 Return a const reference to the Model for which this ModelVisualizer was constructed. More...
 
ModelupdModel ()
 Return a writable reference to the Model for which this ModelVisualizer was constructed. More...
 
bool findGeometryFile (const std::string &geoFile, bool &isAbsolute, SimTK::Array_< std::string > &attempts) const
 Given the name of a geometry file, this method will attempt to find it in a series of locations using the same algorithm as is done internally by the ModelVisualizer. More...
 

Friends

class Model
 

Detailed Description

This class manages runtime visualization of a Model that is being manipulated through the OpenSim API.

You should not allocate one of these yourself; instead, call the Model's setUseVisualizer() method and let the Model allocate one for itself. You may find the defaults to be adequate, but you can also get access to the ModelVisualizer if you need it by calling the Model's getVisualizer() method.

The ModelVisualizer consults the Model's ModelDisplayHints object for instructions on what to display.

Author
Michael Sherman
See Also
ModelDisplayHints, Model

Member Function Documentation

bool OpenSim::ModelVisualizer::findGeometryFile ( const std::string &  geoFile,
bool &  isAbsolute,
SimTK::Array_< std::string > &  attempts 
) const

Given the name of a geometry file, this method will attempt to find it in a series of locations using the same algorithm as is done internally by the ModelVisualizer.

Parameters
[in]geoFileName of file to look for; can be absolute or relative path name or just a file name and the extension must be supplied.
[out]isAbsoluteThis output parameter is set to true on return if the supplied geoFile was an absolute path name; in that case no searching was done.
[out]attemptsOn return, this is a list of the absolute path names that were tried. If geoFile was found, attempts.back() (the last entry) is the absolute path name of geoFile.
Returns
true if geoFile was located and is readable.

The search rule is as follows:

  • If geoFile is an absolute pathname no search is done.
  • Otherwise, define modelDir as the directory from which the current Model file was read in, if any, otherwise the current directory.
  • Try modelDir/geoFile, then modelDir/Geometry/geoFile.
  • Finally, try installDir/geoFile where installDir is taken from the OPENSIM_HOME environment variable if it exists, otherwise a default installation directory.

No attempt is made to validate the contents of the file or whether it has a supported extension; we're just looking for a file of the given name that exists and is readable.

SimTK::DefaultGeometry* OpenSim::ModelVisualizer::getGeometryDecorationGenerator ( )
inline

Return a pointer to the DefaultGeometry decoration generator used by this ModelVisualizer.

const SimTK::Visualizer::InputSilo& OpenSim::ModelVisualizer::getInputSilo ( ) const
inline

If you want to poll for user input, you'll need access to the SimTK::Visualizer::InputSilo maintained here.

Writable access is required to remove user input from the queues.

const Model& OpenSim::ModelVisualizer::getModel ( ) const
inline

Return a const reference to the Model for which this ModelVisualizer was constructed.

const SimTK::Visualizer& OpenSim::ModelVisualizer::getSimbodyVisualizer ( ) const
inline

If you want access to the underlying Simbody SimTK::Visualizer, you can get a const reference here.

void OpenSim::ModelVisualizer::show ( const SimTK::State &  state) const

Evaluate the geometry needed to visualize the given state and use it to generate a new image in the Visualizer window.

SimTK::Visualizer::InputSilo& OpenSim::ModelVisualizer::updInputSilo ( )
inline

Get writable access to the InputSilo so you can remove user input from the queues.

Model& OpenSim::ModelVisualizer::updModel ( )
inline

Return a writable reference to the Model for which this ModelVisualizer was constructed.

SimTK::Visualizer& OpenSim::ModelVisualizer::updSimbodyVisualizer ( )
inline

If you want writable access to the underlying Simbody SimTK::Visualizer, you can get a non-const reference here, provided that you have non-const access to the ModelVisualizer.

Friends And Related Function Documentation

friend class Model
friend

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