CMS 3D CMS Logo

FWDetailViewBase.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWDetailViewBase
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Fri Jan 9 13:35:56 EST 2009
11 //
12 
13 // system include files
14 #include "TBox.h"
15 #include "TEllipse.h"
16 #include "TEveViewer.h"
17 
18 // user include files
22 
23 FWDetailViewBase::FWDetailViewBase(const std::type_info& iInfo) :
24  m_item(nullptr),
25  m_helper(iInfo)
26 {
27 }
28 
30 {
31 }
32 
33 
34 void
36 {
37  m_helper.itemChanged(iID.item());
38  build(iID, m_helper.offsetObject(iID.item()->modelData(iID.index())));
39 }
40 
41 const fireworks::Context&
43  return m_item->context();
44 }
45 
46 //______________________________________________________________________________
47 // UTILITIES for Canvas info
48 void
49 FWDetailViewBase::drawCanvasDot(Float_t x, Float_t y, Float_t r, Color_t fillColor)
50 {
51  // utility function to draw outline cricle
52 
53  Float_t ratio = 0.5;
54  // fill
55  TEllipse *b2 = new TEllipse(x, y, r, r*ratio);
56  b2->SetFillStyle(1001);
57  b2->SetFillColor(fillColor);
58  b2->Draw();
59 
60  // outline
61  TEllipse *b1 = new TEllipse(x, y, r, r*ratio);
62  b1->SetFillStyle(0);
63  b1->SetLineWidth(2);
64  b1->Draw();
65 }
66 
67 void
68 FWDetailViewBase::drawCanvasBox( Double_t *pos, Color_t fillCol, Int_t fillType, bool bg)
69 {
70  // utility function to draw outline box
71 
72  // background
73  if (bg)
74  {
75  TBox *b1 = new TBox(pos[0], pos[1], pos[2], pos[3]);
76  b1->SetFillColor(fillCol);
77  b1->Draw();
78  }
79 
80  // fill (top layer)
81  TBox *b2 = new TBox(pos[0], pos[1], pos[2], pos[3]);
82  b2->SetFillStyle(fillType);
83  b2->SetFillColor(kBlack);
84  b2->Draw();
85 
86  //outline
87  TBox *b3 = new TBox(pos[0], pos[1], pos[2], pos[3]);
88  b3->SetFillStyle(0);
89  b3->SetLineWidth(2);
90  b3->Draw();
91 }
92 
93 
FWSimpleProxyHelper m_helper
#define nullptr
const void * offsetObject(const void *iObj) const
void build(const FWModelId &)
const fireworks::Context & context() const
int index() const
Definition: FWModelId.h:49
const fireworks::Context & context() const
Definition: FWEventItem.h:128
static void drawCanvasDot(Float_t x, Float_t y, Float_t r, Color_t)
virtual ~FWDetailViewBase()
FWDetailViewBase(const std::type_info &)
const FWEventItem * m_item
const void * modelData(int iIndex) const
Definition: FWEventItem.cc:572
const FWEventItem * item() const
Definition: FWModelId.h:44
void itemChanged(const FWEventItem *)
static void drawCanvasBox(Double_t *pos, Color_t fillCol, Int_t fillType=0, bool bg=kTRUE)