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

mainVidBrowse.cpp

Go to the documentation of this file.
00001 #include "OglGui/Tabs.h"
00002 #include "Core/VideoSet/MakeVxsDocument.h"
00003 #include "Visualization/VxsDocumentGuiPlay.h"
00004 #include "Visualization/Background.h"
00005 
00006 
00007 // since we are not using libraries:
00008 #include "OglGui/OglLib.cpp"
00009 #include "Link/ImpalaLib.cpp"
00010 
00011 namespace Impala
00012 {
00013 namespace Application
00014 {
00015 
00016 
00017 using namespace Core::VideoSet;
00018 using namespace Visualization;
00019 
00020 // RvB: No OglGui::ButtonListener implemented!
00021 class WindowVidBrowse : public Window, public OglGui::ButtonListener,
00022                         public OglGui::TabsListener
00023 {
00024 public:
00025 
00026     const static int TAB_SET = 1;
00027     const static int TAB_PLAY = 2;
00028     const static int TAB_ANNO = 3;
00029     const static int TAB_FEATURE = 4;
00030     const static int TAB_OVERLAY = 5;
00031 
00032     WindowVidBrowse(int width, int height) : Window(0, 0, width, height, true)
00033     {
00034         CmdOptions& options = CmdOptions::GetInstance();
00035         mViewScale = options.GetDouble("viewScale");
00036         mCmd = options.GetArg(0);
00037         std::string setName = options.GetArg(1);
00038         mVxsDoc = MakeVxsDocument(setName);
00039         BuildGUI(width, height);
00040         AppController::Instance().MainLoop();
00041     }
00042 
00043     // specialization of base classes
00044 
00045     virtual void
00046     TabSelectionEvent(OglGui::Tabs* src, int tabNr, void* listenerData,
00047                       int tabControlData)
00048     {
00049         AppController::Instance().SetCurrentControl(tabControlData);
00050     }
00051 
00052 private:
00053 
00054     void
00055     BuildGUI(int wndWidth, int wndHeight)
00056     {
00057         SetBackground(0xffd2c799);
00058         AppController& ctr = AppController::Instance();
00059         mTabs = new OglGui::Tabs(this, wndWidth, wndHeight);
00060         mTabs->SetTabsListener(this);
00061         int line = 22;
00062         OglGui::Window* tab;
00063         tab = mTabs->CreateTab("Data set", -1, TAB_SET);
00064         DataDocumentGui<VxsDocument>* dataGui =
00065             new DataDocumentGui<VxsDocument>(tab, wndWidth, wndHeight, mVxsDoc,
00066                                              TAB_SET, true, true, false, 1);
00067         ctr.AddControl((AppControlDoc*) dataGui);
00068 
00069         tab = mTabs->CreateTab("Play", -1, TAB_PLAY);
00070         VxsDocumentGuiPlay* play = new VxsDocumentGuiPlay
00071             (tab, wndWidth, wndHeight-150, 352, 288, false, mVxsDoc, TAB_PLAY);
00072         ctr.AddControl((AppControlDoc*) play);
00073 
00074         tab = mTabs->CreateTab("Anno", -1, TAB_ANNO);
00075         VxsDocumentGuiPlay* anno = new VxsDocumentGuiPlay
00076             (tab, wndWidth, wndHeight-150, 352, 288, true, mVxsDoc, TAB_ANNO);
00077         ctr.AddControl((AppControlDoc*) anno);
00078 
00079         tab = mTabs->CreateTab("Vxs Feature", -1, TAB_FEATURE);
00080         VxsDocumentGuiPlay* feat = new VxsDocumentGuiPlay
00081             (tab, wndWidth/2, wndHeight/2, 352, 288, false, mVxsDoc,
00082              TAB_FEATURE, mViewScale);
00083         mFeatWnd = new Window(tab, wndWidth/2-10, wndHeight/2-10, true);
00084         mTextWnd = new OglGui::StringSelector(tab, 350, 6*line);
00085         ctr.AddControl((AppControlDoc*) feat);
00086         if (mCmd == std::string("background"))
00087             feat->AddDocListener(new Background(mVxsDoc, mFeatWnd, mViewScale));
00088 
00089         mTabs->SetActiveTab(0);
00090     }
00091 
00092     std::string  mCmd;
00093     VxsDocument* mVxsDoc;
00094     double       mViewScale;
00095 
00096     OglGui::Tabs*           mTabs;
00097     OglGui::StringSelector* mTextWnd;
00098     Visualization::Window*  mFeatWnd;
00099 
00100 };
00101 
00102 int
00103 mainVidBrowse(int argc, char* argv[])
00104 {
00105     CmdOptions& options = CmdOptions::GetInstance();
00106     options.Initialise(true, false, true);
00107     options.SetDefault("wndWidth", "1270");
00108     options.SetDefault("wndHeight", "975");
00109     std::string usageStr = "cmd data\n\n";
00110     usageStr += "  cmd = nop|sift|keypoints|keypoints_all|pixconcept|rects|\n";
00111     usageStr += "        background\n";
00112     usageStr += "  data = set.txt|anno.ixs|file\n\n";
00113     if (! options.ParseArgs(argc, argv, usageStr, 2))
00114         return 1;
00115 
00116     int reqWndWidth = options.GetInt("wndWidth");
00117     int reqWndHeight = options.GetInt("wndHeight");
00118     WindowVidBrowse* wnd = new WindowVidBrowse(reqWndWidth, reqWndHeight);
00119     if (! wnd->Valid())
00120     {
00121         std::cout << "WindowVidBrowse failed" << std::endl;
00122         return 0;
00123     }
00124     return 1;
00125 }
00126 
00127 } // namespace Application
00128 } // namespace Impala
00129 
00130 int
00131 main(int argc, char* argv[])
00132 {
00133     return Impala::Application::mainVidBrowse(argc, argv);
00134 }

Generated on Fri Mar 19 09:30:31 2010 for ImpalaSrc by  doxygen 1.5.1