Logo ROOT  
Reference Guide
TGL5DDataSetEditor.cxx
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Bertrand Bellenot 2009
3
4/*************************************************************************
5 * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11#include <string>
12#include <map>
13
14#include "TGDoubleSlider.h"
15#include "TGColorSelect.h"
16#include "TGNumberEntry.h"
17#include "TVirtualPad.h"
18#include "TGListBox.h"
19#include "TGSlider.h"
20#include "TGButton.h"
21#include "TGLabel.h"
22#include "TString.h"
23#include "TColor.h"
24#include "TAxis.h"
25
26#include "TGL5DDataSetEditor.h"
27#include "TGL5DPainter.h"
28#include "TGLUtil.h"
29#include "TGL5D.h"
30
31/** \class TGL5DDataSetEditor
32\ingroup opengl
33GUI editor for OpenGL 5D Painter.
34Exception safety and ROOT's GUI are two
35mutually exclusive things. So, only ROOT's GUI here.
36*/
37
38namespace {
39
40typedef TGL5DPainter::SurfIter_t SurfIter_t;
41typedef std::map<Int_t, SurfIter_t> IterMap_t;
42typedef IterMap_t::iterator IterMapIter_t;
43
44}
45
46//
47//Pimpl.
48//
49class TGL5DDataSetEditor::TGL5DEditorPrivate {
50public:
51 IterMap_t fIterators;
52 Bool_t IsValid(Int_t index)const
53 {
54 return fIterators.find(index) != fIterators.end();
55 }
56};
57
59
60////////////////////////////////////////////////////////////////////////////////
61
63 UInt_t options, Pixel_t back) :
64 TGedFrame(p, width, height, options | kVerticalFrame, back),
65 //"Grid" tab.
66 fNCellsXEntry(0),
67 fNCellsYEntry(0),
68 fNCellsZEntry(0),
69 fXRangeSlider(0),
70 fXRangeSliderMin(0),
71 fXRangeSliderMax(0),
72 fYRangeSlider(0),
73 fYRangeSliderMin(0),
74 fYRangeSliderMax(0),
75 fZRangeSlider(0),
76 fZRangeSliderMin(0),
77 fZRangeSliderMax(0),
78 fCancelGridBtn(0),
79 fOkGridBtn(0),
80 //"Surfaces" tab.
81 fV4MinEntry(0),
82 fV4MaxEntry(0),
83 fHighlightCheck(0),
84 fIsoList(0),
85 fVisibleCheck(0),
86 fShowCloud(0),
87 fSurfColorSelect(0),
88 fSurfAlphaSlider(0),
89 fSurfRemoveBtn(0),
90 fNewIsoEntry(0),
91 fAddNewIsoBtn(0),
92 //"Style" tab's widgets.
93 fShowBoxCut(),
94 fNumberOfPlanes(0),
95 fAlpha(0),
96 fLogScale(0),
97 fSlideRange(0),
98 fApplyAlpha(0),
99 fApplyPlanes(0),
100 //Model.
101 fDataSet(0),
102 fPainter(0),
103 fHidden(0),
104 fSelectedSurface(-1)
105{
106 //Constructor.
109 CreateIsoTab();
110
111 fHidden = new TGL5DEditorPrivate;
112}
113
114//______________________________________________________________________________
115
117{
118 //Destructor.
119 delete fHidden;
120}
121
122////////////////////////////////////////////////////////////////////////////////
123///Connect signals to slots.
124
126{
127 //Controls from "Style" tab.
128 fShowBoxCut->Connect("Toggled(Bool_t)", "TGL5DDataSetEditor", this, "BoxCutToggled()");
129 fAlpha->Connect("ValueChanged(Long_t)", "TGL5DDataSetEditor", this, "AlphaChanged()");
130 fAlpha->Connect("ValueSet(Long_t)", "TGL5DDataSetEditor", this, "AlphaChanged()");
131 fNumberOfPlanes->Connect("ValueChanged(Long_t)", "TGL5DDataSetEditor", this, "NContoursChanged()");
132 fNumberOfPlanes->Connect("ValueSet(Long_t)", "TGL5DDataSetEditor", this, "NContoursChanged()");
133 fApplyPlanes->Connect("Clicked()", "TGL5DDataSetEditor", this, "ApplyPlanes()");
134 fApplyAlpha->Connect("Clicked()", "TGL5DDataSetEditor", this, "ApplyAlpha()");
135
136 //Controls from "Grid" tab.
137 fNCellsXEntry->Connect("ValueSet(Long_t)", "TGL5DDataSetEditor", this, "GridParametersChanged()");
138 fNCellsXEntry->Connect("ValueChanged(Long_t)", "TGL5DDataSetEditor", this, "GridParametersChanged()");
139
140 fNCellsYEntry->Connect("ValueSet(Long_t)", "TGL5DDataSetEditor", this, "GridParametersChanged()");
141 fNCellsZEntry->Connect("ValueSet(Long_t)", "TGL5DDataSetEditor", this, "GridParametersChanged()");
142
143 fXRangeSlider->Connect("PositionChanged()", "TGL5DDataSetEditor", this, "XSliderChanged()");
144 fXRangeSliderMin->Connect("ReturnPressed()", "TGL5DDataSetEditor", this, "XSliderSetMin()");
145 fXRangeSliderMax->Connect("ReturnPressed()", "TGL5DDataSetEditor", this, "XSliderSetMax()");
146
147 fYRangeSlider->Connect("PositionChanged()", "TGL5DDataSetEditor", this, "YSliderChanged()");
148 fYRangeSliderMin->Connect("ReturnPressed()", "TGL5DDataSetEditor", this, "YSliderSetMin()");
149 fYRangeSliderMax->Connect("ReturnPressed()", "TGL5DDataSetEditor", this, "YSliderSetMax()");
150
151 fZRangeSlider->Connect("PositionChanged()", "TGL5DDataSetEditor", this, "ZSliderChanged()");
152 fZRangeSliderMin->Connect("ReturnPressed()", "TGL5DDataSetEditor", this, "ZSliderSetMin()");
153 fZRangeSliderMax->Connect("ReturnPressed()", "TGL5DDataSetEditor", this, "ZSliderSetMax()");
154
155 fCancelGridBtn->Connect("Pressed()", "TGL5DDataSetEditor", this, "RollbackGridParameters()");
156 fOkGridBtn->Connect("Pressed()", "TGL5DDataSetEditor", this, "ApplyGridParameters()");
157
158 //Controls from "Surfaces" tab.
159 fIsoList->Connect("Selected(Int_t)", "TGL5DDataSetEditor", this, "SurfaceSelected(Int_t)");
161
162 fHighlightCheck->Connect("Clicked()", "TGL5DDataSetEditor", this, "HighlightClicked()");
163 fVisibleCheck->Connect("Clicked()", "TGL5DDataSetEditor", this, "VisibleClicked()");
164 fSurfColorSelect->Connect("ColorSelected(Pixel_t)", "TGL5DDataSetEditor", this, "ColorChanged(Pixel_t)");
165 fSurfAlphaSlider->Connect("PositionChanged(Int_t)", "TGL5DDataSetEditor", this, "AlphaChanged(Int_t)");
166 fSurfRemoveBtn->Connect("Pressed()", "TGL5DDataSetEditor", this, "RemoveSurface()");
167
168 fAddNewIsoBtn->Connect("Pressed()", "TGL5DDataSetEditor", this, "AddNewSurface()");
169
170 fInit = kFALSE;
171}
172
173
174namespace
175{
176
177// Auxiliary functions.
178
179////////////////////////////////////////////////////////////////////////////////
180
181void make_slider_range_entries(TGCompositeFrame *parent, TGNumberEntryField *&minEntry,
182 const TString &minToolTip, TGNumberEntryField *&maxEntry,
183 const TString &maxToolTip)
184{
185 TGCompositeFrame *frame = new TGCompositeFrame(parent, 80, 20, kHorizontalFrame);
186
187 minEntry = new TGNumberEntryField(frame, -1, 0., TGNumberFormat::kNESRealThree,
189 minEntry->SetToolTipText(minToolTip.Data());
190 minEntry->Resize(57, 20);
191 frame->AddFrame(minEntry, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
192
193 maxEntry = new TGNumberEntryField(frame, -1, 0., TGNumberFormat::kNESRealThree,
195 maxEntry->SetToolTipText(maxToolTip.Data());
196 maxEntry->Resize(57, 20);
197 frame->AddFrame(maxEntry, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
198 parent->AddFrame(frame, new TGLayoutHints(kLHintsTop, 5, 0, 0, 0));
199}
200
201////////////////////////////////////////////////////////////////////////////////
202
203TGHorizontalFrame *make_labeled_hframe(TGCompositeFrame *p, const char *text)
204{
205 TGHorizontalFrame *frame = new TGHorizontalFrame(p);
206 TGLabel *label = new TGLabel(frame, text);
207 frame->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 0, 0, 0));
208 p->AddFrame(frame, new TGLayoutHints(kLHintsLeft, 0, 0, 1, 0));
209
210 return frame;
211}
212
213////////////////////////////////////////////////////////////////////////////////
214
215TGDoubleHSlider *make_double_hslider(TGCompositeFrame *parent, const char *labelName)
216{
217 TGCompositeFrame *sliderFrame = new TGCompositeFrame(parent, 80, 20, kHorizontalFrame);
218 TGLabel *sliderLabel = new TGLabel(sliderFrame, labelName);
219 sliderFrame->AddFrame(sliderLabel,
220 new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 2, 2, 2, 2));
221 TGDoubleHSlider *slider = new TGDoubleHSlider(sliderFrame, 1, 2);
222 slider->Resize(110, 20);
223
224 sliderFrame->AddFrame(slider, new TGLayoutHints(kLHintsLeft));
225 parent->AddFrame(sliderFrame, new TGLayoutHints(kLHintsTop, 2, 2, 2, 2));
226
227 return slider;
228}
229
230}
231
232////////////////////////////////////////////////////////////////////////////////
233/// Creates "Style" tab.
234
236{
238 //MakeTitle("Update behaviour");
239 fShowBoxCut = new TGCheckButton(this, "Show Box Cut");
240 fShowBoxCut->SetToolTipText("Box cut. When attached to a plot, cuts away a part of it");
242
243 MakeTitle("isosurfaces");
244 f = new TGHorizontalFrame(this, 200, 50);
245 f->AddFrame(new TGLabel(f, "Number:"), new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5, 2, 2, 2));
248 fNumberOfPlanes->GetNumberEntry()->SetToolTipText("Set number of isosurfaces");
249 f->AddFrame(fNumberOfPlanes, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2));
250 fApplyPlanes = new TGTextButton(f, " Apply ");
251 f->AddFrame(fApplyPlanes, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 2, 2, 2));
253 //fApplyPlanes->SetState(kButtonDisabled);
254
255 MakeTitle("Alpha");
256 f = new TGHorizontalFrame(this, 200, 50);
257 f->AddFrame(new TGLabel(f, "Value:"), new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5, 2, 2, 2));
260 fAlpha->GetNumberEntry()->SetToolTipText("Value of alpha parameter");
261 f->AddFrame(fAlpha, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2));
262 fApplyAlpha = new TGTextButton(f, " Apply ");
263 f->AddFrame(fApplyAlpha, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 2, 2, 2));
266
267 fLogScale = new TGCheckButton(this, "Log Scale");
269
270 AddFrame(new TGLabel(this, "Slide Range:"), new TGLayoutHints(kLHintsLeft, 5, 2, 2, 2));
273}
274
275////////////////////////////////////////////////////////////////////////////////
276///Tab, containing controls to set
277///the ranges and number of cells in a grid.
278
280{
281 TGCompositeFrame *tabFrame = CreateEditorTabSubFrame("Grid");
282 //1. The first part of the tab - "Grid parameters" group.
283 TGGroupFrame *gridGroup = new TGGroupFrame(tabFrame, "Grid parameters", kVerticalFrame);
284 //2. Numeric entries.
285 const UInt_t min = 10, max = 300;
286 const UInt_t nDigits = 4;
287
288 TGHorizontalFrame *frame = make_labeled_hframe(gridGroup, "Cells along X:");
289 fNCellsXEntry = new TGNumberEntry(frame, 0., nDigits, -1, TGNumberFormat::kNESInteger,
291 min, max);
292 frame->AddFrame(fNCellsXEntry,
294 //
295 frame = make_labeled_hframe(gridGroup, "Cells along Y:");
296 fNCellsYEntry = new TGNumberEntry(frame, 0., nDigits, -1, TGNumberFormat::kNESInteger,
298 min, max);
299 frame->AddFrame(fNCellsYEntry,
301 //
302 frame = make_labeled_hframe(gridGroup, "Cells along Z:");
303 fNCellsZEntry = new TGNumberEntry(frame, 0., nDigits, -1, TGNumberFormat::kNESInteger,
305 min, max);
306 frame->AddFrame(fNCellsZEntry,
308 tabFrame->AddFrame(gridGroup, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 2, 3, 3, 0));
309
310 //3. The second part - "Ranges" group.
311 TGGroupFrame *rangeGroup = new TGGroupFrame(tabFrame, "Ranges", kVerticalFrame);
312 //4. Sliders and number entry fields.
313 fXRangeSlider = make_double_hslider(rangeGroup, "X:");
314 make_slider_range_entries(rangeGroup, fXRangeSliderMin, "Set the minimum value of the x-axis",
315 fXRangeSliderMax, "Set the maximum value of the x-axis");
316 fYRangeSlider = make_double_hslider(rangeGroup, "Y:");
317 make_slider_range_entries(rangeGroup, fYRangeSliderMin, "Set the minimum value of the y-axis",
318 fYRangeSliderMax, "Set the maximum value of the y-axis");
319 fZRangeSlider = make_double_hslider(rangeGroup, "Z:");
320 make_slider_range_entries(rangeGroup, fZRangeSliderMin, "Set the minimum value of the z-axis",
321 fZRangeSliderMax, "Set the maximum value of the z-axis");
322
323 tabFrame->AddFrame(rangeGroup, new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 2, 3, 0, 0));
324
325 //5. Buttons.
326 TGHorizontalFrame *horizontalFrame = new TGHorizontalFrame(tabFrame, 200, 50);
327 fCancelGridBtn = new TGTextButton(horizontalFrame, " Cancel ");
328 horizontalFrame->AddFrame(fCancelGridBtn, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 2, 2, 2));
329 fOkGridBtn = new TGTextButton(horizontalFrame, " Apply ");
330 horizontalFrame->AddFrame(fOkGridBtn, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 2, 2, 2));
331 tabFrame->AddFrame(horizontalFrame, new TGLayoutHints(kLHintsTop | kLHintsCenterX, 2, 3, 0, 0));
332}
333
334////////////////////////////////////////////////////////////////////////////////
335///Tab, containing controls to work with iso-surfaces.
336
338{
339 TGCompositeFrame *tabFrame = CreateEditorTabSubFrame("Surfaces");
340
341 //1. The first group - contains V4 range (read only number entries with min and max).
342 TGGroupFrame *v4Group = new TGGroupFrame(tabFrame, "V4 Range", kVerticalFrame);
343
344 make_slider_range_entries(v4Group, fV4MinEntry, "Minimum value of V4",
345 fV4MaxEntry, "Maximum value of V4");
346
347 tabFrame->AddFrame(v4Group, new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 2, 3, 0, 0));
348 //
351
352 //2. The second group - contains controls to select surface and
353 //manipulate its parameters.
354 TGGroupFrame *isoGroup = new TGGroupFrame(tabFrame, "Iso-surfaces", kVerticalFrame);
355
356 fHighlightCheck = new TGCheckButton(isoGroup, "Highlight selected");
357 fHighlightCheck->SetToolTipText("Highlight selected surface");
359 isoGroup->AddFrame(fHighlightCheck, new TGLayoutHints(kLHintsLeft, 4, 1, 1, 1));
360
361 TGHorizontalFrame *hf = new TGHorizontalFrame(isoGroup);
362 fIsoList = new TGListBox(hf);
363 fIsoList->Resize(120, 120);
364 hf->AddFrame(fIsoList, new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5));
365 isoGroup->AddFrame(hf, new TGLayoutHints(kLHintsLeft, 2, 1, 1, 1));
366
367 fVisibleCheck = new TGCheckButton(isoGroup, "Visible");
368 fVisibleCheck->SetToolTipText("Show/hide surface");
369 isoGroup->AddFrame(fVisibleCheck, new TGLayoutHints(kLHintsLeft, 4, 1, 1, 1));
370
371 fShowCloud = new TGCheckButton(isoGroup, "Show cloud");
372 fShowCloud->SetToolTipText("Show/hide cloud for surface");
373 isoGroup->AddFrame(fShowCloud, new TGLayoutHints(kLHintsLeft, 4, 1, 1, 1));
374
375 //Sorry, Matevz :) I stole this from TGLViewerEditor :))
376 hf = new TGHorizontalFrame(isoGroup);
377 TGLabel* lab = new TGLabel(hf, "Color");
378 hf->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 4, 8, 3));
379 fSurfColorSelect = new TGColorSelect(hf, 0, -1);
380 hf->AddFrame(fSurfColorSelect, new TGLayoutHints(kLHintsLeft, 1, 1, 8, 1));
381 isoGroup->AddFrame(hf, new TGLayoutHints(kLHintsLeft, 2, 1, 1, 1));
382
383 TGHorizontalFrame *frame = make_labeled_hframe(isoGroup, "Opacity: ");
384 fSurfAlphaSlider = new TGHSlider(frame, 80);
385 fSurfAlphaSlider->SetRange(0, 100);
387
388 fSurfRemoveBtn = new TGTextButton(isoGroup, " Remove surface ");
389 isoGroup->AddFrame(fSurfRemoveBtn, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
390 tabFrame->AddFrame(isoGroup, new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 2, 3, 0, 0));
391
392 //3. Group with controls to add new iso-surface.
393 TGGroupFrame *newGroup = new TGGroupFrame(tabFrame, "New iso-surface", kVerticalFrame);
394 hf = new TGHorizontalFrame(newGroup);
397 fNewIsoEntry->Resize(60, 20);
398 fAddNewIsoBtn = new TGTextButton(hf, " Add ");
400 newGroup->AddFrame(hf, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
401
402 tabFrame->AddFrame(newGroup, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 3, 0, 0));
403}
404
405////////////////////////////////////////////////////////////////////////////////
406///Set model or disables/hides viewer.
407
409{
410 fPainter = 0;
411 Bool_t needUpdate = fSelectedSurface != -1;
412
413 if ((fDataSet = dynamic_cast<TGL5DDataSet *>(obj))) {
415
419
422
423 if (fInit)
425 }
426
427 if (needUpdate && gPad)
428 gPad->Update();
429}
430
431namespace {
432
433void set_grid_range_widgets(const TAxis *a, const Rgl::Range_t r, TGDoubleHSlider *slider,
435{
436 slider->SetRange(r.first, r.second);
437 slider->SetPosition(a->GetBinLowEdge(1), a->GetBinUpEdge(a->GetLast()));
438
439 eMin->SetNumber(a->GetBinLowEdge(1));
440 eMin->SetLimits(TGNumberFormat::kNELLimitMinMax, r.first, r.second);
441 eMax->SetNumber(a->GetBinUpEdge(a->GetLast()));
442 eMax->SetLimits(TGNumberFormat::kNELLimitMinMax, r.first, r.second);
443}
444
445}
446
447////////////////////////////////////////////////////////////////////////////////
448///Set "Style" tab's controls from model.
449
451{
455}
456
457////////////////////////////////////////////////////////////////////////////////
458///Set "Grid" tab's controls from model.
459
461{
462 const TAxis *xA = fDataSet->GetXAxis();
463 const TAxis *yA = fDataSet->GetYAxis();
464 const TAxis *zA = fDataSet->GetZAxis();
465 const Rgl::Range_t &xR = fDataSet->GetXRange();
466 const Rgl::Range_t &yR = fDataSet->GetYRange();
467 const Rgl::Range_t &zR = fDataSet->GetZRange();
468 //Number of cells.
472 //X-range.
473 set_grid_range_widgets(xA, xR, fXRangeSlider, fXRangeSliderMin, fXRangeSliderMax);
474 //Y-range.
475 set_grid_range_widgets(yA, yR, fYRangeSlider, fYRangeSliderMin, fYRangeSliderMax);
476 //Z-range.
477 set_grid_range_widgets(zA, zR, fZRangeSlider, fZRangeSliderMin, fZRangeSliderMax);
478}
479
480////////////////////////////////////////////////////////////////////////////////
481///Set "Surfaces" tab's controls from model.
482
484{
485 const Rgl::Range_t &v4R = fDataSet->GetV4Range();
486 //V4 range.
487 fV4MinEntry->SetNumber(v4R.first);
488 fV4MaxEntry->SetNumber(v4R.second);
489
491 fHidden->fIterators.clear();
492
493 SurfIter_t curr = fPainter->SurfacesBegin();
494
495 for (Int_t ind = 0; curr != fPainter->SurfacesEnd(); ++curr, ++ind) {
496 TString entry(TString::Format("Level: %f", curr->f4D));
497 fIsoList->AddEntry(entry.Data(), ind);
498 fIsoList->Layout();
499 curr->fHighlight = kFALSE;
500 //I'm saving list's iterators here.
501 //If list modified (surface removed)
502 //- corresponding iterator must be removed,
503 //all other iterators are still valid (thanks to std::list).
504 //If surface added, new iterator must be added at the end.
505 fHidden->fIterators[ind] = curr;
506 }
507
509 fNewIsoEntry->SetNumber(v4R.first);
510
511 fSelectedSurface = -1;
512}
513
514////////////////////////////////////////////////////////////////////////////////
515///Some of controls in a "Grid" tab was modified.
516
518{
520}
521
522////////////////////////////////////////////////////////////////////////////////
523///Grid parameters were changed, enable "Cancel" and "Apply" buttons.
524
526{
529}
530
531////////////////////////////////////////////////////////////////////////////////
532///Disable "Cancel" and "Apply" buttons.
533
535{
538}
539
540////////////////////////////////////////////////////////////////////////////////
541///Surface was selected in a list box, enable some controls.
542
544{
546// fShowCloud->SetState(kButtonUp);
547// fSurfColorBtn->SetState(kButtonUp);
549}
550
551////////////////////////////////////////////////////////////////////////////////
552///Disable surface controls.
553
555{
558// fSurfColorBtn->SetState(kButtonDisabled);
560}
561
562////////////////////////////////////////////////////////////////////////////////
563///X slider in a "Grid" tab.
564
566{
569
571}
572
573////////////////////////////////////////////////////////////////////////////////
574///Y slider in a "Grid" tab.
575
577{
580
582}
583
584////////////////////////////////////////////////////////////////////////////////
585///Z slider in a "Grid" tab.
586
588{
591
593}
594
595////////////////////////////////////////////////////////////////////////////////
596///Value in a number entry was modified.
597
599{
604 } else
606}
607
608////////////////////////////////////////////////////////////////////////////////
609///Value in a number entry was modified.
610
612{
617 } else
619}
620
621
622////////////////////////////////////////////////////////////////////////////////
623///Value in a number entry was modified.
624
626{
631 } else
633}
634
635////////////////////////////////////////////////////////////////////////////////
636///Value in a number entry was modified.
637
639{
644 } else
646}
647
648////////////////////////////////////////////////////////////////////////////////
649///Value in a number entry was modified.
650
652{
657 } else
659
660}
661
662////////////////////////////////////////////////////////////////////////////////
663///Value in a number entry was modified.
664
666{
671 } else
673}
674
675////////////////////////////////////////////////////////////////////////////////
676///"Cancel" button was pressed in a "Grid" tab.
677///Return old values.
678
680{
683}
684
685////////////////////////////////////////////////////////////////////////////////
686///"Apply" button was pressed in a "Grid" tab.
687///Modify all meshes.
688
690{
692 //
696
700
704
706 if (gPad)
707 gPad->Update();
708}
709
710////////////////////////////////////////////////////////////////////////////////
711///Check, if selected surface must be highlighted.
712
714{
715 if (fSelectedSurface == -1)
716 return;
717
718 fHidden->fIterators[fSelectedSurface]->fHighlight = fHighlightCheck->IsOn();
719
720 if (gPad)
721 gPad->Update();
722}
723
724////////////////////////////////////////////////////////////////////////////////
725///Surface was selected in a list box.
726///Enable surface controls and set them into
727///correct state.
728
730{
731 if (id >= 0) {
732 //Check, if the index is valid.
733 if (!fHidden->IsValid(id)) {
734 Error("SurfaceSelected", "Got wrong index %d", id);
735 return;
736 }
737
738 if (fSelectedSurface != -1) {
739 //Previously selected surface IS ALWAYS
740 //valid index, so no index check here.
741 fHidden->fIterators[fSelectedSurface]->fHighlight = kFALSE;
742 }
743
745
746
747 SurfIter_t surf = fHidden->fIterators[fSelectedSurface = id];
748 surf->fHighlight = fHighlightCheck->IsOn();
749 //Surface is visible/invisible - check/uncheck.
750 fVisibleCheck->SetOn(!surf->fHide);
752 fSurfAlphaSlider->SetPosition(surf->fAlpha);
753
754 if (gPad)
755 gPad->Update();
756 } else if (fSelectedSurface != -1) {
757 //Deselect.
758 fHidden->fIterators[fSelectedSurface]->fHighlight = kFALSE;
759 fSelectedSurface = -1;
760 DisableSurfaceControls();//No surface is selected, no working controls.
761 if (gPad)
762 gPad->Update();
763 }
764}
765
766////////////////////////////////////////////////////////////////////////////////
767///Hide/show selected surface.
768
770{
771 //In principle, this control can be enabled,
772 //only if some surface was selected and
773 //fSelectedSurface != -1. But I do not trust to
774 //ROOT's GUI so I have a check.
775 if (fSelectedSurface != -1) {
776 fHidden->fIterators[fSelectedSurface]->fHide = !(fVisibleCheck->IsOn());
777 if (gPad)
778 gPad->Update();
779 }
780}
781
782////////////////////////////////////////////////////////////////////////////////
783///Change the color of the selected surface.
784
786{
787 if (fSelectedSurface != -1) {
788 fHidden->fIterators[fSelectedSurface]->fColor = Color_t(TColor::GetColor(pixel));
789 if (gPad)
790 gPad->Update();
791 }
792}
793
794////////////////////////////////////////////////////////////////////////////////
795///Change transparency of selected surface.
796
798{
799 if (fSelectedSurface != -1) {
800 fHidden->fIterators[fSelectedSurface]->fAlpha = alpha;
801 if (gPad)
802 gPad->Update();
803 }
804}
805
806////////////////////////////////////////////////////////////////////////////////
807///Remove selected surface.
808
810{
811 if (fSelectedSurface != -1) {
812
813 SurfIter_t it = fHidden->fIterators[fSelectedSurface];
814 fHidden->fIterators.erase(fSelectedSurface);
816 fIsoList->Layout();
819 fSelectedSurface = -1;
820
821 if (gPad)
822 gPad->Update();
823 }
824}
825
826////////////////////////////////////////////////////////////////////////////////
827///Add new iso-surface.
828
830{
833
834 if (gPad)
835 gPad->Update();
836}
837
838////////////////////////////////////////////////////////////////////////////////
839/// Slot connected to the "Apply" button for alpha value.
840
842{
843 if (fPainter) {
847
848 //Update other tabs and change controls' states.
850 }
851
852 if (gPad)
853 gPad->Update();
854}
855
856
857////////////////////////////////////////////////////////////////////////////////
858/// Slot connected to the Apply Planes button.
859
861{
862 if (fPainter) {
863 //fApplyPlanes->SetState(kButtonDisabled);
866
867 //Update other tabs and change controls' states.
869 }
870
871 if (gPad)
872 gPad->Update();
873}
874
875////////////////////////////////////////////////////////////////////////////////
876/// Slot connected to the Show BoxCut check button.
877
879{
880 if (fPainter)
882 if (gPad)
883 gPad->Update();
884}
885
886////////////////////////////////////////////////////////////////////////////////
887/// Slot connected to the Alpha entry.
888
890{
892}
893
894////////////////////////////////////////////////////////////////////////////////
895/// Slot connected to the Number of Planes value-entry.
896
898{
899// fApplyPlanes->SetState(kButtonUp);
900}
const Mask_t kKeyPressMask
Definition: GuiTypes.h:158
@ kVerticalFrame
Definition: GuiTypes.h:381
@ kHorizontalFrame
Definition: GuiTypes.h:382
ULong_t Pixel_t
Definition: GuiTypes.h:39
ROOT::R::TRInterface & r
Definition: Object.C:4
#define f(i)
Definition: RSha256.hxx:104
int Int_t
Definition: RtypesCore.h:43
const Bool_t kFALSE
Definition: RtypesCore.h:90
bool Bool_t
Definition: RtypesCore.h:61
short Color_t
Definition: RtypesCore.h:81
#define ClassImp(name)
Definition: Rtypes.h:361
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
@ kButtonDown
Definition: TGButton.h:54
@ kButtonDisabled
Definition: TGButton.h:56
@ kButtonUp
Definition: TGButton.h:53
@ kDoubleScaleDownRight
@ kLHintsLeft
Definition: TGLayout.h:31
@ kLHintsCenterY
Definition: TGLayout.h:35
@ kLHintsCenterX
Definition: TGLayout.h:32
@ kLHintsBottom
Definition: TGLayout.h:36
@ kLHintsTop
Definition: TGLayout.h:34
@ kLHintsExpandX
Definition: TGLayout.h:37
XFontStruct * id
Definition: TGX11.cxx:108
#define gPad
Definition: TVirtualPad.h:287
Class to manage histogram axis.
Definition: TAxis.h:30
virtual void Set(Int_t nbins, Double_t xmin, Double_t xmax)
Initialize axis with fix bins.
Definition: TAxis.cxx:728
Int_t GetNbins() const
Definition: TAxis.h:121
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition: TColor.cxx:2016
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition: TColor.cxx:1769
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:397
virtual void SetOn(Bool_t on=kTRUE, Bool_t emit=kFALSE)
Definition: TGButton.h:120
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:187
virtual Bool_t IsOn() const
Definition: TGButton.h:311
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1202
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1101
virtual Float_t GetMaxPosition() const
virtual Float_t GetMinPosition() const
virtual void SetRange(Float_t min, Float_t max)
virtual void SetPosition(Float_t min, Float_t max)
void RemoveInput(UInt_t emask)
Remove events specified in emask from the events the frame should handle.
Definition: TGFrame.cxx:332
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:589
GUI editor for OpenGL 5D Painter.
void VisibleClicked()
Hide/show selected surface.
void ColorChanged(Pixel_t pixelColor)
Change the color of the selected surface.
TGTextButton * fOkGridBtn
TGDoubleHSlider * fYRangeSlider
void ApplyPlanes()
Slot connected to the Apply Planes button.
void AddNewSurface()
Add new iso-surface.
void XSliderSetMax()
Value in a number entry was modified.
TGCheckButton * fShowCloud
TGNumberEntryField * fV4MaxEntry
void SurfaceSelected(Int_t id)
Surface was selected in a list box.
TGColorSelect * fSurfColorSelect
TGCheckButton * fLogScale
TGDoubleHSlider * fXRangeSlider
TGCheckButton * fShowBoxCut
TGTextButton * fCancelGridBtn
TGNumberEntry * fNewIsoEntry
void ZSliderChanged()
Z slider in a "Grid" tab.
void XSliderChanged()
X slider in a "Grid" tab.
TGNumberEntryField * fZRangeSliderMax
void SetStyleTabWidgets()
Set "Style" tab's controls from model.
TGL5DDataSet * fDataSet
void AlphaChanged()
Slot connected to the Alpha entry.
TGL5DDataSetEditor(const TGL5DDataSetEditor &)
void DisableSurfaceControls()
Disable surface controls.
void ApplyGridParameters()
"Apply" button was pressed in a "Grid" tab.
void RemoveSurface()
Remove selected surface.
void BoxCutToggled()
Slot connected to the Show BoxCut check button.
TGTextButton * fAddNewIsoBtn
virtual void SetModel(TObject *obj)
Set model or disables/hides viewer.
void ZSliderSetMin()
Value in a number entry was modified.
TGNumberEntryField * fZRangeSliderMin
TGNumberEntryField * fYRangeSliderMin
TGNumberEntry * fNCellsZEntry
TGNumberEntry * fNCellsXEntry
TGDoubleHSlider * fSlideRange
TGCheckButton * fVisibleCheck
TGTextButton * fApplyAlpha
TGNumberEntry * fNumberOfPlanes
void EnableSurfaceControls()
Surface was selected in a list box, enable some controls.
void YSliderChanged()
Y slider in a "Grid" tab.
TGNumberEntryField * fYRangeSliderMax
TGNumberEntryField * fV4MinEntry
TGTextButton * fApplyPlanes
void ApplyAlpha()
Slot connected to the "Apply" button for alpha value.
void CreateStyleTab()
Creates "Style" tab.
void RollbackGridParameters()
"Cancel" button was pressed in a "Grid" tab.
void ConnectSignals2Slots()
Connect signals to slots.
void CreateIsoTab()
Tab, containing controls to work with iso-surfaces.
void ZSliderSetMax()
Value in a number entry was modified.
void GridParametersChanged()
Some of controls in a "Grid" tab was modified.
void NContoursChanged()
Slot connected to the Number of Planes value-entry.
TGDoubleHSlider * fZRangeSlider
TGHSlider * fSurfAlphaSlider
TGNumberEntryField * fXRangeSliderMin
TGTextButton * fSurfRemoveBtn
TGNumberEntry * fAlpha
void EnableGridTabButtons()
Grid parameters were changed, enable "Cancel" and "Apply" buttons.
TGL5DEditorPrivate * fHidden
void CreateGridTab()
Tab, containing controls to set the ranges and number of cells in a grid.
void SetIsoTabWidgets()
Set "Surfaces" tab's controls from model.
TGNumberEntryField * fXRangeSliderMax
TGCheckButton * fHighlightCheck
void XSliderSetMin()
Value in a number entry was modified.
void YSliderSetMin()
Value in a number entry was modified.
void DisableGridTabButtons()
Disable "Cancel" and "Apply" buttons.
void HighlightClicked()
Check, if selected surface must be highlighted.
TGL5DPainter * fPainter
void SetGridTabWidgets()
Set "Grid" tab's controls from model.
void YSliderSetMax()
Value in a number entry was modified.
TGNumberEntry * fNCellsYEntry
TAxis * GetZAxis() const
Z axis for plot.
Definition: TGL5D.cxx:204
const Rgl::Range_t & GetZRange() const
V3 range (Z).
Definition: TGL5D.cxx:228
const Rgl::Range_t & GetYRange() const
V2 range (Y).
Definition: TGL5D.cxx:220
TGL5DPainter * GetRealPainter() const
Get access to painter (for GUI-editor).
Definition: TGL5D.cxx:135
TAxis * GetYAxis() const
Y axis for plot.
Definition: TGL5D.cxx:196
TAxis * GetXAxis() const
X axis for plot.
Definition: TGL5D.cxx:188
const Rgl::Range_t & GetXRange() const
V1 range (X).
Definition: TGL5D.cxx:212
const Rgl::Range_t & GetV4Range() const
V4 range.
Definition: TGL5D.cxx:236
void ShowBoxCut(Bool_t show)
Definition: TGL5DPainter.h:102
Bool_t IsBoxCutShown() const
Definition: TGL5DPainter.h:103
void SetNContours(Int_t num)
Set the number of predefined contours.
void ResetGeometryRanges()
No need to create or delete meshes, number of meshes (iso-levels) are the same, but meshes must be re...
SurfList_t::iterator SurfIter_t
Definition: TGL5DPainter.h:61
SurfIter_t SurfacesBegin()
std::list::begin.
void RemoveSurface(SurfIter_t surf)
Remove iso-surface.
SurfIter_t SurfacesEnd()
std::list::end.
Double_t GetAlpha() const
Definition: TGL5DPainter.h:106
void SetAlpha(Double_t newAlpha)
Set selection range parameter.
SurfIter_t AddSurface(Double_t v4, Color_t ci, Double_t isoVal=1., Double_t sigma=1., Double_t range=1e-3, Int_t lowNumOfPoints=kNLowPts)
Try to add new iso-surface.
Int_t GetNContours() const
Definition: TGL5DPainter.h:109
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
Definition: TGListBox.cxx:1420
virtual void RemoveEntry(Int_t id=-1)
remove entry with id.
Definition: TGListBox.cxx:1327
virtual void AddEntry(TGString *s, Int_t id)
Add entry with specified string and id to listbox.
Definition: TGListBox.cxx:1212
virtual void RemoveAll()
Remove all entries.
Definition: TGListBox.cxx:1353
virtual TGFrame * GetContainer() const
Definition: TGListBox.h:335
virtual void Layout()
Layout the listbox components.
Definition: TGListBox.cxx:1461
virtual Double_t GetNumber() const
Get the numeric value (floating point representation).
virtual void SetState(Bool_t state)
Set the active state.
virtual void SetLimits(ELimit limits=kNELNoLimits, Double_t min=0, Double_t max=1)
Set the numerical limits.
virtual void SetNumber(Double_t val)
Set the numeric value (floating point representation).
virtual void SetNumber(Double_t val)
virtual void SetIntNumber(Long_t val)
TGNumberEntryField * GetNumberEntry() const
virtual void SetLimits(ELimit limits=TGNumberFormat::kNELNoLimits, Double_t min=0, Double_t max=1)
virtual Long_t GetIntNumber() const
virtual Double_t GetNumber() const
virtual void SetPosition(Int_t pos)
Definition: TGSlider.h:105
virtual void SetRange(Int_t min, Int_t max)
Definition: TGSlider.h:101
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by 'owner' in extra tab 'name'.
Definition: TGedFrame.cxx:123
Bool_t fInit
Definition: TGedFrame.h:53
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
Mother of all ROOT objects.
Definition: TObject.h:37
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:891
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition: TQObject.cxx:866
Basic string class.
Definition: TString.h:131
const char * Data() const
Definition: TString.h:364
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition: TString.cxx:2311
TText * text
std::pair< Double_t, Double_t > Range_t
Definition: TGLUtil.h:1194
auto * a
Definition: textangle.C:12