viewpoint3d.h

Go to the documentation of this file.
00001 /**
00002  * \file viewpoint3d.h <gre/viewpoint3d.h>
00003  * \brief GRE VIEWPOINT3D class
00004  *
00005  * \if NODOC
00006  * $Id: viewpoint3d.h_v 1.5 2003/10/31 23:02:27 vdronov Exp $
00007  *
00008  * $Log: viewpoint3d.h_v $
00009  * Revision 1.5  2003/10/31 23:02:27  vdronov
00010  * removed rollangle
00011  *
00012  * Revision 1.4  2003/10/31 15:32:11  vdronov
00013  * removed roll angle variable
00014  *
00015  * Revision 1.3  2003/09/15 13:48:59  fileserver!dwilliss
00016  * Doxygen
00017  *
00018  * Revision 1.2  2003/07/30 15:49:21  mju
00019  * Ignore private sections.
00020  *
00021  * Revision 1.1  2003/06/24 16:50:05  mju
00022  * Initial revision
00023  *
00024  * \endif
00025 **/
00026 
00027 #ifndef  INC_GRE_VIEWPOINT3D_H
00028 #define  INC_GRE_VIEWPOINT3D_H
00029 
00030 #ifndef  INC_GRE_BASE_H
00031    #include <gre/base.h>
00032 #endif
00033 
00034 #ifndef  INC_GRE_3DSCENE_H
00035    #include <gre/3dscene.h>
00036 #endif
00037 
00038 #ifndef  INC_MI32_SERIALIZ_H
00039    #include <mi32/serializ.h>
00040 #endif
00041 
00042 #ifndef GENERATING_DOXYGEN_OUTPUT
00043 struct SMLCONTEXT;
00044 #endif //!< GENERATING_DOXYGEN_OUTPUT
00045 
00046 //===================================================================================================================
00047 
00048 class GRE_VIEWPOINT3D {
00049    public:
00050 
00051       static ERRVALUE SerializerCB (
00052          SERIALIZER& serializer,
00053          const SERIALIZER::ITEMDEF *item,
00054          void *pvvp,
00055          SERIALIZER::ITEMDEF::ACTION action
00056          );
00057 
00058       //! Install SML class, called by internal SML function.
00059       static void SMLClassInstall (
00060          SMLCONTEXT *context
00061          );
00062 
00063       //! Constructor.
00064       explicit GRE_VIEWPOINT3D (
00065          GRE_GROUP *group,
00066          GRE_VIEW *view = 0
00067          );
00068 
00069       //! Copy constructor.
00070       GRE_VIEWPOINT3D (
00071          const GRE_VIEWPOINT3D& rhs
00072          );
00073 
00074       //! Destructor.
00075       ~GRE_VIEWPOINT3D (
00076          );
00077 
00078       //! Assignment.
00079       GRE_VIEWPOINT3D& operator= (
00080          const GRE_VIEWPOINT3D& rhs
00081          );
00082 
00083       bool Calculate (
00084          );
00085 
00086       void CalculateAutoCenter (
00087          );
00088 
00089       void CalculateCenterPoint (
00090          );
00091 
00092       void CalculateCenterFromViewPoint (
00093          );
00094 
00095       void CalculateParameters (
00096          );
00097 
00098       void CalculatePoint (
00099          const bool center                      //!< if center is true - calculate center point, othewise - viewpoint
00100          );
00101 
00102       void CalculateTransVD (
00103          MAT3X3,
00104          MAT3X3
00105          );
00106 
00107       void CalculateViewDirFromAzimAngle (
00108          double angle
00109          );
00110 
00111       void CalculateTransVRCToWorld (
00112          TRANS3D&
00113          );
00114 
00115       void CalculateUsedRect (
00116          const DRECT2D&,
00117          const DPOINT2D&
00118          );
00119 
00120       void CalculateUsedRect (
00121          double aspect                          //!< Width/Height aspect
00122          );
00123 
00124       //! Get distance to center of view in auto-center mode.
00125       double GetAutoCenterDistance (
00126          ) const;
00127 
00128       //! Retrieve background clipping distance.
00129       double GetBackClipDistance (
00130          ) const;
00131 
00132       //! Retrieve base elevation.
00133       double GetBaseElevation (
00134          ) const;
00135 
00136       //! Retrieve center point.
00137       const DPOINT3D& GetCenterPoint (
00138          ) const;
00139 
00140       //! Retrieve destination rectangle.
00141       const DRECT2D& GetDestRect (
00142          ) const;
00143 
00144       //! Get foreground clipping distance.
00145       double GetFrontClipDistance (
00146          ) const;
00147 
00148       //! Get group associated with viewpoint.
00149       GRE_GROUP* GetGroup (
00150          ) const;
00151 
00152       //! Get heading relative to north or projection.
00153       double GetHeading (
00154          bool FromNorth = true
00155          ) const;
00156 
00157       double GetParallelProjDistance (
00158          ) const;
00159 
00160       //! Get pitch angle for current viewpoint.
00161       double GetPitch (
00162          ) const;
00163 
00164       //! Get roll angle for current viewpoint.
00165 //    double GetRoll (
00166 //       ) const;
00167 
00168       double GetStereoDepthScale (
00169          ) const;
00170 
00171       double GetStereoDistance0 (
00172          ) const;
00173 
00174       double GetSunAzimuthAngle (
00175          );
00176 
00177       double GetSunElevationAngle (
00178          );
00179 
00180       GRE_VIEW* GetView (
00181          ) const;
00182 
00183       double GetViewAngle (
00184          ) const;
00185 
00186       const DPOINT3D& GetViewDirection (
00187          ) const;
00188 
00189       double GetViewPlaneDistance (
00190          ) const;
00191 
00192       const DPOINT3D& GetViewPosition (
00193          ) const;
00194 
00195       const DRECT2D& GetViewRectUsed (
00196          ) const;
00197 
00198       GRE::SCENE3D& GetScene3D (
00199          );
00200 
00201       const GRE::SCENE3D& GetScene3D (
00202          ) const;
00203 
00204       const DPOINT3D& GetViewUp (
00205          ) const;
00206 
00207       const double GetZScale (
00208          ) const;
00209 
00210       void IniRead (
00211          INIHANDLE handle,
00212          const char *inigroup
00213          );
00214 
00215       void IniWrite (
00216          INIHANDLE handle,
00217          const char *inigroup
00218          );
00219 
00220       bool IsAutoCentered (
00221          ) const;
00222 
00223       bool IsCalculated (
00224          ) const;
00225 
00226       bool IsClipBackPlane (
00227          ) const;
00228 
00229       bool IsPerspective (
00230          ) const;
00231 
00232       bool IsStereo (
00233          ) const;
00234 
00235       void SetAutoCenter (
00236          bool AutoCenter
00237          );
00238 
00239       void SetAutoCenterAzimAngle (
00240          double AzimAngle
00241          );
00242 
00243       void SetAutoCenterDistance (
00244          double Distance
00245          );
00246 
00247       void SetAutoCenterElevAngle (
00248          double ElevAngle
00249          );
00250 
00251       void SetAutoCenterPoint (
00252          const DPOINT2D& point
00253          );
00254 
00255       void SetAutoCenterPoint (
00256          const DPOINT3D& point
00257          );
00258 
00259       void SetBackClipDistance (
00260          double BackClipDist
00261          );
00262 
00263       void SetBaseElevation (
00264          double BaseElevation
00265          );
00266 
00267       void SetClipBackPlane (
00268          bool ClipBackPlane
00269          );
00270 
00271       void SetDestRect (
00272          const DRECT2D& DestRect
00273          );
00274 
00275       void SetFrontClipDistance (
00276          double FrontClipDist
00277          );
00278 
00279       void SetHeading (
00280          double Heading,
00281          bool FromNorth = true
00282          );
00283 
00284       void SetParallelProjDistance (
00285          double ParallelProjDist
00286          );
00287 
00288       void SetPerspective (
00289          bool isPerspective = true
00290          );
00291 
00292       void SetPitch (
00293          double Pitch
00294          );
00295 
00296 //    void SetRoll (
00297 //       double RollAngle
00298 //       );
00299 
00300       void SetStereo (
00301          bool isStereo
00302          );
00303 
00304       void SetStereoDepthScale (
00305          double StereoDepthScale
00306          );
00307 
00308       void SetStereoDistance0 (
00309          double StereoDistance0
00310          );
00311 
00312       void SetSunAzimuthAngle (
00313          double SunAzimAngle
00314          );
00315 
00316       void SetSunElevationAngle (
00317          double SunElevAngle
00318          );
00319 
00320       void SetViewDirection (
00321          const DPOINT3D& ViewDir
00322          );
00323 
00324       void SetViewPosition (
00325          const DPOINT2D& ViewPos
00326          );
00327 
00328       void SetViewPosition (
00329          const DPOINT3D& ViewPos
00330          );
00331 
00332       void SetViewPositionZ (
00333          double z
00334          );
00335 
00336       void SetViewRectUsed (
00337          const DRECT2D& ViewRectUsed
00338          );
00339 
00340       void SetViewPlaneDistance (
00341          double ViewPlaneDistance
00342          );
00343 
00344       void SetViewUp (
00345          const DPOINT3D& ViewUp
00346          );
00347 
00348       void SetZScale (
00349          double ZScale
00350          );
00351 
00352    private:
00353       #ifndef GENERATING_DOXYGEN_OUTPUT
00354 
00355       GRE_GROUP *m_group;                 //!< Group this viewpoint refers to
00356       GRE_VIEW *m_view;                   //!< View this viewpoint refers to, may be 0
00357       DPOINT3D m_ViewPos;                 //!< Viewer position in specified map coordinates
00358       DPOINT3D m_ViewDir;                 //!< Direction of view in map coordinates (normalized)
00359       DPOINT3D m_ViewUp;                  //!< View-Up vector in map coordinates (normalized)
00360       DRECT2D m_ViewRectUsed;             //!< Rectangle on view plane for visible area (viewing reference coordinates)
00361       double m_ViewPlaneDist;             //!< Distance to view plane in meters
00362       double m_FrontClipDist;             //!< Front clipping distance (from view plane, usually 0.0)
00363       double m_BackClipDist;              //!< Back clipping distance
00364       double m_ParallelProjDist;          //!< Effective distance for parallel projection
00365       double m_StereoDistance0;           //!< Stereo zero-parallax distance
00366       double m_StereoDepthScale;          //!< Stereo depth scaling
00367       DPOINT3D m_CenterPoint;             //!< Point at center of view in map coordinates
00368       double m_AzimAngle;                 //!< Azimuth angle
00369       double m_ElevAngle;                 //!< Elevation angle
00370 //    double m_RollAngle;                 //!< Roll angle
00371       double m_AutoCenterDist;            //!< Distance from center point in meters
00372       double m_ZScale;                    //!< Overall Z-Scale
00373       double m_BaseElevation;             //!< Base elevation
00374       DRECT2D m_DestRect;                 //!< Destination rectangle to project into
00375 //!      GRE_VIEWTRANS3D m_Trans[2];         // Transformations for left(center)/right views
00376       bool m_IsPerspective;
00377       bool m_ClipBackPlane;
00378       bool m_IsStereo;
00379       bool m_AutoCenter;
00380       bool m_CenterSet;
00381       UINT32 m_oldflags;                     //!< Old "flag" bits, used in serialization only
00382       double m_SunAzimAngle;                 //!< Sun azimuth angle
00383       double m_SunElevAngle;                 //!< Sun elevation angle
00384 
00385       GRE::SCENE3D m_Scene3D;
00386 
00387       static ERRVALUE SerializerCB_OldFlags (
00388          SERIALIZER& serializer,
00389          const SERIALIZER::ITEMDEF *item,
00390          void *vgroup,
00391          SERIALIZER::ITEMDEF::ACTION action
00392          );
00393 
00394       void CalcCVPtoD ();
00395       const TRANS3D& GetNormTrans (
00396          int vindex = 0
00397          ) const;
00398       void CalcNormTrans ();
00399 
00400       #endif //!< GENERATING_DOXYGEN_OUTPUT
00401    };
00402 
00403 
00404 //===================================================================================================================
00405 
00406 #endif   //!< INC_GRE_VIEWPOINT3D_H

Generated on Wed May 31 15:26:43 2006 for TNTsdk by  doxygen 1.3.8-20040913