#include <Iguana/WebFramework/interface/IgWeb2DService.h>
Public Member Functions | |
void | browse (Arguments *arguments) |
void | create (Arguments *arguments) |
IgWeb2DService (IgState *state) | |
Static Public Member Functions | |
static const char * | catalogLabel (void) |
Definition at line 19 of file IgWeb2DService.h.
IgWeb2DService::IgWeb2DService | ( | IgState * | state | ) |
Definition at line 30 of file IgWeb2DService.cc.
References browse(), create(), lat::CreateCallback(), and IgWebService::registerCallback().
00031 : IgWebService (state) 00032 { 00033 registerCallback ("create", lat::CreateCallback (this, &IgWeb2DService::create)); 00034 registerCallback ("browse", lat::CreateCallback (this, &IgWeb2DService::browse)); 00035 }
Definition at line 57 of file IgWeb2DService.cc.
References a, IgWebService::Arguments::args(), ASSERT, IgOIVBrowser::browse(), TestMuL1L2Filter_cff::cerr, dd, lat::endl(), DBSPlugin::get(), IgOIVBrowser::getCamera(), IgOIVBrowser::getJPGBuffer(), IgBrowserManager::lookup(), IgOIVBrowser::moveCameraScreen(), IgWebService::Arguments::outputDevice(), IgDocumentData::root(), split, IgWebService::state(), IgWebService::Arguments::state(), IgOIVBrowser::viewAll(), x, y, z, and IgOIVBrowser::zoom().
Referenced by IgWeb2DService().
00058 { 00059 using namespace lat; 00060 IgState *state = arguments->state (); 00061 QIODevice *outputDevice = arguments->outputDevice (); 00062 ArgumentsMap &args = *arguments->args (); 00063 00064 IgDocumentData *dd = IgDocumentData::get (state); 00065 IgBrowserManager *manager = IgBrowserManager::get (state); 00066 00067 std::string rootName = ""; 00068 if (args.find ("root") != args.end ()) 00069 rootName = args["root"]; 00070 00071 IgTwig *twig = dynamic_cast <IgTwig *> (dd->root (rootName)); 00072 00073 std::string browserName = ""; 00074 if (args.find ("browserName") != args.end ()) 00075 browserName = args["browserName"]; 00076 00077 IgOIVBrowser *browser = manager->lookup<IgOIVBrowser> (browserName); 00078 ASSERT (browser); 00079 00080 browser->browse (twig); 00081 00082 if (args.find ("position") != args.end ()) 00083 { 00084 float x, y, z; 00085 StringList coords = StringOps::split (args["position"], ","); 00086 if (coords.size () == 3) 00087 { 00088 x = strtof (coords[0].c_str (), 0); 00089 y = strtof (coords[1].c_str (), 0); 00090 z = strtof (coords[2].c_str (), 0); 00091 browser->getCamera ()->position = SbVec3f (x, y ,z); 00092 } 00093 } 00094 00095 if (args.find ("orientation") != args.end ()) 00096 { 00097 float x,y,z,a; 00098 StringList coords = StringOps::split (args["orientation"], ","); 00099 if (coords.size () == 4) 00100 { 00101 x = strtof (coords[0].c_str (), 0); 00102 y = strtof (coords[1].c_str (), 0); 00103 z = strtof (coords[2].c_str (), 0); 00104 a = strtof (coords[3].c_str (), 0); 00105 browser->getCamera ()->orientation 00106 = SbRotation (SbVec3f (x, y ,z), a); 00107 } 00108 } 00109 00110 if (args.find ("pointAt") != args.end ()) 00111 { 00112 float x,y,z; 00113 StringList coords = StringOps::split (args["pointAt"], ","); 00114 if (coords.size () == 3) 00115 { 00116 x = strtof (coords[0].c_str (), 0); 00117 y = strtof (coords[1].c_str (), 0); 00118 z = strtof (coords[2].c_str (), 0); 00119 browser->getCamera ()->pointAt (SbVec3f (x, y ,z)); 00120 } 00121 } 00122 00123 00124 if (args.find ("viewAll") != args.end ()) 00125 { 00126 browser->viewAll (); 00127 } 00128 00129 if (args.find ("moveCameraScreen") != args.end ()) 00130 { 00131 float x, y; 00132 StringList coords 00133 = StringOps::split (args["moveCameraScreen"], ","); 00134 if (coords.size () == 2) 00135 { 00136 x = strtof (coords[0].c_str (), 0); 00137 y = strtof (coords[1].c_str (), 0); 00138 std::cerr << x << " " << y << std::endl; 00139 00140 browser->moveCameraScreen (SbVec2f (x, y)); 00141 } 00142 } 00143 00144 if (args.find ("zoom") != args.end ()) 00145 { 00146 float diffValue = 0; 00147 diffValue = strtof (args["zoom"].c_str (), 0); 00148 browser->zoom (diffValue); 00149 } 00150 00151 QByteArray tmpArray = browser->getJPGBuffer (); 00152 outputDevice->writeBlock (tmpArray.data (), tmpArray.size ()); 00153 }
const char * IgWeb2DService::catalogLabel | ( | void | ) | [static] |
Definition at line 38 of file IgWeb2DService.cc.
References IgBrowserManager::add(), IgWebService::Arguments::args(), ASSERT, DBSPlugin::get(), IgWebService::state(), and IgWebService::Arguments::state().
Referenced by IgWeb2DService().
00039 { 00040 IgState *state = arguments->state (); 00041 ArgumentsMap &args = *arguments->args (); 00042 00043 IgBrowserManager *manager = IgBrowserManager::get (state); 00044 ASSERT (manager); 00045 00046 IgBrowser *browser = new IgOIVBrowser (state, 0, (Ig3DBaseModel *) -1); 00047 std::string lookupName = ""; 00048 00049 if (args.find ("name") != args.end ()) 00050 lookupName = args["name"]; 00051 00052 manager->add (browser, lookupName); 00053 }