Mobile API Reference  MicroStrategy 2019
Transformer.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : Transformer.h
3 // AUTHOR : Xin Liu
4 // CREATION : 2008-05-18
5 // Copyright (C) MicroStrategy Incorporated 2009
6 // All Rights Reserved
7 //==============================================================================================
8 
9 #ifndef MSICHART_TRANSFORMER_H
10 #define MSICHART_TRANSFORMER_H
11 
12 #include "Synch/Defines/SmartPtr.h"
13 #include "ChartContext.h"
14 #include "Point2D.h"
15 #include "Point3D.h"
16 #include "Vector3D.h"
17 
18 
19 namespace MsiChart
20 {
21  const Int32 gDefaultCubeSize = 1000;
22 
24  {
28  , mZoomIn(1.0)
29  {}
34  double mZoomIn;
35  };
36 
37  struct ViewInfo
38  {
41  , mRotationX(0), mRotationY(0), mRotationZ(0)
42  , mMove(0, 0, 0)
43  {}
44 
50  };
51 
53  {
54  public:
56 
57  Transformer(ChartContext* ipChartContext);
58 
59  bool Transform(const DPoint3D& irPoint3D, Point2D& orPoint2D) const;
60  bool Transform(const DPoint3D& irPoint3D, FPoint2D& orPoint2D) const;
61 
62  double DistanceToEye(const DPoint3D& irPoint3D) const;
63  void GetEyePosition(DPoint3D& orEyePosition) const;
64  // bool IsVisible(const DVector3D& irPlaneNormal) const;
65  bool IsVisible(const DVector3D& irPlaneNormal, const DPoint3D& irPoint3D) const;
66  void SetLightDirection(const DVector3D& irVector3D);
67  void GetLightDirection(DVector3D& orVector3D) const;
68  void GetCubeSize(SPoint3D& orWallSize) const;
69  void GetWallThickness(SPoint3D& orWallThickness) const;
70 
71  void GetOptions(Int32 iPropertyId, VARIANT* opValue) const;
72  void Update();
73 
74  void SetProjectionArea(const Rect2D& irProjectionArea);
75  private:
76  void hInitialize();
77  void hLoadProperties();
78  void hLoadWallProperties();
79  void hLoadProjectionProperties();
80  void hLoadTranformProperties();
81 
82  void hTruncateSize(Int32& iorSize, Int32 iMinSize, Int32 iMaxSize);
83 
84  void hViewTransformation();
85  void hPerspectiveProjection();
86  void hProjectionPlaneToCairo(double& iorX, double& iorY) const;
87 
88  ChartContext* mpChartContext;
89 
90  double mMatrix[16];
91  DPoint3D mEyePosition;
92  DPoint3D mLookAtPosition;
93  DVector3D mUp;
94 
95  // Wall properties
96  SPoint3D mCubeSize;
97  SPoint3D mWallThickness;
98 
99  ProjectionInfo mProjectionInfo;
100  ViewInfo mViewInfo;
101  double mProjectionPlaneDistance;
102 
103  DVector3D mLightDirection;
104  Rect2D mProjectionArea;
105  bool mAdjustProjectionPlane;
106  };
107 
108  inline void Transformer::hTruncateSize(Int32& iorSize, Int32 iMinSize, Int32 iMaxSize)
109  {
110  iorSize = (iorSize < iMinSize) ? iMinSize : iorSize;
111  iorSize = (iorSize > iMaxSize) ? iMaxSize : iorSize;
112  }
113 }
114 
115 #endif
MSynch::SmartPtr< Transformer > Ptr
Definition: Transformer.h:55
ProjectionInfo()
Definition: Transformer.h:25
bool IsVisible(const DVector3D &irPlaneNormal, const DPoint3D &irPoint3D) const
double mProjectionPaneSize
Definition: Transformer.h:31
void GetEyePosition(DPoint3D &orEyePosition) const
Definition: Transformer.h:52
Definition: Transformer.h:37
Transformer(ChartContext *ipChartContext)
const Int32 gDefaultCubeSize
Definition: Transformer.h:21
bool Transform(const DPoint3D &irPoint3D, Point2D &orPoint2D) const
void GetOptions(Int32 iPropertyId, VARIANT *opValue) const
ViewInfo()
Definition: Transformer.h:39
Int32 mRotationY
Definition: Transformer.h:47
Definition: Transformer.h:23
double mZoomIn
Definition: Transformer.h:34
void GetWallThickness(SPoint3D &orWallThickness) const
#define Int32
Definition: BasicTypes.h:20
Int32 mProjectionPaneYOffset
Definition: Transformer.h:33
void GetCubeSize(SPoint3D &orWallSize) const
Int32 mRotationX
Definition: Transformer.h:46
void SetLightDirection(const DVector3D &irVector3D)
Definition: SmartPtr.h:38
double DistanceToEye(const DPoint3D &irPoint3D) const
Int32 mRotationZ
Definition: Transformer.h:48
Definition: ChartContext.h:542
Int32 mProjectionPaneXOffset
Definition: Transformer.h:32
void GetLightDirection(DVector3D &orVector3D) const
double mDistanceToEye
Definition: Transformer.h:30
Definition: ABLPlot.h:21
Definition: Msi_variant.h:147
void SetProjectionArea(const Rect2D &irProjectionArea)
DVector3D mMove
Definition: Transformer.h:49
double DistanceBetweenEyeAndLookAt
Definition: Transformer.h:45
Use four Int32 values to represent a 2D rectangle.
Definition: Rect2D.h:25