ROOT logo
// @(#)root/eve:$Id: TEveProjectionAxes.cxx 30384 2009-09-23 17:54:23Z matevz $
// Author: Matevz Tadel 2007

/*************************************************************************
* Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
* All rights reserved.                                                  *
*                                                                       *
* For the licensing terms see $ROOTSYS/LICENSE.                         *
* For the list of contributors see $ROOTSYS/README/CREDITS.             *
*************************************************************************/

#include "TEveProjectionAxes.h"
#include "TEveProjectionManager.h"
#include "TMath.h"

#include "TBuffer3D.h"
#include "TBuffer3DTypes.h"
#include "TVirtualPad.h"
#include "TVirtualViewer3D.h"
#include "TEveTrans.h"


// Axes for non-linear projections. Show scale of TEveProjectionManager
// children. With different step mode tick-marks can positioned
// equidistant or placed with value monotonically increasing from lower left corner
// of bounding box.

ClassImp(TEveProjectionAxes);

//______________________________________________________________________________
TEveProjectionAxes::TEveProjectionAxes(TEveProjectionManager* m, Bool_t useCS) :
   TEveElement(),
   TNamed("TEveProjectionAxes", ""),
   fManager(m),

   fUseColorSet(useCS),

   fLabMode(kValue),
   fAxesMode(kAll),

   fDrawCenter(kFALSE),
   fDrawOrigin(kFALSE)
{
   // Constructor.

   fCanEditMainTrans = kFALSE;
   fManager->AddDependent(this);

   // Axis attributes.
   fNdivisions = 1010;
   fLabelSize = 0.015;
   fLabelColor = kGray+1;
   fAxisColor = kGray+1;
   fTickLength = 0.015;
   fLabelOffset = 0.01;
}

//______________________________________________________________________________
TEveProjectionAxes::~TEveProjectionAxes()
{
   // Destructor.

   fManager->RemoveDependent(this);
}

//______________________________________________________________________________
void TEveProjectionAxes::Paint(Option_t* )
{
   // Paint this object. Only direct rendering is supported.

   static const TEveException eH("TEveProjectionAxes::Paint ");

   TBuffer3D buff(TBuffer3DTypes::kGeneric);

   // Section kCore
   buff.fID           = this;
   buff.fColor        = GetMainColor();
   buff.fTransparency = GetMainTransparency();
   if (HasMainTrans())
      RefMainTrans().SetBuffer3D(buff);

   buff.SetSectionsValid(TBuffer3D::kCore);

   Int_t reqSections = gPad->GetViewer3D()->AddObject(buff);
   if (reqSections != TBuffer3D::kNone)
      Error(eH, "only direct GL rendering supported.");
}

//______________________________________________________________________________
void TEveProjectionAxes::ComputeBBox()
{
   // Virtual from TAttBBox; fill bounding-box information.

   static const TEveException eH("TEveProjectionManager::ComputeBBox ");

   BBoxZero();
   if(fManager == 0)
      return;

   for (Int_t i=0; i<6; ++i)
      fBBox[i] = fManager->GetBBox()[i];

   AssertBBoxExtents(0.1);
}

//______________________________________________________________________________
const TGPicture* TEveProjectionAxes::GetListTreeIcon(Bool_t)
{
   // Return TEveProjectionAxes icon.

   return TEveElement::fgListTreeIcons[6];
}
 TEveProjectionAxes.cxx:1
 TEveProjectionAxes.cxx:2
 TEveProjectionAxes.cxx:3
 TEveProjectionAxes.cxx:4
 TEveProjectionAxes.cxx:5
 TEveProjectionAxes.cxx:6
 TEveProjectionAxes.cxx:7
 TEveProjectionAxes.cxx:8
 TEveProjectionAxes.cxx:9
 TEveProjectionAxes.cxx:10
 TEveProjectionAxes.cxx:11
 TEveProjectionAxes.cxx:12
 TEveProjectionAxes.cxx:13
 TEveProjectionAxes.cxx:14
 TEveProjectionAxes.cxx:15
 TEveProjectionAxes.cxx:16
 TEveProjectionAxes.cxx:17
 TEveProjectionAxes.cxx:18
 TEveProjectionAxes.cxx:19
 TEveProjectionAxes.cxx:20
 TEveProjectionAxes.cxx:21
 TEveProjectionAxes.cxx:22
 TEveProjectionAxes.cxx:23
 TEveProjectionAxes.cxx:24
 TEveProjectionAxes.cxx:25
 TEveProjectionAxes.cxx:26
 TEveProjectionAxes.cxx:27
 TEveProjectionAxes.cxx:28
 TEveProjectionAxes.cxx:29
 TEveProjectionAxes.cxx:30
 TEveProjectionAxes.cxx:31
 TEveProjectionAxes.cxx:32
 TEveProjectionAxes.cxx:33
 TEveProjectionAxes.cxx:34
 TEveProjectionAxes.cxx:35
 TEveProjectionAxes.cxx:36
 TEveProjectionAxes.cxx:37
 TEveProjectionAxes.cxx:38
 TEveProjectionAxes.cxx:39
 TEveProjectionAxes.cxx:40
 TEveProjectionAxes.cxx:41
 TEveProjectionAxes.cxx:42
 TEveProjectionAxes.cxx:43
 TEveProjectionAxes.cxx:44
 TEveProjectionAxes.cxx:45
 TEveProjectionAxes.cxx:46
 TEveProjectionAxes.cxx:47
 TEveProjectionAxes.cxx:48
 TEveProjectionAxes.cxx:49
 TEveProjectionAxes.cxx:50
 TEveProjectionAxes.cxx:51
 TEveProjectionAxes.cxx:52
 TEveProjectionAxes.cxx:53
 TEveProjectionAxes.cxx:54
 TEveProjectionAxes.cxx:55
 TEveProjectionAxes.cxx:56
 TEveProjectionAxes.cxx:57
 TEveProjectionAxes.cxx:58
 TEveProjectionAxes.cxx:59
 TEveProjectionAxes.cxx:60
 TEveProjectionAxes.cxx:61
 TEveProjectionAxes.cxx:62
 TEveProjectionAxes.cxx:63
 TEveProjectionAxes.cxx:64
 TEveProjectionAxes.cxx:65
 TEveProjectionAxes.cxx:66
 TEveProjectionAxes.cxx:67
 TEveProjectionAxes.cxx:68
 TEveProjectionAxes.cxx:69
 TEveProjectionAxes.cxx:70
 TEveProjectionAxes.cxx:71
 TEveProjectionAxes.cxx:72
 TEveProjectionAxes.cxx:73
 TEveProjectionAxes.cxx:74
 TEveProjectionAxes.cxx:75
 TEveProjectionAxes.cxx:76
 TEveProjectionAxes.cxx:77
 TEveProjectionAxes.cxx:78
 TEveProjectionAxes.cxx:79
 TEveProjectionAxes.cxx:80
 TEveProjectionAxes.cxx:81
 TEveProjectionAxes.cxx:82
 TEveProjectionAxes.cxx:83
 TEveProjectionAxes.cxx:84
 TEveProjectionAxes.cxx:85
 TEveProjectionAxes.cxx:86
 TEveProjectionAxes.cxx:87
 TEveProjectionAxes.cxx:88
 TEveProjectionAxes.cxx:89
 TEveProjectionAxes.cxx:90
 TEveProjectionAxes.cxx:91
 TEveProjectionAxes.cxx:92
 TEveProjectionAxes.cxx:93
 TEveProjectionAxes.cxx:94
 TEveProjectionAxes.cxx:95
 TEveProjectionAxes.cxx:96
 TEveProjectionAxes.cxx:97
 TEveProjectionAxes.cxx:98
 TEveProjectionAxes.cxx:99
 TEveProjectionAxes.cxx:100
 TEveProjectionAxes.cxx:101
 TEveProjectionAxes.cxx:102
 TEveProjectionAxes.cxx:103
 TEveProjectionAxes.cxx:104
 TEveProjectionAxes.cxx:105
 TEveProjectionAxes.cxx:106
 TEveProjectionAxes.cxx:107
 TEveProjectionAxes.cxx:108
 TEveProjectionAxes.cxx:109
 TEveProjectionAxes.cxx:110
 TEveProjectionAxes.cxx:111
 TEveProjectionAxes.cxx:112