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
47
49 TGedFrame(p, width, height, options | kVerticalFrame, back),
50 fGuidesFrame(nullptr),
51 fClipFrame(nullptr),
52 fClearColor(nullptr),
53 fIgnoreSizesOnUpdate(nullptr),
54 fResetCamerasOnUpdate(nullptr),
55 fUpdateScene(nullptr),
56 fCameraHome(nullptr),
57 fMaxSceneDrawTimeHQ(nullptr),
58 fMaxSceneDrawTimeLQ(nullptr),
59 fPointSizeScale(nullptr), fLineWidthScale(nullptr),
60 fPointSmooth(nullptr), fLineSmooth(nullptr),
61 fWFLineWidth(nullptr), fOLLineWidth(nullptr),
62
63 fCameraCenterExt(nullptr),
64 fCaptureCenter(nullptr),
65 fCameraCenterX(nullptr),
66 fCameraCenterY(nullptr),
67 fCameraCenterZ(nullptr),
68 fCaptureAnnotate(),
69 fAxesType(0),
70 fAxesContainer(nullptr),
71 fAxesNone(nullptr),
72 fAxesEdge(nullptr),
73 fAxesOrigin(nullptr),
74 fAxesDepthTest(nullptr),
75 fRefContainer(nullptr),
76 fReferenceOn(nullptr),
77 fReferencePosX(nullptr),
78 fReferencePosY(nullptr),
79 fReferencePosZ(nullptr),
80 fCamContainer(nullptr),
81 fCamMode(nullptr),
82 fCamOverlayOn(nullptr),
83 fClipSet(nullptr),
84 fARotDt(nullptr), fARotWPhi(nullptr), fARotATheta(nullptr), fARotWTheta(nullptr), fARotADolly(nullptr), fARotWDolly(nullptr),
85 fASavImageGUIBaseName(nullptr), fASavImageGUIOutMode(nullptr),
86 fStereoZeroParallax(nullptr), fStereoEyeOffsetFac(nullptr), fStereoFrustumAsymFac(nullptr),
87 fViewer(nullptr),
88 fIsInPad(kTRUE)
89{
90 // Constructor.
91
96}
97
98//______________________________________________________________________________
99
101{
102 // Destructor.
103
104}
105
106////////////////////////////////////////////////////////////////////////////////
107/// Connect signals to slots.
108
110{
111 fClearColor->Connect("ColorSelected(Pixel_t)", "TGLViewerEditor", this, "DoClearColor(Pixel_t)");
112 fIgnoreSizesOnUpdate->Connect("Toggled(Bool_t)", "TGLViewerEditor", this, "DoIgnoreSizesOnUpdate()");
113 fResetCamerasOnUpdate->Connect("Toggled(Bool_t)", "TGLViewerEditor", this, "DoResetCamerasOnUpdate()");
114 fUpdateScene->Connect("Pressed()", "TGLViewerEditor", this, "DoUpdateScene()");
115 fCameraHome->Connect("Pressed()", "TGLViewerEditor", this, "DoCameraHome()");
116 fMaxSceneDrawTimeHQ->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateMaxDrawTimes()");
117 fMaxSceneDrawTimeLQ->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateMaxDrawTimes()");
118 fPointSizeScale->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdatePointLineStuff()");
119 fLineWidthScale->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdatePointLineStuff()");
120 fPointSmooth->Connect("Clicked()", "TGLViewerEditor", this, "UpdatePointLineStuff()");
121 fLineSmooth ->Connect("Clicked()", "TGLViewerEditor", this, "UpdatePointLineStuff()");
122 fWFLineWidth->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdatePointLineStuff()");
123 fOLLineWidth->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdatePointLineStuff()");
124
125 fCameraCenterExt->Connect("Clicked()", "TGLViewerEditor", this, "DoCameraCenterExt()");
126 fCaptureCenter->Connect("Clicked()", "TGLViewerEditor", this, "DoCaptureCenter()");
127 fDrawCameraCenter->Connect("Clicked()", "TGLViewerEditor", this, "DoDrawCameraCenter()");
128 fCameraCenterX->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateCameraCenter()");
129 fCameraCenterY->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateCameraCenter()");
130 fCameraCenterZ->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateCameraCenter()");
131
132 fCaptureAnnotate->Connect("Clicked()", "TGLViewerEditor", this, "DoAnnotation()");
133
134 fAxesContainer->Connect("Clicked(Int_t)", "TGLViewerEditor", this, "UpdateViewerAxes(Int_t)");
135
136 fReferenceOn->Connect("Clicked()", "TGLViewerEditor", this, "UpdateViewerReference()");
137 fReferencePosX->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateViewerReference()");
138 fReferencePosY->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateViewerReference()");
139 fReferencePosZ->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateViewerReference()");
140
141 fCamMode->Connect("Selected(Int_t)", "TGLViewerEditor", this, "DoCameraOverlay()");
142 fCamOverlayOn->Connect("Clicked()", "TGLViewerEditor", this, "DoCameraOverlay()");
143
144 //
145 fRotateSceneOn->Connect("Clicked()", "TGLViewerEditor", this, "SetRotatorMode()");
146
147 fSceneRotDt->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateRotator()");
148 fARotDt ->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateRotator()");
149 fARotWPhi ->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateRotator()");
150 fARotATheta->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateRotator()");
151 fARotWTheta->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateRotator()");
152 fARotADolly->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateRotator()");
153 fARotWDolly->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateRotator()");
154
155 fASavImageGUIBaseName->Connect("TextChanged(char*", "TGLViewerEditor", this, "DoASavImageGUIBaseName(char*)");
156 fASavImageGUIOutMode->Connect("Clicked(Int_t)", "TGLViewerEditor", this, "DoASavImageGUIOutMode(Int_t)");
157
158 fStereoZeroParallax ->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateStereo()");
159 fStereoEyeOffsetFac ->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateStereo()");
160 fStereoFrustumAsymFac->Connect("ValueSet(Long_t)", "TGLViewerEditor", this, "UpdateStereo()");
161 fStereoZeroParallax ->Connect("ValueChanged(Long_t)", "TGLViewerEditor", this, "UpdateStereo()");
162 fStereoEyeOffsetFac ->Connect("ValueChanged(Long_t)", "TGLViewerEditor", this, "UpdateStereo()");
163 fStereoFrustumAsymFac->Connect("ValueChanged(Long_t)", "TGLViewerEditor", this, "UpdateStereo()");
164
165 fInit = kFALSE;
166}
167
168////////////////////////////////////////////////////////////////////////////////
169/// Initiate redraw of the viewer.
170
172{
173 if (gGLManager && fIsInPad)
174 gGLManager->MarkForDirectCopy(fViewer->GetDev(), kTRUE);
176}
177
178////////////////////////////////////////////////////////////////////////////////
179/// Sets model or disables/hides viewer.
180
182{
183 fViewer = nullptr;
184
185 fViewer = static_cast<TGLViewer *>(obj);
186 fIsInPad = (fViewer->GetDev() != -1);
187
188 SetGuides();
189
190 if (fInit)
192
195
196 // style tab
209 //camera look at
211 fCameraCenterExt->SetDown(cam.GetExternalCenter());
213 Double_t* la = cam.GetCenterVec();
220
221 // push action
224
225 {
227
228 fSceneRotDt->SetNumber(r->GetDeltaPhi());
229 fARotDt ->SetNumber(r->GetDt());
230 fARotWPhi ->SetNumber(r->GetWPhi());
231 fARotATheta->SetNumber(r->GetATheta());
232 fARotWTheta->SetNumber(r->GetWTheta());
233 fARotADolly->SetNumber(r->GetADolly());
234 fARotWDolly->SetNumber(r->GetWDolly());
235
236 fASavImageGUIBaseName->SetText(r->GetImageGUIBaseName());
237 fASavImageGUIOutMode ->SetButton(r->GetImageGUIOutMode());
238
248 }
249
250 if (fViewer->GetStereo())
251 {
256 }
257 else
258 {
260 }
261}
262
263////////////////////////////////////////////////////////////////////////////////
264/// Clear-color was changed.
265
271
272////////////////////////////////////////////////////////////////////////////////
273/// ResetCamerasOnUpdate was toggled.
274
281
282////////////////////////////////////////////////////////////////////////////////
283/// ResetCamerasOnUpdate was toggled.
284
289
290////////////////////////////////////////////////////////////////////////////////
291/// UpdateScene was clicked.
292
297
298////////////////////////////////////////////////////////////////////////////////
299/// CameraHome was clicked.
300
306
307////////////////////////////////////////////////////////////////////////////////
308/// Slot for fMaxSceneDrawTimeHQ and fMaxSceneDrawTimeLQ.
309
315
316////////////////////////////////////////////////////////////////////////////////
317/// Slot for point-sizes and line-widths.
318
329
330////////////////////////////////////////////////////////////////////////////////
331/// Update viewer with GUI state.
332
334{
336
338 {
339 co->SetShowPerspective(fCamOverlayOn->IsDown());
340 co->SetPerspectiveMode((TGLCameraOverlay::EMode)fCamMode->GetSelected());
341 }
342 else
343 {
344 co->SetShowOrthographic(fCamOverlayOn->IsDown());
345 co->SetOrthographicMode((TGLCameraOverlay::EMode)fCamMode->GetSelected());
346 }
347 ViewerRedraw();
348}
349
350////////////////////////////////////////////////////////////////////////////////
351/// Set external camera center.
352
364
365////////////////////////////////////////////////////////////////////////////////
366/// Capture camera-center via picking.
367
373
374////////////////////////////////////////////////////////////////////////////////
375/// Draw camera center.
376
382
383////////////////////////////////////////////////////////////////////////////////
384/// Update current camera with GUI state.
385
392
393////////////////////////////////////////////////////////////////////////////////
394/// Create annotation via picking.
395
400
401////////////////////////////////////////////////////////////////////////////////
402/// Update viewer with GUI state.
403
405{
406 if(id < 4)
407 {
408 fAxesType = id -1;
409 for (Int_t i = 1; i < 4; i++) {
411 if (i == id)
412 button->SetDown(kTRUE);
413 else
414 button->SetDown(kFALSE);
415 }
416 }
417 Bool_t axdt = fAxesContainer->GetButton(4)->IsDown();
421}
422
423////////////////////////////////////////////////////////////////////////////////
424/// Update viewer with GUI state.
425
432
433////////////////////////////////////////////////////////////////////////////////
434/// Helper function to create fixed width TGLabel and TGNumberEntry in same row.
435
438{
441 TGLabel *lab = new TGLabel(labfr, name);
442 labfr->AddFrame(lab, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 0, 0, 0) );
443 rfr->AddFrame(labfr, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 0, 0, 0));
444
446 rfr->AddFrame(ne, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsBottom, 2, 0, 0));
447
448 p->AddFrame(rfr, new TGLayoutHints(kLHintsLeft, 0, 0, 1, 0));
449 return ne;
450}
451
452////////////////////////////////////////////////////////////////////////////////
453/// Creates "Style" tab.
454
456{
457 MakeTitle("Update behaviour");
458 fIgnoreSizesOnUpdate = new TGCheckButton(this, "Ignore sizes");
459 fIgnoreSizesOnUpdate->SetToolTipText("Ignore bounding-box sizes on scene update");
461 fResetCamerasOnUpdate = new TGCheckButton(this, "Reset on update");
462 fResetCamerasOnUpdate->SetToolTipText("Reset camera on scene update");
464
465 TGCompositeFrame* af = this;
466 fUpdateScene = new TGTextButton(af, "Update Scene", 130);
467 af->AddFrame(fUpdateScene, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 8, 1));
468 fCameraHome = new TGTextButton(af, "Camera Home", 130);
469 af->AddFrame(fCameraHome, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 1, 3));
472 fMaxSceneDrawTimeHQ->GetNumberEntry()->SetToolTipText("Maximum time spent in scene drawing\nin high-quality mode [ms].");
475 fMaxSceneDrawTimeLQ->GetNumberEntry()->SetToolTipText("Maximum time spent in scene drawing\nin low-quality mode (during rotation etc).");
476
478 TGLabel* lab = new TGLabel(hf, "Clear Color");
479 hf->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 4, 8, 3));
480 fClearColor = new TGColorSelect(hf, 0, -1);
481 hf->AddFrame(fClearColor, new TGLayoutHints(kLHintsLeft, 1, 1, 8, 1));
482 AddFrame(hf, new TGLayoutHints(kLHintsLeft, 2, 1, 1, 1));
483
484 // LightSet
486 fLightSet->Connect("Changed()", "TGLViewerEditor", this, "ViewerRedraw()");
488
489 // Point-sizes / line-widths.
490 hf = new TGHorizontalFrame(af);
491 fPointSizeScale = MakeLabeledNEntry(hf, "Point-size scale:", 116, 4, TGNumberFormat::kNESRealOne);
494 fPointSmooth->SetToolTipText("Use smooth points.");
495 hf->AddFrame(fPointSmooth, new TGLayoutHints(kLHintsNormal, 3, 0, 3, 0));
496 af->AddFrame(hf);
497 hf = new TGHorizontalFrame(af);
498 fLineWidthScale = MakeLabeledNEntry(hf, "Line-width scale:", 116, 4, TGNumberFormat::kNESRealOne);
501 fLineSmooth->SetToolTipText("Use smooth lines.");
502 hf->AddFrame(fLineSmooth, new TGLayoutHints(kLHintsNormal, 3, 0, 3, 0));
503 af->AddFrame(hf);
504 fWFLineWidth = MakeLabeledNEntry(af, "Wireframe line-width:", 116, 4, TGNumberFormat::kNESRealOne);
506 fOLLineWidth = MakeLabeledNEntry(af, "Outline line-width:", 116, 4, TGNumberFormat::kNESRealOne);
508}
509
510////////////////////////////////////////////////////////////////////////////////
511/// Create "Guides" tab.
512
514{
516
517 // external camera look at point
518 TGGroupFrame* grf = new TGGroupFrame(fGuidesFrame, "Camera center:", kVerticalFrame);
519 fDrawCameraCenter = new TGCheckButton(grf, "Show", 50);
520 grf->AddFrame(fDrawCameraCenter, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 1, 1));
521 fCameraCenterExt = new TGCheckButton(grf, "External", 50);
522 grf->AddFrame(fCameraCenterExt, new TGLayoutHints(kLHintsLeft, 0, 0, 1, 0));
524 Int_t labw = 20;
528 fCaptureCenter = new TGTextButton(grf, " Pick center ");
529 grf->AddFrame(fCaptureCenter, new TGLayoutHints(kLHintsNormal, labw + 2, 0, 2, 0));
530
531 // annotate
532 TGGroupFrame* annf = new TGGroupFrame(fGuidesFrame, "Annotation");
534 fCaptureAnnotate = new TGCheckButton(annf, "Pick annotation");
536
537 // reference container
538 fRefContainer = new TGGroupFrame(fGuidesFrame, "Reference marker");
545
546 // axes
548 fAxesNone = new TGRadioButton(fAxesContainer, "None", 1);
549 fAxesEdge = new TGRadioButton(fAxesContainer, "Edge", 2);
550 fAxesOrigin = new TGRadioButton(fAxesContainer, "Origin", 3);
551 fAxesDepthTest = new TGCheckButton(fAxesContainer, "DepthTest",4);
553
554 // camera overlay
555 fCamContainer = new TGGroupFrame(fGuidesFrame, "Camera overlay");
560 TGLabel* lab = new TGLabel(chf, "Mode");
561 chf->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 4, 1, 2));
562 fCamMode = new TGComboBox(chf);
569 lb->Resize(lb->GetWidth(), 5*18);
570 fCamMode->Resize(90, 20);
571 chf->AddFrame(fCamMode, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
573}
574
575////////////////////////////////////////////////////////////////////////////////
576/// Create GUI controls - clip type (none/plane/box) and plane/box properties.
577
579{
581
583 fClipSet->Connect("Changed()", "TGLViewerEditor", this, "ViewerRedraw()");
585}
586
587////////////////////////////////////////////////////////////////////////////////
588/// Create Extra Tab controls - camera rotator and stereo.
589
591{
592 Int_t labw = 80;
593
594 TGCompositeFrame *tab = CreateEditorTabSubFrame("Extras"), *p = nullptr;
595
596 // ----- Auto rotator -----
597
598 p = new TGGroupFrame(tab, "Auto rotator", kVerticalFrame);
599
600 //
601 fRotateSceneOn = new TGCheckButton(p, "Rotate all objects");
602 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.");
603 p->AddFrame(fRotateSceneOn, new TGLayoutHints(kLHintsLeft, 4, 1, 1, 1));
604
607
610
613
616
619
622
625
626 {
628
629 TGTextButton *b = new TGTextButton(l, "Start");
630 b->Connect("Clicked()", "TGLViewerEditor", this, "DoRotatorStart()");
631 l->AddFrame(b, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
632
633 b = new TGTextButton(l, "Stop");
634 b->Connect("Clicked()", "TGLViewerEditor", this, "DoRotatorStop()");
635 l->AddFrame(b, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
636
637 p->AddFrame(l, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 4, 0));
638 }
639
640 tab->AddFrame(p, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
641
642 // ----- Auto Save Images -----
643
644 p = new TGGroupFrame(tab, "Auto save images", kVerticalFrame);
645
648 p->AddFrame(fASavImageGUIBaseName, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 4, 0));
649
652 new TGRadioButton(fASavImageGUIOutMode, "PNG set ");
655
656 {
658
659 TGTextButton *b = new TGTextButton(l, "Start");
660 b->Connect("Clicked()", "TGLViewerEditor", this, "DoASavImageStart()");
661 l->AddFrame(b, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
662
663 b = new TGTextButton(l, "Stop");
664 b->Connect("Clicked()", "TGLViewerEditor", this, "DoASavImageStop()");
665 l->AddFrame(b, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
666
667 p->AddFrame(l, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 4, 0));
668 }
669
670 tab->AddFrame(p, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
671
672 // ----- Stereo -----
673
674 fStereoFrame = p = new TGGroupFrame(tab, "Stereo", kVerticalFrame);
675
676 // Int_t labw = 80;
677
680
683
686
687 tab->AddFrame(p, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
688}
689
690
691////////////////////////////////////////////////////////////////////////////////
692/// Enable/disable reference position (x/y/z) number edits based on
693/// reference check box.
694
701
702////////////////////////////////////////////////////////////////////////////////
703/// Configuration of guides GUI called from SetModel().
704
706{
709 Double_t referencePos[3] = {0.};
711
712 for (Int_t i = 1; i < 4; i++) {
714 if (fAxesType+1 == i)
715 btn->SetDown(kTRUE);
716 else
717 btn->SetDown(kFALSE);
718 }
720
726
727 // overlay
730
732 {
733 fCamOverlayOn->SetDown(co->GetShowOrthographic());
734 fr->ShowFrame(fCamMode);
735
736
737 if (! fr->IsMapped()) {
738 fr->MapSubwindows();
739 fr->MapWindow();
742 fCamMode->Select(co->GetOrthographicMode(), kFALSE);
743 }
744 }
745 else
746 {
747 fCamOverlayOn->SetDown(co->GetShowPerspective());
748
749 // only mode implemented for perspective camera
750 fCamMode->Select(co->GetPerspectiveMode(), kFALSE);
751 fr->HideFrame(fCamMode);
752 if (fr->IsMapped())
753 fr->UnmapWindow();
754 }
755}
756
757////////////////////////////////////////////////////////////////////////////////
758
787
788////////////////////////////////////////////////////////////////////////////////
789/// Update rotator related variables.
790
792{
794 if (fRotateSceneOn->IsOn()) {
795 r->SetDeltaPhi(fSceneRotDt->GetNumber());
796 } else {
797 r->SetDt (fARotDt->GetNumber());
798 r->SetWPhi (fARotWPhi->GetNumber());
799 r->SetATheta(fARotATheta->GetNumber());
800 r->SetWTheta(fARotWTheta->GetNumber());
801 r->SetADolly(fARotADolly->GetNumber());
802 r->SetWDolly(fARotWDolly->GetNumber());
803 }
804}
805
806////////////////////////////////////////////////////////////////////////////////
807/// Start auto-rotator.
808
810{
812 if (!r->IsRunning())
813 r->SetRotateScene(fRotateSceneOn->IsOn());
814
815 r->Start();
816}
817
818////////////////////////////////////////////////////////////////////////////////
819/// Stop auto-rotator.
820
825
826////////////////////////////////////////////////////////////////////////////////
827/// Update base-name.
828
830{
832 r->SetImageGUIBaseName(t);
833}
834
835////////////////////////////////////////////////////////////////////////////////
836/// Update output mode.
837
839{
841 r->SetImageGUIOutMode(m);
842}
843
844////////////////////////////////////////////////////////////////////////////////
845/// Start auto-rotator image auto-save.
846
848{
850 if (r->GetImageAutoSave())
851 {
852 Warning("DoASavImageStart", "AutoSave in progress.");
853 return;
854 }
855
856 r->StartImageAutoSaveWithGUISettings();
857}
858
859////////////////////////////////////////////////////////////////////////////////
860/// Stop auto-rotator image auto-save.
861
863{
865 if (!r->GetImageAutoSave())
866 {
867 Warning("DoASavImageStop", "AutoSave not in progress.");
868 return;
869 }
870
871 r->StopImageAutoSave();
872}
873
874////////////////////////////////////////////////////////////////////////////////
875/// Update stereo related variables.
876
884
885//Aux. functions that do not have to be members.
886
887namespace {
888
889//Here's how we create a number entry and its label:
890
891// TGHorizontalFrame *rfr = new TGHorizontalFrame(p);
892// TGHorizontalFrame *labfr = new TGHorizontalFrame(rfr, labelw, 20, kFixedSize);
893// TGLabel *lab = new TGLabel(labfr, name);
894// labfr->AddFrame(lab, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 0, 0, 0) );
895// rfr->AddFrame(labfr, new TGLayoutHints(kLHintsLeft | kLHintsBottom, 0, 0, 0));
896//
897// TGNumberEntry* ne = new TGNumberEntry(rfr, 0.0f, nd, -1, (TGNumberFormat::EStyle)style);
898// rfr->AddFrame(ne, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsBottom, 2, 0, 0));
899//
900// p->AddFrame(rfr, new TGLayoutHints(kLHintsLeft, 0, 0, 1, 0));
901
902////////////////////////////////////////////////////////////////////////////////
903
905{
906 if (!entry) {
907 //I would prefer an assert here.
908 ::Error("FindLabelForNEntry", "parameter 'entry' is null");
909 return nullptr;
910 }
911
912 TGLabel *label = nullptr;
913
914 if (const TGHorizontalFrame * const grandpa = dynamic_cast<const TGHorizontalFrame *>(entry->GetParent())) {
915 if (TList * const parents = grandpa->GetList()) {
917 while (TGFrameElement * const frameElement = dynamic_cast<TGFrameElement *>(next1())) {
918 if (TGHorizontalFrame * const parent = dynamic_cast<TGHorizontalFrame *>(frameElement->fFrame)) {
919 if (TList * const children = parent->GetList()) {
920 TIter next2(children);
921 while (TGFrameElement * const candidate = dynamic_cast<TGFrameElement *>(next2())) {
922 if ((label = dynamic_cast<TGLabel *>(candidate->fFrame)))
923 break;
924 }
925 }
926 }
927
928 if (label)
929 break;
930 }
931 }
932 }
933
934 return label;
935}
936
937////////////////////////////////////////////////////////////////////////////////
938///This is quite an ugly hack but still not as ugly as having 5-6 additional
939///TGLabels as data members.
940
942{
943 if (!entry) {
944 //I would prefer an assert here.
945 ::Error("SetLabeledNEntryState", "parameter 'entry' is null");
946 return;
947 }
948
949 entry->SetState(enabled);
950 if (TGLabel * const label = FindLabelForNEntry(entry))
951 //Wah!
952 label->Disable(!enabled);
953}
954
955}
@ 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
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:77
short Color_t
Color number (short)
Definition RtypesCore.h:99
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
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:208
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:252
@ 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:2445
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:1926
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:439
virtual void SetDown(Bool_t on=kTRUE, Bool_t emit=kFALSE)
Definition TGButton.cxx:304
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:289
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
virtual TList * GetList() const
Definition TGFrame.h:312
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1156
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition TGFrame.cxx:1196
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition TGFrame.cxx:1182
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:597
void MapWindow() override
map window
Definition TGFrame.h:206
void UnmapWindow() override
unmap window
Definition TGFrame.h:208
A composite frame with a border and a title.
Definition TGFrame.h:524
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:387
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:1228
Color_t GetColorIndex() const
Returns color-index representing the color.
Definition TGLUtil.cxx:1210
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)
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:912
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:293
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:94
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:865
TMarker m
Definition textangle.C:8
TLine l
Definition textangle.C:4