3ddryter.h

Go to the documentation of this file.
00001 /*** 
00002  * \file 3ddryter.h <gre/3ddryter.h>
00003  * \brief Dense Ray Casting Triangulation
00004  *
00005  * \if NODOC
00006  * $Id: 3ddryter.h_v 1.9 2004/09/03 16:54:32 vdronov Exp $
00007  *
00008  * $Log: 3ddryter.h_v $
00009  * Revision 1.9  2004/09/03 16:54:32  vdronov
00010  * *** empty log message ***
00011  *
00012  * Revision 1.8  2004/08/11 22:58:51  vdronov
00013  * *** empty log message ***
00014  *
00015  * Revision 1.7  2004/07/30 19:06:04  vdronov
00016  * *** empty log message ***
00017  *
00018  * Revision 1.6  2004/06/29 15:10:59  vdronov
00019  * *** empty log message ***
00020  *
00021  * Revision 1.5  2003/09/15 13:48:59  fileserver!dwilliss
00022  * Doxygen
00023  *
00024  * Revision 1.4  2003/08/19 17:23:20  vdronov
00025  * fixed screenrect problrm
00026  *
00027  * Revision 1.3  2003/08/15 15:43:20  vdronov
00028  * nc
00029  *
00030  * Revision 1.2  2003/07/30 13:42:41  mju
00031  * Check inclusion guards.
00032  * Ignore private section.
00033  *
00034  * Revision 1.1  2003/05/28 19:26:51  vdronov
00035  * Initial revision
00036  * \endif
00037 **/ 
00038 
00039 #ifndef  INC_GRE_3DDRYTER_H
00040 #define  INC_GRE_3DDRYTER_H
00041 
00042 #ifndef  INC_GRE_3DTERRA_H
00043 #include <gre/3dterra.h>
00044 #endif
00045 
00046 #ifndef  INC_GRE_3DSCENE_H
00047 #include <gre/3dscene.h>
00048 #endif
00049 
00050 #ifndef  INC_MI32_ASURFACE_H
00051 #include <mi32/asurface.h>
00052 #endif
00053 
00054 #ifndef  INC_MI32_SIMPLEAR_H
00055 #include <mi32/simplear.h>
00056 #endif
00057 
00058 #ifndef  INC_RVC_OBJECT_H
00059 #include <rvc/object.h>
00060 #endif
00061 
00062 #ifndef  INC_RVC_GEOREFER_H
00063 #include <rvc/georefer.h>
00064 #endif
00065 
00066 namespace GRE {
00067 
00068 //! Dense ray-casting terrain model. 
00069 class DENSERAYCASTING : public TERRAIN {
00070    public:
00071 
00072       DENSERAYCASTING (                         //! Constructor 
00073          );
00074 
00075       ~DENSERAYCASTING (                        //! Destructor 
00076          );
00077 
00078    private:
00079       #ifndef GENERATING_DOXYGEN_OUTPUT
00080 
00081       struct ORDER {
00082          INT32 index;
00083          float distance;
00084          };
00085 
00086       struct INTERSECTION {
00087          const DOUBLE_ARRAY<double>& m_Buffer;
00088          const INT32 m_NumCells;
00089          const DPOINT3D m_Min;
00090          const DPOINT3D m_Max;
00091          const bool m_HasNullValue;
00092          const double m_NullValue;
00093          const DPOINT3D& m_Viewer;
00094          const DPOINT3D& m_Direction;
00095          const bool m_IsPerspective;
00096 
00097          POLYLINE m_Polyline;
00098 
00099          INTERSECTION (
00100             const DOUBLE_ARRAY<double>& buffer,
00101             const INT32 numCells,
00102             const DPOINT3D min,
00103             const DPOINT3D max,
00104             const bool hasNullValue,
00105             const double nullValue,
00106             const DPOINT3D& viewer,
00107             const DPOINT3D& direction,
00108             const bool isPerspective
00109             ) :
00110             m_Buffer(buffer),
00111             m_NumCells(numCells),
00112             m_Min(min),
00113             m_Max(max),
00114             m_HasNullValue(hasNullValue),
00115             m_NullValue(nullValue),
00116             m_Viewer(viewer),
00117             m_Direction(direction),
00118             m_IsPerspective(isPerspective)
00119             {
00120             };
00121 
00122          };
00123 
00124       #define  NUMPIXELS      4096
00125 
00126       #define  NUMCORNERS     8
00127       #define  NUMSEGMENTS    12
00128 
00129       static const INT32 s_Segments[NUMSEGMENTS][2];
00130 
00131       ABSTRACT_SURFACE *m_Surface;
00132       DRECT3D m_Extents;
00133       SPATREF::COORDREFSYS m_CoordRefSys;
00134       TRANS2D_MAPGEN m_Transformation;
00135 
00136       RVC::RASTER m_Raster;
00137       DOUBLE_ARRAY<double> m_Buffer;
00138 
00139       INT32 m_XBlocks;
00140       INT32 m_YBlocks;
00141       INT32 m_BlockSize;
00142       DOUBLE_ARRAY<DRECT3D> m_Blocks;
00143       INT32 m_Index;
00144       bool m_BlockIsLoaded;
00145       double m_CoverAreaFactor;
00146 
00147       SIMPLE_ARRAY<ORDER> m_Orders;
00148 
00149       BITSET m_ScreenBits;
00150       INT32 m_ScreenWidth;
00151       INT32 m_ScreenHeight;
00152       INT32 m_ScreenX;
00153       INT32 m_ScreenY;
00154 
00155       SIMPLE_ARRAY<DPOINT3D> m_Points;
00156       SIMPLE_ARRAY<LPOINT2D> m_Pixels;
00157 
00158       PIXALIZATION m_Pixalization;
00159       TRIANGULATION m_Triangulation;
00160 
00161       SCENE3D *m_Scene;
00162       CONTROLLER *m_Controller;
00163       DRAWINGCONTEXT3D *m_Drawing;
00164 
00165       DPOINT3D m_Viewer;
00166       DPOINT3D m_Direction;
00167 
00168       double m_ZMin;
00169       double m_ZMax;
00170       bool m_HasNullValue;
00171       double m_NullValue;
00172 
00173       DENSERAYCASTING& operator= (              //! Assignment operator (not implemented)
00174          const DENSERAYCASTING& rhs
00175          );
00176 
00177       static int OrderSort (
00178          ORDER* item1,
00179          ORDER* item2,
00180          void*
00181          ) { if (item1->distance < item2->distance) return 1; return 0; };
00182 
00183       static void GetCorners (
00184          const DRECT3D& rect,
00185          DPOINT3DH points[8]
00186          );
00187 
00188       static void GetCorners (
00189          const DRECT3D& rect,
00190          DPOINT3D points[8]
00191          );
00192 
00193       static double CalculateElevation (
00194          INTERSECTION& intersection,
00195          const DPOINT3D& pt,
00196          const int type
00197          );
00198 
00199       static bool GetIntersection (
00200          INTERSECTION& intersection,
00201          const DPOINT3D& lookAt,
00202          DPOINT3D& result
00203          );
00204 
00205       static void GetTriangle (
00206          INTERSECTION& intersection,
00207          const DPOINT3D& point,
00208          DPOINT3D points[3]
00209          );
00210 
00211       TERRAIN* v_CreateInstance (
00212          ) { return new DENSERAYCASTING(); };
00213 
00214       ERRVALUE v_Build (
00215          const GRE_LAYER *layer
00216          );
00217 
00218       bool v_IsObjectTypeSupported (
00219          const RVC::OBJTYPE objtype
00220          ) const { return (objtype == RVC::OBJTYPE_Raster); };
00221 
00222       void v_Free (
00223          );
00224 
00225       ERRVALUE Create (              
00226          const GRE_LAYER *layer
00227          );
00228 
00229       void Delete (               
00230          );
00231 
00232       ERRVALUE v_GetDefaultScene ( 
00233          SCENE3D& scene
00234          ) const;
00235 
00236       ERRVALUE v_SetScene (
00237          const SCENE3D& scene,
00238          const SIMPLE_ARRAY<TEXTURE*> &textures   
00239          );
00240 
00241       ERRVALUE v_DrawScene (
00242          CONTROLLER &controller,        
00243          DRAWINGCONTEXT3D& drawing,
00244          TEXTURE* texture,
00245          TEXTUREFILTER* texturefilter
00246          );
00247 
00248       float v_GetElevation (
00249          const float x,
00250          const float y
00251          ) const;
00252 
00253       ERRVALUE v_ComputeProfile (
00254          const POLYLINE& polyline,
00255          POLYLINE& profile,
00256          SIMPLE_ARRAY<INT32>& index
00257          );
00258 
00259       float v_GetAngleToNorth (
00260          const float x,
00261          const float y
00262          ) const;
00263 
00264       const ABSTRACT_SURFACE* v_GetAbstractSurface (
00265          ) { return m_Surface; }
00266 
00267       void v_SetCoordRefSys (
00268          const SPATREF::COORDREFSYS& CoordRefSys
00269          );
00270 
00271       const SPATREF::COORDREFSYS v_GetCoordRefSys (
00272          ) const { return m_CoordRefSys; };
00273 
00274       const DRECT3D& v_GetExtents (
00275          ) { return m_Extents; };
00276 
00277       void v_CreateBoundary (
00278          REGION2D& boundary
00279          );
00280 
00281       bool v_HasNull (
00282          ) const { return m_HasNullValue; };
00283 
00284       bool v_IsNull (
00285          const float x,
00286          const float y
00287          ) const;
00288 
00289       ERRVALUE CreateBlocks (
00290          const TRANS2D_MAPGEN& transformation
00291          );
00292 
00293       void DeleteBlocks (
00294          );
00295       ERRVALUE SetSceneForBlocks (
00296          const SCENE3D& scene,
00297          const SIMPLE_ARRAY<TEXTURE*> &textures   
00298          );
00299 
00300       ERRVALUE DrawSceneForBlocks (
00301          CONTROLLER &controller,        
00302          DRAWINGCONTEXT3D& drawing,
00303          TEXTURE* texture,
00304          TEXTUREFILTER* texturefilter
00305          );
00306 
00307       void TransformBlocks (
00308          const TRANS2D_MAPGEN& transformation
00309          );
00310 
00311       void FillSpan (
00312          const INT32 col1,
00313          const INT32 col2,
00314          const INT32 lin
00315          );
00316 
00317       void DrawPixels (
00318          );
00319 
00320    #endif //!< GENERATING_DOXYGEN_OUTPUT
00321    };
00322 
00323 };    //! End of namespace
00324 
00325 #endif
00326 

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