Mobile API Reference  MicroStrategy 2019
GraphObject.h
Go to the documentation of this file.
1 //===========================================================================
2 // Filename: GraphObject.h
3 // Date: 2008-05-19
4 // Authors: Bing Huang
5 
6 // Copyright (C) 1997-2008 MicroStrategy Incorporated
7 // All rights reserved
8 //===========================================================================
9 
10 #ifndef MsiChart_GraphObject_h
11 #define MsiChart_GraphObject_h
12 
14 #include "Synch/Defines/SmartPtr.h"
15 #include "PDCHeader/PDCstring"
16 
17 #include "../Common.h"
18 #include "ImageMap.h"
19 #include "ChartContext.h"
20 #include "FormatLine.h"
21 
22 namespace MsiChart
23 {
24  class GraphObjectManager;
26  typedef std::vector<Point2D> Polygon2D;
27 
28  typedef enum
29  {
34 
39  {
40  public:
41  //smart ptr
43 
44  //ctor & dtor
45  GraphObject(const TripleId& irTripleId, GraphObjectManager* ipManager, GraphCollectionObject* ipParentObject, bool iHasLine = true);
46  virtual ~GraphObject();
47 
52  void GetTripleId(TripleId& orTripleId) const;
53 
58  Int32 GetObjectId() const;
59 
64  Int32 GetSeriesId() const;
68  virtual void Draw() const = 0;
69 
75  virtual void GenerateView();
76 
84  virtual bool ObjectInRectangle(const Rect2D& irRect) = 0;
85  virtual void ObjectsInRectange(const Rect2D& irRect, std::vector<GraphObject::Ptr>& iorSelectedObjects);
86 
91  virtual void DrawOutLine();
92 
99  virtual bool PointInObject(const Point2D& irPoint);
100 
108  virtual Int32 DistanceToPoint(const Point2D& irPoint);
109 
115  virtual void GetOptions(Int32 iPropertyId, CComVariant* opValue) const;
116 
122  virtual void GenerateImageMap(ImageMap& iorImageMap);
123 
129 
134  void SetFormatLine(FormatLine::Ptr iFormatLinePtr);
135 
141 
147  virtual void GetBoundingRect(Rect2D& orBoundingRect) const;
148 
149  virtual Point2D GetCenterPoint() const;
150 
155  Int32 GetChartAreaId() const;
156 
160  void SetDetectable(bool iIsDetectable);
161 
165  virtual Point2D GetDataPoint();
166 
173  virtual void GetClockwisePolygon(std::vector<Point2D>& orPolygon) const = 0;
174 
178  virtual void SetProgress(double iProgress);
179 
180  void SetAnimationEnable(bool iIsAnimationEnabled);
181  bool IsAnimationEnabled();
182  void SetNativeAnimationEnable(bool iIsNativeAnimationEnabled);
184 
185  virtual bool IsLayerObject() const;
186 
190  virtual float GetMemoryUsageEstimation() const;
191 
192  virtual void SetHover(bool iIsHovered);
193  virtual bool GetHover() const;
194  virtual bool IsVirtual() const;
195  void GetGraphObjectManager(GraphObjectManager* &oprManager);
199  void SetOutlineWidth() const;
200  void SetOutlineWidth(Int32 iLineWidth) const;
201 #ifndef _VE_CE
202 
208  void DrawGlowEffectForRect(const Rect2D& irRect, CGGradientRef iGradient) const;
209 
216  void DrawGlowEffectForPolygon(const Polygon2D& irPolygon, CGGradientRef iGradient) const;
217 #endif
218  protected:
222  void SetLineWidth() const;
223 
227  void ApplyLineFormat() const;
228 
232  void ApplyOutlineFormat() const;
233 
237  void ApplyInnerOutlineFormat() const;
238 
244  void AppendRectangle2ImageMap(const Rect2D& irRect, ImageMap& iorImageMap) const;
245 
251  void AppendPolygon2ImageMap(const std::vector<Point2D>& irPolygon,ImageMap& iorImageMap) const;
252 
263  void GetAngularBisectorIntersectionPoint(const Point2D& irA, const Point2D& irB, const Point2D& irC, float irDepth, Point2D& orBisectorPoint) const;
264 
269  void MakePolygonClockwise(std::vector<Point2D>& iorPolygon) const;
270  //bool mIsShown;
271  //mutable bool mDeviceValid;
274 
278 
280 
281  double mProgress;
282 
284 
286 
287  bool mIsHovered;
288  private:
293  void hSetLineWidth(Int32 iLineWidth) const;
294 
299  void hSetParent(GraphCollectionObject* ipParentObject);
300 
306  virtual void hGetFormatFromParent();
307 
308  friend class GraphCollectionObject;
309  };
311 
313  {
314  return mTripleId.mObjectId;
315  }
317  {
318  return mTripleId.mSeriesId;
319  }
320 
322  {
323  return mpParentObject;
324  }
325 
327  {
328  return mFormatLinePtr;
329  }
330 
331  inline void GraphObject::hSetParent(GraphCollectionObject* ipParentObject)
332  {
333  mpParentObject = ipParentObject;
334  }
335 
336  inline void GraphObject::SetDetectable(bool iIsDetectable)
337  {
338  mIsDetectable = iIsDetectable;
339  }
340 
341  inline void GraphObject::SetAnimationEnable(bool iIsAnimationEnabled)
342  {
343  mIsAnimationEnabled = iIsAnimationEnabled;
344  SetProgress(0.1);
345  }
347  {
348  return mIsAnimationEnabled;
349  }
350  inline void GraphObject::SetNativeAnimationEnable(bool iIsNativeAnimationEnabled)
351  {
352  mIsNativeAnimationEnabled = iIsNativeAnimationEnabled;
353  SetProgress(0.1);
354  }
356  {
358  }
359  inline void GraphObject::SetProgress(double iProgress)
360  {
361  mProgress = iProgress;
362  }
363  inline bool GraphObject::IsLayerObject() const
364  {
365  return false;
366  }
368  {
369  return sizeof(*this);
370  }
371  inline void GraphObject::SetHover(bool iIsHovered)
372  {
373  mIsHovered = iIsHovered;
374  mChartContextPtr->SetHover(mTripleId, iIsHovered);
375  }
376  inline bool GraphObject::GetHover() const
377  {
378  return mIsHovered;
379  }
380  inline bool GraphObject::IsVirtual() const
381  {
382  return false;
383  }
385  {
386  oprManager = mpManager;
387  }
388 }
389 
390 #endif
virtual float GetMemoryUsageEstimation() const
Definition: GraphObject.h:367
bool mIsDetectable
Indicate whether current object is detectable or not.
Definition: GraphObject.h:279
GraphCollectionObject * GetParentObject() const
Definition: GraphObject.h:321
virtual void DrawOutLine()
virtual void GetBoundingRect(Rect2D &orBoundingRect) const
bool mIsAnimationEnabled
Definition: GraphObject.h:283
Int32 mObjectId
Definition: Common.h:406
void SetLineWidth() const
bool mIsNativeAnimationEnabled
Definition: GraphObject.h:285
GraphObject(const TripleId &irTripleId, GraphObjectManager *ipManager, GraphCollectionObject *ipParentObject, bool iHasLine=true)
virtual Int32 DistanceToPoint(const Point2D &irPoint)
FormatLine::Ptr mFormatLinePtr
Definition: GraphObject.h:273
void SetNativeAnimationEnable(bool iIsNativeAnimationEnabled)
Definition: GraphObject.h:350
void SetFormatLine(FormatLine::Ptr iFormatLinePtr)
virtual void SetHover(bool iIsHovered)
Definition: GraphObject.h:371
Definition: GraphCollectionObject.h:19
void MakePolygonClockwise(std::vector< Point2D > &iorPolygon) const
virtual void SetProgress(double iProgress)
Definition: GraphObject.h:359
virtual Point2D GetCenterPoint() const
double mProgress
Definition: GraphObject.h:281
virtual void GenerateView()
virtual bool GetHover() const
Definition: GraphObject.h:376
void GetTripleId(TripleId &orTripleId) const
void ApplyLineFormat() const
EnumGraphObjectUsage
Definition: GraphObject.h:28
const TripleId mTripleId
Definition: GraphObject.h:275
virtual bool IsVirtual() const
Definition: GraphObject.h:380
virtual bool IsLayerObject() const
Definition: GraphObject.h:363
std::vector< Point2D > Polygon2D
Definition: GraphObject.h:25
FormatLine::Ptr GetFormatLine() const
Definition: GraphObject.h:326
void DrawGlowEffectForRect(const Rect2D &irRect, CGGradientRef iGradient) const
#define Int32
Definition: BasicTypes.h:20
void GetAngularBisectorIntersectionPoint(const Point2D &irA, const Point2D &irB, const Point2D &irC, float irDepth, Point2D &orBisectorPoint) const
virtual void ObjectsInRectange(const Rect2D &irRect, std::vector< GraphObject::Ptr > &iorSelectedObjects)
ChartContext::Ptr mChartContextPtr
Definition: GraphObject.h:276
void ApplyOutlineFormat() const
Int32 GetObjectId() const
Definition: GraphObject.h:312
void AppendRectangle2ImageMap(const Rect2D &irRect, ImageMap &iorImageMap) const
Definition: GraphObject.h:31
Definition: GraphObject.h:38
Int32 GetSeriesId() const
Definition: GraphObject.h:316
Definition: ChartContext.h:542
Int32 mSeriesId
Definition: Common.h:407
void SetDetectable(bool iIsDetectable)
Definition: GraphObject.h:336
void GetGraphObjectManager(GraphObjectManager *&oprManager)
Definition: GraphObject.h:384
Definition: ABLPlot.h:21
virtual bool ObjectInRectangle(const Rect2D &irRect)=0
std::vector< AreaRec * > ImageMap
Definition: ImageMap.h:99
bool IsAnimationEnabled()
Definition: GraphObject.h:346
void DrawGlowEffectForPolygon(const Polygon2D &irPolygon, CGGradientRef iGradient) const
virtual void GetClockwisePolygon(std::vector< Point2D > &orPolygon) const =0
void SetHover(const TripleId &iTripleId, bool iIsHover)
virtual Point2D GetDataPoint()
Int32 GetChartAreaId() const
GraphObjectManager * mpManager
Definition: GraphObject.h:277
Definition: Msi_ccomvariant.h:24
virtual bool PointInObject(const Point2D &irPoint)
void SetOutlineWidth() const
virtual void Draw() const =0
Definition: GraphObject.h:32
virtual void GenerateImageMap(ImageMap &iorImageMap)
void AppendPolygon2ImageMap(const std::vector< Point2D > &irPolygon, ImageMap &iorImageMap) const
bool mIsHovered
Hover Effect, used in Graph matrix tooltip.
Definition: GraphObject.h:287
void ApplyInnerOutlineFormat() const
GraphObject LineObject
Definition: GraphObject.h:310
bool IsNativeAnimationEnabled()
Definition: GraphObject.h:355
Definition: GraphObjectManager.h:37
GraphCollectionObject * mpParentObject
Definition: GraphObject.h:272
void SetAnimationEnable(bool iIsAnimationEnabled)
Definition: GraphObject.h:341
Use four Int32 values to represent a 2D rectangle.
Definition: Rect2D.h:25
Definition: GraphObject.h:30
virtual void GetOptions(Int32 iPropertyId, CComVariant *opValue) const
Definition: Common.h:397
MSynch::SmartPtr< GraphObject > Ptr
Definition: GraphObject.h:42