Mobile API Reference  MicroStrategy 2019
BorderObject.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : BorderObject.h
3 // AUTHOR : Xin Liu
4 // CREATION : 3/05/09
5 // Copyright (C) MicroStrategy, Inc. 2009
6 //==============================================================================================
7 
8 #ifndef MSICHART_BORDEROBJECT_H
9 #define MSICHART_BORDEROBJECT_H
10 
11 #include "ShapeObject.h"
12 
13 namespace MsiChart
14 {
16  {
23  };
24 
26  {
29 
33  };
34 
36  {
41  };
42 
44  {
46 
48  : mCornerRadius(0)
49  , mBaseRadius(0)
52  {}
53 
54  float mStartAngle;
55  float mStopAngle;
63  };
67  class BorderObject: public ShapeObject
68  {
69  public:
71 
78  BorderObject(const TripleId& irTripleId,
79  GraphObjectManager* ipManager, // manager who create the object
80  const Point2D& irCenter,
81  float iStartAngle,
82  float iStopAngle,
83  Int32 iRadius,
84  Int32 iThickness,
85  bool iIsClipped = false,
86  Int32 iCornerRadius = 0,
87  Int32 iBaseRadius = 0,
89  GraphCollectionObject* ipParentObject = NULL);
90 
91  virtual ~BorderObject();
92 
93  //virtual functions from GraphObject
94  virtual void Draw() const;
95  virtual bool ObjectInRectangle(const Rect2D& irRect);
96  virtual void DrawOutLine();
97  virtual bool PointInObject(const Point2D& irPoint);
98  virtual void GenerateImageMap(ImageMap& iorImageMap);
99 
100  //pure virtual function from ShapeObject
101  virtual void GetBoundingRect(Rect2D& orBoundingRect) const;
102  virtual bool SupportBevelEffect() const;
103  virtual bool IsCircularShape() const;
104 
106 
107  protected:
108  //virtual functions from ShapeObject
109  virtual void GetClockwisePolygon(std::vector<Point2D>& orPolygon) const;
110  virtual void FillBevel() const;
111 
112  private:
113  void hCalculateCornerCenters(Point2D iCenter) const;
114  void hCalculateClippedBorderShapeType();
115  void hSetBorderPath(Point<double> iCenter, double iThickness = 0.0, bool iIsClockwise = true) const;
116  void hDrawInnerAndOuterPathAsWhole(Point<double> iCenter, double iOuterRadius, double iInnerRadius) const;
117  void hDrawBorderPath(Point<double> iCenter, double iThickness = 0.0, bool iIsClockwise = true) const;
118 
119  void hFillDonutRingSector(const Point<double>& irCenter, double iOuterRadius, double iInnerRadius) const;
120  void hFillDonutRect(const Point<double>& irStartPoint, const Point<double>& irEndPoint) const;
121  // void hSetSectorPath(const Point<double>& irCenter, double iOuterRadius, double iInnerRadius, double iStartAngle, double iEndAngle);
122  void hDrawAndFillClippedBorder() const;
123  void hDrawAndFillClippedBorderDonut() const;
124  void hDrawAndFillNormalBorder() const;
125  void hDrawAndFillBorder3D() const;
126  void hDrawAndFillBorderMetallic() const;
127  void hDrawAndFillEmbossedEdge() const;
128 
129  Point2D hGetOffsetCenterForEmbossedEdge() const;
130 
131  void hFillBevelEffect() const;
132  void hFillDonutEffect() const;
133  void hFillBorderStyleEffect() const;
134  void hFillBorderStyleEffect3D() const;
135  void hFillBorderStyleEffectMetallic() const;
136 
137  void hCalculateMediumRadiusOfMetallic(double& orOuterMediumRadius, double& orInnerMediumRadius) const;
138 
139  Point<double> hGetIntersectionOfMainCurveAndMinCorner(double iThickness) const;
140  Point<double> hGetIntersectionOfMainCurveAndMaxCorner(double iThickness) const;
141  Point<double> hGetIntersectionOfMinCornerAndMinSideLine(double iThickness) const;
142  Point<double> hGetIntersectionOfMaxCornerAndMaxSideLine(double iThickness) const;
143  Point<double> hGetIntersectionOfMinSideLineAndBaseCurve(double iThickness) const;
144  Point<double> hGetIntersectionOfMaxSideLineAndBaseCurve(double iThickness) const;
145  double hGetMinSideBaseAngle(double iThickness) const;
146  double hGetMaxSideBaseAngle(double iThickness) const;
147  double hGetCornerAngularDistance() const;
148 
149  bool hPointInClippedBorder(const Point<double>& irPoint, double iThickness) const;
150  bool hPointInCircle(const Point<double>& irPoint, const Point<double>& irCenter, double iRadius) const;
151  bool hPointInSector(const Point<double>& irPoint, const Point<double>& irCenter, double iRadius, double iStartAngle, double iEndAngle) const;
152 
153  //The method definition is similar PieSliceObject::GetSectorImageMap(), need code refactory in the future.
154  void hGenerateSectorImageMap(const Point2D& irCenter, const Int32 iOuterRadius, const Int32 iInnerRadius,
155  const Int32 iStartAngle, const Int32 iEndAngle, ImageMap& iorImageMap) const;
156  void hGenerateApproximatePolylineOfCircle(const Point2D& irCenter, const Int32 iRadius,
157  const Int32 iStartAngle, const Int32 iEndAngle, std::vector<Point2D>& orPolyline) const;
158  void hGenerateClippedBorderImageMap(ImageMap& iorImageMap) const;
159 
160  //data members
161  EnumDSSGraphGaugeBorderStyle mBorderStyle;
162  Point2D mCenter;
163  Int32 mRadius;
164  Int32 mThickness;
165  bool mIsClipped;
166  bool mIsSolid;
167  ClippedBorderShapeInfo::Ptr mBorderInfoPtr;
168  mutable BorderStyleSection mBorderStyleSection;
169  };
170 
172  {
173  return mRadius - mThickness;
174  }
175 }
176 
177 #endif
virtual bool IsCircularShape() const
Definition: BorderObject.h:18
Definition: BorderObject.h:38
float mStartAngle
The start angle.
Definition: BorderObject.h:54
Definition: BorderObject.h:30
ClippedBorderShapeType
Definition: BorderObject.h:35
virtual void FillBevel() const
Definition: BorderObject.h:20
Definition: BorderObject.h:31
virtual bool SupportBevelEffect() const
Definition: BorderObject.h:32
Definition: GraphCollectionObject.h:19
BorderStyleSection
Definition: BorderObject.h:25
Definition: BorderObject.h:40
virtual bool PointInObject(const Point2D &irPoint)
Definition: BorderObject.h:27
EnumDSSGraphGaugeBorderStyle
Definition: DSSIPhoneEnums.h:2119
Definition: ShapeObject.h:20
Int32 mBaseRadius
Definition: BorderObject.h:58
Definition: DSSIPhoneEnums.h:2122
Definition: BorderObject.h:37
Definition: BorderObject.h:67
#define Int32
Definition: BasicTypes.h:20
Definition: BorderObject.h:17
Definition: BorderObject.h:43
virtual bool ObjectInRectangle(const Rect2D &irRect)
Int32 mCornerRadius
Definition: BorderObject.h:57
virtual void Draw() const
virtual void GetBoundingRect(Rect2D &orBoundingRect) const
MSynch::SmartPtr< ClippedBorderShapeInfo > Ptr
Definition: BorderObject.h:45
Definition: BorderObject.h:22
virtual void DrawOutLine()
BorderObject(const TripleId &irTripleId, GraphObjectManager *ipManager, const Point2D &irCenter, float iStartAngle, float iStopAngle, Int32 iRadius, Int32 iThickness, bool iIsClipped=false, Int32 iCornerRadius=0, Int32 iBaseRadius=0, EnumDSSGraphGaugeBorderStyle iBorderStyle=DssGraphGaugeBorderStyleSimple, GraphCollectionObject *ipParentObject=NULL)
ClippedBorderShapeInfo()
Definition: BorderObject.h:47
Definition: BorderObject.h:28
Definition: ABLPlot.h:21
MSynch::SmartPtr< BorderObject > Ptr
Definition: BorderObject.h:70
ClippedBorderShapeType mClippedBorderShape
Definition: BorderObject.h:62
float mStopAngle
The stop angle.
Definition: BorderObject.h:55
std::vector< AreaRec * > ImageMap
Definition: ImageMap.h:99
virtual void GetClockwisePolygon(std::vector< Point2D > &orPolygon) const
float mAngularDistance
The angle between start and end.
Definition: BorderObject.h:56
Point< double > mMaxCornerCenter
Definition: BorderObject.h:60
BorderSection
Definition: BorderObject.h:15
Int32 GetInnerRadius()
Definition: BorderObject.h:171
Definition: BorderObject.h:19
Definition: BorderObject.h:21
Point< double > mMinCornerCenter
Definition: BorderObject.h:59
virtual void GenerateImageMap(ImageMap &iorImageMap)
#define NULL
Definition: Null.h:10
Definition: GraphObjectManager.h:37
Use four Int32 values to represent a 2D rectangle.
Definition: Rect2D.h:25
Definition: BorderObject.h:39
BorderSection mBorderSection
Definition: BorderObject.h:61
Definition: Common.h:397