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

mainIDashNET.cpp

Go to the documentation of this file.
00001 #include "OglGui/OglLib.cpp"
00002 #include "Basis/ILog.h"
00003 
00004 #include "OglGui/Tabs.h"
00005 #include "OglGui/CheckBox.h"
00006 #include "OglGui/Button.h"
00007 #include "OglGui/Strut.h"
00008 #include "OglGui/DropDownWindow.h"
00009 #include "OglGui/StringSelector.h"
00010 //#include "OglGui/SixButtonCross.h"
00011 #include "OglGui/GroupBox.h"
00012 
00013 #include "Application/idash/TrecEngine.h"
00014 #include "Application/idash/ScreenDossier.h"
00015 #include "Application/idash/ScreenBrowserX.h"
00016 #include "Application/idash/ScreenPlayX.h"
00017 #include "Application/idash/ScreenReconstruction.h"
00018 #include "Application/idash/ScreenQuery.h"
00019 #include "Application/idash/ScreenTabs.h"
00020 
00021 //using namespace OglGui; 
00022 
00023 namespace Impala {
00024 namespace Application {
00025 namespace IDash {
00026 
00027 class IDash :   public DossierListener,
00028                 public ReconstructionListener
00029 {
00030 public:
00031     typedef Visualization::AppController            AppController;
00032     typedef Visualization::AppControlDoc            AppControlDoc;
00033 
00034     IDash(OGLWND* oglWnd) {
00035         ILOG_DEBUG("IDash() constructor");
00036         Impala::CmdOptions& options = Impala::CmdOptions::GetInstance();
00037 
00038         ILOG_STARTACTION("loading engine", ILOG_LEVEL_INFO);
00039         mEngine = new TrecEngine();
00040 
00041         // attach engine to screens:
00042         ScreenBase::SetEngine(mEngine);
00043 //        mAppControl->AddDocListener(this);
00044 
00045         ILOG_ENDACTION("loading engine");
00046 
00047         mStartWithMovies = options.GetBool("startWithMovies");
00048         mEnableMiniQueryPane = options.GetBool("enableInBrowserQueryPane");
00049         mEnableQueryPane = options.GetBool("enableLargeQueryPane");
00050 
00051         if (!mEnableMiniQueryPane && !mEnableQueryPane)
00052         {
00053             ILOG_INFO("No query pane selected: enabling large pane.");
00054             mEnableQueryPane = true;
00055         }
00056 
00057         ILOG_STARTACTION("building GUI", ILOG_LEVEL_INFO);
00058         BuildGUI(oglWnd, options.GetInt("wndWidth"), options.GetInt("wndHeight"));
00059         ILOG_ENDACTION("building GUI");  
00060     }
00061 
00062     void Go()
00063     {
00064         if (mStartWithMovies)
00065         {
00066             ILOG_INFO("Dispatching initial query...");
00067             mScrnBrowser->DoInitialQuery();
00068         }
00069 
00070         ILOG_INFO("Starting main loop...");
00071         AppController::Instance().MainLoop();
00072     }
00073 
00074     virtual void
00075     PlayFileEvent(int videoID)
00076     {
00077         // we should switch to the PLAY tab:
00078         mScrnTabs->GotoTab(TAB_PLAY);
00079     }
00080 
00081     virtual void
00082     ViewCrimeSceneEvent()
00083     {
00084         mScrnTabs->GotoTab(TAB_RECONSTRUCT);
00085     }
00086 
00087     virtual void
00088     ViewBrowserEvent()
00089     {
00090         mScrnTabs->GotoTab(TAB_BROWSE);
00091     }
00092 
00093     virtual void
00094     QueryByRegionEvent(int keyframe, float x, float y, float w, float h)
00095     {
00096         mScrnTabs->GotoTab(TAB_BROWSE);
00097     }
00098 
00099 
00100 
00101 private:
00102     void
00103     BuildGUI(OGLWND* oglWnd, int w, int h)
00104     {
00105         OglGui::Window *wndStub;
00106         wndStub = new OglGui::Window(oglWnd);
00107         wndStub->SetBackground(oglGUI_BG);
00108 
00109         mScrnTabs = new ScreenTabs(wndStub, w,h);
00110         mScrnTabs->ConnectTo(wndStub);
00111 
00112         // define ONE appcontrol for the entire application, to handle
00113         // global keys and manage the dossier state.
00114         // all other screens rely on this appcontrol for state change info and events.
00115         mAppControlDoc = new AppControlDoc(TAB_DOSSIER, mEngine->SegmentationDocument());
00116 
00117         // attach this appcontrol to the AppController:
00118         Visualization::AppController::Instance().AddControl((AppControlDoc*)mAppControlDoc);
00119 
00120         mScrnBrowser = new ScreenBrowser(mScrnTabs->MakeTab("Search through dataset", TAB_BROWSE));
00121         mScrnBrowser->SetControlId(TAB_BROWSE);
00122         Visualization::AppController::Instance().AddControl(mScrnBrowser);
00123 
00124         mScrnPlay = new ScreenPlay(mScrnTabs->MakeTab("VideoParts", TAB_PLAY), mEngine->SegmentationDocument());
00125         mScrnPlay->SetControlId(TAB_PLAY);
00126         Visualization::AppController::Instance().AddControl(mScrnPlay);
00127 
00128         mScrnDossier = new ScreenDossier(mScrnTabs->MakeTab("Dossier", TAB_DOSSIER));
00129         mScrnDossier->SetControlId(TAB_DOSSIER);
00130         Visualization::AppController::Instance().AddControl(mScrnDossier);
00131 
00132         if (mEnableQueryPane)
00133         {
00134             mScrnQuery = new ScreenQuery(mScrnTabs->MakeTab("Query", TAB_QUERY), mScrnBrowser);
00135             mScrnQuery->SetControlId(TAB_QUERY);
00136             Visualization::AppController::Instance().AddControl(mScrnQuery);
00137         }
00138         else
00139             mScrnQuery = 0;
00140 
00141 
00142         // attach dossier management to screens:
00143         mScrnDossier->SetAppControlDoc(mAppControlDoc, TAB_DOSSIER);
00144         mScrnTabs->SetAppControlDoc(mAppControlDoc, TAB_TABS);
00145         mScrnBrowser->SetAppControlDoc(mAppControlDoc, TAB_BROWSE);
00146         mScrnPlay->SetAppControlDoc(mAppControlDoc, TAB_PLAY);       
00147         mScrnDossier->AddDossierListener(this);
00148 
00149         mScrnTabs->GetTabs()->ScaleTabBar(true);
00150         mScrnTabs->GotoTab(TAB_BROWSE);
00151     }
00152 
00153     bool mStartWithMovies, mEnableQueryPane, mEnableMiniQueryPane;
00154 
00155     ScreenDossier*          mScrnDossier;
00156     ScreenBrowser*          mScrnBrowser;
00157     ScreenPlay*             mScrnPlay;
00158     ScreenQuery*            mScrnQuery;
00159     ScreenTabs              *mScrnTabs;
00160 
00161     AppControlDoc *mAppControlDoc;
00162 
00163     TrecEngine *mEngine;
00164 
00165 public:
00166     const static int TAB_PLAY = 1;
00167     const static int TAB_BROWSE = 2;
00168     const static int TAB_RECONSTRUCT = 3;
00169     const static int TAB_DOSSIER = 4;
00170     const static int TAB_TABS = 5;
00171     const static int TAB_TABSB = 6;
00172     const static int TAB_QUERY = 7;
00173     const static int TAB_TLINEVIDEO = 8;
00174 
00175     ILOG_VAR_DEC;
00176 
00177 }; //class IDash
00178 
00179 ILOG_VAR_INIT(IDash, Application.IDash);
00180 
00181 int mainIDash(OGLWND* oglWnd)
00182 {
00183     int argc = 3;
00184     char* argv[] = { "Test", "--ini", "trecsearch.ini" };
00185     OglInit(&argc, &argv[0]);
00186 
00187     // configuration:
00188     Impala::CmdOptions& options = Impala::CmdOptions::GetInstance();
00189     options.Initialise(true, false, true);
00190     options.SetDefault("wndWidth", "1280");
00191     options.SetDefault("wndHeight", "975");
00192 
00193     options.AddOption(0, "noArchive", "", "0");
00194     options.AddOption(0, "imFileArchive", "", "0");
00195     options.AddOption(0, "imServer", "name", "");
00196 
00197     options.AddOption(0, "maxImagesOnRow", "", "99");
00198 
00199     options.AddOption(0, "actionloglevel", "0=all .. 10=nothing", "2");
00200     options.AddOption(0, "loglevel", "0=all .. 10=nothing", "2");
00201     options.AddOption(0, "logfile", "filename", "trecsearch.log");
00202     options.AddOption(0, "logtofile", "0 = no, 1 = yes", "1");
00203    
00204     options.AddOption(0, "mdBrowserUseKeyframes", "0=no, thumbnails, 1=yes, only center, 2=yes, always", "0");
00205     options.AddOption(0, "mdBrowserAspectRatio", "0=automatic, else value", "0");
00206     options.AddOption(0, "mdBrowserHighResDistance", "nr of shots from center, 0=only center", "0");
00207 
00208     // enable in browser mini-query pane
00209     options.AddOption(0, "enableLargeQueryPane", "", "0");
00210     options.AddOption(0, "enableInBrowserQueryPane", "", "0");
00211     options.AddOption(0, "startWithMovies", "", "0");
00212     if (! options.ParseArgs(argc, argv, "", 0))
00213         return 1;
00214 
00215     ILOG_VAR(Application.IDash.mainIDash);
00216 
00217     int oldW = oglWnd->width;
00218     int oldH = oglWnd->height;
00219 
00220     oglWnd->width  = options.GetInt("wndWidth");
00221     oglWnd->height = options.GetInt("wndHeight");
00222 
00223     ILOG_SYSTEM("LOADING......");
00224     Impala::Application::IDash::IDash *d =
00225         new Impala::Application::IDash::IDash(oglWnd);
00226     oglWnd->width  = oldW;
00227     oglWnd->height = oldH;
00228     ILOG_SYSTEM("STARTING -----------------------------");
00229     d->Go();
00230     ILOG_SYSTEM("STOPPING -----------------------------");
00231     return 0;
00232 }
00233 
00234 } //namespace
00235 } //namespace
00236 } //namespace
00237 
00238 /*
00239 int
00240 main(int argc, char* argv[])
00241 {
00242     OGLWND* wnd1 = oglSys.CreateOGLWND(0,0,1260, 960);
00243     //OGLWND* wnd2 = oglSys.CreateOGLWND(0,0,1260, 960);
00244     OGLStart(wnd1);
00245     //OGLStart(wnd2);
00246     return Impala::Application::IDash::mainIDash(wnd1, 0);
00247 }
00248 */
00249 
00250 extern "C" void C_IDash(OGLWND* wnd1)
00251 {
00252     Impala::Application::IDash::mainIDash(wnd1);
00253 }

Generated on Thu Jan 13 09:03:39 2011 for ImpalaSrc by  doxygen 1.5.1