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

ScreenReconstruction.h

Go to the documentation of this file.
00001 /***********************************************************************************
00002  *
00003  * Application: Investigator's Dashboard (MultimediaN project 6)
00004  * 
00005  * Screen: Dossier
00006  *
00007  * Primary author(s): Ork
00008  *                  : Frank
00009  *                  : 
00010  ***********************************************************************************/
00011 
00012 #ifndef Impala_Application_IDash_ScreenReconstruction_h
00013 #define Impala_Application_IDash_ScreenReconstruction_h
00014 
00015 #include "ScreenBase.h"
00016 
00017 #include "Visualization/VideoPlayer.h"
00018 #include "OglGui/FramesPerSecond.h"
00019 #include "Core/VideoSet/VideoSet.h"
00020 #include "Visualization/ViewWithRect.h"
00021 
00022 #include "Core/Array/Arrays.h"
00023 #include "Core/Array/ReadFile.h"
00024 
00025 #include "WindowView2DWithRect.h"
00026 
00027 namespace Impala {
00028 namespace Application {
00029 namespace IDash {
00030 
00031 //using namespace OglGui;
00032 
00033 class ReconstructionListener
00034 {
00035 public:
00036     virtual void
00037     QueryByRegionEvent(int keyframe, float x, float y, float w, float h)
00038     {
00039     }
00040 };
00041 
00042 class ScreenReconstruction : public ScreenBase,
00043                              public OglGui::WindowView2DWithRectListener
00044 {
00045 public:
00046     typedef OglGui::Window                         Window;
00047     typedef OglGui::Button                         Button;
00048     typedef OglGui::WindowView2DWithRect           WindowView2DWithRect;
00049     typedef OglGui::WindowView2DWithRectListener   WindowView2DWithRectListener;
00050     typedef Visualization::VideoPlayer             VideoPlayer;
00051 
00052     ScreenReconstruction(int width, int height) :
00053         ScreenBase(width, height)
00054     {
00055         InitScreen();
00056     }
00057 
00058     ScreenReconstruction(OglGui::Window *parent, int width, int height) :
00059         ScreenBase(parent, width, height)
00060     {
00061         InitScreen();
00062     }
00063 
00064     ScreenReconstruction(OglGui::Window *parent) :
00065         ScreenBase(parent)
00066     {
00067         InitScreen();
00068     }
00069 
00070     void
00071     AddReconstructionListener(ReconstructionListener *listener)
00072     {
00073         mListeners.push_back(listener);
00074     }
00075 
00076     void
00077     OnRectangleSelect(float x, float y, float w, float h)
00078     {
00079         ILOG_DEBUG("Region selected in panorama, sending keyframe 4145...");
00080         for (int i=0; i<mListeners.size();i++)
00081             mListeners[i]->QueryByRegionEvent(4145 , x, y, w, h);
00082     }
00083 
00084     
00085 private:
00086 
00087      // handlers:
00088 
00089     virtual void
00090     ButtonSelectionEvent(Button *src, void* vData)
00091     {
00092         int userData = (int)(long long)vData;
00093         switch (userData) {
00094             case BTN_PLAY:
00095                 ILOG_DEBUG("BTN: play crime scene video");
00096                 Play();
00097             break;
00098             case BTN_STOP:
00099                 ILOG_DEBUG("BTN: stop crime scene video");
00100                 Stop();
00101             break;
00102         }
00103     }
00104 
00105     void
00106     CheckLoad()
00107     {
00108         if (!mLoaded)
00109             mPlayer->OpenVideo(Engine()->ThreadSet()->GetSegmentation()->GetVideoSet()->GetVideo(mCrimeScene), -1, 1, 0);
00110         mLoaded = true;
00111     }
00112 
00113     void
00114     Toggle()
00115     {
00116         if (mPlayer->Playing())
00117             Stop();
00118         else
00119             Play();
00120     }
00121 
00122     void
00123     Play()
00124     {
00125         CheckLoad();
00126         mPlayer->Play();
00127     }
00128 
00129     void
00130     Stop()
00131     {
00132         mPlayer->Stop();
00133     }
00134 
00135     void
00136     InitScreen()
00137     {
00138         ILOG_DEBUG("constructing screen Dossier");
00139 
00140 
00141         mCrimeScene = 95;
00142         mLoaded = false;
00143 
00144         //scherm bevat (crime scene) video player en panorama plaatje
00145         
00146         //control window
00147         Window *ctrlWnd = new Window(this, W() - 170, H() - 450, 160, 440);
00148         SetAsBox(ctrlWnd);
00149 
00150         Button* play = new Button(ctrlWnd, 8, ctrlWnd->H() - 8 - 120, 116,28,"Play");
00151         play->SetButtonListener(this, BTN_PLAY);
00152         Button* stop = new Button(ctrlWnd, 8, ctrlWnd->H() - 8 - 120 - 120, 116,28,"Stop");
00153         stop->SetButtonListener(this, BTN_STOP);
00154         
00155         ctrlWnd->RepositionViewports();
00156         //videoplayer window
00157 //        Window *playWnd = new Window(this, 30, H() - 450, 420, 380);
00158         Window *playWnd = new Window(this, 30, H() - 450, W() - 200, 440);
00159         SetAsBox(playWnd);
00160         mPlayer = new VideoPlayer(playWnd, playWnd->W(), playWnd->H(), "", "");
00161         mPlayer->NormalSpeed(true);
00162         
00163         
00164         //panorama pic
00165         Window *panWnd = new Window(this, 30, 15, WndWidth() - 60, WndHeight() - 500);
00166         SetAsBox(panWnd);
00167         
00168         //Array2dVec3UInt8* panorama = 0;
00169         //ReadFile(panorama, "icons/panorama.png");
00170         OGLIMAGE *pano = TryReadPNG("icons/panorama.png");
00171         if (pano)
00172         {
00173             WindowView2DWithRect *panorama = new WindowView2DWithRect(panWnd, 0, 0, panWnd->W(), panWnd->H(), pano);
00174             panorama->SetListener(this);
00175         }
00176 
00177         RepositionViewports();
00178         ScaleChildren();
00179     }
00180 
00181     OGLIMAGE*       oglIm;
00182     
00183     VideoPlayer*    mPlayer;
00184 
00185     int mCrimeScene;
00186     bool mLoaded;
00187     std::vector<ReconstructionListener*> mListeners;
00188 
00189     const static int BTN_PLAY = 1;
00190     const static int BTN_STOP = 2;
00191 
00192     ILOG_VAR_DEC;
00193 };
00194 
00195 ILOG_VAR_INIT(ScreenReconstruction, IDash);
00196 
00197 
00198 }
00199 }
00200 }
00201 
00202 #endif

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