Added the usage report to the examples for when no arguments are passed

to the examples.
This commit is contained in:
Robert Osfield 2003-04-06 21:32:44 +00:00
parent 908164d58a
commit 49a28660dc
40 changed files with 166 additions and 72 deletions

View File

@ -123,5 +123,7 @@ EXAMPLE_DIRS = \
osgvertexprogram\ osgvertexprogram\
osgviewer\ osgviewer\
# osgjigsaw\
# comment in you want to compile the cluster demo. # comment in you want to compile the cluster demo.
EXAMPLE_DIRS += osgcluster EXAMPLE_DIRS += osgcluster

View File

@ -193,7 +193,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// initialize the viewer. // initialize the viewer.
@ -221,7 +221,7 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
// load the nodes from the commandline arguments. // load the nodes from the commandline arguments.
osg::Node* model = createModel(); osg::Node* model = createModel();
if (!model) if (!model)

View File

@ -168,7 +168,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// initialize the viewer. // initialize the viewer.
@ -196,7 +196,7 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
// create a model from the images. // create a model from the images.
osg::Node* rootNode = createModel(); osg::Node* rootNode = createModel();

View File

@ -132,7 +132,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// initialize the viewer. // initialize the viewer.
@ -160,6 +160,12 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
// load the nodes from the commandline arguments. // load the nodes from the commandline arguments.
osg::Node* rootnode = osgDB::readNodeFiles(arguments); osg::Node* rootnode = osgDB::readNodeFiles(arguments);

View File

@ -131,7 +131,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// initialize the viewer. // initialize the viewer.
@ -159,6 +159,12 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
// load the nodes from the commandline arguments. // load the nodes from the commandline arguments.
osg::Node* loadedModel = osgDB::readNodeFiles(arguments); osg::Node* loadedModel = osgDB::readNodeFiles(arguments);

View File

@ -99,7 +99,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
arguments.getApplicationUsage()->addCommandLineOption("-m","Set viewer to MASTER mode, sending view via packets."); arguments.getApplicationUsage()->addCommandLineOption("-m","Set viewer to MASTER mode, sending view via packets.");
arguments.getApplicationUsage()->addCommandLineOption("-s","Set viewer to SLAVE mode, reciving view via packets."); arguments.getApplicationUsage()->addCommandLineOption("-s","Set viewer to SLAVE mode, reciving view via packets.");
@ -149,6 +149,12 @@ int main( int argc, char **argv )
return 1; return 1;
} }
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
// load model. // load model.
osg::ref_ptr<osg::Node> rootnode = osgDB::readNodeFiles(arguments); osg::ref_ptr<osg::Node> rootnode = osgDB::readNodeFiles(arguments);

View File

@ -133,7 +133,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// initialize the viewer. // initialize the viewer.
@ -155,6 +155,12 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
// load the nodes from the commandline arguments. // load the nodes from the commandline arguments.
osg::Node* rootnode = osgDB::readNodeFiles(arguments); osg::Node* rootnode = osgDB::readNodeFiles(arguments);

View File

@ -74,7 +74,7 @@ int main(int argc, char *argv[])
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer. // construct the viewer.
@ -102,6 +102,12 @@ int main(int argc, char *argv[])
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
// load the nodes from the commandline arguments. // load the nodes from the commandline arguments.
osg::Node* rootnode = osgDB::readNodeFiles(arguments); osg::Node* rootnode = osgDB::readNodeFiles(arguments);

View File

@ -89,7 +89,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
arguments.getApplicationUsage()->addCommandLineOption("--fov <float>","Set the Field of View"); arguments.getApplicationUsage()->addCommandLineOption("--fov <float>","Set the Field of View");
@ -121,6 +121,12 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
// load the nodes from the commandline arguments. // load the nodes from the commandline arguments.

View File

@ -646,7 +646,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer. // construct the viewer.
@ -674,7 +674,7 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
// create the model // create the model
osg::Group* root = new osg::Group; osg::Group* root = new osg::Group;

View File

@ -108,7 +108,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer. // construct the viewer.
@ -139,7 +139,7 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
// load the nodes from the commandline arguments. // load the nodes from the commandline arguments.
osg::Node* rootnode = osgDB::readNodeFiles(arguments); osg::Node* rootnode = osgDB::readNodeFiles(arguments);
if (!rootnode) rootnode = createModel(); if (!rootnode) rootnode = createModel();

View File

@ -117,7 +117,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] [filename] ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] [filename] ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
@ -146,8 +146,7 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
// read the scene from the list of file specified commandline args. // read the scene from the list of file specified commandline args.
osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments); osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments);

View File

@ -219,7 +219,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer. // construct the viewer.
@ -253,7 +253,6 @@ int main( int argc, char **argv )
} }
// load the nodes from the commandline arguments. // load the nodes from the commandline arguments.
osg::Node* model = osgDB::readNodeFiles(arguments); osg::Node* model = osgDB::readNodeFiles(arguments);
if (model) if (model)

View File

@ -381,7 +381,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
arguments.getApplicationUsage()->addCommandLineOption("-c","Mannually create occluders"); arguments.getApplicationUsage()->addCommandLineOption("-c","Mannually create occluders");
@ -416,7 +416,6 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
// attach the scene graph. // attach the scene graph.
viewer.setSceneData( keyboardModel->getScene() ); viewer.setSceneData( keyboardModel->getScene() );

View File

@ -303,7 +303,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer. // construct the viewer.
@ -332,7 +332,6 @@ int main( int argc, char **argv )
return 1; return 1;
} }
// load the nodes from the commandline arguments. // load the nodes from the commandline arguments.
osg::Node* loadedModel = osgDB::readNodeFiles(arguments); osg::Node* loadedModel = osgDB::readNodeFiles(arguments);

View File

@ -11,10 +11,6 @@
#include <osgDB/Registry> #include <osgDB/Registry>
#include <osgDB/ReadFile> #include <osgDB/ReadFile>
#include <osgGA/TrackballManipulator>
#include <osgGA/FlightManipulator>
#include <osgGA/DriveManipulator>
#include <osgUtil/Optimizer> #include <osgUtil/Optimizer>
#include <osgSim/LightPointNode> #include <osgSim/LightPointNode>
@ -119,7 +115,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer. // construct the viewer.
@ -147,8 +143,7 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
osg::Group* rootnode = new osg::Group; osg::Group* rootnode = new osg::Group;
// load the nodes from the commandline arguments. // load the nodes from the commandline arguments.

View File

@ -407,7 +407,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
arguments.getApplicationUsage()->addCommandLineOption("ps","Render the Professional Services logo"); arguments.getApplicationUsage()->addCommandLineOption("ps","Render the Professional Services logo");
@ -438,7 +438,7 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
osg::Node* node = createLogo(); osg::Node* node = createLogo();
// add model to viewer. // add model to viewer.

View File

@ -22,7 +22,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer. // construct the viewer.
@ -50,6 +50,12 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
// load the nodes from the commandline arguments. // load the nodes from the commandline arguments.
osg::Node* rootnode = osgDB::readNodeFiles(arguments); osg::Node* rootnode = osgDB::readNodeFiles(arguments);

View File

@ -283,7 +283,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
arguments.getApplicationUsage()->addCommandLineOption("-c","Mannually create occluders"); arguments.getApplicationUsage()->addCommandLineOption("-c","Mannually create occluders");

View File

@ -348,7 +348,7 @@ int main(int argc, char **argv)
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] image_file_left_eye image_file_right_eye"); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] image_file_left_eye image_file_right_eye");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
@ -377,7 +377,7 @@ int main(int argc, char **argv)
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
osg::Group *root = new osg::Group; osg::Group *root = new osg::Group;
build_world(root); build_world(root);

View File

@ -585,7 +585,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
@ -615,6 +615,12 @@ int main( int argc, char **argv )
return 1; return 1;
} }
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
// load the nodes from the commandline arguments. // load the nodes from the commandline arguments.
osg::Node* loadedModel = osgDB::readNodeFiles(arguments); osg::Node* loadedModel = osgDB::readNodeFiles(arguments);

View File

@ -369,7 +369,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer. // construct the viewer.
@ -397,6 +397,12 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
// load the nodes from the commandline arguments. // load the nodes from the commandline arguments.

View File

@ -325,7 +325,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
@ -354,6 +354,12 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
// read the scene from the list of file specified commandline args. // read the scene from the list of file specified commandline args.
@ -362,7 +368,7 @@ int main( int argc, char **argv )
// if no model has been successfully loaded report failure. // if no model has been successfully loaded report failure.
if (!loadedModel) if (!loadedModel)
{ {
std::cout << arguments.getProgramName() <<": No data loaded" << std::endl; std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
return 1; return 1;
} }

View File

@ -20,7 +20,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer. // construct the viewer.
@ -48,6 +48,12 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
// load the nodes from the commandline arguments. // load the nodes from the commandline arguments.
osg::Node* loadedModel = osgDB::readNodeFiles(arguments); osg::Node* loadedModel = osgDB::readNodeFiles(arguments);

View File

@ -96,7 +96,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer. // construct the viewer.
@ -125,6 +125,12 @@ int main( int argc, char **argv )
return 1; return 1;
} }
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
// assumes any remaining parameters are models // assumes any remaining parameters are models
std::vector<osg::Node*> model; std::vector<osg::Node*> model;
for (int i = 1; i < arguments.argc(); i++) for (int i = 1; i < arguments.argc(); i++)

View File

@ -171,7 +171,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer. // construct the viewer.
@ -199,6 +199,12 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
// load the nodes from the commandline arguments. // load the nodes from the commandline arguments.
osg::Node* model = createModel(); osg::Node* model = createModel();

View File

@ -86,7 +86,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer. // construct the viewer.

View File

@ -395,7 +395,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] image_file_left_eye image_file_right_eye"); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] image_file_left_eye image_file_right_eye");
arguments.getApplicationUsage()->addCommandLineOption("-d <float>","Time delay in sceonds between the display of successive image pairs when in auto advance mode."); arguments.getApplicationUsage()->addCommandLineOption("-d <float>","Time delay in sceonds between the display of successive image pairs when in auto advance mode.");
arguments.getApplicationUsage()->addCommandLineOption("-a","Enter auto advance of image pairs on start up."); arguments.getApplicationUsage()->addCommandLineOption("-a","Enter auto advance of image pairs on start up.");
arguments.getApplicationUsage()->addCommandLineOption("-x <float>","Horizontal offset of left and right images."); arguments.getApplicationUsage()->addCommandLineOption("-x <float>","Horizontal offset of left and right images.");
@ -446,6 +446,12 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
// extract the filenames from the arguments list. // extract the filenames from the arguments list.
FileList fileList; FileList fileList;

View File

@ -319,7 +319,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer. // construct the viewer.

View File

@ -430,7 +430,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] [filename] ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] [filename] ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
@ -459,7 +459,7 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
// read the scene from the list of file specified commandline args. // read the scene from the list of file specified commandline args.
osg::ref_ptr<osg::Node> rootNode = osgDB::readNodeFiles(arguments); osg::ref_ptr<osg::Node> rootNode = osgDB::readNodeFiles(arguments);

View File

@ -144,7 +144,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer. // construct the viewer.
@ -172,6 +172,12 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
// load the images specified on command line // load the images specified on command line
osg::Node* loadedModel = osgDB::readNodeFiles(arguments); osg::Node* loadedModel = osgDB::readNodeFiles(arguments);

View File

@ -687,7 +687,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer. // construct the viewer.

View File

@ -218,7 +218,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
@ -247,7 +247,7 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
// create a model from the images. // create a model from the images.
osg::Node* rootNode = createModel(); osg::Node* rootNode = createModel();

View File

@ -7,7 +7,7 @@ int main( int argc, char** argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options]"); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options]");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
arguments.getApplicationUsage()->addCommandLineOption("qt","Display qualified tests."); arguments.getApplicationUsage()->addCommandLineOption("qt","Display qualified tests.");
@ -32,6 +32,12 @@ int main( int argc, char** argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
if (printQualifiedTest) if (printQualifiedTest)

View File

@ -345,7 +345,7 @@ int main(int argc, char *argv[])
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer. // construct the viewer.

View File

@ -20,9 +20,9 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setApplicatonName(arguments.getProgramName()); arguments.getApplicationUsage()->setApplicatonName(arguments.getApplicationName());
arguments.getApplicationUsage()->setDescription(arguments.getProgramName()+" is the standard OpenSceneGraph example which loads and visualises 3d models."); arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the standard OpenSceneGraph example which loads and visualises 3d models.");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getProgramName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
@ -51,7 +51,12 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
// read the scene from the list of file specified commandline args. // read the scene from the list of file specified commandline args.
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments); osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
@ -59,7 +64,7 @@ int main( int argc, char **argv )
// if no model has been successfully loaded report failure. // if no model has been successfully loaded report failure.
if (!loadedModel) if (!loadedModel)
{ {
std::cout << arguments.getProgramName() <<": No data loaded" << std::endl; std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
return 1; return 1;
} }

View File

@ -43,9 +43,9 @@ class SG_EXPORT ApplicationUsage
enum Type enum Type
{ {
COMMAND_LINE_OPTION, COMMAND_LINE_OPTION = 0x1,
ENVIRONMENTAL_VARIABLE, ENVIRONMENTAL_VARIABLE = 0x2,
KEYBOARD_MOUSE_BINDING KEYBOARD_MOUSE_BINDING = 0x4
}; };
void addUsageExplanation(Type type,const std::string& option,const std::string& explanation); void addUsageExplanation(Type type,const std::string& option,const std::string& explanation);
@ -74,7 +74,7 @@ class SG_EXPORT ApplicationUsage
void write(std::ostream& output,const UsageMap& um,unsigned int widthOfOutput=80); void write(std::ostream& output,const UsageMap& um,unsigned int widthOfOutput=80);
void write(std::ostream& output,unsigned int widthOfOutput=80); void write(std::ostream& output,unsigned int type=COMMAND_LINE_OPTION|ENVIRONMENTAL_VARIABLE|KEYBOARD_MOUSE_BINDING, unsigned int widthOfOutput=80);
protected: protected:

View File

@ -46,8 +46,8 @@ class SG_EXPORT ArgumentParser
/** return const char* argument at specificed position.*/ /** return const char* argument at specificed position.*/
const char* operator [] (int pos) const { return _argv[pos]; } const char* operator [] (int pos) const { return _argv[pos]; }
/** return the program name, as specified by argv[0] */ /** return the application name, as specified by argv[0] */
std::string getProgramName() const; std::string getApplicationName() const;
/** return the position of an occurance of a string in the argument list. /** return the position of an occurance of a string in the argument list.
* return -1 when no string is found.*/ * return -1 when no string is found.*/

View File

@ -145,12 +145,12 @@ void ApplicationUsage::write(std::ostream& output, const ApplicationUsage::Usage
output << str << std::endl; output << str << std::endl;
} }
void ApplicationUsage::write(std::ostream& output,unsigned int widthOfOutput) void ApplicationUsage::write(std::ostream& output, unsigned int type, unsigned int widthOfOutput)
{ {
output << "Usage: "<<getCommandLineUsage()<<std::endl; output << "Usage: "<<getCommandLineUsage()<<std::endl;
bool needspace = false; bool needspace = false;
if (!getCommandLineOptions().empty()) if ((type&COMMAND_LINE_OPTION) && !getCommandLineOptions().empty())
{ {
if (needspace) output << std::endl; if (needspace) output << std::endl;
output << "Options:"<<std::endl; output << "Options:"<<std::endl;
@ -158,7 +158,7 @@ void ApplicationUsage::write(std::ostream& output,unsigned int widthOfOutput)
needspace = true; needspace = true;
} }
if (!getEnvironmentalVariables().empty()) if ((type&ENVIRONMENTAL_VARIABLE) && !getEnvironmentalVariables().empty())
{ {
if (needspace) output << std::endl; if (needspace) output << std::endl;
output << "Environmental Variables:"<<std::endl; output << "Environmental Variables:"<<std::endl;
@ -166,7 +166,7 @@ void ApplicationUsage::write(std::ostream& output,unsigned int widthOfOutput)
needspace = true; needspace = true;
} }
if (!getKeyboardMouseBindings().empty()) if ((type&KEYBOARD_MOUSE_BINDING) && !getKeyboardMouseBindings().empty())
{ {
if (needspace) output << std::endl; if (needspace) output << std::endl;
output << "Keyboard and Mouse Bindings:"<<std::endl; output << "Keyboard and Mouse Bindings:"<<std::endl;

View File

@ -14,7 +14,7 @@ ArgumentParser::ArgumentParser(int* argc,char **argv):
{ {
} }
std::string ArgumentParser::getProgramName() const std::string ArgumentParser::getApplicationName() const
{ {
if (_argc>0) return std::string(_argv[0]); if (_argc>0) return std::string(_argv[0]);
return ""; return "";
@ -314,7 +314,7 @@ void ArgumentParser::reportRemainingOptionsAsUnrecognized(ErrorSeverity severity
// if an option and havn't been previous querried for report as unrecognized. // if an option and havn't been previous querried for report as unrecognized.
if (isOption(pos) && options.find(_argv[pos])==options.end()) if (isOption(pos) && options.find(_argv[pos])==options.end())
{ {
reportError(getProgramName() +": unrceognized option "+_argv[pos],severity); reportError(getApplicationName() +": unrceognized option "+_argv[pos],severity);
} }
} }
} }
@ -326,7 +326,7 @@ void ArgumentParser::writeErrorMessages(std::ostream& output,ErrorSeverity sever
{ {
if (itr->second>=severity) if (itr->second>=severity)
{ {
output<< getProgramName() << ": " << itr->first << std::endl; output<< getApplicationName() << ": " << itr->first << std::endl;
} }
} }
} }