ROOT logo
// @(#)root/eve:$Id: TEveGeoNodeEditor.cxx 26034 2008-10-31 14:01:05Z matevz $
// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 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 "TEveGeoNodeEditor.h"
#include "TEveGValuators.h"

#include "TEveGeoNode.h"
#include "TGeoNode.h"

#include "TVirtualPad.h"
#include "TColor.h"

#include "TGLabel.h"
#include "TGButton.h"
#include "TGNumberEntry.h"
#include "TGColorSelect.h"
#include "TGDoubleSlider.h"

//______________________________________________________________________________
// TEveGeoNodeEditor
//
// Editor for TEveGeoNode class.

ClassImp(TEveGeoNodeEditor)

//______________________________________________________________________________
TEveGeoNodeEditor::TEveGeoNodeEditor(const TGWindow *p,
                                     Int_t width, Int_t height,
                                     UInt_t options, Pixel_t back) :
   TGedFrame(p,width, height, options | kVerticalFrame, back),

   fNodeRE (0),

   fVizNode(0),
   fVizNodeDaughters(0),
   fVizVolume(0),
   fVizVolumeDaughters(0)
{
   // Constructor.

   MakeTitle("GeoNode");

   // --- Visibility control

   fVizNode = new TGCheckButton(this, "VizNode");
   AddFrame(fVizNode, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
   fVizNode->Connect
      ("Toggled(Bool_t)",
       "TEveGeoNodeEditor", this, "DoVizNode()");

   fVizNodeDaughters = new TGCheckButton(this, "VizNodeDaughters");
   AddFrame(fVizNodeDaughters, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
   fVizNodeDaughters->Connect
      ("Toggled(Bool_t)",
       "TEveGeoNodeEditor", this, "DoVizNodeDaughters()");

   fVizVolume = new TGCheckButton(this, "VizVolume");
   AddFrame(fVizVolume, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
   fVizVolume->Connect
      ("Toggled(Bool_t)",
       "TEveGeoNodeEditor", this, "DoVizVolume()");

   fVizVolumeDaughters = new TGCheckButton(this, "VizVolumeDaughters");
   AddFrame(fVizVolumeDaughters, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
   fVizVolumeDaughters->Connect
      ("Toggled(Bool_t)",
       "TEveGeoNodeEditor", this, "DoVizVolumeDaughters()");
}

/******************************************************************************/

//______________________________________________________________________________
void TEveGeoNodeEditor::SetModel(TObject* obj)
{
   // Set model object.

   fNodeRE = dynamic_cast<TEveGeoNode*>(obj);
   TGeoNode*  node = fNodeRE->fNode;
   TGeoVolume* vol = node->GetVolume();

   fVizNode->SetState(node->TGeoAtt::IsVisible() ? kButtonDown : kButtonUp);
   fVizNodeDaughters->SetState(node->TGeoAtt::IsVisDaughters() ? kButtonDown : kButtonUp);
   fVizVolume->SetState(vol->IsVisible() ? kButtonDown : kButtonUp);
   fVizVolumeDaughters->SetState(vol->IsVisDaughters() ? kButtonDown : kButtonUp);
}

/******************************************************************************/

//______________________________________________________________________________
void TEveGeoNodeEditor::DoVizNode()
{
   // Slot for VizNode.

   fNodeRE->SetRnrSelf(fVizNode->IsOn());
   Update();
}

//______________________________________________________________________________
void TEveGeoNodeEditor::DoVizNodeDaughters()
{
   // Slot for VizNodeDaughters.

   fNodeRE->SetRnrChildren(fVizNodeDaughters->IsOn());
   Update();
}

//______________________________________________________________________________
void TEveGeoNodeEditor::DoVizVolume()
{
   // Slot for VizVolume.

   fNodeRE->fNode->GetVolume()->SetVisibility(fVizVolume->IsOn());
   Update();
}

//______________________________________________________________________________
void TEveGeoNodeEditor::DoVizVolumeDaughters()
{
   // Slot for VizVolumeDaughters.

   fNodeRE->fNode->GetVolume()->VisibleDaughters(fVizVolumeDaughters->IsOn());
   Update();
}


//______________________________________________________________________________
// TEveGeoTopNodeEditor
//
// Editor for TEveGeoTopNode class.

ClassImp(TEveGeoTopNodeEditor)

//______________________________________________________________________________
TEveGeoTopNodeEditor::TEveGeoTopNodeEditor(const TGWindow *p,
                                           Int_t width, Int_t height,
                                           UInt_t options, Pixel_t back) :
   TGedFrame(p, width, height, options | kVerticalFrame, back),

   fTopNodeRE   (0),
   fVisOption   (0),
   fVisLevel    (0),
   fMaxVisNodes (0)
{
   // Constructor.

   MakeTitle("GeoTopNode");

   Int_t labelW = 64;

   fVisOption = new TEveGValuator(this, "VisOption:", 90, 0);
   fVisOption->SetLabelWidth(labelW);
   fVisOption->SetShowSlider(kFALSE);
   fVisOption->SetNELength(4);
   fVisOption->Build();
   fVisOption->SetLimits(0, 2, 10, TGNumberFormat::kNESInteger);
   fVisOption->SetToolTip("Visualization option passed to TGeoPainter.");
   fVisOption->Connect("ValueSet(Double_t)", "TEveGeoTopNodeEditor", this, "DoVisOption()");
   AddFrame(fVisOption, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));

   fVisLevel = new TEveGValuator(this, "VisLevel:", 90, 0);
   fVisLevel->SetLabelWidth(labelW);
   fVisLevel->SetShowSlider(kFALSE);
   fVisLevel->SetNELength(4);
   fVisLevel->Build();
   fVisLevel->SetLimits(0, 10, 10, TGNumberFormat::kNESInteger);
   fVisLevel->SetToolTip("Level (depth) to which the geometry is traversed.\nWhen zero, maximum number of nodes to draw can be specified.");
   fVisLevel->Connect("ValueSet(Double_t)", "TEveGeoTopNodeEditor", this, "DoVisLevel()");
   AddFrame(fVisLevel, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));

   fMaxVisNodes = new TEveGValuator(this, "MaxNodes:", 90, 0);
   fMaxVisNodes->SetLabelWidth(labelW);
   fMaxVisNodes->SetShowSlider(kFALSE);
   fMaxVisNodes->SetNELength(6);
   fMaxVisNodes->Build();
   fMaxVisNodes->SetLimits(100, 999999, 0, TGNumberFormat::kNESInteger);
   fMaxVisNodes->SetToolTip("Maximum number of nodes to draw.");
   fMaxVisNodes->Connect("ValueSet(Double_t)", "TEveGeoTopNodeEditor", this, "DoMaxVisNodes()");
   AddFrame(fMaxVisNodes, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
}

/******************************************************************************/

//______________________________________________________________________________
void TEveGeoTopNodeEditor::SetModel(TObject* obj)
{
   // Set model object.

   fTopNodeRE = dynamic_cast<TEveGeoTopNode*>(obj);

   fVisOption  ->SetValue(fTopNodeRE->GetVisOption());
   fVisLevel   ->SetValue(fTopNodeRE->GetVisLevel());
   fMaxVisNodes->SetValue(fTopNodeRE->GetMaxVisNodes());
   if (fTopNodeRE->GetVisLevel() > 0)
      fMaxVisNodes->UnmapWindow();
   else
      fMaxVisNodes->MapWindow();
}

/******************************************************************************/

//______________________________________________________________________________
void TEveGeoTopNodeEditor::DoVisOption()
{
   // Slot for VisOption.

   fTopNodeRE->SetVisOption(Int_t(fVisOption->GetValue()));
   Update();
}

//______________________________________________________________________________
void TEveGeoTopNodeEditor::DoVisLevel()
{
   // Slot for VisLevel.

   fTopNodeRE->SetVisLevel(Int_t(fVisLevel->GetValue()));
   Update();
}

//______________________________________________________________________________
void TEveGeoTopNodeEditor::DoMaxVisNodes()
{
   // Slot for MaxVisNodes.

   fTopNodeRE->SetMaxVisNodes(Int_t(fMaxVisNodes->GetValue()));
   Update();
}
 TEveGeoNodeEditor.cxx:1
 TEveGeoNodeEditor.cxx:2
 TEveGeoNodeEditor.cxx:3
 TEveGeoNodeEditor.cxx:4
 TEveGeoNodeEditor.cxx:5
 TEveGeoNodeEditor.cxx:6
 TEveGeoNodeEditor.cxx:7
 TEveGeoNodeEditor.cxx:8
 TEveGeoNodeEditor.cxx:9
 TEveGeoNodeEditor.cxx:10
 TEveGeoNodeEditor.cxx:11
 TEveGeoNodeEditor.cxx:12
 TEveGeoNodeEditor.cxx:13
 TEveGeoNodeEditor.cxx:14
 TEveGeoNodeEditor.cxx:15
 TEveGeoNodeEditor.cxx:16
 TEveGeoNodeEditor.cxx:17
 TEveGeoNodeEditor.cxx:18
 TEveGeoNodeEditor.cxx:19
 TEveGeoNodeEditor.cxx:20
 TEveGeoNodeEditor.cxx:21
 TEveGeoNodeEditor.cxx:22
 TEveGeoNodeEditor.cxx:23
 TEveGeoNodeEditor.cxx:24
 TEveGeoNodeEditor.cxx:25
 TEveGeoNodeEditor.cxx:26
 TEveGeoNodeEditor.cxx:27
 TEveGeoNodeEditor.cxx:28
 TEveGeoNodeEditor.cxx:29
 TEveGeoNodeEditor.cxx:30
 TEveGeoNodeEditor.cxx:31
 TEveGeoNodeEditor.cxx:32
 TEveGeoNodeEditor.cxx:33
 TEveGeoNodeEditor.cxx:34
 TEveGeoNodeEditor.cxx:35
 TEveGeoNodeEditor.cxx:36
 TEveGeoNodeEditor.cxx:37
 TEveGeoNodeEditor.cxx:38
 TEveGeoNodeEditor.cxx:39
 TEveGeoNodeEditor.cxx:40
 TEveGeoNodeEditor.cxx:41
 TEveGeoNodeEditor.cxx:42
 TEveGeoNodeEditor.cxx:43
 TEveGeoNodeEditor.cxx:44
 TEveGeoNodeEditor.cxx:45
 TEveGeoNodeEditor.cxx:46
 TEveGeoNodeEditor.cxx:47
 TEveGeoNodeEditor.cxx:48
 TEveGeoNodeEditor.cxx:49
 TEveGeoNodeEditor.cxx:50
 TEveGeoNodeEditor.cxx:51
 TEveGeoNodeEditor.cxx:52
 TEveGeoNodeEditor.cxx:53
 TEveGeoNodeEditor.cxx:54
 TEveGeoNodeEditor.cxx:55
 TEveGeoNodeEditor.cxx:56
 TEveGeoNodeEditor.cxx:57
 TEveGeoNodeEditor.cxx:58
 TEveGeoNodeEditor.cxx:59
 TEveGeoNodeEditor.cxx:60
 TEveGeoNodeEditor.cxx:61
 TEveGeoNodeEditor.cxx:62
 TEveGeoNodeEditor.cxx:63
 TEveGeoNodeEditor.cxx:64
 TEveGeoNodeEditor.cxx:65
 TEveGeoNodeEditor.cxx:66
 TEveGeoNodeEditor.cxx:67
 TEveGeoNodeEditor.cxx:68
 TEveGeoNodeEditor.cxx:69
 TEveGeoNodeEditor.cxx:70
 TEveGeoNodeEditor.cxx:71
 TEveGeoNodeEditor.cxx:72
 TEveGeoNodeEditor.cxx:73
 TEveGeoNodeEditor.cxx:74
 TEveGeoNodeEditor.cxx:75
 TEveGeoNodeEditor.cxx:76
 TEveGeoNodeEditor.cxx:77
 TEveGeoNodeEditor.cxx:78
 TEveGeoNodeEditor.cxx:79
 TEveGeoNodeEditor.cxx:80
 TEveGeoNodeEditor.cxx:81
 TEveGeoNodeEditor.cxx:82
 TEveGeoNodeEditor.cxx:83
 TEveGeoNodeEditor.cxx:84
 TEveGeoNodeEditor.cxx:85
 TEveGeoNodeEditor.cxx:86
 TEveGeoNodeEditor.cxx:87
 TEveGeoNodeEditor.cxx:88
 TEveGeoNodeEditor.cxx:89
 TEveGeoNodeEditor.cxx:90
 TEveGeoNodeEditor.cxx:91
 TEveGeoNodeEditor.cxx:92
 TEveGeoNodeEditor.cxx:93
 TEveGeoNodeEditor.cxx:94
 TEveGeoNodeEditor.cxx:95
 TEveGeoNodeEditor.cxx:96
 TEveGeoNodeEditor.cxx:97
 TEveGeoNodeEditor.cxx:98
 TEveGeoNodeEditor.cxx:99
 TEveGeoNodeEditor.cxx:100
 TEveGeoNodeEditor.cxx:101
 TEveGeoNodeEditor.cxx:102
 TEveGeoNodeEditor.cxx:103
 TEveGeoNodeEditor.cxx:104
 TEveGeoNodeEditor.cxx:105
 TEveGeoNodeEditor.cxx:106
 TEveGeoNodeEditor.cxx:107
 TEveGeoNodeEditor.cxx:108
 TEveGeoNodeEditor.cxx:109
 TEveGeoNodeEditor.cxx:110
 TEveGeoNodeEditor.cxx:111
 TEveGeoNodeEditor.cxx:112
 TEveGeoNodeEditor.cxx:113
 TEveGeoNodeEditor.cxx:114
 TEveGeoNodeEditor.cxx:115
 TEveGeoNodeEditor.cxx:116
 TEveGeoNodeEditor.cxx:117
 TEveGeoNodeEditor.cxx:118
 TEveGeoNodeEditor.cxx:119
 TEveGeoNodeEditor.cxx:120
 TEveGeoNodeEditor.cxx:121
 TEveGeoNodeEditor.cxx:122
 TEveGeoNodeEditor.cxx:123
 TEveGeoNodeEditor.cxx:124
 TEveGeoNodeEditor.cxx:125
 TEveGeoNodeEditor.cxx:126
 TEveGeoNodeEditor.cxx:127
 TEveGeoNodeEditor.cxx:128
 TEveGeoNodeEditor.cxx:129
 TEveGeoNodeEditor.cxx:130
 TEveGeoNodeEditor.cxx:131
 TEveGeoNodeEditor.cxx:132
 TEveGeoNodeEditor.cxx:133
 TEveGeoNodeEditor.cxx:134
 TEveGeoNodeEditor.cxx:135
 TEveGeoNodeEditor.cxx:136
 TEveGeoNodeEditor.cxx:137
 TEveGeoNodeEditor.cxx:138
 TEveGeoNodeEditor.cxx:139
 TEveGeoNodeEditor.cxx:140
 TEveGeoNodeEditor.cxx:141
 TEveGeoNodeEditor.cxx:142
 TEveGeoNodeEditor.cxx:143
 TEveGeoNodeEditor.cxx:144
 TEveGeoNodeEditor.cxx:145
 TEveGeoNodeEditor.cxx:146
 TEveGeoNodeEditor.cxx:147
 TEveGeoNodeEditor.cxx:148
 TEveGeoNodeEditor.cxx:149
 TEveGeoNodeEditor.cxx:150
 TEveGeoNodeEditor.cxx:151
 TEveGeoNodeEditor.cxx:152
 TEveGeoNodeEditor.cxx:153
 TEveGeoNodeEditor.cxx:154
 TEveGeoNodeEditor.cxx:155
 TEveGeoNodeEditor.cxx:156
 TEveGeoNodeEditor.cxx:157
 TEveGeoNodeEditor.cxx:158
 TEveGeoNodeEditor.cxx:159
 TEveGeoNodeEditor.cxx:160
 TEveGeoNodeEditor.cxx:161
 TEveGeoNodeEditor.cxx:162
 TEveGeoNodeEditor.cxx:163
 TEveGeoNodeEditor.cxx:164
 TEveGeoNodeEditor.cxx:165
 TEveGeoNodeEditor.cxx:166
 TEveGeoNodeEditor.cxx:167
 TEveGeoNodeEditor.cxx:168
 TEveGeoNodeEditor.cxx:169
 TEveGeoNodeEditor.cxx:170
 TEveGeoNodeEditor.cxx:171
 TEveGeoNodeEditor.cxx:172
 TEveGeoNodeEditor.cxx:173
 TEveGeoNodeEditor.cxx:174
 TEveGeoNodeEditor.cxx:175
 TEveGeoNodeEditor.cxx:176
 TEveGeoNodeEditor.cxx:177
 TEveGeoNodeEditor.cxx:178
 TEveGeoNodeEditor.cxx:179
 TEveGeoNodeEditor.cxx:180
 TEveGeoNodeEditor.cxx:181
 TEveGeoNodeEditor.cxx:182
 TEveGeoNodeEditor.cxx:183
 TEveGeoNodeEditor.cxx:184
 TEveGeoNodeEditor.cxx:185
 TEveGeoNodeEditor.cxx:186
 TEveGeoNodeEditor.cxx:187
 TEveGeoNodeEditor.cxx:188
 TEveGeoNodeEditor.cxx:189
 TEveGeoNodeEditor.cxx:190
 TEveGeoNodeEditor.cxx:191
 TEveGeoNodeEditor.cxx:192
 TEveGeoNodeEditor.cxx:193
 TEveGeoNodeEditor.cxx:194
 TEveGeoNodeEditor.cxx:195
 TEveGeoNodeEditor.cxx:196
 TEveGeoNodeEditor.cxx:197
 TEveGeoNodeEditor.cxx:198
 TEveGeoNodeEditor.cxx:199
 TEveGeoNodeEditor.cxx:200
 TEveGeoNodeEditor.cxx:201
 TEveGeoNodeEditor.cxx:202
 TEveGeoNodeEditor.cxx:203
 TEveGeoNodeEditor.cxx:204
 TEveGeoNodeEditor.cxx:205
 TEveGeoNodeEditor.cxx:206
 TEveGeoNodeEditor.cxx:207
 TEveGeoNodeEditor.cxx:208
 TEveGeoNodeEditor.cxx:209
 TEveGeoNodeEditor.cxx:210
 TEveGeoNodeEditor.cxx:211
 TEveGeoNodeEditor.cxx:212
 TEveGeoNodeEditor.cxx:213
 TEveGeoNodeEditor.cxx:214
 TEveGeoNodeEditor.cxx:215
 TEveGeoNodeEditor.cxx:216
 TEveGeoNodeEditor.cxx:217
 TEveGeoNodeEditor.cxx:218
 TEveGeoNodeEditor.cxx:219
 TEveGeoNodeEditor.cxx:220
 TEveGeoNodeEditor.cxx:221
 TEveGeoNodeEditor.cxx:222
 TEveGeoNodeEditor.cxx:223
 TEveGeoNodeEditor.cxx:224
 TEveGeoNodeEditor.cxx:225
 TEveGeoNodeEditor.cxx:226
 TEveGeoNodeEditor.cxx:227
 TEveGeoNodeEditor.cxx:228
 TEveGeoNodeEditor.cxx:229
 TEveGeoNodeEditor.cxx:230
 TEveGeoNodeEditor.cxx:231
 TEveGeoNodeEditor.cxx:232
 TEveGeoNodeEditor.cxx:233
 TEveGeoNodeEditor.cxx:234