CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_6/src/Fireworks/Core/src/FWDetailViewBase.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     Core
00004 // Class  :     FWDetailViewBase
00005 //
00006 // Implementation:
00007 //     <Notes on implementation>
00008 //
00009 // Original Author:  Chris Jones
00010 //         Created:  Fri Jan  9 13:35:56 EST 2009
00011 // $Id: FWDetailViewBase.cc,v 1.23 2010/06/18 10:17:15 yana Exp $
00012 //
00013 
00014 // system include files
00015 #include "TBox.h"
00016 #include "TEllipse.h"
00017 #include "TEveViewer.h"
00018 
00019 // user include files
00020 #include "Fireworks/Core/interface/FWDetailViewBase.h"
00021 #include "Fireworks/Core/interface/FWModelId.h"
00022 #include "Fireworks/Core/interface/FWEventItem.h"
00023 
00024 FWDetailViewBase::FWDetailViewBase(const std::type_info& iInfo) :
00025    m_item(0),
00026    m_helper(iInfo)
00027 {
00028 }
00029 
00030 FWDetailViewBase::~FWDetailViewBase()
00031 {
00032 }
00033 
00034 
00035 void
00036 FWDetailViewBase::build (const FWModelId &iID)
00037 {
00038    m_helper.itemChanged(iID.item());
00039    build(iID, m_helper.offsetObject(iID.item()->modelData(iID.index())));
00040 }
00041 
00042 const fireworks::Context&
00043 FWDetailViewBase::context () const {
00044    return m_item->context();
00045 }
00046 
00047 //______________________________________________________________________________
00048 // UTILITIES for Canvas info
00049 void
00050 FWDetailViewBase::drawCanvasDot(Float_t x, Float_t y, Float_t r, Color_t fillColor)
00051 { 
00052    // utility function to draw outline cricle
00053 
00054    Float_t ratio = 0.5;
00055    // fill
00056    TEllipse *b2 = new TEllipse(x, y, r, r*ratio);
00057    b2->SetFillStyle(1001);
00058    b2->SetFillColor(fillColor);
00059    b2->Draw();
00060 
00061    // outline
00062    TEllipse *b1 = new TEllipse(x, y, r, r*ratio);
00063    b1->SetFillStyle(0);
00064    b1->SetLineWidth(2);
00065    b1->Draw();
00066 }
00067 
00068 void
00069 FWDetailViewBase::drawCanvasBox( Double_t *pos, Color_t fillCol, Int_t fillType, bool bg)
00070 { 
00071    // utility function to draw outline box
00072 
00073    // background
00074    if (bg)
00075    {
00076       TBox *b1 = new TBox(pos[0], pos[1], pos[2], pos[3]);
00077       b1->SetFillColor(fillCol);
00078       b1->Draw();
00079    }
00080 
00081    // fill  (top layer)
00082    TBox *b2 = new TBox(pos[0], pos[1], pos[2], pos[3]);
00083    b2->SetFillStyle(fillType);
00084    b2->SetFillColor(kBlack);
00085    b2->Draw();
00086 
00087    //outline
00088    TBox *b3 = new TBox(pos[0], pos[1], pos[2], pos[3]);
00089    b3->SetFillStyle(0);
00090    b3->SetLineWidth(2);
00091    b3->Draw();
00092 }
00093 
00094