EXAMPLE
CREATING DEFAULT MODE MENU
/* creating the Main Menu, displayed when
in default mode */
MenuNode *menuRoot = new MenuNode("Main
Menu", true);
m_pWorld->addChild(menuRoot);
menuRoot->setFunction(this->MakeSceneUntouchable, m_pGeometrySep);
menuRoot->setAlwaysFunction(this->MakeSceneTouchable,
m_pGeometrySep);
MenuNode *switchModes = new MenuNode("Switch
Modes", false);
menuRoot->addItem(switchModes);
/* for adding postit
notes */
MenuNode *addNotes = new MenuNode("PostIt Notes", false);
addNotes->setFunction(enable_add_notes,0);
menuRoot->addItem(addNotes);
/* for exiting the program */
MenuNode *quit = new MenuNode("Exit", false);
quit->setFunction(quit_Func, 0);
menuRoot->addItem(quit);
/* for adjustint
the Binocular */
MenuNode *AdjustBinocular = new MenuNode("Binocular
Adjust",
false);
AdjustBinocular->setFunction(move_to_stereo_test_mode, 0);
menuRoot->addItem(AdjustBinocular);
/* for switching to polyline
mode, added to switchmodes */
MenuNode *polylineMode = new MenuNode("Polylines", false);
polylineMode->setFunction(this->MenuSwitchModes,
m_aModes[SYS_MODE_LINES]);
switchModes->addItem(polylineMode);
/* for switching to postit
mode, added to switchmodes */
MenuNode *postItMode = new MenuNode("PostIts", false);
postItMode->setFunction(this->MenuSwitchModes,
m_aModes[SYS_MODE_NOTES]);
switchModes->addItem(postItMode);
/* for switching back to default mode,
added to switchmodes */
MenuNode *defaultMode = new MenuNode("Default",
false);
defaultMode->setFunction(this->MenuSwitchModes,
m_aModes[SYS_MODE_DEFAULT]);
switchModes->addItem(defaultMode);
menuRoot->setPhantom(phantom);
menuRoots[0]
= menuRoot;
FIGURE 1: default mode menu
note:
switch Modes slice is shared by both Default menu and
later
on postIt mode menu
EXAMPLE
CREATING POSTIT MODE MENU
/* creating a menu tree for the postit mode */
MenuNode *menuRoot1 = new MenuNode("mr1",
true);
m_pWorld->addChild(menuRoot1);
menuRoot1->setFunction(this->MakeSceneUntouchable, m_pGeometrySep);
menuRoot1->setAlwaysFunction(this->MakeSceneTouchable,
m_pGeometrySep);
MenuNode
*switchModes1 = new MenuNode("slice1", false,
gstPoint(1.0, 0.7, 1.0));
menuRoot1->addItem(switchModes1);
menuRoot1->addItem(switchModes);
MenuNode *switchModes1_2 = new MenuNode("slice1.2",
false,
gstPoint(0.6, 0.5, 1.0));
menuRoot1->addItem(switchModes1_2);
MenuNode *addNotes1 = new MenuNode("slice2",
false);
addNotes->setFunction(enable_add_notes,0);
menuRoot1->addItem(addNotes1);
MenuNode *quit1 = new MenuNode("slice3", false);
quit->setFunction(quit_Func, 0);
menuRoot1->addItem(quit1);
MenuNode *AdjustBinocular1 = new MenuNode("slice4",
false,
gstPoint(0.4,
0.3, 9.0));
AdjustBinocular->setFunction(move_to_stereo_test_mode, 0);
menuRoot1->addItem(AdjustBinocular1);
/*
for adding postit notes */
MenuNode *polylineMode1 = new MenuNode("slic5",
false);
switchModes1->addItem(polylineMode1);
MenuNode *postItMode1 = new MenuNode("slice6",
false);
switchModes1->addItem(postItMode1);
MenuNode *defaultMode1 = new MenuNode("slice7",
false);
switchModes1->addItem(defaultMode1);
menuRoot1->setPhantom(phantom);
menuRoots[2]
= menuRoot1;
FIGURE 2
Note: slice1, slice4, and slice1.2 all
have user defined colors
FIGURE 3
Note: when a slice with user defined color
is selected, the color lightens
Written by Nisha Pan 2004-04-28