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

mainImBrowse.cpp

Go to the documentation of this file.
00001 #pragma warning( disable : 4786 )
00002 
00003 #include "OglGui/Tabs.h"
00004 #include "Core/ImageSet/MakeIxsDocument.h"
00005 #include "Visualization/IxsDocumentGuiMain.h"
00006 
00007 
00008 // since we are not using libraries:
00009 #include "OglGui/OglLib.cpp"
00010 #include "Link/ImpalaLib.cpp"
00011 
00012 namespace Impala
00013 {
00014 namespace Application
00015 {
00016 
00017 
00018 using namespace Core::ImageSet;
00019 using namespace Visualization;
00020 
00021 class WindowImBrowse : 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_IXS = 2;
00028 
00029     WindowImBrowse(int width, int height) : Window(0, 0, width, height, true)
00030     {
00031         CmdOptions& options = CmdOptions::GetInstance();
00032         mCmd = options.GetArg(0);
00033         std::string setName = options.GetArg(1);
00034         mIxsDoc = MakeIxsDocument(setName);
00035         mIxsDoc->GetImageSet()->SetImageSrc(options.GetBool("imArchive"),
00036                                             options.GetBool("imFileArchive"),
00037                                             options.GetBool("imSplitArchive"));
00038         BuildGUI(width, height);
00039         AppController::Instance().MainLoop();
00040     }
00041 
00042     // specialization of base classes
00043 
00044     virtual void
00045     TabSelectionEvent(OglGui::Tabs* src, int tabNr, void* listenerData,
00046                       int tabControlData)
00047     {
00048         AppController::Instance().SetCurrentControl(tabControlData);
00049     }
00050 
00051 private:
00052 
00053     void
00054     BuildGUI(int wndWidth, int wndHeight)
00055     {
00056         SetBackground(0xffd2c799);
00057         AppController& ctr = AppController::Instance();
00058         mTabs = new OglGui::Tabs(this, wndWidth, wndHeight);
00059         mTabs->SetTabsListener(this);
00060         int line = 22;
00061         OglGui::Window* tab;
00062         tab = mTabs->CreateTab("Data set", -1, TAB_SET);
00063         DataDocumentGui<IxsDocument>* dataGui =
00064             new DataDocumentGui<IxsDocument>(tab, wndWidth, wndHeight, mIxsDoc,
00065                                              TAB_SET);
00066         ctr.AddControl((AppControlDoc*) dataGui);
00067 
00068         tab = mTabs->CreateTab("Ixs", -1, TAB_IXS);
00069         int nrImOnRow = 7; // -1 to skip
00070         int imWidth = 176;
00071         int imHeight = 120;
00072         int height = wndHeight;
00073         mIxsDocMain = new IxsDocumentGuiMain(tab, wndWidth, height, nrImOnRow,
00074                                              imWidth, imHeight, 1.0, true,
00075                                              mIxsDoc, TAB_IXS);
00076         ctr.AddControl((AppControlDoc*) mIxsDocMain);
00077 
00078         mTabs->SetActiveTab(0);
00079     }
00080 
00081     std::string  mCmd;
00082     IxsDocument* mIxsDoc;
00083 
00084     OglGui::Tabs*           mTabs;
00085     IxsDocumentGuiMain*     mIxsDocMain;
00086 
00087 };
00088 
00089 int
00090 mainImBrowse(int argc, char* argv[])
00091 {
00092     CmdOptions& options = CmdOptions::GetInstance();
00093     options.Initialise(true, false, true);
00094     options.SetDefault("wndWidth", "1270");
00095     options.SetDefault("wndHeight", "975");
00096     options.AddOption(0, "imArchive", "", "0");
00097     options.AddOption(0, "imFileArchive", "", "0");
00098     options.AddOption(0, "imSplitArchive", "", "0");
00099     options.AddOption(0, "imServer", "name", "");
00100     std::string usageStr = "cmd data\n\n";
00101     usageStr += "  cmd = nop\n";
00102     usageStr += "  data = set.txt|anno.ixs|file\n\n";
00103     if (! options.ParseArgs(argc, argv, usageStr, 2))
00104         return 1;
00105 
00106     int reqWndWidth = options.GetInt("wndWidth");
00107     int reqWndHeight = options.GetInt("wndHeight");
00108     WindowImBrowse* wnd = new WindowImBrowse(reqWndWidth, reqWndHeight);
00109     if (! wnd->Valid())
00110     {
00111         std::cout << "WindowImBrowse failed" << std::endl;
00112         return 0;
00113     }
00114     return 1;
00115 }
00116 
00117 } // namespace Application
00118 } // namespace Impala
00119 
00120 int
00121 main(int argc, char* argv[])
00122 {
00123     return Impala::Application::mainImBrowse(argc, argv);
00124 }

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