EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EtmPolygonGroup.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EtmPolygonGroup.h
1 
2 #include <vector>
3 
4 #include <TVector2.h>
5 
6 #ifndef _ETM_POLYGON_GROUP_
7 #define _ETM_POLYGON_GROUP_
8 
9 #include <EtmOrphans.h>
10 
11 class EtmPolygonGroup: public TObject {
12  public:
13  EtmPolygonGroup(int fillcolor = 0, int linecolor = 1):
14  mFillColor(fillcolor), mLineColor(linecolor), mLineWidth(2),
15  mTextColor(kBlack), mLineStyle(etm::solid) {};
16  ~EtmPolygonGroup() { Clear(); };
17 
18  void AddPolygon(const std::vector<TVector2> &polygon) { mPolygons.push_back(polygon); };
19  void AddPolygon(unsigned dim, const double xx[], const double yy[]);
20  void AddRectangle(double x0, double y0, double xsize, double ysize,
21  unsigned xsplit = 1, unsigned ysplit = 1);
22  void AddRectangle(const TVector2 &bl, const TVector2 &tr,
23  unsigned xsplit = 1, unsigned ysplit = 1);
24 
25  int GetFillColor( void ) const { return mFillColor; };
26  int GetLineColor( void ) const { return mLineColor; };
27  etm::LineStyle GetLineStyle( void ) const { return mLineStyle; };
28 
29  void SetLineColor(int color) { mLineColor = color; };
30  void SetLineWidth(int width) { mLineWidth = width; };
31  void SetLineStyle(etm::LineStyle style) { mLineStyle = style; };
32  void SetTextColor(int color) { mTextColor = color; };
33 
34  const std::vector<std::vector<TVector2> > &Polygons( void ) const { return mPolygons; };
35 
36  void DrawPolygon(unsigned dim, const double xx[], const double yy[], bool line = true) const;
37  void DrawPolygon(const std::vector<TVector2> &polygon, bool line = true,
38  const TVector2 *shift = 0, unsigned tb = 0) const;
39  void DrawMe(const TVector2 *shift = 0, unsigned tb = 0) const;
40 
41  void ClearPolygons( void );
42 
43  unsigned PolygonCount( void ) const { return mPolygons.size(); };
44 
45  virtual bool IsHighlighted( void ) const { return true; };
46  virtual double GetColorAlpha( void ) const { return 1.0; };
47 
48  protected:
49  // Line color, fill color and line style is the same for all polygons;
52 
53  // Polygon is just a vector of 2D vertices, for all practical purposes;
54  std::vector<std::vector<TVector2> > mPolygons;
55 
56  ClassDef(EtmPolygonGroup, 3)
57 };
58 
59 #endif