proj home

Files   Classes   Functions   Hierarchy  

vispointxml.cpp

Go to the documentation of this file.
00001 #include <random.h>
00002 #include <vispointxml.h>
00003 
00004 vispointxml::vispointxml()
00005   : sphere01(0)
00006 {
00007   defaultsettings();
00008 }
00009 
00010 void vispointxml::defaultsettings()
00011 {
00012   colorrandom=false;
00013   pointdisplay=false;
00014   color=pt3(1.0,0.0,1.0);
00015 
00016   if (sphere01==0)
00017   {
00018     sphere01 = new gobjQuadric();
00019 
00020     sphere01->radius = 0.05;
00021     sphere01->slices = 30;
00022     sphere01->loops = 7;
00023   }    
00024 
00025   visoperator::set(*this);
00026 
00027   assert(ve!=0);
00028 }
00029 
00030 
00031 void vispointxml::piaddpoint(bool& res, stringc & s)
00032 {
00033 //cout << SHOW(s) << endl;
00034   pt3 p;
00035   p.serializeInverse(s);
00036 //cout << SHOW(p) << endl;
00037   res=true;
00038   assert(ve);
00039   ve->pi.push_back(p);
00040 //pointdisplay=true;
00041   if (pointdisplay)
00042   {
00043     if (colorrandom==false)
00044     {
00045       gobjpush( new gobjglColor3d(color) );
00046     }
00047     else
00048     {
00049       gobjpush( new gobjglColor3d(randompoint<>().makepoint3()) );
00050     }
00051     
00052     //gobjpush( new gobjglColor3f(1.0,0.0,0.0) );
00053     gobjpush
00054     ( 
00055       new gobjMySphereDraw(p,sphere01)
00056 //      new gobjMySphereDraw(p.x,p.y,p.z,sphere01)
00057     );
00058   }
00059 }
00060 
00061 void vispointxml::handlecommand(bool & matches, viscmd & c )
00062 {
00063   assert(ve!=0);
00064   assert(vp!=0);
00065   assert(this==vp);
00066 
00067   matches=false;
00068   if (c.command != this->id())
00069     return;
00070   matches=true;
00071 
00072   bool res=true;
00073   commandline cmd(c.arg);
00074 
00075   cmd.mapvar(pointdisplay,"display");
00076   cmd.mapvar(colorrandom,"colorrandom");
00077 
00078   string colorrgb;
00079   cmd.mapvar(colorrgb,"colorrgb");
00080   if (colorrgb.empty()==false)
00081   {
00082     pt3 p;
00083     p.serializeInverse(colorrgb);
00084     p /= 255.0;
00085     if (randomgenerator::domain(p))
00086       color=p;
00087     else
00088       res=false;
00089   }
00090 
00091   c.valid=res; 
00092 }
00093 
00094 

Generated on Fri Mar 4 00:49:32 2011 for Chelton Evans Source by  doxygen 1.5.8