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) : m_item(nullptr), m_helper(iInfo) {}
24 
26 
28  m_helper.itemChanged(iID.item());
29  build(iID, m_helper.offsetObject(iID.item()->modelData(iID.index())));
30 }
31 
33 
34 //______________________________________________________________________________
35 // UTILITIES for Canvas info
36 void FWDetailViewBase::drawCanvasDot(Float_t x, Float_t y, Float_t r, Color_t fillColor) {
37  // utility function to draw outline cricle
38 
39  Float_t ratio = 0.5;
40  // fill
41  TEllipse *b2 = new TEllipse(x, y, r, r * ratio);
42  b2->SetFillStyle(1001);
43  b2->SetFillColor(fillColor);
44  b2->Draw();
45 
46  // outline
47  TEllipse *b1 = new TEllipse(x, y, r, r * ratio);
48  b1->SetFillStyle(0);
49  b1->SetLineWidth(2);
50  b1->Draw();
51 }
52 
53 void FWDetailViewBase::drawCanvasBox(Double_t *pos, Color_t fillCol, Int_t fillType, bool bg) {
54  // utility function to draw outline box
55 
56  // background
57  if (bg) {
58  TBox *b1 = new TBox(pos[0], pos[1], pos[2], pos[3]);
59  b1->SetFillColor(fillCol);
60  b1->Draw();
61  }
62 
63  // fill (top layer)
64  TBox *b2 = new TBox(pos[0], pos[1], pos[2], pos[3]);
65  b2->SetFillStyle(fillType);
66  b2->SetFillColor(kBlack);
67  b2->Draw();
68 
69  //outline
70  TBox *b3 = new TBox(pos[0], pos[1], pos[2], pos[3]);
71  b3->SetFillStyle(0);
72  b3->SetLineWidth(2);
73  b3->Draw();
74 }
FWDetailViewBase(const FWDetailViewBase &)=delete
const void * modelData(int iIndex) const
Definition: FWEventItem.cc:466
FWSimpleProxyHelper m_helper
const fireworks::Context & context() const
int index() const
Definition: FWModelId.h:41
const fireworks::Context & context() const
Definition: FWEventItem.h:121
void build(const FWModelId &)
static void drawCanvasDot(Float_t x, Float_t y, Float_t r, Color_t)
virtual ~FWDetailViewBase()
const FWEventItem * item() const
Definition: FWModelId.h:39
const void * offsetObject(const void *iObj) const
const FWEventItem * m_item
float x
static constexpr float b2
void itemChanged(const FWEventItem *)
static constexpr float b1
static void drawCanvasBox(Double_t *pos, Color_t fillCol, Int_t fillType=0, bool bg=kTRUE)