Mobile API Reference  MicroStrategy 2019
LineSeriesRenderer.h
Go to the documentation of this file.
1 //=======================================================================
2 // Filename: LineSeriesRenderer.h
3 // Date: 2008-10-06
4 // Authors: Bing Huang
5 
6 // Copyright (C) 1997-2008 MicroStrategy Incorporated
7 // All rights reserved
8 //=======================================================================
9 
10 #ifndef MsiChart_LineSeriesRenderer_h
11 #define MsiChart_LineSeriesRenderer_h
12 
13 #include "SeriesRenderer.h"
14 #include "DataLabelManager.h"
15 #ifdef _VE_CE
16 #include "GraphObjectAggregation.h"
17 #endif
18 
19 namespace MsiChart
20 {
22  {
24 
26  mMarkerShape(0), mShowStepLine(false), mMarkerSize(50)
27  {}
28 
31  unsigned char mMarkerShape;
33  };
34 
35  class ABLPlot;
37 
38  typedef std::pair<Point2D, Point2D> LinePair;
39 
41  {
42  public:
44 
45  LineSeriesRenderer(const TripleId& irTripleId, GraphObjectManager* ipManager, Dataset::Ptr iDatasetPtr, Legend::Ptr iLegendPtr);
46 
47  //pure virtual functions from GraphObjectManager
48  virtual void GenerateMapAndList();
49  virtual void GetOptions(Int32 iSeriesId, Int32 iPropertyId, CComVariant* opValue) const;
50 
51  //pure virtual function from SeriesRenderer
52  virtual void GenerateByValueAxis(EnumValueAxis iValueAxis, std::vector<GraphObject::Ptr>& iorGraphObjectList);
53 #ifndef _VE_CE
54  virtual void GenerateInterpolationFrame(double iProgress, LayerObject* ipLayerObject);
55 #else
56  virtual void GenerateInterpolationFrame(double iProgress);
57 #endif
58  virtual bool GetToolTipData(Int32 iSeriesID, Int32 iGroupID, double& orValue, double& orPercentValue, Int32 iOffset = 0);
59 
60  //override from GraphObjectManager
61  virtual GraphObject::Ptr OnPointDetectionEx(const Point2D& irCursor,
62  const std::vector<Int32>& irObjectIds, Int32& iorDistance, Int32 iRadius,
63  std::vector<GraphObject::Ptr>& iorGraphObjectsAround, EnumGraphObjectUsage iUsage = GOU_NORMAL_HIGHLIGHT);
64  virtual void GenerateVirtualMarker();
65 
66  bool GetData(Int32 iInfoIndex, Int32 iGroupId, double& orValue, bool iPreValue = false, Int32 iDataGroup = 0) const;
67  void AddObjectsToDataLabelManager(DataLabelManager::Ptr iDataLabelManagerPtr);
68  void hCreateDataMarkerForDataLabel(bool iOnlyForDisplayedDataLable = true);
69 
70  protected:
75  void LoadSeriesProperties(Int32 iInfoIndex);
76 
81  virtual void LoadStepLine(Int32 iInfoIndex);
82 
89  virtual void GenerateMapAndListForSeries(Int32 iInfoIndex);
90 
98  virtual void GenerateByValueAxisAndGroup(EnumValueAxis iValueAxisIndex, Int32 iGroupId);
99 
105  virtual void GetLinePointSet(Int32 iInfoIndex, std::vector<std::vector<Point2D> >& orPointSet) const;
106 
115  bool GetLinePoint(Int32 iInfoIndex, Int32 iGroupIndex, Point2D& orPoint) const;
116 
126  bool GetFinalLinePoint(Int32 iInfoIndex, Int32 iGroupIndex, Point2D& orLinePoint, bool iIsOldRenderer) const;
127 
137  virtual void GenerateDepthLine(Int32 iInfoIndex, Int32 iGroupId, LinePair& irLinePair);
138 
144 
149 
154  void CreateSeriesMarkers(Int32 iInfoIndex);
155 
159  void CreateAllSeriesLabels();
160 
171  void CreateMarker(Int32 iInfoIndex, Int32 iGroupId, GraphCollectionObject::Ptr iMarkerCollectionPtr, Point2D& irCenterPoint);
172 
173  //For Graph Matrix, we create virtual marker in method OnPointDetectionEx() when tooltip trigled.
174  void CreateVirtualMarker(Int32 iInfoIndex, Int32 iGroupId, GraphCollectionObject::Ptr iMarkerCollectionPtr, Point2D& irCenterPoint);
175 
180  //void CreateTrendLines(Int32 iInfoIndex);
181 
191  bool GetMinMaxPoint(Int32 iInfoIndex, Int32 iGroupId, Point2D& orMinPoint, Point2D& orMaxPoint) const;
192 
203  virtual bool GetPointPair(Int32 iInfoIndex, Int32 iGroupId, Point2D& orStartPoint, Point2D& orEndPoint) const;
204 
212  void GenerateOrderedDepthLine(EnumValueAxis iValueAxisIndex, Int32 iGroupId, bool iIsStepLine);
213 
219  virtual bool hGetParetoLinePoints(Int32 iInfoIndex, std::vector<std::vector<Point2D> >& orPointSet) const;
220 
226  //virtual bool hGetParetoLinePoints(Int32 iInfoIndex, std::vector<Point2D>& orPointSet) const;
227 
233  virtual bool hGetFinalParetoLinePoint(Int32 iInfoIndex, Int32 iOffsetFromGroupOrder, Point2D& orPointSet) const;
234 
242  virtual bool hGetParetoLinePointWithOffset(Int32 iInfoIndex, Int32 iGroupId, Point2D& orPoint, bool iIsFinal) const;
243 
250  Int32 hGetOffsetFromGroupOrder(const std::vector<Int32>& irGroupOrder, Int32 iGroupId) const;
251 
259  double hGetCumulatedYValueForPareto(Int32 iGroupOffsetOrId, bool iIsUseOffset = true) const;
260 
267  bool hGetParetoLineValues(Int32 iInfoIndex, std::vector<double>& orValues) const;
268 
274 
279 
285  bool hGetParetoTrendLineCoordination(std::vector<double>& iorX, std::vector<double>& iorY) const;
286 
290  bool hIsLastFrame() const;
291 
295  bool hIsFirstFrame() const;
296 
298  bool hIsParetoPercent() const;
299 
304  void hDrawStandAlonePoint(Int32 iSeriesID);
310  GraphObject::Ptr hGetLineObject(Int32 iInfoIndex, Int32 iGroupId, const std::vector<std::vector<Point2D> >& irLinePointSet, bool& iorAlreadyInMapAndList);
311 
315  GraphObject::Ptr hGetPolyGonObjectWithStepGradientFill(const TripleId& iLineId, const std::vector<std::vector<Point2D> >& irLinePointSet, bool& iorAlreadyInMapAndList, Int32 iDepthValue, bool iIsTrapezoid, Int32 iSeriesInfo = 0);
316 
320  void hCheckPolylineSizeAndColorMode(Int32& iorDepthValue, bool& iorIsLineWithFill, bool& iorIsTrapezoid, bool& iorIsUnified, Int32 iSeriesIndex = -3);
321 
325  GraphObject::Ptr hGetSingleShapeObject(Int32 iInfoIndex, Int32 iGroupId, const std::vector<std::vector<Point2D> >& irLinePointSet, bool& iorAlreadyInMapAndList);
329  GraphObject::Ptr hGetSinglePointOrIsolatedPoint(Int32 iInfoIndex, Int32 iGroupId, const std::vector<std::vector<Point2D> >& irLinePointSet, bool& iorAlreadyInMapAndList);
334 
338  void CreateVirtualMarkerForGMLineWithSizeby(const TripleId& irDataPointId, const Point2D &irBasePoint, Int32 iLineWidth, Rect2D &orPolygon);
339 
340 
347  void hGetSectionFromBasePolygon(Int32 iSectionIndex, const std::vector<Point2D>& irBasePolyGon, std::vector<Point2D>& orPolygon);
348 
356  void hGetTrapezoidFromPoints(const TripleId& irLineId, std::vector<Point2D>& irPoints, Int32 iLineWidth, std::vector<Point2D>& orPolygon);
357 
363  void hGetAccompanyPoints(const Point2D& irBasePoint, double iMaxSize, double iSizeRatio, Point2D& orPoint1, Point2D& orPoint2);
364 
368  void hGetBoundPointsForLineWithFill(std::vector<Point2D>& irPolyLine, float iLineWidth, std::vector<Point2D>& orPolygon);
369 
371 
372 
374  //void CreateMarkerForEngeDataPoint(Int32 iInfoIndex, Int32 iGroupId, GraphCollectionObject::Ptr iMarkerCollectionPtr, Point2D& irCenterPoint)
375 
377 
384 
386  int hGetDLIndexInVec(Int32 iSeriesId, Int32 iGroupId);
387  void hGetDLCenterOffset(Int32 iInfoIndex, Int32 iGroupIndex, Int32& iorXCenterOffset,Int32& iorYCenterOffset);
389  //void CreateMarkerForDataLabel(Int32 iInfoIndex, Int32 iGroupId, GraphCollectionObject::Ptr iMarkerCollectionPtr, Point2D& irCenterPoint);
390 
391 
397  std::vector<GraphCollectionObject::Ptr> mLineCollections;
398 
404  std::vector<GraphCollectionObject::Ptr> mMarkerCollections;
405 
406  mutable std::vector<std::vector<Point2D> > mVecSeriesPoints;
407 
408  std::vector<LineSeriesOptions::Ptr> mLineSeriesOptions;
414  std::vector<std::vector<bool> > mIsVirtualMarkerCreated;
415 
417 
418  // Li en : GM Combination Graph, we need to draw tick in lineseriesrender
419  void hCalTickWidth();
420  double hGetTickThickness(Int32 iInfoIndex, Int32 iGroupId);
421  double hGetTickRiserWidth(Int32 iInfoIndex, Int32 iGroupId);
422  bool hPrepareTickRect(Rect2D &iorRect, const Point2D& iCenter, Int32 iInfoIndex, Int32 iGroupId);
423  GraphObject::Ptr hDrawSingleTickObject(Int32 iInfoIndex, Int32 iGroupId, Point2D iCenter);
427 
428  private:
429 #ifndef _VE_CE
430  virtual void GenerateFrameInOnePlot(LayerObject* ipLayerObject);
431 #else
432  virtual void GenerateFrameInOnePlot(GraphObjectAggregation* ioGraphObjectAggregation, bool iForStartFrame);
433 #endif
434 
435  std::vector<std::map<Int32, Int32> >mVecGroupIdMapPerSeries; //<in one specific series, there could be null point, each section of contineous points will make one map.
436  void hPopulateGroupIdMapAtSeries(Int32 iInfoIndex);
437  void hGetGroupIdMapAt(Int32 iInfoIndex);
438  void hCreateLineMarkers();
439 
440  GMDataLabelVecs mDataLabels;
441  std::vector<GraphObject::Ptr > mSinglePointObjects;
442  std::vector<GraphObject::Ptr > mPolygonObjects;
443  std::vector<GraphObject::Ptr > mPolyLineObjects;
444 
445  // DE36136, get groupIDMap for one series, and don't modify current series's groupIDMap in mVecGroupIdMapPerSeries.
446  std::vector<std::map<Int32, Int32> > hGetGroupIdMapAtSeries(Int32 iInfoIndex);
447  };
448 }
449 
450 #endif
DataLabelManager::Ptr hInitDataLabelManager()
void CreateVirtualMarkerForGMLineWithSizeby(const TripleId &irDataPointId, const Point2D &irBasePoint, Int32 iLineWidth, Rect2D &orPolygon)
void hGetBoundPointsForLineWithFill(std::vector< Point2D > &irPolyLine, float iLineWidth, std::vector< Point2D > &orPolygon)
Definition: LayerObject.h:21
std::vector< std::vector< Point2D > > mVecSeriesPoints
Maintains a vector of series points.
Definition: LineSeriesRenderer.h:406
Definition: LineSeriesRenderer.h:40
bool mShowStepLine
Definition: LineSeriesRenderer.h:29
bool hPrepareTickRect(Rect2D &iorRect, const Point2D &iCenter, Int32 iInfoIndex, Int32 iGroupId)
bool mShowMarkers
Definition: LineSeriesRenderer.h:30
bool mIsShowDataMarkerForEdgePoint
Definition: LineSeriesRenderer.h:409
GraphObject::Ptr hGetSinglePointOrIsolatedPoint(Int32 iInfoIndex, Int32 iGroupId, const std::vector< std::vector< Point2D > > &irLinePointSet, bool &iorAlreadyInMapAndList)
virtual void GenerateMapAndListForSeries(Int32 iInfoIndex)
virtual void GenerateByValueAxis(EnumValueAxis iValueAxis, std::vector< GraphObject::Ptr > &iorGraphObjectList)
bool GetMinMaxPoint(Int32 iInfoIndex, Int32 iGroupId, Point2D &orMinPoint, Point2D &orMaxPoint) const
GraphObject::Ptr hDrawSingleTickObject(Int32 iInfoIndex, Int32 iGroupId, Point2D iCenter)
void hCheckPolylineSizeAndColorMode(Int32 &iorDepthValue, bool &iorIsLineWithFill, bool &iorIsTrapezoid, bool &iorIsUnified, Int32 iSeriesIndex=-3)
unsigned char mMarkerShape
Definition: LineSeriesRenderer.h:31
bool hIsParetoPercent() const
Check whether current series type is pareto percent.
Int32 hGetCorrectLineObjectGroupIdInSeriesPoints(Int32 iInfoIndex, Int32 irGroupId)
void CreateVirtualMarker(Int32 iInfoIndex, Int32 iGroupId, GraphCollectionObject::Ptr iMarkerCollectionPtr, Point2D &irCenterPoint)
void hGetSectionFromBasePolygon(Int32 iSectionIndex, const std::vector< Point2D > &irBasePolyGon, std::vector< Point2D > &orPolygon)
double hGetCumulatedYValueForPareto(Int32 iGroupOffsetOrId, bool iIsUseOffset=true) const
Int32 mMarkerSize
Definition: LineSeriesRenderer.h:32
Definition: ABLPlot.h:157
virtual void GetOptions(Int32 iSeriesId, Int32 iPropertyId, CComVariant *opValue) const
EnumValueAxis
Definition: Plot.h:54
virtual void GenerateVirtualMarker()
Definition: LineSeriesRenderer.h:21
virtual void GetLinePointSet(Int32 iInfoIndex, std::vector< std::vector< Point2D > > &orPointSet) const
Int32 mDepth
Definition: LineSeriesRenderer.h:410
bool GetLinePoint(Int32 iInfoIndex, Int32 iGroupIndex, Point2D &orPoint) const
GraphObject::Ptr hGetPolyGonObjectWithStepGradientFill(const TripleId &iLineId, const std::vector< std::vector< Point2D > > &irLinePointSet, bool &iorAlreadyInMapAndList, Int32 iDepthValue, bool iIsTrapezoid, Int32 iSeriesInfo=0)
std::vector< GraphCollectionObject::Ptr > mMarkerCollections
Definition: LineSeriesRenderer.h:404
Definition: Dataset.h:198
EnumGraphObjectUsage
Definition: GraphObject.h:28
virtual void GenerateDepthLine(Int32 iInfoIndex, Int32 iGroupId, LinePair &irLinePair)
void hDrawStandAlonePoint(Int32 iSeriesID)
Int32 mTickWidth
Definition: LineSeriesRenderer.h:425
void hGetTrapezoidFromPoints(const TripleId &irLineId, std::vector< Point2D > &irPoints, Int32 iLineWidth, std::vector< Point2D > &orPolygon)
void hGetAccompanyPoints(const Point2D &irBasePoint, double iMaxSize, double iSizeRatio, Point2D &orPoint1, Point2D &orPoint2)
bool mIsByValueAxis
Definition: LineSeriesRenderer.h:412
#define Int32
Definition: BasicTypes.h:20
Int32 mTickGapWidth
Definition: LineSeriesRenderer.h:424
std::vector< std::vector< bool > > mIsVirtualMarkerCreated
Definition: LineSeriesRenderer.h:414
LineSeriesOptions()
Definition: LineSeriesRenderer.h:25
virtual bool hGetFinalParetoLinePoint(Int32 iInfoIndex, Int32 iOffsetFromGroupOrder, Point2D &orPointSet) const
double hGetTickRiserWidth(Int32 iInfoIndex, Int32 iGroupId)
double hGetTickThickness(Int32 iInfoIndex, Int32 iGroupId)
LineSeriesRenderer(const TripleId &irTripleId, GraphObjectManager *ipManager, Dataset::Ptr iDatasetPtr, Legend::Ptr iLegendPtr)
virtual void LoadStepLine(Int32 iInfoIndex)
bool hIsSeriesAsSingleDataPointShapeType(Int32 iInfoIndex)
std::vector< GraphCollectionObject::Ptr > mLineCollections
Definition: LineSeriesRenderer.h:397
Definition: DataLabelManager.h:54
void hCreateDataMarkerForDataLabel(bool iOnlyForDisplayedDataLable=true)
GraphObject::Ptr hGetLineObject(Int32 iInfoIndex, Int32 iGroupId, const std::vector< std::vector< Point2D > > &irLinePointSet, bool &iorAlreadyInMapAndList)
void CreateSeriesMarkers(Int32 iInfoIndex)
Definition: SmartPtr.h:38
void LoadSeriesProperties(Int32 iInfoIndex)
virtual void GenerateInterpolationFrame(double iProgress, LayerObject *ipLayerObject)
Int32 mSpaceBetweenGroup
Definition: LineSeriesRenderer.h:426
void CreateMarker(Int32 iInfoIndex, Int32 iGroupId, GraphCollectionObject::Ptr iMarkerCollectionPtr, Point2D &irCenterPoint)
MSynch::SmartPtr< LineSeriesRenderer > Ptr
Definition: LineSeriesRenderer.h:43
Definition: ABLPlot.h:21
Definition: ABLPlot.h:144
void hCreateRiserLabelForPareto(GraphCollectionObject::Ptr iTextCollectionPtr)
void hGetDLCenterOffset(Int32 iInfoIndex, Int32 iGroupIndex, Int32 &iorXCenterOffset, Int32 &iorYCenterOffset)
bool mIsVirtualMarkerAllCreated
Definition: LineSeriesRenderer.h:416
EnumDssGraphMatrixDataLabelHostMarkerShape hGetDataLabelHostMarkerShape(Int32 iInfoIndex)
virtual bool GetPointPair(Int32 iInfoIndex, Int32 iGroupId, Point2D &orStartPoint, Point2D &orEndPoint) const
void AddObjectsToDataLabelManager(DataLabelManager::Ptr iDataLabelManagerPtr)
bool hCalculateDLBasePointAndOffset(GMDataLabelInfo &iorDataLabel)
bool mSupportDiscretePoints
Whether or not discrete points should be drawn.
Definition: LineSeriesRenderer.h:413
Definition: Msi_ccomvariant.h:24
void GenerateOrderedDepthLine(EnumValueAxis iValueAxisIndex, Int32 iGroupId, bool iIsStepLine)
bool mInitialized
Definition: LineSeriesRenderer.h:411
std::vector< GMDataLabelInfo > GMDataLabelVecs
Definition: DataLabelManager.h:93
EnumDssGraphMatrixDataLabelHostMarkerShape
Definition: DataLabelManager.h:44
bool GetData(Int32 iInfoIndex, Int32 iGroupId, double &orValue, bool iPreValue=false, Int32 iDataGroup=0) const
bool hGetParetoTrendLineCoordination(std::vector< double > &iorX, std::vector< double > &iorY) const
virtual void GenerateByValueAxisAndGroup(EnumValueAxis iValueAxisIndex, Int32 iGroupId)
Int32 hGetOffsetFromGroupOrder(const std::vector< Int32 > &irGroupOrder, Int32 iGroupId) const
virtual 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)
GraphObject::Ptr hGetSingleShapeObject(Int32 iInfoIndex, Int32 iGroupId, const std::vector< std::vector< Point2D > > &irLinePointSet, bool &iorAlreadyInMapAndList)
virtual void GenerateMapAndList()
virtual bool GetToolTipData(Int32 iSeriesID, Int32 iGroupID, double &orValue, double &orPercentValue, Int32 iOffset=0)
Definition: GraphObjectManager.h:37
virtual bool hGetParetoLinePoints(Int32 iInfoIndex, std::vector< std::vector< Point2D > > &orPointSet) const
Definition: GraphObjectAggregation.h:22
MSynch::SmartPtr< LineSeriesOptions > Ptr
Definition: LineSeriesRenderer.h:23
int hGetDLIndexInVec(Int32 iSeriesId, Int32 iGroupId)
Use four Int32 values to represent a 2D rectangle.
Definition: Rect2D.h:25
std::vector< LineSeriesOptions::Ptr > mLineSeriesOptions
Definition: LineSeriesRenderer.h:408
virtual bool hGetParetoLinePointWithOffset(Int32 iInfoIndex, Int32 iGroupId, Point2D &orPoint, bool iIsFinal) const
Definition: GraphObject.h:30
bool GetFinalLinePoint(Int32 iInfoIndex, Int32 iGroupIndex, Point2D &orLinePoint, bool iIsOldRenderer) const
bool hGetParetoLineValues(Int32 iInfoIndex, std::vector< double > &orValues) const
std::pair< Point2D, Point2D > LinePair
Definition: LineSeriesRenderer.h:36
Definition: Common.h:397
Definition: SeriesRenderer.h:52