00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef INC_GRE_LAYERVIEW_H
00037 #define INC_GRE_LAYERVIEW_H
00038
00039 #ifndef INC_GRE_BASE_H
00040 #include <gre/base.h>
00041 #endif
00042
00043 #ifndef INC_GRE_LABELPLACEMENT_H
00044 #include <gre/labelplacement.h>
00045 #endif
00046
00047 #ifndef INC_MI32_RENDERBUFFER_H
00048 #include <mi32/renderbuffer.h>
00049 #endif
00050
00051 #ifndef INC_MI32_TRANS2DC_H
00052 #include <mi32/trans2dc.h>
00053 #endif
00054
00055
00056 namespace GRE {
00057
00058
00059
00060
00061 class LAYERVIEW {
00062 public:
00063
00064
00065 enum RENDERTYPE {
00066 RENDERTYPE_Layer = 0,
00067 RENDERTYPE_Labels = 1,
00068 RENDERTYPE_Highlight = 2
00069 };
00070
00071 virtual ~LAYERVIEW ();
00072
00073
00074 void CheckRendered (
00075 );
00076
00077
00078
00079 void ClearAllDrawnSets (
00080 bool UseHighlighted
00081 );
00082
00083
00084 void ClearLabelPlacement (
00085 );
00086
00087
00088 ERRVALUE ComputeTrans (
00089 );
00090
00091
00092 ERRVALUE DrawElementToBuffer (
00093 ELEMTYPE ElemType,
00094 INT32 ElemNum,
00095 GRE::LAYERVIEW::RENDERTYPE RenderType,
00096 GRE::DRAWFLAGS drawflags
00097 );
00098
00099
00100 ERRVALUE DrawElementToDevice (
00101 ELEMTYPE ElemType,
00102 INT32 ElemNum,
00103 MGD::DEVICE *pDevice,
00104 GRE::DRAWFLAGS drawflags
00105 );
00106
00107
00108 ERRVALUE DrawElementsToBuffer (
00109 ELEMTYPE ElemType,
00110 const UINT8 *ElemSet,
00111 GRE::LAYERVIEW::RENDERTYPE RenderType,
00112 GRE::DRAWFLAGS drawflags
00113 );
00114
00115
00116 ERRVALUE DrawElementsToDevice (
00117 ELEMTYPE ElemType,
00118 const UINT8 *ElemSet,
00119 MGD::DEVICE *pDevice,
00120 GRE::DRAWFLAGS drawflags
00121 );
00122
00123
00124 double Get3dDepthScale (
00125 ) const { return (m_3dDepthScale); }
00126
00127
00128 double Get3dSurfaceIncrement (
00129 ) const { return (m_3dSurfaceIncrement); }
00130
00131
00132 const GRE_VIEWPOINT3D* Get3dViewPoint (
00133 ) const { return (m_pViewPoint3D); }
00134
00135
00136 double Get3dZScale (
00137 ) const { return (m_3dZScale); }
00138
00139
00140 double GetDesignScale (
00141 ) const { return (m_DesignScale); }
00142
00143
00144
00145
00146
00147 const LRECT2D& GetDeviceRectUsed (
00148 ) const { return (m_CurDevRectUsed); }
00149
00150
00151
00152
00153
00154 const BITSET* GetElemDrawnSet (
00155 ELEMTYPE ElemType,
00156 bool UseHighlighted
00157 ) const { return (const_cast<LAYERVIEW*>(this)->v_GetElemDrawnSet(ElemType,UseHighlighted)); }
00158
00159
00160
00161
00162
00163 BITSET* GetElemDrawnSet (
00164 ELEMTYPE ElemType,
00165 bool UseHighlighted
00166 ) { return (v_GetElemDrawnSet(ElemType,UseHighlighted)); }
00167
00168
00169
00170 LABELPLACEMENT* GetLabelPlacement (
00171 bool ReturnNullIfEmpty = true
00172 );
00173
00174
00175 GRE_LAYER* GetLayer (
00176 ) const { return (m_layer); }
00177
00178
00179 const RENDERBUFFER& GetRenderBuffer (
00180 RENDERTYPE RenderType
00181 ) const { return (m_RenderBuffer[RenderType]); }
00182
00183
00184 RENDERBUFFER& GetRenderBuffer (
00185 RENDERTYPE RenderType
00186 ) { return (m_RenderBuffer[RenderType]); }
00187
00188
00189 GRE_LAYER_SURFACE* GetSurfaceLayer (
00190 ) const { return (m_pSurfaceLayer); }
00191
00192
00193 const TRANS2D_MAPGEN& GetTransLayerDevice (
00194 ) const { return (m_TransLayerDevice); }
00195
00196
00197 const TRANS2D_MAPGEN& GetTransLayerSurface (
00198 ) const { return (m_TransLayerSurface); }
00199
00200
00201 const TRANS2D_MAPGEN& GetTransLayerView (
00202 ) const { return (m_TransLayerView); }
00203
00204
00205 GRE_VIEW* GetView (
00206 ) const { return (m_view); }
00207
00208
00209 bool HasSurfaceNulls (
00210 ) const { return (m_HasSurfaceNulls); }
00211
00212
00213 bool Is3D (
00214 ) const { return (m_Is3D); }
00215
00216
00217 bool Is3dStereo (
00218 ) const;
00219
00220
00221 bool IsSurfaceUsed (
00222 ) const { return (m_IsSurfaceUsed); }
00223
00224
00225 bool IsLayerOverlappedDevice (
00226 ) const { return (m_LayerOverlapsDevice); }
00227
00228
00229
00230 bool OverlayBufferIfRendered (
00231 RENDERTYPE RenderType,
00232 MGD::DEVICE *pDevTarget,
00233 const LRECT2D *pClipRect = 0
00234 );
00235
00236
00237 void ResetAllDrawnSets (
00238 );
00239
00240
00241 void ResetRendered (
00242 GRE::RENDERTARGET target = GRE::RENDERTARGET_LayerAll
00243 );
00244
00245 protected:
00246
00247
00248 LAYERVIEW (
00249 GRE_LAYER *layer,
00250 GRE_VIEW *view
00251 );
00252
00253 private:
00254 #ifndef GENERATING_DOXYGEN_OUTPUT
00255 GRE_LAYER *m_layer;
00256 GRE_VIEW *m_view;
00257 RENDERBUFFER m_RenderBuffer[3];
00258 TRANS2D_MAPGEN m_TransLayerView;
00259 TRANS2D_MAPGEN m_TransLayerDevice;
00260 TRANS2D_MAPGEN m_TransLayerSurface;
00261 GRE_VIEWPOINT3D *m_pViewPoint3D;
00262 GRE_LAYER_SURFACE *m_pSurfaceLayer;
00263 DRECT2D m_NewTgtRectFull;
00264 DRECT2D m_CurTgtRectFull;
00265 LRECT2D m_NewDevRectUsed;
00266 LRECT2D m_CurDevRectUsed;
00267 double m_DesignScale;
00268 double m_3dSurfaceIncrement;
00269 double m_3dDepthScale;
00270 double m_3dZScale;
00271 bool m_Is3D;
00272 bool m_IsSurfaceUsed;
00273 bool m_HasSurfaceNulls;
00274 bool m_LayerOverlapsDevice;
00275
00276 void DestroyRenderDevices (
00277 );
00278
00279 void SetTransLayerDevice (
00280 const TRANS2D_MAPGEN& TransLayerDevice
00281 ) { m_TransLayerDevice = TransLayerDevice; }
00282
00283 LAYERVIEW (const LAYERVIEW&);
00284 LAYERVIEW& operator= (const LAYERVIEW&);
00285
00286 friend class GRE_LAYER;
00287 friend class GRE_LAYERDC;
00288 #endif // GENERATING_DOXYGEN_OUTPUT
00289
00290
00291
00292
00293
00294 virtual BITSET* v_GetElemDrawnSet (
00295 ELEMTYPE ElemType,
00296 bool UseHighlighted
00297 );
00298
00299
00300
00301 virtual LABELPLACEMENT* v_GetLabelPlacement (
00302 );
00303
00304 };
00305
00306
00307
00308 class LAYERVIEW_GEOMETRIC : public LAYERVIEW {
00309 public:
00310
00311
00312 LAYERVIEW_GEOMETRIC (
00313 GRE_LAYER *layer,
00314 GRE_VIEW *view
00315 );
00316
00317 virtual ~LAYERVIEW_GEOMETRIC ();
00318
00319 private:
00320 #ifndef GENERATING_DOXYGEN_OUTPUT
00321
00322 unsigned m_NumComponents;
00323 BITSET *m_ElemDrawnSetsNormal;
00324 BITSET *m_ElemDrawnSetsHighlighted;
00325
00326 virtual BITSET* v_GetElemDrawnSet (
00327 ELEMTYPE ElemType,
00328 bool UseHighlighted
00329 );
00330
00331 LAYERVIEW_GEOMETRIC (const LAYERVIEW_GEOMETRIC&);
00332 LAYERVIEW_GEOMETRIC& operator= (const LAYERVIEW_GEOMETRIC&);
00333
00334 #endif // GENERATING_DOXYGEN_OUTPUT
00335 };
00336
00337
00338
00339
00340 class LAYERVIEW_LABELED : public LAYERVIEW_GEOMETRIC {
00341 public:
00342
00343
00344 LAYERVIEW_LABELED (
00345 GRE_LAYER *layer,
00346 GRE_VIEW *view
00347 );
00348
00349 virtual ~LAYERVIEW_LABELED ();
00350
00351 private:
00352 #ifndef GENERATING_DOXYGEN_OUTPUT
00353 LABELPLACEMENT m_LabelPlacement;
00354
00355 virtual LABELPLACEMENT* v_GetLabelPlacement (
00356 );
00357
00358 LAYERVIEW_LABELED (const LAYERVIEW_LABELED&);
00359 LAYERVIEW_LABELED& operator= (const LAYERVIEW_LABELED&);
00360
00361 #endif // GENERATING_DOXYGEN_OUTPUT
00362 };
00363
00364
00365 }
00366
00367 #endif // INC_GRE_LAYERVIEW_H