3dtextur.h

Go to the documentation of this file.
00001 /*** 
00002  * \file gre/3dtextur.h
00003  * \brief Base class for texturing algorithm
00004  *
00005  * \if NODOC
00006  * $Id: 3dtextur.h_v 1.23 2004/09/20 17:37:00 vdronov Exp $
00007  *
00008  * $Log: 3dtextur.h_v $
00009  * Revision 1.23  2004/09/20 17:37:00  vdronov
00010  * added fence drawing
00011  *
00012  * Revision 1.22  2004/09/03 16:56:35  vdronov
00013  * *** empty log message ***
00014  *
00015  * Revision 1.21  2004/08/12 22:17:23  vdronov
00016  * added SetPedestalcoordRef
00017  *
00018  * Revision 1.20  2004/08/12 19:39:10  vdronov
00019  * added ClearPedestal
00020  *
00021  * Revision 1.19  2004/08/11 23:03:51  vdronov
00022  * *** empty log message ***
00023  *
00024  * Revision 1.18  2004/08/03 20:30:04  vdronov
00025  * *** empty log message ***
00026  *
00027  * Revision 1.17  2004/07/30 19:10:05  vdronov
00028  * *** empty log message ***
00029  *
00030  * Revision 1.16  2004/06/28 20:42:43  vdronov
00031  * *** empty log message ***
00032  *
00033  * Revision 1.15  2004/06/17 17:26:47  vdronov
00034  * added formula texture class
00035  *
00036  * Revision 1.14  2004/01/14 01:21:54  vdronov
00037  * made some changes
00038  *
00039  * Revision 1.13  2003/12/22 17:50:07  vdronov
00040  * *** empty log message ***
00041  *
00042  * Revision 1.12  2003/10/02 16:18:21  linux32build!build
00043  * Doxygen
00044  *
00045  * Revision 1.11  2003/09/15 13:48:59  fileserver!dwilliss
00046  * Doxygen
00047  *
00048  * Revision 1.10  2003/08/15 17:03:05  vdronov
00049  * nc
00050  *
00051  * Revision 1.9  2003/08/15 16:55:14  vdronov
00052  * add docs
00053  *
00054  * Revision 1.8  2003/07/30 14:27:36  mju
00055  * Check inclusion guards.
00056  * Ignore private section.
00057  * Make pure virtual methods private.
00058  *
00059  * Revision 1.2  2003/03/24 20:39:15  vdronov
00060  * added forward GRE_LAYER
00061  *
00062  * Revision 1.1  2003/03/10 15:08:04  vdronov
00063  * Initial revision
00064  * \endif
00065 **/ 
00066 
00067 #ifndef  INC_GRE_3DTEXTUR_H
00068 #define  INC_GRE_3DTEXTUR_H
00069 
00070 #ifndef  INC_GRE_3DUTILS
00071 #include <gre/3dutils.h>
00072 #endif
00073 
00074 #ifndef  INC_GRE_3DSCENE
00075 #include <gre/3dscene.h>
00076 #endif
00077 
00078 #ifndef  INC_MI32_MGD2
00079 #include <mi32/mgd2.h>
00080 #endif
00081 
00082 #ifndef GENERATING_DOXYGEN_OUTPUT
00083 class GRE_LAYER;
00084 #endif // GENERATING_DOXYGEN_OUTPUT
00085 
00086 namespace GRE {
00087 
00088 #ifndef GENERATING_DOXYGEN_OUTPUT
00089 class TEXTUREFILTER;
00090 class CONTROLLER;
00091 class TERRAIN;
00092 class DRAWINGCONTEXT3D;
00093 class BOUNDPARM;
00094 #endif // GENERATING_DOXYGEN_OUTPUT
00095 
00096 //! Base class for 3D texture models.
00097 class TEXTURE {
00098    public:
00099 
00100       enum MODEL {
00101          MODEL_Default = 0,
00102          MODEL_SimpleRaster = 0,
00103          MODEL_Formula = 1,
00104          MODEL_Count = 2
00105          };
00106 
00107       //! GetName returns a name of the given model enum
00108       //!
00109       //! @return char pointer of the name
00110       static const char* GetName (
00111          MODEL model
00112          );
00113 
00114       //! GetDescription returns a description of the given model enum
00115       //!
00116       //! @return char pointer of the description
00117       static const char* GetDescription (
00118          MODEL model
00119          );
00120 
00121       //! GetInstance returns a new instance of the given model enum
00122       //!
00123       //! @return pointer to new model
00124       static TEXTURE* GetInstance (
00125          MODEL model
00126          );
00127 
00128       virtual ~TEXTURE (                        //! Destructor
00129          );
00130 
00131       //! GetName returns a name of the model
00132       //!
00133       //! @return char pointer of the name
00134       const char* GetName (
00135          ) const;
00136 
00137       //! GetDescription returns a description of the model
00138       //!
00139       //! @return char pointer of the description
00140       const char* GetDescription (
00141          ) const;
00142 
00143       //! GetModel returns an enum of the model
00144       //!
00145       //! @return enum of the model
00146       const MODEL GetModel (
00147          ) const {return m_Model; };
00148 
00149       //! Create new instance of texture model
00150       //!
00151       //! @return instance of texture model
00152       TEXTURE* CreateInstance (
00153          ) { return v_CreateInstance(); };
00154 
00155       //!   Build internal structures for texture construction for given drape layer 
00156       //!
00157       //! @return 0 if built or < 0 if an error
00158       ERRVALUE Build (
00159          const GRE_LAYER* layer
00160          ) { return v_Build(layer); };
00161 
00162       //!   Free internal structures for texture construction 
00163       void Free (
00164          ) { v_Free(); return; };
00165 
00166       //!   Is internal structures for texture construction built? 
00167       //!
00168       //! @return true if built or false if an error
00169       bool IsBuilt (
00170          );
00171 
00172       //! Begining of texture retriving for given scene
00173       void Begin (
00174          const SCENE3D& scene
00175          ) { v_Begin(scene); return; };
00176 
00177       //! Rnding of texture retriving
00178       void End (
00179          ) { v_End(); return; };
00180 
00181       //! Get extents in map projection coordinates
00182       //!
00183       //! @return extents
00184       const DRECT2D& GetExtents (
00185          ) { return v_GetExtents(); };
00186 
00187       //! Set model map projection be used for output data
00188       void SetCoordRefSys (
00189          const SPATREF::COORDREFSYS& CoordRefSys
00190          ) { SetPedestalCoordRefSys(CoordRefSys); v_SetCoordRefSys(CoordRefSys); return; };
00191 
00192       //! Get map projection be used for output data 
00193       //!
00194       //! @return MAPPROJPARM
00195       const SPATREF::COORDREFSYS GetCoordRefSys (
00196          ) { return v_GetCoordRefSys(); };
00197 
00198       //! Get color for given cell and depth
00199       //!
00200       //! @return true if color was retrived
00201       bool GetColor (
00202          const INT32 line,
00203          const INT32 column,
00204          const UINT8 depth,
00205          COLOR& color 
00206          ) { return v_GetColor(line, column, depth, color); };
00207 
00208       //! Get color for given point in specifyed map projection and depth
00209       //!
00210       //! @return true if color was retrived
00211       bool GetColor (
00212          const DPOINT2D& point,
00213          const UINT8 depth,
00214          COLOR& color 
00215          ) { return v_GetColor(point, depth, color); };
00216 
00217       //! Check if for given depth pyramid tier exist
00218       //!
00219       //! @return the nearest lower depth
00220       UINT8 CheckDepth (
00221          const UINT8 depth
00222          ) { return v_CheckDepth(depth); };
00223 
00224       //! Get transformation from object coordinates to specifyed map projection
00225       //!
00226       //! @return TRANS2D_MAPGEN&
00227       const TRANS2D_MAPGEN& GetTransformationInternalToModel (
00228          ) { return v_GetTransformationInternalToModel(); };
00229 
00230       //!   Set boundary wall pedestal for terrain and texture
00231       //!
00232       //! @return >= 0 if set is done
00233       ERRVALUE SetBoundaryWall (
00234          const SCENE3D& scene,
00235          TERRAIN* terrain
00236          );
00237 
00238       //!   Draw given pedestal
00239       //!
00240       //! @return >= 0 if set is done
00241       ERRVALUE DrawBoundaryWall (
00242          CONTROLLER &controller,        
00243          DRAWINGCONTEXT3D& drawing,
00244          GRE::BOUNDPARM& boundparm
00245          );
00246 
00247       const REGION2D& GetBoundary (
00248          ) { 
00249          if (m_Boundary.IsEmpty()) v_CreateBoundary(m_Boundary); 
00250          return m_Boundary;
00251          };
00252 
00253 
00254       void ClearPedestal (
00255          ) { 
00256          m_PolyLineList.Clear();
00257          return;
00258          };
00259 
00260 
00261       void ClearBoundary (
00262          ) { 
00263          m_Boundary.Clear();
00264          return;
00265          };
00266 
00267       bool IsBoundaryChanged (
00268          ) const { 
00269          return m_Boundary.IsEmpty();
00270          };
00271 
00272    protected:
00273 
00274       //! Register this model (Called by constructor)
00275       static void Register (
00276          TEXTURE* texture
00277          );
00278 
00279       TEXTURE (   
00280          const char* name,
00281          const char* desc,
00282          const MODEL model
00283          );
00284 
00285       //!   Set built state? 
00286       void SetBuilt (
00287          const bool built
00288          );
00289 
00290    private:
00291 
00292       #ifndef GENERATING_DOXYGEN_OUTPUT
00293 
00294       typedef SIMPLE_ARRAY<INT32> BASEINDEX;
00295       typedef MILIST<BASEINDEX> BASEINDEXLIST;
00296 
00297       static TEXTURE* s_TextureModels[MODEL_Count];
00298 
00299       const char* m_Name;
00300       const char* m_Description;
00301       const MODEL m_Model;
00302 
00303       bool m_Built;                             //!<  Is an object built?
00304 
00305       REGION2D m_Boundary;
00306 
00307       REGION2D m_FinalBoundary;
00308       POLYLINELIST m_PolyLineList;
00309       BASEINDEXLIST m_BaseIndexList;
00310       SPATREF::COORDREFSYS m_PolyLineCoordRefSys;
00311       TRIANGULATION m_Triangulation;
00312       SCENE3D *m_Scene;
00313 
00314       TEXTURE (   
00315          );
00316 
00317       TEXTURE (                                 //! Copy constructor (not implemented)
00318          const TEXTURE &rhs
00319          );
00320 
00321       TEXTURE& operator= (                      //! Assignment operator (not implemented)
00322          const TEXTURE& rhs
00323          );
00324 
00325       #endif // GENERATING_DOXYGEN_OUTPUT
00326 
00327       void SetPedestalCoordRefSys (
00328          const SPATREF::COORDREFSYS& CoordRefSys
00329          );
00330 
00331       virtual TEXTURE* v_CreateInstance (
00332          ) = 0;
00333 
00334       virtual ERRVALUE v_Build (
00335          const GRE_LAYER *layer
00336          ) = 0;
00337 
00338       virtual void v_Free (
00339          ) = 0;
00340 
00341       virtual void v_Begin (
00342          const SCENE3D& scene
00343          ) = 0;
00344 
00345       virtual void v_End (
00346          ) = 0;
00347 
00348       virtual const DRECT2D& v_GetExtents (
00349          ) = 0;
00350 
00351       virtual void v_CreateBoundary (
00352          REGION2D& boundary
00353          ) = 0;
00354 
00355       virtual void v_SetCoordRefSys (
00356          const SPATREF::COORDREFSYS& CoordRefSys
00357          ) = 0;
00358 
00359       virtual const SPATREF::COORDREFSYS v_GetCoordRefSys (
00360          ) = 0;
00361 
00362       virtual bool v_GetColor (
00363          const INT32 line,
00364          const INT32 column,
00365          const UINT8 depth,
00366          COLOR& color 
00367          ) = 0;
00368 
00369       virtual bool v_GetColor (
00370          const DPOINT2D& point,
00371          const UINT8 depth,
00372          COLOR& color 
00373          ) = 0;
00374 
00375       virtual UINT8 v_CheckDepth (
00376          const UINT8 depth
00377          ) = 0;
00378 
00379       virtual const TRANS2D_MAPGEN& v_GetTransformationInternalToModel (
00380          ) = 0;
00381 
00382    };
00383 
00384 }     // End of GRE namespace
00385 
00386 #endif
00387 
00388 
00389 

Generated on Tue Dec 14 13:18:12 2004 for TNTsdk by  doxygen 1.3.8-20040913