proj home

Files   Classes   Functions   Hierarchy  

simplexD1tessapp01 Class Reference

Application to displays a line tessellation from indexed lines. More...

#include <simplexD1tessapp01.h>

Collaboration diagram for simplexD1tessapp01:

List of all members.

Public Types

typedef point2< double > pt2
typedef simplexD1tessindexed
< pt2, double, uint
tesstype
typedef tessD1disp01< tesstype,
pt2, uint
tessdisptype

Public Member Functions

 simplexD1tessapp01 (int argc, char **argv)
 Tessellation in 1D.
void mainmenu ()
 Set up the main menu display.
void createdisplay ()
 Add the tess drawing components.
void messagemenu ()
 Initialize the message menu.

Static Public Member Functions

static void keyboard (unsigned char key, int x, int y)
 Keyboard handler.
static void display ()
 Displays gobj::global .

Static Public Attributes

static string doc []
 Program documentation on the command line and in the doxygen description.
static boolhelp = 0
 Toggle the help menu.
static menusystemmessages = 0
 Output window.
static tesstypetess = 0
 Access the tessellation in static functions.
static tessdisptypetessdisp = 0
static uint displaypoints = 0
 Index to points switch.
static uint displaylines = 0
 Index to lines switch.
static uint displaylinesmulticolor = 0
 Index to multi color lines switch.
static uint displaysimplexindexes = 0
 Index to simplex indexes display.


Detailed Description

Application to displays a line tessellation from indexed lines.

Definition at line 12 of file simplexD1tessapp01.h.


Member Typedef Documentation

Definition at line 21 of file simplexD1tessapp01.h.

Definition at line 28 of file simplexD1tessapp01.h.

Definition at line 27 of file simplexD1tessapp01.h.


Constructor & Destructor Documentation

simplexD1tessapp01::simplexD1tessapp01 ( int  argc,
char **  argv 
)

Tessellation in 1D.

Definition at line 168 of file simplexD1tessapp01.cpp.

References createdisplay(), display(), keyboard(), mainmenu(), commandline::mapvar(), messagemenu(), tokenizermisc::readfile(), simplexD1tessindexed< PT, PD, INDX >::serializeInverse(), gobjContainer::set(), and tess.

00169 {
00170   glutInit(&argc,argv);
00171   glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
00172   glutInitWindowSize(800,600);
00173   glutCreateWindow("");
00174   glutDisplayFunc(display);
00175   glutKeyboardFunc(keyboard);
00176 
00177   OpenGLinitialisation();
00178 
00179   glEnable(GL_DEPTH_TEST);
00180   glEnable(GL_CULL_FACE);
00181   glEnable(GL_NORMALIZE);
00182 
00183   xGraphics.set();
00184 
00185   commandline cmd(argc,argv);
00186 
00187   // Read in the tessellation file
00188   string file;
00189   cmd.mapvar(file,"file");
00190   if (file.empty())
00191   {
00192     cout << "error:  filename of an indexed 2D tessellation expected." << endl;
00193     cout << "  eg ./main prog=15 file=tessD1001.txt" << endl;
00194     return;
00195   }
00196 
00197   string s;
00198   bool res = tokenizermisc::readfile(s,file);
00199   if (res==false)
00200   {
00201     cout << "error:  could not read file " << file << endl;
00202     return;
00203   }
00204 
00205   // Create the tessellation
00206   tesstype tessD1;
00207   tess = & tessD1;
00208 
00209   tess->serializeInverse(s);
00210 
00211   createdisplay();
00212 
00213   mainmenu();
00214 
00215   messagemenu();
00216 
00217   zpr zz;
00218   glutMainLoop();
00219 }


Member Function Documentation

void simplexD1tessapp01::createdisplay (  ) 

Add the tess drawing components.

Definition at line 133 of file simplexD1tessapp01.cpp.

References tessD1disp01< TESS, PT, INDX >::displayDeferred(), displaylines, displaylinesmulticolor, displaypoints, displaysimplexindexes, gobjContainer::push(), tessdisp, and graphicsImmediateDeferred::update().

Referenced by simplexD1tessapp01().

00134 {
00135   tessdisp = new tessD1disp01<tesstype,pt2,uint>(*tess);
00136 
00137   typeop< tessD1draw01points<tesstype,pt2> > pointstype;
00138   tessdisp->displayDeferred(displaypoints,pointstype);
00139 
00140   typeop< tessD1draw01lines<tesstype,pt2> > linestype;
00141   tessdisp->displayDeferred(displaylines,linestype);
00142 
00143   typeop< tessD1draw01linesmulticolor<tesstype,pt2> > linesmulticolortype;
00144   tessdisp->displayDeferred(displaylinesmulticolor,linesmulticolortype);
00145 
00146   typeop< tessD1draw01simplexindexes<tesstype,pt2> > simplexindexestype;
00147   tessdisp->displayDeferred(displaysimplexindexes,simplexindexestype);
00148 
00149   //gobjpush(tessdisp);
00150 
00151   tessdisp->update();
00152   xGraphics.push(tessdisp);
00153 }

void simplexD1tessapp01::display (  )  [static]

Displays gobj::global .

Definition at line 87 of file simplexD1tessapp01.cpp.

References gobjContainer::draw(), glerrordisplay(), and gobj::global.

Referenced by simplexD1tessapp01().

00088 {
00089   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00090 
00091   gobj::global->draw();
00092 
00093 
00094   glerrordisplay();
00095   
00096   glutSwapBuffers();
00097 }

void simplexD1tessapp01::keyboard ( unsigned char  key,
int  x,
int  y 
) [static]

Keyboard handler.

if (tessdisp)

Definition at line 26 of file simplexD1tessapp01.cpp.

References menusystem::addfont10blockstart(), menusystem::clear(), displaylines, displaylinesmulticolor, displaypoints, displaysimplexindexes, graphicsImmediateDeferredSwitch::gswitches, help, messages, simplexD1tessindexed< PT, PD, INDX >::pts, menusystem::scrolldown(), menusystem::scrollup(), tess, tessdisp, and simplexD1tessindexed< PT, PD, INDX >::vi.

Referenced by simplexD1tessapp01().

00027 {
00028   switch (key)
00029   {
00030     case 27: exit(0); break;
00031 
00032     case 'h': if (help) *help = !*help; break;
00033     case '1': if (tessdisp) tessdisp->gswitches[displaypoints]->toggle(); break;
00034     case '2': if (tessdisp)
00035       {
00036         tessdisp->gswitches[displaylinesmulticolor]->isdrawn = false;
00037         tessdisp->gswitches[displaylines]->isdrawn = false;
00038       }
00039       break;
00040     case '3': if (tessdisp)
00041       {
00042         tessdisp->gswitches[displaylinesmulticolor]->isdrawn = false;
00043         tessdisp->gswitches[displaylines]->isdrawn = true;
00044       }
00045       break;
00046     case '4': if (tessdisp)
00047       {
00048         tessdisp->gswitches[displaylinesmulticolor]->isdrawn = true;
00049         tessdisp->gswitches[displaylines]->isdrawn = false;
00050       }
00051     case '5': if (tessdisp) tessdisp->gswitches[displaysimplexindexes]->toggle(); break;
00052       break;
00053 
00054     case 'u': if (messages) messages->scrollup(); break;
00055     case ' ': if (messages) messages->scrolldown(); break;
00056     case 's': 
00057     {
00058       stringstream ss;
00059       for (uint i=1; i<tess->vi.size(); ++i)
00060         ss << i << ":   " << tess->vi[i] << endl;
00061 
00062       if (messages)
00063         messages->addfont10blockstart(ss.str(),1); 
00064     }
00065     break;
00066     case 'p':
00067     {
00068       stringstream ss;
00069       for (uint i=1; i<tess->pts.size(); ++i)
00070         ss << i << ":   " << tess->pts[i] << endl;
00071 
00072       messages->addfont10blockstart(ss.str(),1); 
00073     }
00074     break;
00075     case 'c':  messages->clear(); break;
00076 
00077 
00078   }
00079 
00081 //    tessdisp->update();
00082 
00083   glutPostRedisplay();
00084 }

void simplexD1tessapp01::mainmenu (  ) 

Set up the main menu display.

Definition at line 99 of file simplexD1tessapp01.cpp.

References menusystem::fontcolor, gobjpush, help, and gobjSwitch< BOOL >::isdrawn.

Referenced by simplexD1tessapp01().

00100 {
00101   gobjpush(new gobjglDisable(GL_LIGHTING));
00102   menusystem * menu = 
00103     new menusystem(0,0,true,point2<GLint>(60,30),10);
00104   menu->fontcolor = point4<float>(218.0/255.0,165.0/255.0,32.0/255.0,0.75);
00105 
00106   gobjSwitch<> * menuswitch = new gobjSwitch<>(menu,true);
00107   help = & menuswitch->isdrawn;
00108   gobjpush(menuswitch);
00109 
00110   menu->addfont12("Indexed Lines Display",2);
00111 
00112   menu->addfont10("1        Toggle the points",1);
00113   menu->addfont10("2        Mesh - none",1);
00114   menu->addfont10("3        Mesh - uniform color",1);
00115   menu->addfont10("4        Mesh - multi color",1);
00116   menu->addfont10("5        Toggle the simples indexes",1);
00117   menu->addfont10(" ",1);
00118 
00119   menu->addfont10("s        Print simplexes",1);
00120   menu->addfont10("p        Print points",1);
00121   menu->addfont10("space    Scroll down",1);
00122   menu->addfont10("u        Scroll up",1);
00123   menu->addfont10("c        Clear the display",1);
00124   
00125 
00126   
00127   menu->addfont10(" ",1);
00128   menu->addfont10("h        Toggle help menu",1);
00129   menu->addfont10("ESC      Quit");
00130 
00131 }

void simplexD1tessapp01::messagemenu (  ) 

Initialize the message menu.

Definition at line 155 of file simplexD1tessapp01.cpp.

References menusystem::fontcolor, gobjpush, textoverlay::lightingdisable(), and messages.

Referenced by simplexD1tessapp01().

00156 {
00157   messages = 
00158     new menusystem(0,0,true,point2<GLint>(60,250),10);
00159   gobjpush(messages);
00160   messages->fontcolor = point4<float>(1.0,0.0,0.0,0.8);
00161   messages->lightingdisable();
00162 
00163   glDisable(GL_DEPTH_TEST);
00164   glEnable(GL_BLEND);
00165   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00166 }


Member Data Documentation

Index to lines switch.

Definition at line 41 of file simplexD1tessapp01.h.

Referenced by createdisplay(), and keyboard().

Index to multi color lines switch.

Definition at line 43 of file simplexD1tessapp01.h.

Referenced by createdisplay(), and keyboard().

Index to points switch.

Definition at line 39 of file simplexD1tessapp01.h.

Referenced by createdisplay(), and keyboard().

Index to simplex indexes display.

Definition at line 45 of file simplexD1tessapp01.h.

Referenced by createdisplay(), and keyboard().

string simplexD1tessapp01::doc [static]

Initial value:

 
{  
  "",
  "Application to displays a line tessellation from indexed lines."
}
Program documentation on the command line and in the doxygen description.

Definition at line 19 of file simplexD1tessapp01.h.

Referenced by main().

Toggle the help menu.

Definition at line 23 of file simplexD1tessapp01.h.

Referenced by keyboard(), and mainmenu().

Output window.

Definition at line 25 of file simplexD1tessapp01.h.

Referenced by keyboard(), and messagemenu().

Access the tessellation in static functions.

Definition at line 31 of file simplexD1tessapp01.h.

Referenced by keyboard(), and simplexD1tessapp01().

Definition at line 33 of file simplexD1tessapp01.h.

Referenced by createdisplay(), and keyboard().


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

Generated on Fri Mar 4 00:50:17 2011 for Chelton Evans Source by  doxygen 1.5.8