proj home

Files   Classes   Functions   Hierarchy  

visline Class Reference

#include <visline.h>

Inheritance diagram for visline:
Collaboration diagram for visline:

List of all members.

Public Member Functions

 visline ()
 Default settings.
void handlecommand (bool &matches, viscmd &c)
 Possibly run the command.
stringc id () const
 Command name.

Public Attributes

pt3 color
 Defalut line color.


Detailed Description

Definition at line 10 of file visline.h.


Constructor & Destructor Documentation

visline::visline (  ) 

Default settings.

Definition at line 6 of file visline.cpp.

References color.

00007 {
00008   color = pt3(1.0,0.0,0.0);
00009 }


Member Function Documentation

void visline::handlecommand ( bool matches,
viscmd c 
) [virtual]

Possibly run the command.

Implements visoperator.

Definition at line 11 of file visline.cpp.

References viscmd::arg, color, viscmd::command, gobjpush, visenv::pi, tokenizer::reset(), tokenizer::seq, stringfrom(), tokenizer::subtract(), viscmd::valid, and visoperator::ve.

00012 {
00013   assert(ve!=0);
00014   matches=false;
00015   if (c.command != this->id())
00016     return;
00017   matches=true;
00018 
00019   tokenizer ss;
00020   ss.seq.push_back(c.arg);
00021   ss.subtract(" ");
00022 //cout << SHOW( ss.seq.size() ) << endl;
00023 
00024   uint sz=ss.seq.size();
00025 assert(sz%2==0);
00026   if ((sz%2)!=0)
00027   {
00028     c.valid=false; 
00029     return;
00030   }
00031 
00032   vector<uint> vk; 
00033   uint k;
00034 
00035   vector< pt3 > & pi(ve->pi);
00036 
00037   ss.reset();
00038   for ( ss.reset(); !ss; )
00039   {
00040     stringfrom(k,ss());
00041     ++ss;
00042     if (k>= pi.size())
00043     {
00044       c.valid=false;
00045       return;
00046     }
00047  
00048     vk.push_back(k);
00049   } 
00050 
00051   gobjpush( new gobjglPushAttrib(GL_LIGHTING) );
00052   gobjpush( new gobjglPushAttrib(GL_CURRENT_BIT) );
00053   gobjpush( new gobjglColor3d(color) );
00054   gobjpush( new gobjglDisable( GL_LIGHTING));
00055   gobjpush( new gobjglBegin(GL_LINE) );
00056 
00057   for (uint i=0; i<vk.size()/2; ++i)
00058   {
00059     gobjpush(
00060       new gobjglVertex3d(
00061         pi[vk[i*2]]));
00062     gobjpush(
00063       new gobjglVertex3d(
00064         pi[vk[i*2+1]]));
00065   }
00066 
00067   gobjpush( new gobjglEnd() );
00068   gobjpush( new gobjglPopAttrib() );
00069   gobjpush( new gobjglPopAttrib() );
00070 
00071   c.valid=true; 
00072 }

stringc visline::id (  )  const [inline, virtual]

Command name.

Implements visoperator.

Definition at line 24 of file visline.h.

00025     { return string("line"); }


Member Data Documentation

Defalut line color.

Definition at line 15 of file visline.h.

Referenced by handlecommand(), and visline().


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

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