Mobile API Reference  MicroStrategy 2019
DataLabelManager.h
Go to the documentation of this file.
1 //
2 // DataLabelManager.h
3 // IPhoneChart
4 //
5 // Created by Li, En on 7/26/13.
6 //
7 //
8 
9 #ifndef IPhoneChart_DataLabelManager_h
10 #define IPhoneChart_DataLabelManager_h
11 
12 
13 #include "GridMap.h"
14 #include "TextObject.h"
15 #include "ChartContext.h"
16 
17 #include "GraphObjectManager.h"
18 namespace MsiChart {
19 
20  // RefLineDataLabel support
22  {
24  {
25  mPositionIndex = 0;
26  mCannotFitHorizontally = false;
27  mCannotFitVertically = false;
31  }
32 
38  std::vector<Int32> mOverlapedDataLablesIndexs;
42  };
43 
44  typedef enum
45  {
52 
53  //Data Label Info for all chart types
55  {
56  bool mIsDisPlayed; //<Whether this label is already been located
57  bool mIsValid; //Is Host marker valid ?
58 
61 
63 
66 
68  {}
69 
71  {
72  Rect2D lRect;
73  mLabelPtr->GetBoundingRect(lRect);
74  return lRect;
75  }
76 
77  std::vector<Point2D> mDLCenterPoint;
78  Int32 mCenterXOffset; //used for Line with sizeby, area..., the offset from Base Point.
80  std::vector<EnumDssGraphMatrixDataLabelPosition> mDLPosition;
81 
82  //For Grid Chart
83  int mXIndex;
84  int mYIndex;
85 
86  //For Bar/Line/Area Chart
87  int mSeriesInfo; //seriesInfo index
88  Point2D mHostMarkerPoint; //the host marker's position of DL.
89 
91  };
92 
93  typedef std::vector<GMDataLabelInfo> GMDataLabelVecs;
94 
96  {
97  bool mIsDisPlayed; //<Whether this label is already been located
100 
102 
104  {}
105 
107  {
108  Rect2D lRect;
109  mLabelPtr->GetBoundingRect(lRect);
110  return lRect;
111  }
112 
113  };
115  {
116  Int32 mAxisIndex; //Y1 ,Y2,Y3 or Y4.
119  bool mIsDisPlayed; //<Whether this label is already been located
120  bool mIsVertical; //Whther the chart is vertical or horizontal
122 
123  AxisOriginLabelInfo(bool iIsVertical,Int32 iAxisIndex,Point2D iRefPoint,bool iIsAttributeMetrixLable):
124  mIsVertical(iIsVertical),
125  mAxisIndex(iAxisIndex),
126  mRefPoint(iRefPoint),
127  mIsAttributeMetrixLable(iIsAttributeMetrixLable),
128  mIsDisPlayed(false)
129  {}
130 
132  {
133  Rect2D lRect;
134  mLabelPtr->GetBoundingRect(lRect);
135  return lRect;
136  }
137 
138  };
139 
140  typedef std::vector<GMRefLabelInfo> GMRefLabelVecs;
141  typedef std::vector<AxisOriginLabelInfo> AxisOriginLabelVecs;
143  {
144  public:
145 
147 
148  DataLabelManager(const ChartContext::Ptr irChartContextPtr, GraphObjectManager* ipManager = NULL);
150 
151  //void SetChartContext(const ChartContext::Ptr irChartContextPtr);
152 
153  //Add Occupied Object in initial
154  void AddSinglePointObject(const std::vector<GraphObject::Ptr >& irSinglePointObjects);
155  void AddPolygonObject(const std::vector<GraphObject::Ptr >& irPolygonObjects);
156  void AddPolyLinePointObject(const std::vector<GraphObject::Ptr >& irPolyLineObjects);
157  void AddRectangleObject(const std::vector<Rect2D >& irRectangleObject);
158  void AddCircleObject(const std::vector<Circle>& irCirclePieObject);
159 
160  //Add Data Labels to be detected
161  void AddDataLabels(const GMDataLabelVecs& irDataLabels);
162 
163  //Place Data Labels restore in local list
164  void PlaceDataLabels();
165 
166  //Place Data Labels in the input list
167  bool PlaceDataLabels(GMDataLabelVecs& iorDataLabelVec);
168 
169  //place data labels in combo chart
170  bool PlaceDataLabelsForCombo(GMDataLabelVecs &iorDataLabelVec, bool isLastProcess);
171 
172  //RefLine Labels support
173  void AddRefLineLabel(const GMRefLabelInfo& irRefLabel);
174  void PlaceRefLineLabels();
175 
176  //AxisOrigin Label support
177  void AddAxisOriginLabel(const AxisOriginLabelInfo& irAxisOrigin);
178  void PlaceAxisOriginLabels();
180  protected:
185 
186  //Occupied Object
187  std::vector<GraphObject::Ptr > mSinglePointObjects;
188  std::vector<GraphObject::Ptr > mPolygonObjects;
189  std::vector<GraphObject::Ptr > mPolyLineObjects;
190  std::vector<Rect2D> mRectangleObject;
191  std::vector<Circle> mCirclePieObject;
192 
193  //Init Grid Map by Occupied Objects
195 
199 
200 
201 
202  //RefLine Labels support
203  void hGetRefLabelPosition(TextObject::Ptr iTextLable, Int32 iRefLableIndex, Int32 iRefLinePos, bool iIsVertical, Int32 &iorXOffset, Int32 &iorYOffset, Rect2D &iorRect);
204  void hCheckRefLabelCandiate(refLableCandidate& iorRefLableCandidate, Int32 iCurIndex);
206 
207  //AxisOrigin Labels support
209  bool hGetAxisOriginLabelPosition(Point2D iRefPos ,Int32 iIndex,Rect2D& orRect, bool iIsAtriMetri);
210  };
211 }
212 
213 
214 
215 
216 #endif
std::vector< Circle > mCirclePieObject
Definition: DataLabelManager.h:191
Definition: DataLabelManager.h:48
void hInitGridMapOccupationByDataObjects()
Int32 mSeriesId
Definition: DataLabelManager.h:59
Definition: DataLabelManager.h:95
bool mIsValid
Definition: DataLabelManager.h:57
std::vector< GMRefLabelInfo > GMRefLabelVecs
Definition: DataLabelManager.h:140
std::vector< GraphObject::Ptr > mPolyLineObjects
Definition: DataLabelManager.h:189
Definition: DataLabelManager.h:142
Rect2D mDataAreaFrame
Definition: DataLabelManager.h:182
AxisOriginLabelVecs mAxisOriginLables
Definition: DataLabelManager.h:208
void AddAxisOriginLabel(const AxisOriginLabelInfo &irAxisOrigin)
Definition: DataLabelManager.h:46
std::vector< Int32 > mOverlapedDataLablesIndexs
Definition: DataLabelManager.h:38
bool mIsVertical
Definition: DataLabelManager.h:120
DataLabelManager(const ChartContext::Ptr irChartContextPtr, GraphObjectManager *ipManager=NULL)
GMDataLabelVecs mDataLabels
Definition: DataLabelManager.h:179
int mYIndex
Definition: DataLabelManager.h:84
Point2D mRefPoint
Definition: DataLabelManager.h:117
Definition: DataLabelManager.h:50
bool mIsDisPlayed
Definition: DataLabelManager.h:56
bool mIsDisPlayed
Definition: DataLabelManager.h:97
MSynch::SmartPtr< DataLabelManager > Ptr
Definition: DataLabelManager.h:146
std::vector< GraphObject::Ptr > mPolygonObjects
Definition: DataLabelManager.h:188
bool mCannotFitVertically
Definition: DataLabelManager.h:34
Int32 mCenterXOffset
Definition: DataLabelManager.h:78
Definition: DataLabelManager.h:114
int mXIndex
Definition: DataLabelManager.h:83
std::vector< EnumDssGraphMatrixDataLabelPosition > mDLPosition
Definition: DataLabelManager.h:80
GMDataLabelInfo()
Definition: DataLabelManager.h:67
Definition: DataLabelManager.h:21
void AddPolyLinePointObject(const std::vector< GraphObject::Ptr > &irPolyLineObjects)
bool PlaceDataLabelsForCombo(GMDataLabelVecs &iorDataLabelVec, bool isLastProcess)
Int32 mRefLinePos
Definition: DataLabelManager.h:98
EnumDssGraphMatrixDataLabelHostMarkerShape mHostMarkerShape
Definition: DataLabelManager.h:90
refLableCandidate()
Definition: DataLabelManager.h:23
Definition: GridMap.h:39
Rect2D mHostMarkerBound
Definition: DataLabelManager.h:62
bool mIsAttributeMetrixLable
Definition: DataLabelManager.h:121
void AddDataLabels(const GMDataLabelVecs &irDataLabels)
ChartContext::Ptr mChartContextPtr
Definition: DataLabelManager.h:183
bool hGetAxisOriginLabelPosition(Point2D iRefPos, Int32 iIndex, Rect2D &orRect, bool iIsAtriMetri)
void hGetRefLabelPosition(TextObject::Ptr iTextLable, Int32 iRefLableIndex, Int32 iRefLinePos, bool iIsVertical, Int32 &iorXOffset, Int32 &iorYOffset, Rect2D &iorRect)
#define Int32
Definition: BasicTypes.h:20
Rect2D ToRectangle()
Definition: DataLabelManager.h:131
Rect2D ToRectangle()
Definition: DataLabelManager.h:106
Definition: DataLabelManager.h:47
EnumDssGraphMatrixDataLabelPosition hGetCorrectLocationByOrder(int iOrder, GMDataLabelInfo irDataLabel)
std::vector< Rect2D > mRectangleObject
Definition: DataLabelManager.h:190
bool mIsVertical
Definition: DataLabelManager.h:99
Definition: DataLabelManager.h:54
Point2D mHostMarkerPoint
Definition: DataLabelManager.h:88
Int32 mAxisIndex
Definition: DataLabelManager.h:116
void AddRectangleObject(const std::vector< Rect2D > &irRectangleObject)
bool mCannotFitHorizontally
Definition: DataLabelManager.h:35
Rect2D ToRectangle()
Definition: DataLabelManager.h:70
EnumDssGraphMatrixDataLabelPosition mDataLabelLocation
Definition: DataLabelManager.h:64
Definition: ChartContext.h:542
Int32 mYOffset
Definition: DataLabelManager.h:41
bool mIsDisPlayed
Definition: DataLabelManager.h:119
Rect2D mPosition
Definition: DataLabelManager.h:39
GraphObjectManager * mpManager
Definition: DataLabelManager.h:184
Int32 mOverlapRefLabelCount
Definition: DataLabelManager.h:36
Definition: ABLPlot.h:21
Int32 mGroupId
Definition: DataLabelManager.h:60
Int32 mOverlapDataLabelCount
Definition: DataLabelManager.h:37
Int32 mCenterYOffset
Definition: DataLabelManager.h:79
TextObject::Ptr mLabelPtr
Definition: DataLabelManager.h:118
Int32 mPositionIndex
Definition: DataLabelManager.h:33
EnumDssGraphMatrixDataLabelPosition
Definition: Common.h:131
Definition: Common.h:133
std::vector< GraphObject::Ptr > mSinglePointObjects
Definition: DataLabelManager.h:187
std::vector< GMDataLabelInfo > GMDataLabelVecs
Definition: DataLabelManager.h:93
GMRefLabelVecs mRefLineLabels
Definition: DataLabelManager.h:205
EnumDssGraphMatrixDataLabelHostMarkerShape
Definition: DataLabelManager.h:44
void AddRefLineLabel(const GMRefLabelInfo &irRefLabel)
AxisOriginLabelInfo(bool iIsVertical, Int32 iAxisIndex, Point2D iRefPoint, bool iIsAttributeMetrixLable)
Definition: DataLabelManager.h:123
EnumDssGraphMatrixDataLabelPosition hGetCorrectLocationByOrderForCombo(int iOrder, GMDataLabelInfo irDataLabel)
Int32 mXOffset
Definition: DataLabelManager.h:40
TextObject::Ptr mLabelPtr
Definition: DataLabelManager.h:101
std::vector< Point2D > mDLCenterPoint
Definition: DataLabelManager.h:77
void AddSinglePointObject(const std::vector< GraphObject::Ptr > &irSinglePointObjects)
TextObject::Ptr mLabelPtr
Definition: DataLabelManager.h:65
std::vector< AxisOriginLabelInfo > AxisOriginLabelVecs
Definition: DataLabelManager.h:141
GridMap mGridMap
Definition: DataLabelManager.h:181
#define NULL
Definition: Null.h:10
void AddPolygonObject(const std::vector< GraphObject::Ptr > &irPolygonObjects)
Definition: GraphObjectManager.h:37
Use four Int32 values to represent a 2D rectangle.
Definition: Rect2D.h:25
void hPutDataLabelsInLocation(GMDataLabelInfo &iorDataLabel, EnumDssGraphMatrixDataLabelPosition iLocation)
Definition: DataLabelManager.h:49
void AddCircleObject(const std::vector< Circle > &irCirclePieObject)
void hCheckRefLabelCandiate(refLableCandidate &iorRefLableCandidate, Int32 iCurIndex)
GMRefLabelInfo()
Definition: DataLabelManager.h:103
int mSeriesInfo
Definition: DataLabelManager.h:87