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.6 2005/08/26 15:43:36 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 <TVirtualX.h>
30 #include "AliMpRowSegmentPainter.h"
31 #include "AliMpGraphContext.h"
32 #include "AliMpVRowSegment.h"
34 #include "AliMpMotifMap.h"
35 #include "AliMpMotifPosition.h"
37 ClassImp(AliMpRowSegmentPainter)
39 //_______________________________________________________________________
40 AliMpRowSegmentPainter::AliMpRowSegmentPainter()
44 /// Default constructor
47 //_______________________________________________________________________
48 AliMpRowSegmentPainter::AliMpRowSegmentPainter(AliMpVRowSegment *row)
52 /// Standard constructor
56 //_____________________________________________________________________________
57 AliMpRowSegmentPainter::AliMpRowSegmentPainter(
58 const AliMpRowSegmentPainter& right)
59 : AliMpVPainter(right)
61 /// Protected copy constructor (not provided)
63 Fatal("AliMpRowSegmentPainter", "Copy constructor not provided.");
66 //_______________________________________________________________________
67 AliMpRowSegmentPainter::~AliMpRowSegmentPainter()
72 //_____________________________________________________________________________
73 AliMpRowSegmentPainter&
74 AliMpRowSegmentPainter::operator=(const AliMpRowSegmentPainter& right)
76 /// Assignment operator (not provided)
78 // check assignment to self
79 if (this == &right) return *this;
81 Fatal("operator =", "Assignment operator not provided.");
86 //_______________________________________________________________________
87 TVector2 AliMpRowSegmentPainter::GetPosition() const
89 /// Get the owned object's position
91 return fRowSegment->Position();
94 //_______________________________________________________________________
95 TVector2 AliMpRowSegmentPainter::GetDimensions() const
97 /// Get the owned object's dimensions
99 return fRowSegment->Dimensions();
102 //_______________________________________________________________________
103 void AliMpRowSegmentPainter::DumpObject()
105 /// Draw the owned object
110 //_______________________________________________________________________
111 void AliMpRowSegmentPainter::Draw(Option_t *option)
113 /// Draw the sector on the current pad
114 /// The first letter of <option> is treated as follows:
115 /// - case "S" : each row segments are drawn separately
116 /// - case "" : the whole row is drawn at once
117 /// in both cases, the rest of the option is passed
118 /// as argument to the Draw function of respectively
119 /// zone or row objects.
121 AliMpGraphContext *gr = AliMpGraphContext::Instance();
122 if( !fRowSegment) return;
130 for (Int_t iMotif=0;iMotif<fRowSegment->GetNofMotifs();++iMotif){
133 Int_t motifPositionId = fRowSegment->GetMotifPositionId(iMotif);
134 AliMpMotifPosition *motifPos =
135 fRowSegment->GetRow()->GetMotifMap()
136 ->FindMotifPosition(motifPositionId);
138 gr->SetPadPosForReal(motifPos->Position(),motifPos->Dimensions());
139 gr->SetColor(GetColor());
140 DrawObject(motifPos,option+1);
146 default: AppendPad(option);
152 //_______________________________________________________________________
153 void AliMpRowSegmentPainter::Paint(Option_t* /*option*/)
157 AliMpGraphContext *gr = AliMpGraphContext::Instance();
158 if (!fRowSegment) return;
159 Int_t col=gVirtualX->GetFillColor();
161 gPad->Range(0.,0.,1.,1.);
163 PaintWholeBox(kTRUE);
165 // Float_t textSize = gVirtualX->GetTextSize();
166 // if (option[0]=='T')
167 // gPad->PaintText(GetPadPosition().X()-0.01,GetPadPosition().Y()-0.01,
168 // Form("%d",fRowSegment->GetMotif()->GetID()));
169 // gVirtualX->SetTextSize(textSize);
171 gVirtualX->SetFillColor(col);