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
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
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() {
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
00042 ScreenBase::SetEngine(mEngine);
00043
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(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
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(int w, int h)
00104 {
00105
00106
00107
00108
00109
00110
00111 mScrnTabs = new ScreenTabs(w,h);
00112
00113
00114
00115
00116 mAppControlDoc = new AppControlDoc(TAB_DOSSIER, mEngine->SegmentationDocument());
00117
00118
00119 Visualization::AppController::Instance().AddControl((AppControlDoc*)mAppControlDoc);
00120
00121
00122
00123 mScrnTabsB = new ScreenTabs(w, h);
00124 mScrnBrowser = new ScreenBrowser(mScrnTabs->MakeTab("Search through dataset", TAB_BROWSE));
00125 mScrnBrowser->SetControlId(TAB_BROWSE);
00126 Visualization::AppController::Instance().AddControl(mScrnBrowser);
00127
00128 mScrnPlay = new ScreenPlay(mScrnTabs->MakeTab("VideoParts", TAB_PLAY), mEngine->SegmentationDocument());
00129 mScrnPlay->SetControlId(TAB_PLAY);
00130 Visualization::AppController::Instance().AddControl(mScrnPlay);
00131
00132
00133
00134 mScrnDossier = new ScreenDossier(mScrnTabsB->MakeTab("Dossier", TAB_DOSSIER));
00135 mScrnDossier->SetControlId(TAB_DOSSIER);
00136 Visualization::AppController::Instance().AddControl(mScrnDossier);
00137
00138 if (mEnableQueryPane) {
00139 mScrnQuery = new ScreenQuery(mScrnTabsB->MakeTab("Query", TAB_QUERY), mScrnBrowser);
00140 mScrnQuery->SetControlId(TAB_QUERY);
00141 Visualization::AppController::Instance().AddControl(mScrnQuery);
00142 } else {
00143 mScrnQuery = 0;
00144 }
00145
00146
00147
00148 mScrnDossier->SetAppControlDoc(mAppControlDoc, TAB_DOSSIER);
00149 mScrnTabs->SetAppControlDoc(mAppControlDoc, TAB_TABS);
00150 mScrnBrowser->SetAppControlDoc(mAppControlDoc, TAB_BROWSE);
00151
00152 mScrnPlay->SetAppControlDoc(mAppControlDoc, TAB_PLAY);
00153
00154 mScrnTabsB->SetAppControlDoc(mAppControlDoc, TAB_TABSB);
00155
00156 mScrnDossier->AddDossierListener(this);
00157
00158 mScrnTabs->GetTabs()->ScaleTabBar(true);
00159 mScrnTabs->GotoTab(TAB_BROWSE);
00160 }
00161
00162 bool mStartWithMovies, mEnableQueryPane, mEnableMiniQueryPane;
00163
00164 ScreenDossier* mScrnDossier;
00165 ScreenBrowser* mScrnBrowser;
00166 ScreenPlay* mScrnPlay;
00167 ScreenQuery* mScrnQuery;
00168 ScreenTabs *mScrnTabs, *mScrnTabsB;
00169
00170 AppControlDoc *mAppControlDoc;
00171
00172 TrecEngine *mEngine;
00173
00174 ILOG_VAR_DECL;
00175
00176 public:
00177 const static int TAB_PLAY = 1;
00178 const static int TAB_BROWSE = 2;
00179 const static int TAB_RECONSTRUCT = 3;
00180 const static int TAB_DOSSIER = 4;
00181 const static int TAB_TABS = 5;
00182 const static int TAB_TABSB = 6;
00183 const static int TAB_QUERY = 7;
00184 const static int TAB_TLINEVIDEO = 8;
00185
00186 };
00187
00188 ILOG_VAR_INIT(IDash, Impala.Application.IDash);
00189
00190
00191 int mainIDash(int argc, char* argv[])
00192 {
00193 OglInit(&argc, &argv[0]);
00194
00195
00196 Impala::CmdOptions& options = Impala::CmdOptions::GetInstance();
00197 options.Initialise(true, false, true);
00198 options.SetDefault("wndWidth", "1280");
00199 options.SetDefault("wndHeight", "975");
00200
00201 options.AddOption(0, "noArchive", "", "0");
00202 options.AddOption(0, "imFileArchive", "", "0");
00203 options.AddOption(0, "imServer", "name", "");
00204
00205 options.AddOption(0, "maxImagesOnRow", "", "99");
00206
00207 options.AddOption(0, "actionloglevel", "0=all .. 10=nothing", "2");
00208 options.AddOption(0, "loglevel", "0=all .. 10=nothing", "2");
00209 options.AddOption(0, "logfile", "filename", "trecsearch.log");
00210 options.AddOption(0, "logtofile", "0 = no, 1 = yes", "1");
00211
00212 options.AddOption(0, "mdBrowserUseKeyframes", "0=no, thumbnails, 1=yes, only center, 2=yes, always", "0");
00213 options.AddOption(0, "mdBrowserAspectRatio", "0=automatic, else value", "0");
00214 options.AddOption(0, "mdBrowserHighResDistance", "nr of shots from center, 0=only center", "0");
00215
00216
00217 options.AddOption(0, "enableLargeQueryPane", "", "0");
00218 options.AddOption(0, "enableInBrowserQueryPane", "", "0");
00219 options.AddOption(0, "startWithMovies", "", "0");
00220 if (! options.ParseArgs(argc, argv, "", 0))
00221 return 1;
00222
00223 ILOG_VAR(Impala.Application.IDash.mainIDash);
00224
00225 ILOG_SYSTEM("LOADING......");
00226 Impala::Application::IDash::IDash *d = new Impala::Application::IDash::IDash();
00227 ILOG_SYSTEM("STARTING -----------------------------");
00228 d->Go();
00229 ILOG_SYSTEM("STOPPING -----------------------------");
00230 return 0;
00231 }
00232
00233 }
00234 }
00235 }
00236
00237 int
00238 main(int argc, char* argv[])
00239 {
00240 return Impala::Application::IDash::mainIDash(argc, argv);
00241 }
00242