Mobile API Reference  MicroStrategy 2019
GaugePlot.h
Go to the documentation of this file.
1 //====================================================================
2 // Filename: Kernel/SourceCode/ChartEngine/PrivateSource/GaugePlot.h
3 // AUTHOR : Xin Liu
4 // CREATION : 3/03/09
5 // Copyright (C) MicroStrategy, Inc. 2009
6 //==============================================================================================
7 
8 #ifndef MSICHART_GAUGEPLOT_H
9 #define MSICHART_GAUGEPLOT_H
10 
11 #include "PDCHeader/PDCvector"
12 
13 #include "Plot.h"
14 #include "GaugeValueAxis.h"
15 #include "NumberObject.h"
16 
17 namespace MsiChart
18 {
20  {
22 
24  : mMarkerShape(0)
25  , mMarkerSize(34)
26  {}
27 
28  unsigned char mMarkerShape;
30  };
31 
33  {
35 
36  GaugeBandOptions(Int32 iBandId = 0, double iBandRangeMin = 0.0, double iBandRangeMax = 0.0)
37  : mBandId(iBandId)
38  , mBandRangeMin(iBandRangeMin)
39  , mBandRangeMax(iBandRangeMax)
40  {}
41 
43  double mBandRangeMin;
44  double mBandRangeMax;
45  };
46 
47  struct GaugeOptions
48  {
50  : mStartAngle(325)
51  , mStopAngle(215)
52  , mCircularThickness(30)
53  , mGaugesPerRow(2)
54  , mBorderThickness(30)
55  , mShowDataLabels(true)
56  , mShowGaugeTitles(true)
57  , mShowBeveledFrame(false)
59  , mDrawAxisLabelOutside(false)
61  , mIsClipped(false)
64  {}
65 
77  bool mIsClipped;
81  std::vector<GaugeBandOptions> mShownBands;
82  };
83 
84 
85  class GaugePlot: public Plot
86  {
87  public:
89 
90  GaugePlot(const TripleId& irTripleId, GraphObjectManager* ipManager, const Rect2D& irDataArea);
91  ~GaugePlot();
92 
93  //Re-implemention the virtual functions inherited from GraphObjectManager
94  virtual GraphObject::Ptr OnPointDetection(const Point2D& irCursor) const;
95  virtual void OnRectangleSelection(const Rect2D& irRect, std::vector<GraphObject::Ptr>& iorSelectedObjects) const;
96  virtual void Draw();
97  virtual void GenerateView();
98  virtual void GenerateImageMap(ImageMap& iorImageMap);
99  virtual void GenerateMapAndList();
100  virtual void GetOptions(Int32 iSeriesId, Int32 iPropertyId, CComVariant* opValue) const;
101 #ifndef _VE_CE
102  virtual void GenerateInterpolationFrame(double iProgress, LayerObject* ipLayerObject);
103 #else
104  virtual void GenerateInterpolationFrame(double iProgress);
105 #endif
106 
107  private:
111  void hLoadProperties();
112 
117  void hLoadSeriesProperties(Int32 iSeriesId);
118 
123  void hGenerateOneGauge(Int32 iGroupId, const Point2D& irBasePoint, Int32 iNeedleSize);
124 
130  void hGetMinMaxValue(double& orMin, double& orMax);
131 
134  void hGenerateGaugeValueAxis(Int32 iRadius);
135 
138  void hCalculateSubFrameAreas(Int32 iGroupCount, std::vector<Rect2D>& orSubFrameAreas);
139 
140  void hGenerateSubFrames(const std::vector<Rect2D>& irSubFrameAreas);
141 
144  void hGenerateGroupTitleAndLabels(const std::vector<Rect2D>& irSubFrameAreas, std::vector<Point2D>& orBasePoints, Int32& orBorderRadius);
145 
148  void hCalcualteBorderRadiusAndBasePoint(const Rect2D& irSubFrameArea, Int32 iGroupTitieHeight, Int32 iGroupLabelHeight,
149  Point2D& orBasePoint, Int32& orBorderRadius);
150 
153  void hGenerateOneGroupTitle(Int32 iGroupId);
154 
157  void hGenerateOneGroupDataLabel(Int32 iGroupId);
158 
161  Int32 hCalculateBorderThicknessInPixel(Int32 iRadius);
162 
163  Int32 hCalculateBorderRangeThicknessInPixel(Int32 iRadius);
164 
165  void hGenerateBands(Int32 iGroupId, const Point2D& irBasePoint, Int32 iRadius);
166 
167  bool hCalculateActualBandRange(const GaugeBandOptions &irGaugeBandOptions, double &orBandRangeMin, double &orBandRangeMax);
168 
169  Int32 hFindBandOptionIndexByBandId(Int32 iBandId) const;
170 
171  void hCalculateFinalAngles();
172 
173  bool hGetAngle(Int32 iGroupId, Int32 iSeriesId, float& orAngle);
174 
178  bool hIsFirstFrame() const;
179 
180  Int32 hGetNeedleSize();
181 
182  void hGenerateLabelsAndNeedleBase(Int32 iGroupId, const Point2D& irBasePoint, Int32 iNeedleSize);
183 
184 
185  //private members
186  GaugeValueAxis::Ptr mGaugeValueAxisPtr;
187  GaugeOptions mGaugeOptions;
188  std::vector<GaugeSeriesOptions::Ptr> mGaugeSeriesOptions;
189 
190  GraphCollectionObject::Ptr mGroupTitleCollectionPtr;
191  GraphCollectionObject::Ptr mDataLabelCollectionPtr;
192  GraphCollectionObject::Ptr mGaugeBorderCollectionPtr;
193  GraphCollectionObject::Ptr mGaugePanelCollectionPtr;
194  GraphCollectionObject::Ptr mNeedleBaseCollectionPtr;
195  std::vector<GraphCollectionObject::Ptr> mGaugeSeriesCollections;
196  std::vector<GraphCollectionObject::Ptr> mBandCollections;
197 
198  std::vector<Point2D> mBasePoints;
199  Int32 mGroupCount;
200  Int32 mBorderInnerRadius;
201  std::vector<std::vector<float> > mVecVecAngles;
202  std::vector<std::vector<bool> > mVecVecIsAngleValid;
203 
205  std::vector<GraphObject::Ptr> mPostGraphObjectList;
206 
207  GaugePlot* mpOldGaugePlot;
208  float mStartAngleInRad;
209  float mStopAngleInRad;
210 
211  };
212 }
213 
214 #endif
bool mShowGaugeTitles
Definition: GaugePlot.h:72
Int32 mStartAngle
Definition: GaugePlot.h:66
Definition: LayerObject.h:21
bool mIsClipped
Definition: GaugePlot.h:77
virtual void GenerateInterpolationFrame(double iProgress, LayerObject *ipLayerObject)
MSynch::SmartPtr< GaugePlot > Ptr
Definition: GaugePlot.h:88
MSynch::SmartPtr< GaugeBandOptions > Ptr
Definition: GaugePlot.h:34
Int32 mBandId
Definition: GaugePlot.h:42
Int32 mGaugesPerRow
Definition: GaugePlot.h:69
This struct is from ChartCtrl.h.
Definition: NumberObject.h:38
Definition: GaugePlot.h:19
EnumDSSGraphGaugeNeedleStyle mNeedleStyle
Definition: GaugePlot.h:78
virtual void GenerateMapAndList()
EnumDSSGraphGaugeBorderStyle mBorderStyle
Definition: GaugePlot.h:79
virtual void GenerateImageMap(ImageMap &iorImageMap)
virtual void Draw()
EnumDSSGraphGaugeBorderStyle
Definition: DSSIPhoneEnums.h:2119
bool mShowSecondaryValuesAsMarkers
Definition: GaugePlot.h:74
Definition: DSSIPhoneEnums.h:2122
Int32 mMarkerSize
Definition: GaugePlot.h:29
double mBandRangeMin
Definition: GaugePlot.h:43
GaugeSeriesOptions()
Definition: GaugePlot.h:23
#define Int32
Definition: BasicTypes.h:20
MSynch::SmartPtr< GaugeSeriesOptions > Ptr
Definition: GaugePlot.h:21
unsigned char mMarkerShape
Definition: GaugePlot.h:28
GaugeBandOptions(Int32 iBandId=0, double iBandRangeMin=0.0, double iBandRangeMax=0.0)
Definition: GaugePlot.h:36
Definition: GaugePlot.h:47
bool mDrawAxisLabelOutside
Definition: GaugePlot.h:75
bool mShowDataLabels
Definition: GaugePlot.h:71
Definition: SmartPtr.h:38
Int32 mBorderThickness
Definition: GaugePlot.h:70
GaugePlot(const TripleId &irTripleId, GraphObjectManager *ipManager, const Rect2D &irDataArea)
double mBandRangeMax
Definition: GaugePlot.h:44
virtual GraphObject::Ptr OnPointDetection(const Point2D &irCursor) const
bool mShowBeveledFrame
Definition: GaugePlot.h:73
Definition: ABLPlot.h:21
std::vector< AreaRec * > ImageMap
Definition: ImageMap.h:99
ChartAdvFormat mGraphNumberFormat
Definition: GaugePlot.h:80
Int32 mStopAngle
Definition: GaugePlot.h:67
Definition: GaugePlot.h:85
bool mDrawCategoriesInReverseOrder
Definition: GaugePlot.h:76
Definition: Msi_ccomvariant.h:24
Int32 mCircularThickness
Definition: GaugePlot.h:68
EnumDSSGraphGaugeNeedleStyle
Definition: DSSIPhoneEnums.h:2130
Definition: DSSIPhoneEnums.h:2134
GaugeOptions()
Definition: GaugePlot.h:49
Definition: Plot.h:70
std::vector< GaugeBandOptions > mShownBands
Definition: GaugePlot.h:81
Definition: GraphObjectManager.h:37
virtual void GetOptions(Int32 iSeriesId, Int32 iPropertyId, CComVariant *opValue) const
Definition: GaugePlot.h:32
Use four Int32 values to represent a 2D rectangle.
Definition: Rect2D.h:25
virtual void GenerateView()
virtual void OnRectangleSelection(const Rect2D &irRect, std::vector< GraphObject::Ptr > &iorSelectedObjects) const
Definition: Common.h:397