AliRoot Core  3dc7879 (3dc7879)
AliMpRowSegmentPainter.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
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  **************************************************************************/
15 
16 // $Id$
17 // $MpId: AliMpRowSegmentPainter.cxx,v 1.8 2006/05/24 13:58:32 ivana Exp $
18 // Category: graphics
19 
20 //-----------------------------------------------------------------------------
21 // Class AliMpRowSegmentPainter
22 // ----------------------------
23 // Class for drawing a motif into canvas
24 // Included in AliRoot: 2003/05/02
25 // Authors: David Guez, IPN Orsay
26 //-----------------------------------------------------------------------------
27 
28 #include "AliMpRowSegmentPainter.h"
29 #include "AliMpGraphContext.h"
30 #include "AliMpVRowSegment.h"
31 #include "AliMpRow.h"
32 #include "AliMpMotifMap.h"
33 #include "AliMpMotifPosition.h"
34 
35 #include <TVirtualX.h>
36 #include <TPad.h>
37 
38 #include <iostream>
39 #include <vector>
40 #include "TPolyMarker.h"
41 
43 ClassImp(AliMpRowSegmentPainter)
45 
46 //_______________________________________________________________________
48  : AliMpVPainter(),
49  fRowSegment(0)
50 {
52 }
53 
54 //_______________________________________________________________________
56  : AliMpVPainter(),
57  fRowSegment(row)
58 {
60 
61 }
62 
63 //_______________________________________________________________________
65 {
67 }
68 
69 //_______________________________________________________________________
71 {
73 
74  return TVector2(fRowSegment->GetPositionX(), fRowSegment->GetPositionY());
75 }
76 
77 //_______________________________________________________________________
79 {
81 
82  return TVector2(fRowSegment->GetDimensionX(),fRowSegment->GetDimensionY());
83 }
84 
85 //_______________________________________________________________________
87 {
89 
90  fRowSegment->Dump();
91 }
92 
93 //_______________________________________________________________________
94 void AliMpRowSegmentPainter::Draw(Option_t *option)
95 {
103 
105  if( !fRowSegment) return;
106 
107  gr->Push();
109  switch (option[0]){
110  case 'M':
111  {
112 
113  for (Int_t iMotif=0;iMotif<fRowSegment->GetNofMotifs();++iMotif){
114  gr->Push();
115 
116  Int_t motifPositionId = fRowSegment->GetMotifPositionId(iMotif);
117  AliMpMotifPosition *motifPos =
119  ->FindMotifPosition(motifPositionId);
120 
121  gr->SetPadPosForReal(TVector2(motifPos->GetPositionX(), motifPos->GetPositionY()),
122  TVector2(motifPos->GetDimensionX(),motifPos->GetDimensionY()));
123  gr->SetColor(GetColor());
124  DrawObject(motifPos,option+1);
125 
126  gr->Pop();
127  }
128  }
129  break;
130  default: AppendPad(option);
131  }
132  AppendPad(option);
133  gr->Pop();
134 }
135 
136 
137 //_______________________________________________________________________
138 void AliMpRowSegmentPainter::Paint(Option_t* /*option*/)
139 {
141 
143  if (!fRowSegment) return;
144  Int_t col=gVirtualX->GetFillColor();
145  Style_t sty = gVirtualX->GetFillStyle();
146  gr->Push();
147  gPad->Range(0.,0.,1.,1.);
149  PaintWholeBox(kTRUE,kTRUE);
150 
151 
152 // Float_t textSize = gVirtualX->GetTextSize();
153 // if (option[0]=='T')
154 // gPad->PaintText(GetPadPosition().X()-0.01,GetPadPosition().Y()-0.01,
155 // Form("%d",fRowSegment->GetMotif()->GetID()));
156 // gVirtualX->SetTextSize(textSize);
157  gr->Pop();
158  gVirtualX->SetFillColor(col);
159 }
Double_t GetPositionY() const
Return y position.
Double_t GetDimensionY() const
Return y dimension.
virtual TVector2 GetPosition() const
Return the owned object&#39;s position.
virtual AliMpRow * GetRow() const =0
Return the row.which this row segment belongs to.
virtual Double_t GetDimensionX() const =0
Return the x dimension of the row segment centre.
Int_t GetColor() const
Return the color.
Definition: AliMpVPainter.h:41
Double_t GetDimensionX() const
Return x dimension.
static AliMpGraphContext * Instance()
virtual void Paint(Option_t *)
Paint the associated object.
void SetPadPosForReal(const TVector2 &position, const TVector2 &dimensions)
void SetColor(Int_t color)
Set color to use.
An interface for a row segment.
A placed motif.
virtual Double_t GetPositionX() const =0
Return the x position of the row segment centre.
virtual Double_t GetPositionY() const =0
Return the y position of the row segment centre.
TGraph * gr
Definition: CalibTime.C:25
Abstract base class for drawing objects into canvas.
Definition: AliMpVPainter.h:21
Class for drawing a motif into canvas.
virtual Int_t GetMotifPositionId(Int_t i) const =0
Return the i-th motif position Id of this row segment.
virtual Double_t GetDimensionY() const =0
Return the y dimension of the row segment centre.
virtual TVector2 GetDimensions() const
Return the owned object&#39;s dimensions.
AliMpVRowSegment * fRowSegment
the row segment to draw
AliMpVPainter * DrawObject(TObject *object, Option_t *option="")
Not implemented.
AliMpMotifPosition * FindMotifPosition(Int_t motifPositionID) const
void PaintWholeBox(Bool_t fill=kTRUE, Bool_t center=kFALSE)
virtual void Draw(Option_t *option)
Double_t GetPositionX() const
Return x position.
Class describing the correspondance between a given area in pad, and a zone of real (cm) position...
virtual Int_t GetNofMotifs() const =0
Return the number of motifs in this this row segment.
AliMpMotifMap * GetMotifMap() const
Return the motif map associated with its sector.
Definition: AliMpRow.h:88
void InitGraphContext()