/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ // $Id$ // $MpId: AliMpSectorPainter.cxx,v 1.6 2005/08/26 15:43:36 ivana Exp $ // // Class AliMpSectorPainter // ------------------------ // Class for drawing a sector into canvas // Included in AliRoot: 2003/05/02 // Authors: David Guez, IPN Orsay #include #include #include #include "AliMpSectorPainter.h" #include "AliMpGraphContext.h" #include "AliMpSector.h" #include "AliMpZone.h" #include "AliMpSubZone.h" #include "AliMpRow.h" #include "AliMpVRowSegment.h" ClassImp(AliMpSectorPainter) //_______________________________________________________________________ AliMpSectorPainter::AliMpSectorPainter() :AliMpVPainter(), fSector(0) { /// Default constructor } //_______________________________________________________________________ AliMpSectorPainter::AliMpSectorPainter(AliMpSector *sector) :AliMpVPainter(), fSector(sector) { /// Standard constructor } //_____________________________________________________________________________ AliMpSectorPainter::AliMpSectorPainter(const AliMpSectorPainter& right) : AliMpVPainter(right) { /// Protected copy constructor (not provided) Fatal("AliMpSectorPainter", "Copy constructor not provided."); } //_______________________________________________________________________ AliMpSectorPainter::~AliMpSectorPainter() { /// Destructor } //_____________________________________________________________________________ AliMpSectorPainter& AliMpSectorPainter::operator=(const AliMpSectorPainter& right) { /// Assignment operator (not provided) // check assignment to self if (this == &right) return *this; Fatal("operator =", "Assignment operator not provided."); return *this; } //_______________________________________________________________________ void AliMpSectorPainter::DumpObject() { //// Draw the owned object fSector->Dump(); } //_______________________________________________________________________ TVector2 AliMpSectorPainter::GetPosition() const { //// Get the owned object's position if (fSector->GetNofRows()<1) return TVector2(0.,0.); AliMpRow* row = fSector->GetRow(0); // bl = bottom left position; TVector2 bl = row->Position()-row->Dimensions(); // ur = upper right position TVector2 ur = row->Position()+row->Dimensions();; for (Int_t irow=1;irowGetNofRows();++irow){ row = fSector->GetRow(irow); // update the bottom-left corner if (bl.X()>row->Position().X()-row->Dimensions().X()) bl.Set(row->Position().X()-row->Position().X(),bl.Y()); if (bl.Y()>row->Position().Y()-row->Dimensions().Y()) bl.Set(bl.X(),row->Position().Y()-row->Dimensions().Y()); // update the upper-right corner if (ur.X()Position().X()+row->Dimensions().X()) ur.Set(row->Position().X()+row->Dimensions().X(),ur.Y()); if (ur.Y()Position().Y()+row->Dimensions().Y()) ur.Set(ur.X(),row->Position().Y()+row->Dimensions().Y()); } return (ur+bl)/2.; } //_______________________________________________________________________ TVector2 AliMpSectorPainter::GetDimensions() const { //// Get the owned object's dimensions if (fSector->GetNofRows()<1) return TVector2(0.,0.); AliMpRow* row = fSector->GetRow(0); // bl = bottom left position TVector2 bl = row->Position()-row->Dimensions(); // ur = upper right position TVector2 ur = row->Position()+row->Dimensions(); for (Int_t irow=1;irowGetNofRows();++irow){ row = fSector->GetRow(irow); // update the bottom-left corner if (bl.X()>row->Position().X()-row->Dimensions().X()) bl.Set(row->Position().X()-row->Dimensions().X(),bl.Y()); if (bl.Y()>row->Position().Y()-row->Dimensions().Y()) bl.Set(bl.X(),row->Position().Y()-row->Dimensions().Y()); // update the upper-right corner if (ur.X()Position().X()+row->Dimensions().X()) ur.Set(row->Position().X()+row->Dimensions().X(),ur.Y()); if (ur.Y()Position().Y()+row->Dimensions().Y()) ur.Set(ur.X(),row->Position().Y()+row->Dimensions().Y()); } return (ur-bl)/2.; } //_______________________________________________________________________ void AliMpSectorPainter::Draw(Option_t *option) { /// Draw the sector on the current pad /// The first letter of