Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

int Impala::Application::mainShow ( int  argc,
char *  argv[] 
)

Definition at line 217 of file mainShow.cpp.

References Impala::CmdOptions::AddOption(), Impala::Core::Array::ARRAY2DSCALARINT32, Impala::Core::Array::ARRAY2DSCALARREAL64, Impala::Core::Array::ARRAY2DSCALARUINT8, Impala::Core::Array::ARRAY2DUNKNOWN, Impala::Core::Array::ARRAY2DVEC3REAL64, Impala::Core::Array::ARRAY2DVEC3UINT8, Impala::FileNameExt(), Impala::CmdOptions::GetArg(), Impala::CmdOptions::GetBool(), Impala::Persistency::RepositoryInFileSystem::GetFile(), Impala::Persistency::RepositoryInFileSystem::GetInstance(), Impala::CmdOptions::GetInstance(), Impala::CmdOptions::GetInt(), ILOG_DEBUG, ILOG_ERROR, ILOG_INFO, ILOG_VAR, Impala::CmdOptions::Initialise(), OglEventLoop(), Impala::CmdOptions::ParseArgs(), Impala::Core::Array::ReadRawArrayType(), OglGui::OglWindow::SetBackground(), OglGui::OglWindow::Start(), and Impala::Persistency::File::Valid().

Referenced by main().

00218 {
00219     OglInit(&argc, &argv[0]);
00220     CmdOptions& options = CmdOptions::GetInstance();
00221     options.Initialise(false, false, true);
00222     options.AddOption(0, "grid", "", "0");
00223     options.AddOption(0, "png", "", "0");
00224     options.AddOption(0, "fset", "", "0");
00225     options.AddOption(0, "wndWidth", "width", "1260");
00226     options.AddOption(0, "wndHeight", "height", "950");
00227     String usageStr = "location dataset filename\n\n";
00228     usageStr += "  location = file:|dataServer:host:port|mapi:host:port:[db]\n";
00229     usageStr += "  dataset = dot|abs|dataset.txt\n";
00230     usageStr += "  filename = file.{raw,jpg,png,fset}\n";
00231     if (! options.ParseArgs(argc, argv, usageStr, 3))
00232         return 1;
00233 
00234     ILOG_VAR(Impala.Application.mainShow);
00235 
00236     int verb = options.GetInt("verb");
00237     bool png = options.GetBool("png");
00238 
00239     bool grid = options.GetBool("grid");
00240     int reqWndWidth = options.GetInt("wndWidth");
00241     int reqWndHeight = options.GetInt("wndHeight");
00242 
00243     String loc = options.GetArg(0);
00244     String setName = options.GetArg(1);
00245     String fileName = options.GetArg(2);
00246 
00247     if (FileNameExt(fileName) != "raw")
00248     {
00249         ILOG_DEBUG("new WindowShow<Array2dVec3UInt8>(direct)");
00250         new WindowShow<Array2dVec3UInt8>(loc, setName, fileName, "Direct");
00251         return 0;
00252     }
00253 
00254     ArrayType arrayType = ARRAY2DSCALARUINT8; // assume this for mapi:
00255     if (loc != "mapi:")
00256     {
00257         arrayType = ARRAY2DUNKNOWN;
00258         RepositoryInFileSystem& repFS = RepositoryInFileSystem::GetInstance();
00259         Locator locator(loc, setName);
00260         Persistency::File f = repFS.GetFile(locator, "", fileName, false, true);
00261         if (f.Valid())
00262             arrayType = ReadRawArrayType(f);
00263         else
00264             ILOG_ERROR("Unable to open " << fileName << " at " << locator);
00265     }
00266 
00267     switch (arrayType)
00268     {
00269     case ARRAY2DSCALARUINT8:
00270         if (grid)
00271         {
00272             ILOG_INFO("new DirImViewerScroller");
00273             Visualization::DirImViewerScroller *gridViewer =
00274                 new Visualization::DirImViewerScroller(4, 4, reqWndWidth,
00275                                                        reqWndHeight);
00276             Persistency::RgbDataSrcLocator srcLoc(loc, setName, fileName);
00277             gridViewer->OpenSrc(srcLoc);
00278             gridViewer->SetBackground(oglGUI_BG);
00279             gridViewer->Start();
00280             OglEventLoop();
00281             return 1;
00282         }
00283         ILOG_DEBUG("new WindowShow<Array2dVec3UInt8>(jpg/png)");
00284         if (png)
00285             new WindowShow<Array2dVec3UInt8>(loc, setName, fileName, "png");
00286         else
00287             new WindowShow<Array2dVec3UInt8>(loc, setName, fileName, "jpg");
00288         return 0; // assume all was well
00289     case ARRAY2DSCALARINT32:
00290         ILOG_DEBUG("new WindowShow<Array2dScalarInt32>(stretch)");
00291         new WindowShow<Array2dScalarInt32>(loc, setName, fileName, "Stretch");
00292         return 0; // assume all was well
00293     case ARRAY2DSCALARREAL64:
00294         ILOG_DEBUG("new WindowShow<Array2dScalarReal64>(stretch)");
00295         new WindowShow<Array2dScalarReal64>(loc, setName, fileName, "Stretch");
00296         return 0; // assume all was well
00297     case ARRAY2DVEC3UINT8:
00298         ILOG_DEBUG("new WindowShow<Array2dVec3UInt8>(direct)");
00299         new WindowShow<Array2dVec3UInt8>(loc, setName, fileName, "Direct");
00300         return 0; // assume all was well
00301         /*
00302     case ARRAY2DVEC2REAL64:
00303     case ARRAY2DCOMPLEX64:
00304         new WindowShow<Array2dComplex64>(loc, setName, fileName, "LogMagnitude");
00305         return 0; // assume all was well
00306         */
00307     case ARRAY2DVEC3REAL64:
00308         ILOG_DEBUG("new WindowShow<Array2dVec3Real64>(stretch)");
00309         new WindowShow<Array2dVec3Real64>(loc, setName, fileName, "Stretch");
00310         return 0; // assume all was well
00311     default:
00312         ILOG_ERROR("Unknown Array type");
00313         return 1;
00314     }
00315     return 1;
00316 }

Here is the call graph for this function:


Generated on Fri Mar 19 10:36:42 2010 for ImpalaSrc by  doxygen 1.5.1