Mobile API Reference  MicroStrategy 2019
LayerObject.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : LayerObject.h
3 // AUTHOR : Liang Liu
4 // CREATION : 2010-04-28
5 // Copyright (C) MicroStrategy Incorporated 2008
6 // All Rights Reserved
7 //==============================================================================================
8 #ifndef MsiChart_LayerObject_h
9 #define MsiChart_LayerObject_h
10 
11 #include "PDCHeader/PDCvector"
12 #include "GraphObject.h"
13 #include "LayerObjectHelper.h"
14 
15 namespace MsiChart
16 {
17 
21  class LayerObject: public GraphObject
22  {
23 #ifdef _VE_CE
24  friend class LayerObjectWINHelper;
25 #else
26  friend class LayerObjectIOSHelper;
27 #endif
28  public:
30 
35  LayerObject(const TripleId& irTripleId, GraphObjectManager* ipManager, bool iIsAnimationNeeded);
36  virtual ~LayerObject();
37 
41  void AddGraphObject(GraphObject::Ptr iGraphObjectPtr);
42  bool DeleteGraphObject(GraphObject::Ptr iGraphObjectPtr);
43 
44  void AddRedrawGraphObject(GraphObject::Ptr iGraphObjectPtr);
45  bool DeleteRedrawGraphObject(GraphObject::Ptr iGraphObjectPtr);
46 
49  void Clear();
50 
51  //---------Override functions-------------------------------------
52  virtual void Draw() const;
53  virtual void GenerateView();
54  virtual void DrawOutLine();
55  virtual bool ObjectInRectangle(const Rect2D& irRect);
56  virtual void GetClockwisePolygon(std::vector<Point2D>& orPolygon) const;
57  virtual bool IsLayerObject() const;
58  virtual void ObjectsInRectange(const Rect2D& irRect, std::vector<GraphObject::Ptr>& iorSelectedObjects);
59 
60 #ifndef _VE_CE
61  void DrawWithContext(CGContextRef ipCGContext, const CGRect& irRect);
62 #endif
63 
67  void EnableAnimation(bool iIsAnimationNeeded);
68 
72  bool IsAnimationNeeded() const;
73 
75  void SetFrameIndex(Int32 iFrameIndex);
77  Int32 GetFrameIndex() const;
79  bool IsEmpty() const;
81  double GetAnimationDuration() const;
86  std::string GetTemplateNodeKey() const;
87 
89  void ResetLayerView();
90 
91  void AnimationDidFinished();
92 
93  bool IsInGraphObjectsList(const GraphObject* ipGraphObject);
94  bool IsInRedrawGraphObjectsList(const GraphObject* ipGraphObject);
95 
97 
98  void SetProgress(double iProgress);
99 
101  const std::vector<Int32>& irObjectIds, Int32& iorDistance, Int32 iRadius,
102  std::vector<GraphObject::Ptr>& iorGraphObjectsAround, EnumGraphObjectUsage iUsage = GOU_NORMAL_HIGHLIGHT);
103 
104 #ifndef _VE_CE
105  void GetAllGraphObjectInfo(std::vector<CGRect> &iAllGraphObjectsBorder, std::vector<MsiChart::TripleId > &iAllGraphObjectsTripleId);
106 #endif
107 
108  virtual float GetMemoryUsageEstimation() const;
109 
110  void GetGraphObjectList(std::vector<GraphObject::Ptr>& orGraphObjectList);
111 
112  protected:
113  // Draw the objects in mGraphObjectList;
114  void DoDraw() const;
115 
116  // A collection of GraphObjects which will be redraw in the highlight view to bring the object to the top of the chart.
117  std::vector<GraphObject::Ptr> mRedrawGraphObjectList;
118 
120  std::vector<GraphObject::Ptr> mGraphObjectList;
124  mutable void* mpLayerObjectView;
125  mutable float mPreviousScale;
126  private:
127  void hGenerateLayerObjectView() const;
128 
129  void hMakeClearForHoveredGrid(GraphObject::Ptr iGraphObjectPtr, double iRatio) const;
130 
131  //void hClearAllSubviewsFromDrawRect() const;
132  LayerObjectHelper *mpLayerObjectHelper;
133  };
134 
135  inline void LayerObject::EnableAnimation(bool iIsAnimationNeeded)
136  {
137  mIsAnimationNeeded = iIsAnimationNeeded;
138  }
139 
140  inline bool LayerObject::IsAnimationNeeded() const
141  {
142  return mIsAnimationNeeded;
143  }
144  inline void LayerObject::SetFrameIndex(Int32 iFrameIndex)
145  {
146  mFrameIndex = iFrameIndex;
147  }
149  {
150  return mFrameIndex;
151  }
152  inline bool LayerObject::IsLayerObject() const
153  {
154  return true;
155  }
156 
157  inline void LayerObject::GetGraphObjectList(std::vector<GraphObject::Ptr>& orGraphObjectList)
158  {
159  orGraphObjectList = mGraphObjectList;
160  }
161 }
162 #endif
Definition: LayerObjectIOSHelper.h:16
Definition: LayerObject.h:21
void GetAllGraphObjectInfo(std::vector< CGRect > &iAllGraphObjectsBorder, std::vector< MsiChart::TripleId > &iAllGraphObjectsTripleId)
Int32 GetFrameIndex() const
Get frame index.
Definition: LayerObject.h:148
virtual void GetClockwisePolygon(std::vector< Point2D > &orPolygon) const
void SetProgress(double iProgress)
virtual void DrawOutLine()
virtual bool IsLayerObject() const
Definition: LayerObject.h:152
bool mIsAnimationNeeded
Definition: LayerObject.h:122
bool IsInGraphObjectsList(const GraphObject *ipGraphObject)
float mPreviousScale
Definition: LayerObject.h:125
virtual void GenerateView()
bool IsEmpty() const
Check whether the current LayerObject is empty.
std::vector< GraphObject::Ptr > mGraphObjectList
A collection of GraphObjects which share the same format properties.
Definition: LayerObject.h:120
Definition: LayerObjectWINHelper.h:16
MSynch::SmartPtr< LayerObject > Ptr
Definition: LayerObject.h:29
GraphObject::Ptr OnPointDetectionEx(const Point2D &irCursor, const std::vector< Int32 > &irObjectIds, Int32 &iorDistance, Int32 iRadius, std::vector< GraphObject::Ptr > &iorGraphObjectsAround, EnumGraphObjectUsage iUsage=GOU_NORMAL_HIGHLIGHT)
void AddGraphObject(GraphObject::Ptr iGraphObjectPtr)
virtual void Draw() const
Definition: LayerObjectHelper.h:15
std::string GetTemplateNodeKey() const
LayerObject(const TripleId &irTripleId, GraphObjectManager *ipManager, bool iIsAnimationNeeded)
Int32 mFrameIndex
Definition: LayerObject.h:123
virtual float GetMemoryUsageEstimation() const
bool IsAnimationNeeded() const
Definition: LayerObject.h:140
EnumGraphObjectUsage
Definition: GraphObject.h:28
bool DeleteRedrawGraphObject(GraphObject::Ptr iGraphObjectPtr)
bool IsInRedrawGraphObjectsList(const GraphObject *ipGraphObject)
void ResetLayerView()
Remove current layer view from its superview and clear reference.
double GetAnimationDuration() const
Get the duration of animation;.
void GetGraphObjectList(std::vector< GraphObject::Ptr > &orGraphObjectList)
Definition: LayerObject.h:157
void DrawWithContext(CGContextRef ipCGContext, const CGRect &irRect)
void EnableAnimation(bool iIsAnimationNeeded)
Definition: LayerObject.h:135
#define Int32
Definition: BasicTypes.h:20
bool mIsInSeriesRenderer
Definition: LayerObject.h:121
std::vector< GraphObject::Ptr > mRedrawGraphObjectList
Definition: LayerObject.h:117
virtual bool ObjectInRectangle(const Rect2D &irRect)
void * mpLayerObjectView
Definition: LayerObject.h:124
Definition: GraphObject.h:38
Definition: ABLPlot.h:21
bool DeleteGraphObject(GraphObject::Ptr iGraphObjectPtr)
virtual void ObjectsInRectange(const Rect2D &irRect, std::vector< GraphObject::Ptr > &iorSelectedObjects)
Definition: GraphObjectManager.h:37
void SetFrameIndex(Int32 iFrameIndex)
Set frame index.
Definition: LayerObject.h:144
void AddRedrawGraphObject(GraphObject::Ptr iGraphObjectPtr)
Use four Int32 values to represent a 2D rectangle.
Definition: Rect2D.h:25
Definition: GraphObject.h:30
Definition: Common.h:397