1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 // $MpId: AliMpRowSegmentPainter.cxx,v 1.8 2006/05/24 13:58:32 ivana Exp $
20 // Class AliMpRowSegmentPainter
21 // ----------------------------
22 // Class for drawing a motif into canvas
23 // Included in AliRoot: 2003/05/02
24 // Authors: David Guez, IPN Orsay
26 #include "AliMpRowSegmentPainter.h"
27 #include "AliMpGraphContext.h"
28 #include "AliMpVRowSegment.h"
30 #include "AliMpMotifMap.h"
31 #include "AliMpMotifPosition.h"
33 #include <TVirtualX.h>
37 ClassImp(AliMpRowSegmentPainter)
40 //_______________________________________________________________________
41 AliMpRowSegmentPainter::AliMpRowSegmentPainter()
45 /// Default constructor
48 //_______________________________________________________________________
49 AliMpRowSegmentPainter::AliMpRowSegmentPainter(AliMpVRowSegment *row)
53 /// Standard constructor
57 //_______________________________________________________________________
58 AliMpRowSegmentPainter::~AliMpRowSegmentPainter()
63 //_______________________________________________________________________
64 TVector2 AliMpRowSegmentPainter::GetPosition() const
66 /// Get the owned object's position
68 return fRowSegment->Position();
71 //_______________________________________________________________________
72 TVector2 AliMpRowSegmentPainter::GetDimensions() const
74 /// Get the owned object's dimensions
76 return fRowSegment->Dimensions();
79 //_______________________________________________________________________
80 void AliMpRowSegmentPainter::DumpObject()
82 /// Draw the owned object
87 //_______________________________________________________________________
88 void AliMpRowSegmentPainter::Draw(Option_t *option)
90 /// Draw the sector on the current pad
91 /// The first letter of \a option is treated as follows:
92 /// - case "S" : each row segments are drawn separately
93 /// - case "" : the whole row is drawn at once
94 /// in both cases, the rest of the option is passed
95 /// as argument to the Draw function of respectively
96 /// zone or row objects.
98 AliMpGraphContext *gr = AliMpGraphContext::Instance();
99 if( !fRowSegment) return;
107 for (Int_t iMotif=0;iMotif<fRowSegment->GetNofMotifs();++iMotif){
110 Int_t motifPositionId = fRowSegment->GetMotifPositionId(iMotif);
111 AliMpMotifPosition *motifPos =
112 fRowSegment->GetRow()->GetMotifMap()
113 ->FindMotifPosition(motifPositionId);
115 gr->SetPadPosForReal(motifPos->Position(),motifPos->Dimensions());
116 gr->SetColor(GetColor());
117 DrawObject(motifPos,option+1);
123 default: AppendPad(option);
129 //_______________________________________________________________________
130 void AliMpRowSegmentPainter::Paint(Option_t* /*option*/)
134 AliMpGraphContext *gr = AliMpGraphContext::Instance();
135 if (!fRowSegment) return;
136 Int_t col=gVirtualX->GetFillColor();
138 gPad->Range(0.,0.,1.,1.);
140 PaintWholeBox(kTRUE);
142 // Float_t textSize = gVirtualX->GetTextSize();
143 // if (option[0]=='T')
144 // gPad->PaintText(GetPadPosition().X()-0.01,GetPadPosition().Y()-0.01,
145 // Form("%d",fRowSegment->GetMotif()->GetID()));
146 // gVirtualX->SetTextSize(textSize);
148 gVirtualX->SetFillColor(col);