00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef INC_GRE_3DGEOMET_H
00022 #define INC_GRE_3DGEOMET_H
00023
00024 #ifndef INC_GRE_BASE_H
00025 #include <gre/base.h>
00026 #endif
00027
00028 #ifndef INC_GRE_3DUTILS_H
00029 #include <gre/3dutils.h>
00030 #endif
00031
00032 #ifndef INC_GRE_3DSCENE_H
00033 #include <gre/3dscene.h>
00034 #endif
00035
00036 #ifndef INC_GRE_3DGMELEM_H
00037 #include <gre/3dgmelem.h>
00038 #endif
00039
00040 namespace GRE {
00041
00042 #ifndef GENERATING_DOXYGEN_OUTPUT
00043 class CONTROLLER;
00044 class TERRAIN;
00045 class DRAWINGCONTEXT3D;
00046 class GEOMETRIC3D_ELEMENTS;
00047 #endif // GENERATING_DOXYGEN_OUTPUT
00048
00049
00050
00051 class GEOMETRIC3D {
00052 public:
00053
00054 enum MODEL {
00055 MODEL_Default = 0,
00056 MODEL_Vector = 0,
00057 MODEL_CAD = 1,
00058 MODEL_Shape = 2,
00059 MODEL_Pinmap = 3,
00060 MODEL_TIN = 4,
00061 MODEL_Count = 5
00062 };
00063
00064
00065
00066
00067 static const char* GetName (
00068 MODEL model
00069 );
00070
00071
00072
00073
00074 static const char* GetDescription (
00075 MODEL model
00076 );
00077
00078
00079
00080
00081 static GEOMETRIC3D* GetInstance (
00082 MODEL model
00083 );
00084
00085 virtual ~GEOMETRIC3D (
00086 );
00087
00088
00089
00090
00091 const char* GetName (
00092 ) const;
00093
00094
00095
00096
00097 const char* GetDescription (
00098 ) const;
00099
00100
00101
00102
00103 const MODEL GetModel (
00104 ) const {return m_Model; };
00105
00106
00107
00108
00109 GEOMETRIC3D* CreateInstance (
00110 ) { return v_CreateInstance(); };
00111
00112
00113
00114
00115 bool IsTerrainNeeded (
00116 );
00117
00118
00119
00120
00121 bool IsPointsFieldNeeded (
00122 );
00123
00124
00125
00126
00127 ERRVALUE Build (
00128 const GRE_LAYER* layer
00129 ) { return v_Build(layer); };
00130
00131
00132 void Free (
00133 ) { v_Free(); return; };
00134
00135
00136
00137
00138 bool IsBuilt (
00139 );
00140
00141
00142
00143
00144 void SetScene (
00145 SCENE3D& scene
00146 ) {
00147 m_Scene = &scene;
00148 m_Viewer = DPOINT3D(m_Scene->GetViewer().x, m_Scene->GetViewer().y, m_Scene->GetViewer().z);
00149 m_Direction = DPOINT3D(m_Scene->GetDirection().x, m_Scene->GetDirection().y, m_Scene->GetDirection().z);
00150 return;
00151 };
00152
00153
00154
00155
00156 ERRVALUE DrawScene (
00157 CONTROLLER &controller,
00158 DRAWINGCONTEXT3D& drawing,
00159 TERRAIN* terrain,
00160 const bool wireframe = false
00161 );
00162
00163
00164
00165
00166 const DRECT3D& GetExtents (
00167 ) { return v_GetExtents(); };
00168
00169
00170 void SetCoordRefSys (
00171 const SPATREF::COORDREFSYS& CoordRefSys
00172 ) { v_SetCoordRefSys(CoordRefSys); return; };
00173
00174
00175 const SPATREF::COORDREFSYS GetCoordRefSys (
00176 ) { return v_GetCoordRefSys(); };
00177
00178
00179
00180
00181
00182 const TRANS2D_MAPGEN& GetTransformationInternalToModel (
00183 ) { return v_GetTransformationInternalToModel(); };
00184
00185 protected:
00186
00187
00188 static void Register (
00189 GEOMETRIC3D* geometric
00190 );
00191
00192 GEOMETRIC3D (
00193 const char* name,
00194 const char* desc,
00195 const MODEL model
00196 );
00197
00198
00199 void SetBuilt (
00200 const bool built
00201 );
00202
00203 void AppendElements (
00204 GEOMETRIC3D_ELEMENTS* elements
00205 ) { m_ElementsArray.Append(elements); return; };
00206
00207 void ClearElements (
00208 );
00209
00210 double ComputeScaleForPoint (
00211 const DPOINT2D& point
00212 );
00213
00214 private:
00215
00216 #ifndef GENERATING_DOXYGEN_OUTPUT
00217
00218 class BUILDER_IMPL : public GEOMETRIC3D_BUILDER {
00219 public :
00220
00221 BUILDER_IMPL (
00222 const GEOMETRIC3D& geometric
00223 ) : m_Geometric(geometric) {};
00224
00225 ~BUILDER_IMPL (
00226 ) {};
00227
00228 private:
00229
00230 const GEOMETRIC3D& m_Geometric;
00231
00232 BUILDER_IMPL (
00233 );
00234
00235 void OnConstruction (
00236 GRE::TRIANGULATION& triangulation
00237 );
00238
00239 void OnConstruction (
00240 GRE::PIXALIZATION& pixalization
00241 );
00242
00243 friend class GEOMETRIC3D;
00244 };
00245
00246 static GEOMETRIC3D* s_GeometricModels[MODEL_Count];
00247
00248 const char* m_Name;
00249 const char* m_Description;
00250 const MODEL m_Model;
00251 BUILDER_IMPL m_Builder;
00252
00253 bool m_Built;
00254
00255 SCENE3D *m_Scene;
00256 DPOINT3D m_Viewer;
00257 DPOINT3D m_Direction;
00258 CONTROLLER* m_Controller;
00259 DRAWINGCONTEXT3D* m_Drawing;
00260 TERRAIN* m_Terrain;
00261
00262 GEOMETRIC3D_ELEMENTS_ARRAY m_ElementsArray;
00263
00264 GEOMETRIC3D (
00265 );
00266
00267 GEOMETRIC3D (
00268 const GEOMETRIC3D &rhs
00269 );
00270
00271 GEOMETRIC3D& operator= (
00272 const GEOMETRIC3D& rhs
00273 );
00274
00275 #endif // GENERATING_DOXYGEN_OUTPUT
00276
00277 virtual GEOMETRIC3D* v_CreateInstance (
00278 ) = 0;
00279
00280 virtual ERRVALUE v_Build (
00281 const GRE_LAYER *layer
00282 ) = 0;
00283
00284 virtual void v_Free (
00285 ) = 0;
00286
00287 virtual const DRECT3D& v_GetExtents (
00288 ) = 0;
00289
00290 virtual void v_SetCoordRefSys (
00291 const SPATREF::COORDREFSYS& CoordRefSys
00292 ) = 0;
00293
00294 virtual const SPATREF::COORDREFSYS v_GetCoordRefSys (
00295 ) = 0;
00296
00297 virtual const TRANS2D_MAPGEN& v_GetTransformationInternalToModel (
00298 ) = 0;
00299
00300 virtual void OnDrawBegin (GRE::GEOMETRIC3D_BUILDER* builder, const bool wireframe = false) {};
00301
00302 virtual void OnDrawEnd () {};
00303
00304 };
00305
00306 }
00307
00308 #endif
00309
00310
00311