LTI-Lib latest version v1.9 - last update 10 Apr 2010

ltiScene3DViewer.h

00001 /*
00002  * Copyright (C) 2003, 2004, 2005, 2006
00003  * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany
00004  *
00005  * This file is part of the LTI-Computer Vision Library (LTI-Lib)
00006  *
00007  * The LTI-Lib is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License (LGPL)
00009  * as published by the Free Software Foundation; either version 2.1 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * The LTI-Lib is distributed in the hope that it will be
00013  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00014  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with the LTI-Lib; see the file LICENSE.  If
00019  * not, write to the Free Software Foundation, Inc., 59 Temple Place -
00020  * Suite 330, Boston, MA 02111-1307, USA.
00021  */
00022 
00023 /*----------------------------------------------------------------
00024  * project ....: LTI Digital Image/Signal Processing Library
00025  * file .......: ltiScene3DViewer.h
00026  * authors ....: Jens Paustenbach
00027  * organization: LTI, RWTH Aachen
00028  * creation ...: 17.1.2003
00029  * revisions ..: $Id: ltiScene3DViewer.h,v 1.7 2006/02/08 12:57:35 ltilib Exp $
00030  */
00031 
00032 #ifndef _LTI_SCENE_3_D_VIEWER_H_
00033 #define _LTI_SCENE_3_D_VIEWER_H_
00034 
00035 #include "ltiConfig.h"
00036 
00037 #ifdef HAVE_GTK
00038 
00039 #include "ltiViewerBase3D.h"
00040 #include "ltiScene3D.h"
00041 
00042 
00043 namespace lti {
00044 
00045   /**
00046    * View a scene3D object.
00047    * This class provides the possiblity to show a scene3D object in a three
00048    * dimensional view.
00049    * This class only excepts colored scenes. This means that you can only
00050    * show object like scene3D<rgbPixel>.
00051    */
00052   class scene3DViewer : public viewerBase3D {
00053   public:
00054 
00055 
00056     /**
00057      * the parameters for the class viewerBase3D
00058      */
00059     class parameters : public viewerBase3D::parameters {
00060     public:
00061       /**
00062        * default constructor
00063        */
00064       parameters();
00065 
00066       /**
00067        * copy constructor
00068        * @param other the parameters object to be copied
00069        */
00070       parameters(const parameters& other);
00071 
00072       /**
00073        * destructor
00074        */
00075       ~parameters();
00076 
00077       /**
00078        * returns name of this type
00079        */
00080       const char* getTypeName() const;
00081 
00082       /**
00083        * copy the contents of a parameters object
00084        * @param other the parameters object to be copied
00085        * @return a reference to this parameters object
00086        */
00087       virtual parameters& copy(const parameters& other);
00088 
00089       /**
00090        * returns a pointer to a clone of the parameters
00091        */
00092       virtual functor::parameters* clone() const;
00093 
00094       /**
00095        * write the parameters in the given ioHandler
00096        * @param handler the ioHandler to be used
00097        * @param complete if true (the default) the enclosing begin/end will
00098        *        be also written, otherwise only the data block will be written.
00099        * @return true if write was successful
00100        */
00101       virtual bool write(ioHandler& handler,const bool complete=true) const;
00102 
00103       /**
00104        * read the parameters from the given ioHandler
00105        * @param handler the ioHandler to be used
00106        * @param complete if true (the default) the enclosing begin/end will
00107        *        be also written, otherwise only the data block will be written.
00108        * @return true if write was successful
00109        */
00110       virtual bool read(ioHandler& handler,const bool complete=true);
00111 
00112 #     ifdef _LTI_MSC_6     
00113       /**
00114        * this function is required by MSVC only, as a workaround for a
00115        * very awful bug, which exists since MSVC V.4.0, and still by
00116        * V.6.0 with all bugfixes (so called "service packs") remains
00117        * there...  This method is also public due to another bug, so please
00118        * NEVER EVER call this method directly: use read() instead
00119        */
00120       bool readMS(ioHandler& handler,const bool complete=true);
00121 
00122       /**
00123        * this function is required by MSVC only, as a workaround for a
00124        * very awful bug, which exists since MSVC V.4.0, and still by
00125        * V.6.0 with all bugfixes (so called "service packs") remains
00126        * there...  This method is also public due to another bug, so please
00127        * NEVER EVER call this method directly: use write() instead
00128        */
00129       bool writeMS(ioHandler& handler,const bool complete=true) const;
00130 #     endif
00131 
00132       // ------------------------------------------------
00133       // the parameters
00134       // ------------------------------------------------
00135 
00136       /**
00137        * Informational parameter
00138        */
00139       //@{
00140 
00141       /** 
00142        * the ranges of grid, if grid is shown
00143        */
00144       dmatrix ranges;
00145 
00146       //@}
00147 
00148     };
00149   
00150 
00151     /**
00152      * default constructor
00153      */
00154     scene3DViewer(bool createDefaultParameters = true);
00155 
00156     /**
00157      * copy constructor
00158      * @param other the object to be copied
00159      */
00160     scene3DViewer(const scene3DViewer& other);
00161 
00162     /**
00163      * constructor with windows title
00164      */
00165     scene3DViewer(const std::string& title);
00166 
00167     /**
00168      * constructor with windows title
00169      */
00170     scene3DViewer(const char* title);
00171 
00172     /**
00173      * destructor
00174      */
00175     virtual ~scene3DViewer();
00176 
00177     /**
00178      * returns the name of this type ("scene3DViewer")
00179      */
00180     virtual const char* getTypeName() const;
00181 
00182     /**
00183      * copy data of "other" functor.
00184      * @param other the functor to be copied
00185      * @return a reference to this functor object
00186      */
00187     scene3DViewer& copy(const scene3DViewer& other);
00188 
00189     /**
00190      * alias for copy member
00191      * @param other the functor to be copied
00192      * @return a reference to this functor object
00193      */
00194     scene3DViewer& operator=(const scene3DViewer& other);
00195 
00196     /**
00197      * returns a pointer to a clone of this functor.
00198      */
00199     virtual viewerBase* clone() const;
00200 
00201     /**
00202      * returns used parameters
00203      */
00204     const parameters& getParameters() const;
00205 
00206     /**
00207      * shows a color image.
00208      * @param scene the object to be shown.
00209      * @return true if successful, false otherwise.
00210      */
00211      bool show(scene3D<rgbPixel>& scene);
00212 
00213   protected:
00214 
00215     /**
00216      * return a new instance of the mainWindow class.
00217      *
00218      * This class must be reimplemented in order to get the
00219      * proper class instance.
00220      */
00221     virtual viewerBase3D::mainWindow* getNewMainWindow() const;
00222 
00223 # ifdef _LTI_MSC_6
00224   public:
00225 # endif
00226 
00227     /**
00228      * GTK Widget for the main class of the histogram viewer
00229      */
00230     class mainWindow : public viewerBase3D::mainWindow {
00231     public:
00232       /**
00233        * default constructor
00234        */
00235       mainWindow();
00236 
00237       /**
00238        * copy constructor
00239        */
00240       mainWindow(const mainWindow& other);
00241 
00242       /**
00243        * destructor
00244        */
00245       ~mainWindow();
00246 
00247       /**
00248        * indicate which data should be used when drawing.
00249        */
00250       void putData(scene3D<rgbPixel>& scene);
00251 
00252       /**
00253        * returns used parameters
00254        */
00255       const parameters& getParameters() const;
00256     protected:
00257 
00258       /**
00259        * a pointer to the scene that is shown
00260        */
00261       scene3D<rgbPixel>* ptScene;
00262       
00263       /**
00264        * draw an image of the scene
00265        */
00266       virtual void dataToImage();
00267 
00268       /**
00269        * prepares the parameters before the settings dialog is started
00270        */
00271       void prepareParameters(void);
00272       
00273 
00274     };    
00275 
00276     class configDialog : public viewerBase3D::configDialog {
00277     public:
00278       /**
00279        * create dialog
00280        */
00281       configDialog();
00282 
00283       /**
00284        * destroy the  dialog
00285        */
00286       virtual ~configDialog();
00287 
00288     protected:
00289       /**
00290        * Inserts all Pages in the main settings dialog
00291        */
00292       virtual void insertPages();
00293 
00294       /**
00295        * Build a page in the main settings dialog
00296        */
00297       pageWidget buildRangePage();
00298 
00299       /**
00300        * gtkWidget which contains the ranges of axes
00301        */
00302       GtkWidget* table1;
00303 
00304       /**
00305        * copy the contents of the dialog in the parameters object
00306        */
00307       virtual bool getDialogData();
00308       
00309       /**
00310        * copy the contents of the parameters object into the dialog entries
00311        */
00312       virtual bool setDialogData();
00313 
00314 #   ifdef _LTI_MSC_6     
00315       /**
00316        * this function is required by MSVC only, as a workaround for a
00317        * very awful bug, which exists since MSVC V.4.0, and still by
00318        * V.6.0 with all bugfixes (so called "service packs") remains
00319        * there...  This method is also public due to another bug, so please
00320        * NEVER EVER call this method directly: use mouseMovedHandler instead
00321        */
00322       bool getDialogDataMS();
00323 
00324       /**
00325        * this function is required by MSVC only, as a workaround for a
00326        * very awful bug, which exists since MSVC V.4.0, and still by
00327        * V.6.0 with all bugfixes (so called "service packs") remains
00328        * there...  This method is also public due to another bug, so please
00329        * NEVER EVER call this method directly: use mouseMovedHandler instead
00330        */
00331       bool setDialogDataMS();
00332 #   endif
00333 
00334 
00335 
00336       };
00337   };
00338 
00339 }
00340 
00341 #endif
00342 #endif

Generated on Sat Apr 10 15:26:07 2010 for LTI-Lib by Doxygen 1.6.1