Files Classes Functions Hierarchy
00001 #include <visconvex.h> 00002 #include <visline.h> 00003 #include <visoperator.h> 00004 #include <vispoint2.h> 00005 #include <vispoint3.h> 00006 #include <vispointxml.h> 00007 00008 00009 00010 visenv* visoperator::ve=0; 00011 vispointxml* visoperator::vp=0; 00012 00013 vector< visoperator* > visdictionary::dictionary; 00014 00015 00016 void visoperator::set(visenv& ve_) 00017 { 00018 ve = & ve_; 00019 } 00020 00021 void visoperator::set(vispointxml& vp_) 00022 { 00023 vp = & vp_; 00024 } 00025 00026 00027 void visdictionary::add(visoperator* x) 00028 { 00029 assert(x!=0); 00030 dictionary.push_back(x); 00031 } 00032 00033 /* 00034 void visoperator::handlecommand(bool & matches, viscmd & c) 00035 { 00036 assert(ve!=0); 00037 00038 matches=false; 00039 if (c.command != this->id()) 00040 return; 00041 00042 matches=true; 00043 this->handle(c); 00044 */ 00045 00046 00047 00048 void visdictionary::handlecommand 00049 (bool & matches, viscmd & c) 00050 { 00051 matches=false; 00052 for (uint i=0; i<dictionary.size(); ++i) 00053 { 00054 if (dictionary[i]==0) 00055 continue; 00056 00057 dictionary[i]->handlecommand(matches,c); 00058 if (matches) 00059 return; 00060 } 00061 } 00062 00063 void visdictionary::process(vector<viscmd> &v) 00064 { 00065 bool res; 00066 00067 for (uint i=0; i<v.size(); ++i) 00068 { 00069 00070 if (v[i].enabled==false) 00071 continue; 00072 00073 res=false; 00074 for (uint k=0; k<dictionary.size(); ++k) 00075 { 00076 if (dictionary[k]==0) 00077 continue; 00078 00079 dictionary[k]->handlecommand(res,v[i]); 00080 if (res) 00081 k=dictionary.size()+1; 00082 } 00083 } 00084 } 00085 00086 void visdictionary::build01() 00087 { 00088 add(new vispointxml); 00089 add(new vispoint2); 00090 add(new vispoint3); 00091 add(new visline); 00092 add(new visconvex); 00093 00094 } 00095
1.5.8