Mobile API Reference  MicroStrategy 2019
FunnelObject.h
Go to the documentation of this file.
1 //=====================================================================================
2 // Filename: Kernel/SourceCode/ChartEngine/PrivateSource/FunnelObject.h
3 // Date: 2009-04-07
4 // Authors: Bing Huang
5 
6 // Copyright (C) 1997-2008 MicroStrategy Incorporated
7 // All rights reserved
8 //=====================================================================================
9 
10 #ifndef MsiChart_FunnelObject_h
11 #define MsiChart_FunnelObject_h
12 
13 #include "ShapeObject.h"
14 #include "CurveLineObject.h"
15 
16 namespace MsiChart
17 {
18  //related structs and enums
19  struct FunnelInfo
20  {
21  FunnelInfo(double iScale, Point2D& irTopCenter, Point2D& irBottomCenter, float iTopRadius, float iBottomRadius,
22  Int32 iHeight, bool iIs2DFunnle);
23 
24  double mScale;
25 
26  Point2D mTopCenter;//use Int32 here to avoid overflow for Y coordinate
28  float mTopRadiusA;
30  float mTopRadiusB;
33  //the flag is false when there is tilt only, not related to width
35  };
36 
37  class FunnelObject : public ShapeObject
38  {
39  public:
41 
42  FunnelObject(const TripleId& irTripleId, GraphObjectManager* ipManager, GraphCollectionObject* ipParentObject, FunnelInfo& irFunnelInfo);
43 
44  //virtual functions from GraphObject
45  virtual void Draw() const;
46  virtual void DrawOutLine();
47  virtual bool PointInObject(const Point2D& irPoint);
48  virtual bool ObjectInRectangle(const Rect2D& irRect);
49  virtual void GenerateImageMap(ImageMap& iorImageMap);
50  virtual void GetOptions(Int32 iPropertyId, CComVariant* opValue) const;
51  virtual void GetBoundingRect(Rect2D& orBoundingRect) const;
52  virtual Point2D GetDataPoint();
53 
54  //virtual function from ShapeObject
55  virtual bool SupportBevelEffect() const;
56 
57  //helper method for label & leader line position
58  Point2D GetMiddlePoint() const;
59  Int32 GetMiddleWidth() const;
60 
61  protected:
62  //pure virtual functions from ShapeObject
63  virtual void GetClockwisePolygon(std::vector<Point2D>& orPolygon) const;
64  virtual bool IsCircularShape() const;
65 
66  private:
67 
68  void hDraw2DFunnel() const;
69  void hDraw3DFunnel(bool iIsOutline) const;
70  void hDrawSurface(bool iIsInnerSurface, bool iIsLinePath) const;
71  void hDrawTop() const;
72  void hFillInnerSurface() const;
73  bool hPointInEllipse(const Point2D& irPoint, const Point<Int32>& irCenter, Int32 iRadiusA, Int32 iRadiusB);
74 
75  void hCreateCurves();
76  void hCreateOneCurve(CurveLineObject::Ptr iCurvePtr, bool iIsTop, bool iInnerAngle, Point2D iOffset);
77  void hCreate2DPolygon();
78  void hCreate3DPolygon();
79 
80  bool hIsPointInPolygon(const Point2D& irPoint) const;
81  bool hIsPointInFunnelEllipse(const Point2D& irPoint, bool iIsTop, bool iIsHeight, bool iIsUpPart);
82 
83  void hGenerateImageMap(bool iIsInnerSurface, ImageMap& iorImageMap);
84 
85  FunnelInfo mFunnelInfo;
86 
87  std::vector<Point2D> mPolygon;
88  CurveLineObject::Ptr mTopInnerPtr;
89  CurveLineObject::Ptr mTopOuterPtr;
90  CurveLineObject::Ptr mBottomInnerPtr;
91  CurveLineObject::Ptr mBottomOuterPtr;
92 
93  CurveLineObject::Ptr mWholeEllipsePtr;
94 
95  double mTopTheta;
96  double mBottomTheta;
97  bool mBottomInsideTop;
98 
99  };
100 }
101 
102 #endif
float mTopRadiusA
Definition: FunnelObject.h:28
float mBottomRadiusA
Definition: FunnelObject.h:29
virtual void Draw() const
virtual bool PointInObject(const Point2D &irPoint)
Point2D mBottomCenter
Definition: FunnelObject.h:27
FunnelObject(const TripleId &irTripleId, GraphObjectManager *ipManager, GraphCollectionObject *ipParentObject, FunnelInfo &irFunnelInfo)
double mScale
Definition: FunnelObject.h:24
Definition: GraphCollectionObject.h:19
virtual bool SupportBevelEffect() const
virtual void DrawOutLine()
bool mIs2DFunnel
Definition: FunnelObject.h:34
virtual void GetClockwisePolygon(std::vector< Point2D > &orPolygon) const
Definition: ShapeObject.h:20
virtual void GenerateImageMap(ImageMap &iorImageMap)
virtual void GetBoundingRect(Rect2D &orBoundingRect) const
#define Int32
Definition: BasicTypes.h:20
float mBottomRadiusB
Definition: FunnelObject.h:31
Definition: FunnelObject.h:37
FunnelInfo(double iScale, Point2D &irTopCenter, Point2D &irBottomCenter, float iTopRadius, float iBottomRadius, Int32 iHeight, bool iIs2DFunnle)
Definition: SmartPtr.h:38
virtual bool IsCircularShape() const
virtual bool ObjectInRectangle(const Rect2D &irRect)
Definition: ABLPlot.h:21
std::vector< AreaRec * > ImageMap
Definition: ImageMap.h:99
Point2D mTopCenter
Definition: FunnelObject.h:26
Definition: Msi_ccomvariant.h:24
MSynch::SmartPtr< FunnelObject > Ptr
Definition: FunnelObject.h:40
Point2D GetMiddlePoint() const
Int32 mHeight
Definition: FunnelObject.h:32
Definition: GraphObjectManager.h:37
virtual Point2D GetDataPoint()
virtual void GetOptions(Int32 iPropertyId, CComVariant *opValue) const
Use four Int32 values to represent a 2D rectangle.
Definition: Rect2D.h:25
Definition: FunnelObject.h:19
float mTopRadiusB
Definition: FunnelObject.h:30
Definition: Common.h:397
Int32 GetMiddleWidth() const