Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGLViewerEditor.cxx
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Alja Mrak-Tadel, Matevz Tadel, Timur Pocheptsov 08/03/2006
3
4/*************************************************************************
5 * Copyright (C) 1995-2006, 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
12#include <cstring>
13
14#include "TGedEditor.h"
15#include "TGNumberEntry.h"
16#include "TGButtonGroup.h"
17#include "TGColorSelect.h"
18#include "TGTextEntry.h"
19#include "TVirtualGL.h"
20#include "TG3DLine.h"
21#include "TGButton.h"
22#include "TColor.h"
23#include "TString.h"
24#include "TGLabel.h"
25#include "TGComboBox.h"
26#include "TError.h"
27
28#include "TGLViewerEditor.h"
29#include "TGLViewer.h"
30#include "TGLLightSetEditor.h"
31#include "TGLClipSetEditor.h"
32#include "TGLUtil.h"
33#include "TGLCameraOverlay.h"
34#include "TGLAutoRotator.h"
35
36/** \class TGLViewerEditor
37\ingroup opengl
38GUI editor for TGLViewer.
39*/
40
41namespace {
42
44
45}
46
48
50 TGedFrame(p, width, height, options | kVerticalFrame, back),
51 fGuidesFrame(nullptr),
52 fClipFrame(nullptr),
53 fClearColor(nullptr),
54 fIgnoreSizesOnUpdate(nullptr),
55 fResetCamerasOnUpdate(nullptr),
56 fUpdateScene(nullptr),
57 fCameraHome(nullptr),
58 fMaxSceneDrawTimeHQ(nullptr),
59 fMaxSceneDrawTimeLQ(nullptr),
60 fPointSizeScale(nullptr), fLineWidthScale(nullptr),
61 fPointSmooth(nullptr), fLineSmooth(nullptr),
62 fWFLineWidth(nullptr), fOLLineWidth(nullptr),
63
64 fCameraCenterExt(nullptr),
65 fCaptureCenter(nullptr),
66 fCameraCenterX(nullptr),
67 fCameraCenterY(nullptr),
68 fCameraCenterZ(nullptr),
69 fCaptureAnnotate(),
70 fAxesType(0),
71 fAxesContainer(nullptr),
72 fAxesNone(nullptr),
73 fAxesEdge(nullptr),
74 fAxesOrigin(nullptr),
75 fAxesDepthTest(nullptr),
76 fRefContainer(nullptr),
77 fReferenceOn(nullptr),
78 fReferencePosX(nullptr),
79 fReferencePosY(nullptr),
80 fReferencePosZ(nullptr),
81 fCamContainer(nullptr),
82 fCamMode(nullptr),
83 fCamOverlayOn(nullptr),
84 fClipSet(nullptr),
85 fARotDt(nullptr), fARotWPhi(nullptr), fARotATheta(nullptr), fARotWTheta(nullptr), fARotADolly(nullptr), fARotWDolly(nullptr),
86 fASavImageGUIBaseName(nullptr), fASavImageGUIOutMode(nullptr),
87 fStereoZeroParallax(nullptr), fStereoEyeOffsetFac(nullptr), fStereoFrustumAsymFac(nullptr),
88 fViewer(nullptr),
89 fIsInPad(kTRUE)
90{
91 // Constructor.
92
97}
98
99//______________________________________________________________________________
100
102{
103 // Destructor.
104
105}
106
107////////////////////////////////////////////////////////////////////////////////
108/// Connect signals to slots.
109
111{
112 fClearColor->Connect("ColorSelected(Pixel_t)", "TGLViewerEditor", this, "DoClearColor(Pixel_t)");
113 fIgnoreSizesOnUpdate->Connect("Toggled(Bool_t)", "TGLViewerEditor", this, "DoIgnoreSizesOnUpdate()");
114 fResetCamerasOnUpdate->Connect("Toggled(Bool_t)", "TGLViewerEditor", this, "DoResetCamerasOnUpdate()");
115 fUpdateScene->Connect("Pressed()", "TGLViewerEditor", this, "DoUpdateScene()");
116 fCameraHome->Connect("Pressed()", "TGLViewerEditor", this, "DoCameraHome()");
117 fMaxSceneDrawTimeHQ->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateMaxDrawTimes()");
118 fMaxSceneDrawTimeLQ->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateMaxDrawTimes()");
119 fPointSizeScale->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdatePointLineStuff()");
120 fLineWidthScale->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdatePointLineStuff()");
121 fPointSmooth->Connect("Clicked()", "TGLViewerEditor", this, "UpdatePointLineStuff()");
122 fLineSmooth ->Connect("Clicked()", "TGLViewerEditor", this, "UpdatePointLineStuff()");
123 fWFLineWidth->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdatePointLineStuff()");
124 fOLLineWidth->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdatePointLineStuff()");
125
126 fCameraCenterExt->Connect("Clicked()", "TGLViewerEditor", this, "DoCameraCenterExt()");
127 fCaptureCenter->Connect("Clicked()", "TGLViewerEditor", this, "DoCaptureCenter()");
128 fDrawCameraCenter->Connect("Clicked()", "TGLViewerEditor", this, "DoDrawCameraCenter()");
129 fCameraCenterX->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateCameraCenter()");
130 fCameraCenterY->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateCameraCenter()");
131 fCameraCenterZ->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateCameraCenter()");
132
133 fCaptureAnnotate->Connect("Clicked()", "TGLViewerEditor", this, "DoAnnotation()");
134
135 fAxesContainer->Connect("Clicked(Int_t)", "TGLViewerEditor", this, "UpdateViewerAxes(Int_t)");
136
137 fReferenceOn->Connect("Clicked()", "TGLViewerEditor", this, "UpdateViewerReference()");
138 fReferencePosX->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateViewerReference()");
139 fReferencePosY->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateViewerReference()");
140 fReferencePosZ->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateViewerReference()");
141
142 fCamMode->Connect("Selected(Int_t)", "TGLViewerEditor", this, "DoCameraOverlay()");
143 fCamOverlayOn->Connect("Clicked()", "TGLViewerEditor", this, "DoCameraOverlay()");
144
145 //
146 fRotateSceneOn->Connect("Clicked()", "TGLViewerEditor", this, "SetRotatorMode()");
147
148 fSceneRotDt->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateRotator()");
149 fARotDt ->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateRotator()");
150 fARotWPhi ->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateRotator()");
151 fARotATheta->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateRotator()");
152 fARotWTheta->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateRotator()");
153 fARotADolly->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateRotator()");
154 fARotWDolly->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateRotator()");
155
156 fASavImageGUIBaseName->Connect("TextChanged(char*", "TGLViewerEditor", this, "DoASavImageGUIBaseName(char*)");
157 fASavImageGUIOutMode->Connect("Clicked(Int_t)", "TGLViewerEditor", this, "DoASavImageGUIOutMode(Int_t)");
158
159 fStereoZeroParallax ->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateStereo()");
160 fStereoEyeOffsetFac ->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateStereo()");
161 fStereoFrustumAsymFac->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateStereo()");
162 fStereoZeroParallax ->Connect("ValueChanged(Long_t)", "TGLViewerEditor", this, "UpdateStereo()");
163 fStereoEyeOffsetFac ->Connect("ValueChanged(Long_t)", "TGLViewerEditor", this, "UpdateStereo()");
164 fStereoFrustumAsymFac->Connect("ValueChanged(Long_t)", "TGLViewerEditor", this, "UpdateStereo()");
165
166 fInit = kFALSE;
167}
168
169////////////////////////////////////////////////////////////////////////////////
170/// Initiate redraw of the viewer.
171
173{
174 if (gGLManager && fIsInPad)
175 gGLManager->MarkForDirectCopy(fViewer->GetDev(), kTRUE);
177}
178
179////////////////////////////////////////////////////////////////////////////////
180/// Sets model or disables/hides viewer.
181
183{
184 fViewer = nullptr;
185
186 fViewer = static_cast<TGLViewer *>(obj);
187 fIsInPad = (fViewer->GetDev() != -1);
188
189 SetGuides();
190
191 if (fInit)
193
196
197 // style tab
210 //camera look at
212 fCameraCenterExt->SetDown(cam.GetExternalCenter());
214 Double_t* la = cam.GetCenterVec();
221
222 // push action
225
226 {
228
229 fSceneRotDt->SetNumber(r->GetDeltaPhi());
230 fARotDt ->SetNumber(r->GetDt());
231 fARotWPhi ->SetNumber(r->GetWPhi());
232 fARotATheta->SetNumber(r->GetATheta());
233 fARotWTheta->SetNumber(r->GetWTheta());
234 fARotADolly->SetNumber(r->GetADolly());
235 fARotWDolly->SetNumber(r->GetWDolly());
236
237 fASavImageGUIBaseName->SetText(r->GetImageGUIBaseName());
238 fASavImageGUIOutMode ->SetButton(r->GetImageGUIOutMode());
239
249 }
250
251 if (fViewer->GetStereo())
252 {
257 }
258 else
259 {
261 }
262}
263
264////////////////////////////////////////////////////////////////////////////////
265/// Clear-color was changed.
266
272
273////////////////////////////////////////////////////////////////////////////////
274/// ResetCamerasOnUpdate was toggled.
275
282
283////////////////////////////////////////////////////////////////////////////////
284/// ResetCamerasOnUpdate was toggled.
285
290
291////////////////////////////////////////////////////////////////////////////////
292/// UpdateScene was clicked.
293
298
299////////////////////////////////////////////////////////////////////////////////
300/// CameraHome was clicked.
301
307
308////////////////////////////////////////////////////////////////////////////////
309/// Slot for fMaxSceneDrawTimeHQ and fMaxSceneDrawTimeLQ.
310
316
317////////////////////////////////////////////////////////////////////////////////
318/// Slot for point-sizes and line-widths.
319
330
331////////////////////////////////////////////////////////////////////////////////
332/// Update viewer with GUI state.
333
335{
337
339 {
340 co->SetShowPerspective(fCamOverlayOn->IsDown());
341 co->SetPerspectiveMode((TGLCameraOverlay::EMode)fCamMode->GetSelected());
342 }
343 else
344 {
345 co->SetShowOrthographic(fCamOverlayOn->IsDown());
346 co->SetOrthographicMode((TGLCameraOverlay::EMode)fCamMode->GetSelected());
347 }
348 ViewerRedraw();
349}
350
351////////////////////////////////////////////////////////////////////////////////
352/// Set external camera center.
353
365
366////////////////////////////////////////////////////////////////////////////////
367/// Capture camera-center via picking.
368
374
375////////////////////////////////////////////////////////////////////////////////
376/// Draw camera center.
377
383
384////////////////////////////////////////////////////////////////////////////////
385/// Update current camera with GUI state.
386
393
394////////////////////////////////////////////////////////////////////////////////
395/// Create annotation via picking.
396
401
402////////////////////////////////////////////////////////////////////////////////
403/// Update viewer with GUI state.
404
406{
407 if(id < 4)
408 {
409 fAxesType = id -1;
410 for (Int_t i = 1; i < 4; i++) {
412 if (i == id)
413 button->SetDown(kTRUE);
414 else
415 button->SetDown(kFALSE);
416 }
417 }
418 Bool_t axdt = fAxesContainer->GetButton(4)->IsDown();
422}
423
424////////////////////////////////////////////////////////////////////////////////
425/// Update viewer with GUI state.
426
433
434////////////////////////////////////////////////////////////////////////////////
435/// Helper function to create fixed width TGLabel and TGNumberEntry in same row.
436
439{
442 TGLabel *lab = new TGLabel(labfr, name);
443 labfr->AddFrame(lab, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 0, 0, 0) );
444 rfr->AddFrame(labfr, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 0, 0, 0));
445
447 rfr->AddFrame(ne, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsBottom, 2, 0, 0));
448
449 p->AddFrame(rfr, new TGLayoutHints(kLHintsLeft, 0, 0, 1, 0));
450 return ne;
451}
452
453////////////////////////////////////////////////////////////////////////////////
454/// Creates "Style" tab.
455
457{
458 MakeTitle("Update behaviour");
459 fIgnoreSizesOnUpdate = new TGCheckButton(this, "Ignore sizes");
460 fIgnoreSizesOnUpdate->SetToolTipText("Ignore bounding-box sizes on scene update");
462 fResetCamerasOnUpdate = new TGCheckButton(this, "Reset on update");
463 fResetCamerasOnUpdate->SetToolTipText("Reset camera on scene update");
465
466 TGCompositeFrame* af = this;
467 fUpdateScene = new TGTextButton(af, "Update Scene", 130);
468 af->AddFrame(fUpdateScene, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 8, 1));
469 fCameraHome = new TGTextButton(af, "Camera Home", 130);
470 af->AddFrame(fCameraHome, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 1, 3));
473 fMaxSceneDrawTimeHQ->GetNumberEntry()->SetToolTipText("Maximum time spent in scene drawing\nin high-quality mode [ms].");
476 fMaxSceneDrawTimeLQ->GetNumberEntry()->SetToolTipText("Maximum time spent in scene drawing\nin low-quality mode (during rotation etc).");
477
479 TGLabel* lab = new TGLabel(hf, "Clear Color");
480 hf->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 4, 8, 3));
481 fClearColor = new TGColorSelect(hf, 0, -1);
482 hf->AddFrame(fClearColor, new TGLayoutHints(kLHintsLeft, 1, 1, 8, 1));
483 AddFrame(hf, new TGLayoutHints(kLHintsLeft, 2, 1, 1, 1));
484
485 // LightSet
487 fLightSet->Connect("Changed()", "TGLViewerEditor", this, "ViewerRedraw()");
489
490 // Point-sizes / line-widths.
491 hf = new TGHorizontalFrame(af);
492 fPointSizeScale = MakeLabeledNEntry(hf, "Point-size scale:", 116, 4, TGNumberFormat::kNESRealOne);
495 fPointSmooth->SetToolTipText("Use smooth points.");
496 hf->AddFrame(fPointSmooth, new TGLayoutHints(kLHintsNormal, 3, 0, 3, 0));
497 af->AddFrame(hf);
498 hf = new TGHorizontalFrame(af);
499 fLineWidthScale = MakeLabeledNEntry(hf, "Line-width scale:", 116, 4, TGNumberFormat::kNESRealOne);
502 fLineSmooth->SetToolTipText("Use smooth lines.");
503 hf->AddFrame(fLineSmooth, new TGLayoutHints(kLHintsNormal, 3, 0, 3, 0));
504 af->AddFrame(hf);
505 fWFLineWidth = MakeLabeledNEntry(af, "Wireframe line-width:", 116, 4, TGNumberFormat::kNESRealOne);
507 fOLLineWidth = MakeLabeledNEntry(af, "Outline line-width:", 116, 4, TGNumberFormat::kNESRealOne);
509}
510
511////////////////////////////////////////////////////////////////////////////////
512/// Create "Guides" tab.
513
515{
517
518 // external camera look at point
519 TGGroupFrame* grf = new TGGroupFrame(fGuidesFrame, "Camera center:", kVerticalFrame);
520 fDrawCameraCenter = new TGCheckButton(grf, "Show", 50);
521 grf->AddFrame(fDrawCameraCenter, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 1, 1));
522 fCameraCenterExt = new TGCheckButton(grf, "External", 50);
523 grf->AddFrame(fCameraCenterExt, new TGLayoutHints(kLHintsLeft, 0, 0, 1, 0));
525 Int_t labw = 20;
529 fCaptureCenter = new TGTextButton(grf, " Pick center ");
530 grf->AddFrame(fCaptureCenter, new TGLayoutHints(kLHintsNormal, labw + 2, 0, 2, 0));
531
532 // annotate
533 TGGroupFrame* annf = new TGGroupFrame(fGuidesFrame, "Annotation");
535 fCaptureAnnotate = new TGCheckButton(annf, "Pick annotation");
537
538 // reference container
539 fRefContainer = new TGGroupFrame(fGuidesFrame, "Reference marker");
546
547 // axes
549 fAxesNone = new TGRadioButton(fAxesContainer, "None", 1);
550 fAxesEdge = new TGRadioButton(fAxesContainer, "Edge", 2);
551 fAxesOrigin = new TGRadioButton(fAxesContainer, "Origin", 3);
552 fAxesDepthTest = new TGCheckButton(fAxesContainer, "DepthTest",4);
554
555 // camera overlay
556 fCamContainer = new TGGroupFrame(fGuidesFrame, "Camera overlay");
561 TGLabel* lab = new TGLabel(chf, "Mode");
562 chf->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 4, 1, 2));
563 fCamMode = new TGComboBox(chf);
570 lb->Resize(lb->GetWidth(), 5*18);
571 fCamMode->Resize(90, 20);
572 chf->AddFrame(fCamMode, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
574}
575
576////////////////////////////////////////////////////////////////////////////////
577/// Create GUI controls - clip type (none/plane/box) and plane/box properties.
578
580{
582
584 fClipSet->Connect("Changed()", "TGLViewerEditor", this, "ViewerRedraw()");
586}
587
588////////////////////////////////////////////////////////////////////////////////
589/// Create Extra Tab controls - camera rotator and stereo.
590
592{
593 Int_t labw = 80;
594
595 TGCompositeFrame *tab = CreateEditorTabSubFrame("Extras"), *p = nullptr;
596
597 // ----- Auto rotator -----
598
599 p = new TGGroupFrame(tab, "Auto rotator", kVerticalFrame);
600
601 //
602 fRotateSceneOn = new TGCheckButton(p, "Rotate all objects");
603 fRotateSceneOn->SetToolTipText("This covers a very specific use-case and is most likely not what you need.\nProceed at your own risk. Sorry about that.");
604 p->AddFrame(fRotateSceneOn, new TGLayoutHints(kLHintsLeft, 4, 1, 1, 1));
605
608
611
614
617
620
623
626
627 {
629
630 TGTextButton *b = new TGTextButton(l, "Start");
631 b->Connect("Clicked()", "TGLViewerEditor", this, "DoRotatorStart()");
632 l->AddFrame(b, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
633
634 b = new TGTextButton(l, "Stop");
635 b->Connect("Clicked()", "TGLViewerEditor", this, "DoRotatorStop()");
636 l->AddFrame(b, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
637
638 p->AddFrame(l, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 4, 0));
639 }
640
641 tab->AddFrame(p, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
642
643 // ----- Auto Save Images -----
644
645 p = new TGGroupFrame(tab, "Auto save images", kVerticalFrame);
646
649 p->AddFrame(fASavImageGUIBaseName, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 4, 0));
650
653 new TGRadioButton(fASavImageGUIOutMode, "PNG set ");
656
657 {
659
660 TGTextButton *b = new TGTextButton(l, "Start");
661 b->Connect("Clicked()", "TGLViewerEditor", this, "DoASavImageStart()");
662 l->AddFrame(b, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
663
664 b = new TGTextButton(l, "Stop");
665 b->Connect("Clicked()", "TGLViewerEditor", this, "DoASavImageStop()");
666 l->AddFrame(b, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
667
668 p->AddFrame(l, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 4, 0));
669 }
670
671 tab->AddFrame(p, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
672
673 // ----- Stereo -----
674
675 fStereoFrame = p = new TGGroupFrame(tab, "Stereo", kVerticalFrame);
676
677 // Int_t labw = 80;
678
681
684
687
688 tab->AddFrame(p, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
689}
690
691
692////////////////////////////////////////////////////////////////////////////////
693/// Enable/disable reference position (x/y/z) number edits based on
694/// reference check box.
695
702
703////////////////////////////////////////////////////////////////////////////////
704/// Configuration of guides GUI called from SetModel().
705
707{
710 Double_t referencePos[3] = {0.};
712
713 for (Int_t i = 1; i < 4; i++) {
715 if (fAxesType+1 == i)
716 btn->SetDown(kTRUE);
717 else
718 btn->SetDown(kFALSE);
719 }
721
727
728 // overlay
731
733 {
734 fCamOverlayOn->SetDown(co->GetShowOrthographic());
735 fr->ShowFrame(fCamMode);
736
737
738 if (! fr->IsMapped()) {
739 fr->MapSubwindows();
740 fr->MapWindow();
743 fCamMode->Select(co->GetOrthographicMode(), kFALSE);
744 }
745 }
746 else
747 {
748 fCamOverlayOn->SetDown(co->GetShowPerspective());
749
750 // only mode implemented for perspective camera
751 fCamMode->Select(co->GetPerspectiveMode(), kFALSE);
752 fr->HideFrame(fCamMode);
753 if (fr->IsMapped())
754 fr->UnmapWindow();
755 }
756}
757
758////////////////////////////////////////////////////////////////////////////////
759
788
789////////////////////////////////////////////////////////////////////////////////
790/// Update rotator related variables.
791
793{
795 if (fRotateSceneOn->IsOn()) {
796 r->SetDeltaPhi(fSceneRotDt->GetNumber());
797 } else {
798 r->SetDt (fARotDt->GetNumber());
799 r->SetWPhi (fARotWPhi->GetNumber());
800 r->SetATheta(fARotATheta->GetNumber());
801 r->SetWTheta(fARotWTheta->GetNumber());
802 r->SetADolly(fARotADolly->GetNumber());
803 r->SetWDolly(fARotWDolly->GetNumber());
804 }
805}
806
807////////////////////////////////////////////////////////////////////////////////
808/// Start auto-rotator.
809
811{
813 if (!r->IsRunning())
814 r->SetRotateScene(fRotateSceneOn->IsOn());
815
816 r->Start();
817}
818
819////////////////////////////////////////////////////////////////////////////////
820/// Stop auto-rotator.
821
826
827////////////////////////////////////////////////////////////////////////////////
828/// Update base-name.
829
831{
833 r->SetImageGUIBaseName(t);
834}
835
836////////////////////////////////////////////////////////////////////////////////
837/// Update output mode.
838
840{
842 r->SetImageGUIOutMode(m);
843}
844
845////////////////////////////////////////////////////////////////////////////////
846/// Start auto-rotator image auto-save.
847
849{
851 if (r->GetImageAutoSave())
852 {
853 Warning("DoASavImageStart", "AutoSave in progress.");
854 return;
855 }
856
857 r->StartImageAutoSaveWithGUISettings();
858}
859
860////////////////////////////////////////////////////////////////////////////////
861/// Stop auto-rotator image auto-save.
862
864{
866 if (!r->GetImageAutoSave())
867 {
868 Warning("DoASavImageStop", "AutoSave not in progress.");
869 return;
870 }
871
872 r->StopImageAutoSave();
873}
874
875////////////////////////////////////////////////////////////////////////////////
876/// Update stereo related variables.
877
885
886//Aux. functions that do not have to be members.
887
888namespace {
889
890//Here's how we create a number entry and its label:
891
892// TGHorizontalFrame *rfr = new TGHorizontalFrame(p);
893// TGHorizontalFrame *labfr = new TGHorizontalFrame(rfr, labelw, 20, kFixedSize);
894// TGLabel *lab = new TGLabel(labfr, name);
895// labfr->AddFrame(lab, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 0, 0, 0) );
896// rfr->AddFrame(labfr, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 0, 0, 0));
897//
898// TGNumberEntry* ne = new TGNumberEntry(rfr, 0.0f, nd, -1, (TGNumberFormat::EStyle)style);
899// rfr->AddFrame(ne, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsBottom, 2, 0, 0));
900//
901// p->AddFrame(rfr, new TGLayoutHints(kLHintsLeft, 0, 0, 1, 0));
902
903////////////////////////////////////////////////////////////////////////////////
904
906{
907 if (!entry) {
908 //I would prefer an assert here.
909 ::Error("FindLabelForNEntry", "parameter 'entry' is null");
910 return nullptr;
911 }
912
913 TGLabel *label = nullptr;
914
915 if (const TGHorizontalFrame * const grandpa = dynamic_cast<const TGHorizontalFrame *>(entry->GetParent())) {
916 if (TList * const parents = grandpa->GetList()) {
918 while (TGFrameElement * const frameElement = dynamic_cast<TGFrameElement *>(next1())) {
919 if (TGHorizontalFrame * const parent = dynamic_cast<TGHorizontalFrame *>(frameElement->fFrame)) {
920 if (TList * const children = parent->GetList()) {
921 TIter next2(children);
922 while (TGFrameElement * const candidate = dynamic_cast<TGFrameElement *>(next2())) {
923 if ((label = dynamic_cast<TGLabel *>(candidate->fFrame)))
924 break;
925 }
926 }
927 }
928
929 if (label)
930 break;
931 }
932 }
933 }
934
935 return label;
936}
937
938////////////////////////////////////////////////////////////////////////////////
939///This is quite an ugly hack but still not as ugly as having 5-6 additional
940///TGLabels as data members.
941
943{
944 if (!entry) {
945 //I would prefer an assert here.
946 ::Error("SetLabeledNEntryState", "parameter 'entry' is null");
947 return;
948 }
949
950 entry->SetState(enabled);
951 if (TGLabel * const label = FindLabelForNEntry(entry))
952 //Wah!
953 label->Disable(!enabled);
954}
955
956}
@ kChildFrame
Definition GuiTypes.h:379
@ kVerticalFrame
Definition GuiTypes.h:381
@ kHorizontalFrame
Definition GuiTypes.h:382
@ kFixedSize
Definition GuiTypes.h:390
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
#define b(i)
Definition RSha256.hxx:100
bool Bool_t
Definition RtypesCore.h:63
short Color_t
Definition RtypesCore.h:85
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
#define ClassImp(name)
Definition Rtypes.h:374
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:185
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:229
@ kButtonDown
Definition TGButton.h:54
@ kButtonUp
Definition TGButton.h:53
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsNormal
Definition TGLayout.h:32
@ kLHintsCenterX
Definition TGLayout.h:25
@ kLHintsBottom
Definition TGLayout.h:29
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t width
Option_t Option_t style
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t button
char name[80]
Definition TGX11.cxx:110
#define gGLManager
Definition TVirtualGL.h:159
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition TColor.cxx:2441
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:1924
Organizes TGButton widgets in a group.
virtual void SetLayoutHints(TGLayoutHints *l, TGButton *button=nullptr)
Set layout hints for the specified button or if button=0 for all buttons.
virtual void SetButton(Int_t id, Bool_t down=kTRUE)
Sets the button with id to be on/down, and if this is an exclusive group, all other button in the gro...
virtual TGButton * GetButton(Int_t id) const
A button abstract base class.
Definition TGButton.h:68
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition TGButton.cxx:445
virtual void SetDown(Bool_t on=kTRUE, Bool_t emit=kFALSE)
Definition TGButton.cxx:310
Selects different options.
Definition TGButton.h:264
Bool_t IsDown() const override
Definition TGButton.h:311
Bool_t IsOn() const override
Definition TGButton.h:310
void SetState(EButtonState state, Bool_t emit=kFALSE) override
Set check button state.
Like a checkbutton but instead of the check mark there is color area with a little down arrow.
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
void Enable(Bool_t on=kTRUE)
Set state of widget as enabled.
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition TGComboBox.h:47
virtual Int_t GetSelected() const
Definition TGComboBox.h:114
virtual void AddEntry(TGString *s, Int_t id)
Definition TGComboBox.h:86
virtual TGListBox * GetListBox() const
Definition TGComboBox.h:110
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
virtual TList * GetList() const
Definition TGFrame.h:310
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1164
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition TGFrame.cxx:1204
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition TGFrame.cxx:1190
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:605
void MapWindow() override
map window
Definition TGFrame.h:204
void UnmapWindow() override
unmap window
Definition TGFrame.h:206
A composite frame with a border and a title.
Definition TGFrame.h:522
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:385
Automatically rotates GL camera.
void Stop()
Stop the auto-rotator.
Bool_t GetRotateScene() const
A GL overlay element which displays camera furstum.
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
Definition TGLCamera.h:44
virtual Bool_t IsPerspective() const
Definition TGLCamera.h:119
virtual Bool_t IsOrthographic() const
Definition TGLCamera.h:118
GUI sub-editor for TGLClipSet.
void SetModel(TGLClipSet *m)
Set model object.
TGLColor & Background()
Definition TGLUtil.h:851
void SetColor(Int_t r, Int_t g, Int_t b, Int_t a=255)
Set color with Int_t values.
Definition TGLUtil.cxx:1235
Color_t GetColorIndex() const
Returns color-index representing the color.
Definition TGLUtil.cxx:1217
Sub-editor for TGLLightSet.
void SetModel(TGLLightSet *m)
New model was set, refresh data.
TGLColorSet & ColorSet()
Return reference to current color-set (top of the stack).
void SetOLLineW(Float_t w)
Float_t OLLineW() const
Float_t WFLineW() const
TGLRnrCtx & RnrCtx() const
void SetWFLineW(Float_t w)
GUI editor for TGLViewer.
TGButtonGroup * fAxesContainer
void DoDrawCameraCenter()
Draw camera center.
void DoUpdateScene()
UpdateScene was clicked.
TGCompositeFrame * fGuidesFrame
void DoCameraHome()
CameraHome was clicked.
void DoCaptureCenter()
Capture camera-center via picking.
void DoCameraCenterExt()
Set external camera center.
void DoASavImageGUIBaseName(const char *t)
Update base-name.
TGLLightSetSubEditor * fLightSet
static TGNumberEntry * MakeLabeledNEntry(TGCompositeFrame *p, const char *name, Int_t labelw, Int_t nd=7, Int_t s=5)
Helper function to create fixed width TGLabel and TGNumberEntry in same row.
void UpdateCameraCenter()
Update current camera with GUI state.
TGLViewer * fViewer
TGNumberEntry * fPointSizeScale
void DoClearColor(Pixel_t color)
Clear-color was changed.
void UpdatePointLineStuff()
Slot for point-sizes and line-widths.
TGCompositeFrame * fClipFrame
TGCheckButton * fPointSmooth
TGCheckButton * fReferenceOn
TGComboBox * fCamMode
TGNumberEntry * fARotWDolly
TGNumberEntry * fCameraCenterY
void SetGuides()
Configuration of guides GUI called from SetModel().
void DoRotatorStart()
Start auto-rotator.
TGNumberEntry * fStereoEyeOffsetFac
void UpdateViewerReference()
Update viewer with GUI state.
void CreateClippingTab()
Create GUI controls - clip type (none/plane/box) and plane/box properties.
TGCheckButton * fLineSmooth
void SetModel(TObject *obj) override
Sets model or disables/hides viewer.
TGNumberEntry * fMaxSceneDrawTimeLQ
TGCheckButton * fRotateSceneOn
void DoRotatorStop()
Stop auto-rotator.
TGNumberEntry * fARotATheta
TGCheckButton * fDrawCameraCenter
TGNumberEntry * fSceneRotDt
void UpdateStereo()
Update stereo related variables.
void UpdateMaxDrawTimes()
Slot for fMaxSceneDrawTimeHQ and fMaxSceneDrawTimeLQ.
TGNumberEntry * fReferencePosY
TGGroupFrame * fRefContainer
void UpdateReferencePosState()
Enable/disable reference position (x/y/z) number edits based on reference check box.
TGCheckButton * fResetCamerasOnUpdate
TGLClipSetSubEditor * fClipSet
TGCheckButton * fIgnoreSizesOnUpdate
TGCheckButton * fCameraCenterExt
TGNumberEntry * fCameraCenterX
TGNumberEntry * fReferencePosZ
TGRadioButton * fAxesEdge
TGNumberEntry * fCameraCenterZ
void DoIgnoreSizesOnUpdate()
ResetCamerasOnUpdate was toggled.
void DoASavImageGUIOutMode(Int_t m)
Update output mode.
TGNumberEntry * fARotADolly
TGLViewerEditor(const TGLViewerEditor &)
TGCheckButton * fCamOverlayOn
TGTextButton * fUpdateScene
void CreateExtrasTab()
Create Extra Tab controls - camera rotator and stereo.
TGCompositeFrame * fStereoFrame
void DoASavImageStop()
Stop auto-rotator image auto-save.
void CreateGuidesTab()
Create "Guides" tab.
void CreateStyleTab()
Creates "Style" tab.
TGButtonGroup * fASavImageGUIOutMode
TGNumberEntry * fReferencePosX
TGRadioButton * fAxesOrigin
void DoAnnotation()
Create annotation via picking.
virtual void ViewerRedraw()
Initiate redraw of the viewer.
TGNumberEntry * fOLLineWidth
TGNumberEntry * fARotWPhi
TGRadioButton * fAxesNone
void DoCameraOverlay()
Update viewer with GUI state.
TGColorSelect * fClearColor
TGNumberEntry * fARotDt
TGNumberEntry * fMaxSceneDrawTimeHQ
TGCheckButton * fCaptureAnnotate
TGNumberEntry * fWFLineWidth
void DoASavImageStart()
Start auto-rotator image auto-save.
void DoResetCamerasOnUpdate()
ResetCamerasOnUpdate was toggled.
TGGroupFrame * fCamContainer
TGNumberEntry * fStereoFrustumAsymFac
TGTextButton * fCameraHome
~TGLViewerEditor() override
TGNumberEntry * fARotWTheta
void UpdateViewerAxes(Int_t id)
Update viewer with GUI state.
TGNumberEntry * fLineWidthScale
TGCheckButton * fAxesDepthTest
TGTextEntry * fASavImageGUIBaseName
TGNumberEntry * fStereoZeroParallax
void UpdateRotator()
Update rotator related variables.
void ConnectSignals2Slots()
Connect signals to slots.
TGTextButton * fCaptureCenter
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Definition TGLViewer.h:55
void SetDrawCameraCenter(Bool_t x)
Draw camera look at and rotation point.
void SetMaxSceneDrawTimeLQ(Float_t t)
Definition TGLViewer.h:311
void SetStereoFrustumAsymFac(Float_t f)
Definition TGLViewer.h:296
Float_t GetStereoEyeOffsetFac() const
Definition TGLViewer.h:290
EPushAction GetPushAction() const
Definition TGLViewer.h:299
Bool_t GetSmoothPoints() const
Definition TGLViewer.h:257
TGLCameraOverlay * GetCameraOverlay() const
Definition TGLViewer.h:282
Bool_t GetSmoothLines() const
Definition TGLViewer.h:258
Int_t GetDev() const
Definition TGLViewer.h:228
Float_t GetStereoZeroParallax() const
Definition TGLViewer.h:289
Float_t GetMaxSceneDrawTimeLQ() const
Definition TGLViewer.h:309
Bool_t GetDrawCameraCenter()
Definition TGLViewer.h:279
@ kPushCamCenter
Definition TGLViewer.h:126
@ kPushAnnotate
Definition TGLViewer.h:126
Float_t GetPointScale() const
Definition TGLViewer.h:253
void RequestDraw(Short_t LOD=TGLRnrCtx::kLODMed)
Post request for redraw of viewer at level of detail 'LOD' Request is directed via cross thread gVirt...
void SetGuideState(Int_t axesType, Bool_t axesDepthTest, Bool_t referenceOn, const Double_t *referencePos)
Set the state of guides (axes & reference markers) from arguments.
TGLLightSet * GetLightSet() const
Definition TGLViewer.h:262
void SetIgnoreSizesOnUpdate(Bool_t v)
Definition TGLViewer.h:356
TGLCamera & CurrentCamera() const
Definition TGLViewer.h:268
Float_t GetStereoFrustumAsymFac() const
Definition TGLViewer.h:291
void SetStereoEyeOffsetFac(Float_t f)
Definition TGLViewer.h:295
TGLClipSet * GetClipSet() const
Definition TGLViewer.h:263
Bool_t IsUsingDefaultColorSet() const
Check if the viewer is using the default color set.
void SetSmoothPoints(Bool_t s)
Definition TGLViewer.h:259
void UpdateScene(Bool_t redraw=kTRUE)
Force update of pad-scenes.
void SetLineScale(Float_t s)
Definition TGLViewer.h:256
Bool_t GetStereo() const
Definition TGLViewer.h:288
void SetMaxSceneDrawTimeHQ(Float_t t)
Definition TGLViewer.h:310
void SetPointScale(Float_t s)
Definition TGLViewer.h:255
void SetStereoZeroParallax(Float_t f)
Definition TGLViewer.h:294
void SetSmoothLines(Bool_t s)
Definition TGLViewer.h:260
Float_t GetLineScale() const
Definition TGLViewer.h:254
Bool_t GetIgnoreSizesOnUpdate() const
Definition TGLViewer.h:355
TGLAutoRotator * GetAutoRotator()
Get the auto-rotator for this viewer.
Bool_t GetResetCamerasOnUpdate() const
Definition TGLViewer.h:358
void PickCameraCenter()
Definition TGLViewer.h:280
Float_t GetMaxSceneDrawTimeHQ() const
Definition TGLViewer.h:308
void GetGuideState(Int_t &axesType, Bool_t &axesDepthTest, Bool_t &referenceOn, Double_t *referencePos) const
Fetch the state of guides (axes & reference markers) into arguments.
void PickAnnotate()
Definition TGLViewer.h:281
void SetResetCamerasOnUpdate(Bool_t v)
Definition TGLViewer.h:359
void ResetCurrentCamera()
Resets position/rotation of current camera to default values.
This class handles GUI labels.
Definition TGLabel.h:24
virtual void Disable(Bool_t on=kTRUE)
Definition TGLabel.h:89
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
A listbox is a box, possibly with scrollbar, containing entries.
Definition TGListBox.h:221
TGNumberEntry is a number entry input widget with up/down buttons.
TGNumberEntryField * GetNumberEntry() const
Get the number entry field.
virtual void SetLimits(ELimit limits=TGNumberFormat::kNELNoLimits, Double_t min=0, Double_t max=1)
virtual void SetState(Bool_t enable=kTRUE)
Set the active state.
virtual Double_t GetNumber() const
virtual void SetNumber(Double_t val, Bool_t emit=kTRUE)
@ kNESRealOne
Fixed fraction real, one digit.
@ kNESRealThree
Fixed fraction real, three digit.
@ kNESInteger
Style of number entry field.
@ kNESRealTwo
Fixed fraction real, two digit.
@ kNELLimitMin
Lower limit only.
@ kNELLimitMinMax
Both lower and upper limits.
Selects different options.
Definition TGButton.h:321
Yield an action as soon as it is clicked.
Definition TGButton.h:142
virtual void SetTextColor(Pixel_t color, Bool_t global=kFALSE)
Changes text color.
Definition TGButton.cxx:918
A TGTextEntry is a one line text input widget.
Definition TGTextEntry.h:24
virtual void SetDefaultSize(UInt_t w, UInt_t h)
Set the default / minimal size of the widget.
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
virtual void SetText(const char *text, Bool_t emit=kTRUE)
Sets text entry to text, clears the selection and moves the cursor to the end of the line.
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual Bool_t IsMapped()
Returns kTRUE if window is mapped on screen, kFALSE otherwise.
Definition TGWindow.cxx:295
Base frame for implementing GUI - a service class.
Definition TGedFrame.h:27
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by 'owner' in extra tab 'name'.
Bool_t fInit
init flag for setting signals/slots
Definition TGedFrame.h:47
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition TGedFrame.cxx:95
A doubly linked list.
Definition TList.h:38
Mother of all ROOT objects.
Definition TObject.h:41
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:869
TMarker m
Definition textangle.C:8
TLine l
Definition textangle.C:4