Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TParallelCoordEditor.cxx
Go to the documentation of this file.
1// @(#)root/treeviewer:$Id$
2// Author: Bastien Dalla Piazza 02/08/2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, 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
13#include "TParallelCoord.h"
14#include "TParallelCoordRange.h"
15#include "TParallelCoordVar.h"
16
17#include "TGButton.h"
18#include "TGButtonGroup.h"
19#include "TGNumberEntry.h"
20#include "TGLabel.h"
21#include "TGTextEntry.h"
22#include "TGComboBox.h"
23#include "TGColorSelect.h"
24#include "TColor.h"
25#include "TG3DLine.h"
26#include "TGSlider.h"
27#include "TGDoubleSlider.h"
28#include "TGedPatternSelect.h"
29#include "TCanvas.h"
30
31#include "TROOT.h"
32
33
34
35/** \class TParallelCoordEditor
36
37This is the TParallelCoord editor. It brings tools to explore datas
38Using parallel coordinates. The main tools are:
39
40 - Dots spacing : Set the dots spacing with which-one the lines
41 must be drawn. This tool is useful to reduce the image
42 cluttering.
43 - The Selections section : Set the current edited selection and
44 allows to apply it to the tree through a generated entry list.
45 - The Entries section : Set how many events must be drawn.
46 A weight cut can be defined here (see TParallelCoord for a
47 a description of the weight cut).
48 - The Variables tab : To define the global settings to display
49 the axes. It is also possible to add a variable from its
50 expression or delete a selected one (also possible using right
51 click on the pad.
52*/
53
90
91////////////////////////////////////////////////////////////////////////////////
92/// Normal constructor.
93
95 Int_t/*width*/, Int_t /*height*/,
96 UInt_t /*options*/, Pixel_t /*back*/)
97{
98 fPriority = 1;
99 fDelay = true;
100
101 // Line
102 MakeTitle("Line");
103
108 fGlobalLineWidth->Resize(91, 20);
109 f1->AddFrame(fGlobalLineWidth, new TGLayoutHints(kLHintsLeft, 3, 1, 1, 1));
111
112 if (!TCanvas::SupportAlpha()) {
113
114 AddFrame(new TGLabel(this,"Dots spacing"),
116
117 TGHorizontalFrame *f2 = new TGHorizontalFrame(this);
119 fDotsSpacing->SetRange(0,60);
124 fDotsSpacingField->Resize(40,20);
127 }
128 else {
129 TGLabel *AlphaLabel = new TGLabel(this,"Opacity");
130 AddFrame(AlphaLabel,
132 TGHorizontalFrame *f2a = new TGHorizontalFrame(this);
133 fAlpha = new TGHSlider(f2a,100,kSlider2|kScaleNo,kAlpha);
134 fAlpha->SetRange(0,1000);
139 fAlphaField->Resize(40,20);
142 }
143
144 fLineTypeBgroup = new TGButtonGroup(this,2,1,0,0, "Line type");
145 fLineTypeBgroup->SetRadioButtonExclusive(true);
147 fLineTypePoly->SetToolTipText("Draw the entries with a polyline");
150 fLineTypeCurves->SetToolTipText("Draw the entries with a curve");
153
154 // Selections
155 MakeTitle("Selections");
156
157 fHideAllRanges = new TGCheckButton(this,"Hide all ranges",kHideAllRanges);
159
161 fSelectionSelect->Resize(140,20);
163
164 TGHorizontalFrame *f3 = new TGHorizontalFrame(this);
168 fSelectLineWidth->Resize(94, 20);
169 f3->AddFrame(fSelectLineWidth, new TGLayoutHints(kLHintsLeft, 3, 1, 1, 1));
170 AddFrame(f3, new TGLayoutHints(kLHintsLeft | kLHintsTop,0,0,3,0));
171
173 fActivateSelection->SetToolTipText("Activate the current selection");
175 fShowRanges = new TGCheckButton(this,"Show ranges",kShowRanges);
177
178 TGHorizontalFrame *f5 = new TGHorizontalFrame(this);
180 fAddSelectionField->Resize(57,20);
182 fAddSelection = new TGTextButton(f5,"Add");
183 fAddSelection->SetToolTipText("Add a new selection (Right click on the axes to add a range).");
186 fDeleteSelection->SetToolTipText("Delete the current selection");
189
190 TGHorizontalFrame *f7 = new TGHorizontalFrame(this);
191 fApplySelect = new TGTextButton(f7,"Apply to tree",kApplySelect);
192 fApplySelect->SetToolTipText("Generate an entry list for the current selection and apply it to the tree.");
194 fUnApply = new TGTextButton(f7,"Reset tree",kUnApply);
195 fUnApply->SetToolTipText("Reset the tree entry list");
198
199 // Entries
200 MakeTitle("Entries");
201
202 fPaintEntries = new TGCheckButton(this,"Draw entries",kPaintEntries);
204 fDelayDrawing = new TGCheckButton(this,"Delay Drawing", kDelayDrawing);
206
209
210 TGHorizontalFrame *f6 = new TGHorizontalFrame(this);
213 v1->AddFrame(new TGLabel(v1,"First entry:"));
217 fFirstEntry->Resize(68,20);
218 v1->AddFrame(fFirstEntry);
219 v2->AddFrame(new TGLabel(v2,"# of entries:"));
223 fNentries->Resize(68,20);
224 v2->AddFrame(fNentries);
225 f6->AddFrame(v1);
226 f6->AddFrame(v2, new TGLayoutHints(kLHintsLeft,4,0,0,0));
227 AddFrame(f6);
228
229 AddFrame(new TGLabel(this,"Weight cut:"));
230
231 TGHorizontalFrame *f8 = new TGHorizontalFrame(this);
236 fWeightCutField->Resize(40,20);
237 f8->AddFrame(fWeightCut);
239 AddFrame(f8);
240
242}
243
244////////////////////////////////////////////////////////////////////////////////
245/// Make the "variable" tab.
246
248{
249 fVarTab = CreateEditorTabSubFrame("Variables");
250 // Variable
251
253 fAddVariable = new TGTextEntry(f9);
254 fAddVariable->Resize(71,20);
256 fButtonAddVar = new TGTextButton(f9,"Add");
257 fButtonAddVar->SetToolTipText("Add a new variable from the tree (must be a valid expression).");
259 fVarTab->AddFrame(f9);
260
263 fVariables->Resize(105,20);
265 fVarTab->AddFrame(f10,new TGLayoutHints(kLHintsLeft,0,0,2,0));
266
268 fDeleteVar = new TGTextButton(f12,"Delete",kDeleteVar);
269 fDeleteVar->SetToolTipText("Delete the current selected variable");
271 fRenameVar = new TGTextButton(f12,"Rename",kRenameVar);
272 fRenameVar->SetToolTipText("Rename the current selected variable");
274 fVarTab->AddFrame(f12,new TGLayoutHints(kLHintsLeft,0,0,2,0));
275
276 fVarTab->AddFrame(new TGLabel(fVarTab,"Axis histograms:"));
277
281 v3->AddFrame(new TGLabel(v3,"Binning:"));
285 fHistBinning->Resize(68,20);
286 v3->AddFrame(fHistBinning);
287 v4->AddFrame(new TGLabel(v4,"Width:"));
291 fHistWidth->Resize(68,20);
292 v4->AddFrame(fHistWidth, new TGLayoutHints(kLHintsLeft,4,0,0,0));
293 f11->AddFrame(v3);
294 f11->AddFrame(v4);
295 fVarTab->AddFrame(f11);
296
297 fHistShowBoxes = new TGCheckButton(fVarTab,"Show box histograms");
298 fVarTab->AddFrame(fHistShowBoxes);
299
300 fVarTab->AddFrame(new TGLabel(fVarTab,"Bar histograms style:"));
301
304 f13->AddFrame(fHistColorSelect, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
305 fHistColorSelect->Associate(this);
308 fHistPatternSelect->Associate(this);
309 fVarTab->AddFrame(f13, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
310}
311
312////////////////////////////////////////////////////////////////////////////////
313/// Destructor.
314
320
321////////////////////////////////////////////////////////////////////////////////
322/// Clean up the selection combo box.
323
325{
326 TList *list = fParallel->GetSelectList();
327 fSelectionSelect->RemoveAll();
328 bool enable = list->GetSize() > 0;
329 fSelectionSelect->SetEnabled(enable);
330 fSelectLineColor->SetEnabled(enable);
331 fSelectLineWidth->SetEnabled(enable);
332 fActivateSelection->SetEnabled(enable);
333 fShowRanges->SetEnabled(enable);
334 fDeleteSelection->SetEnabled(enable);
335 if (list->GetSize() > 0) {
336 Int_t i = 0;
337 TIter next(list);
339 while ((sel = (TParallelCoordSelect*)next())) {
340 fSelectionSelect->AddEntry(sel->GetTitle(),i);
341 TGLBEntry *entry = fSelectionSelect->GetListBox()->GetEntry(i);
342 if (entry)
344 ++i;
345 }
346 sel = fParallel->GetCurrentSelection();
347 if (sel) {
348 fSelectionSelect->Select(list->IndexOf(sel),false);
349 Color_t c;
350 Pixel_t p;
351 c = sel->GetLineColor();
353 fSelectLineColor->SetColor(p);
354 fSelectLineWidth->Select(sel->GetLineWidth());
357 }
358 }
359}
360
361////////////////////////////////////////////////////////////////////////////////
362/// Clean up the variables combo box.
363
365{
366 TList *list = fParallel->GetVarList();
367 fVariables->RemoveAll();
368 bool enable = list->GetSize() > 0;
369 fVariables->SetEnabled(enable);
370 fDeleteVar->SetEnabled(enable);
371 fHistShowBoxes->SetEnabled(enable);
372 fHistWidth->SetEnabled(enable);
373 fHistBinning->SetEnabled(enable);
374 if (list->GetSize() > 0) {
375 Int_t i = 0;
376 TIter next(list);
378 while ((var = (TParallelCoordVar*)next())) {
379 fVariables->AddEntry(var->GetTitle(),i);
380 ++i;
381 }
382 var = (TParallelCoordVar*)list->First();
383 fVariables->Select(0,false);
385 fHistWidth->SetNumber(var->GetHistLineWidth());
386 fHistBinning->SetNumber(var->GetHistBinning());
387 }
388}
389
390////////////////////////////////////////////////////////////////////////////////
391/// Connect signals to slots.
392
394{
395 fGlobalLineColor->Connect("ColorSelected(Pixel_t)","TParallelCoordEditor",
396 this, "DoGlobalLineColor(Pixel_t)");
397 fGlobalLineWidth->Connect("Selected(Int_t)","TParallelCoordEditor",
398 this, "DoGlobalLineWidth(Int_t)");
399 if (!TCanvas::SupportAlpha()) {
400 fDotsSpacing->Connect("Released()","TParallelCoordEditor",
401 this, "DoDotsSpacing()");
402 fDotsSpacing->Connect("PositionChanged(Int_t)","TParallelCoordEditor",
403 this, "DoLiveDotsSpacing(Int_t)");
404 fDotsSpacingField->Connect("ReturnPressed()","TParallelCoordEditor",
405 this, "DoDotsSpacingField()");
406 }
407 else {
408 fAlpha->Connect("Released()","TParallelCoordEditor",
409 this, "DoAlpha()");
410 fAlpha->Connect("PositionChanged(Int_t)","TParallelCoordEditor",
411 this, "DoLiveAlpha(Int_t)");
412 fAlphaField->Connect("ReturnPressed()","TParallelCoordEditor",
413 this, "DoAlphaField()");
414 }
415 fLineTypeBgroup->Connect("Clicked(Int_t)", "TParallelCoordEditor",
416 this, "DoLineType()");
417 fSelectionSelect->Connect("Selected(const char*)","TParallelCoordEditor",
418 this, "DoSelectionSelect(const char*)");
419 fSelectLineColor->Connect("ColorSelected(Pixel_t)","TParallelCoordEditor",
420 this, "DoSelectLineColor(Pixel_t)");
421 fSelectLineWidth->Connect("Selected(Int_t)","TParallelCoordEditor",
422 this, "DoSelectLineWidth(Int_t)");
423 fActivateSelection->Connect("Toggled(bool)","TParallelCoordEditor",
424 this, "DoActivateSelection(bool)");
425 fShowRanges->Connect("Toggled(bool)","TParallelCoordEditor",
426 this, "DoShowRanges(bool)");
427 fDeleteSelection->Connect("Clicked()","TParallelCoordEditor",
428 this, "DoDeleteSelection()");
429 fAddSelection->Connect("Clicked()","TParallelCoordEditor",
430 this, "DoAddSelection()");
431 fPaintEntries->Connect("Toggled(bool)","TParallelCoordEditor",
432 this, "DoPaintEntries(bool)");
433 fEntriesToDraw->Connect("Released()","TParallelCoordEditor",
434 this, "DoEntriesToDraw()");
435 fEntriesToDraw->Connect("PositionChanged()","TParallelCoordEditor",
436 this, "DoLiveEntriesToDraw()");
437 fFirstEntry->Connect("ReturnPressed()","TParallelCoordEditor",
438 this, "DoFirstEntry()");
439 fNentries->Connect("ReturnPressed()","TParallelCoordEditor",
440 this, "DoNentries()");
441 fApplySelect->Connect("Clicked()","TParallelCoordEditor",
442 this, "DoApplySelect()");
443 fUnApply->Connect("Clicked()","TParallelCoordEditor",
444 this, "DoUnApply()");
445 fDelayDrawing->Connect("Toggled(bool)","TParallelCoordEditor",
446 this, "DoDelayDrawing(bool)");
447 fAddVariable->Connect("ReturnPressed()","TParallelCoordEditor",
448 this, "DoAddVariable()");
449 fButtonAddVar->Connect("Clicked()","TParallelCoordEditor",
450 this, "DoAddVariable()");
451 fHideAllRanges->Connect("Toggled(bool)","TParallelCoordEditor",
452 this, "DoHideAllRanges(bool)");
453 fVariables->Connect("Selected(const char*)","TParallelCoordEditor",
454 this, "DoVariableSelect(const char*)");
455 fDeleteVar->Connect("Clicked()","TParallelCoordEditor",
456 this, "DoDeleteVar()");
457 fHistWidth->Connect("ReturnPressed()","TParallelCoordEditor",
458 this, "DoHistWidth()");
459 fHistBinning->Connect("ReturnPressed()","TParallelCoordEditor",
460 this, "DoHistBinning()");
461 fWeightCut->Connect("Released()","TParallelCoordEditor",
462 this, "DoWeightCut()");
463 fWeightCut->Connect("PositionChanged(Int_t)","TParallelCoordEditor",
464 this, "DoLiveWeightCut(Int_t)");
465 fWeightCutField->Connect("ReturnPressed()","TParallelCoordEditor",
466 this, "DoWeightCut()");
467 fHistColorSelect->Connect("ColorSelected(Pixel_t)", "TParallelCoordEditor",
468 this, "DoHistColorSelect(Pixel_t)");
469 fHistPatternSelect->Connect("PatternSelected(Style_t)", "TParallelCoordEditor",
470 this, "DoHistPatternSelect(Style_t)");
471 fHistShowBoxes->Connect("Toggled(bool)","TParallelCoordEditor",
472 this, "DoHistShowBoxes(bool)");
473
474 fInit = false;
475}
476
477////////////////////////////////////////////////////////////////////////////////
478/// Slot to activate or not a selection.
479
481{
482 if (fAvoidSignal) return;
483
484 TParallelCoordSelect* sel = fParallel->GetCurrentSelection();
485 if (sel) {
486 sel->SetActivated(on);
487 Update();
488 }
489}
490
491////////////////////////////////////////////////////////////////////////////////
492/// Slot to add a selection.
493
495{
496 TString title = fAddSelectionField->GetText();
497 if (title == "") title = "Selection";
498 TString titlebis = title;
499 bool found = true;
500 Int_t i=1;
501 while (found){
502 if (fSelectionSelect->FindEntry(titlebis)) {
503 titlebis = title;
504 titlebis.Append(Form("(%d)",i));
505 }
506 else found = false;
507 ++i;
508 }
509
510 fParallel->AddSelection(titlebis.Data());
511
513}
514
515////////////////////////////////////////////////////////////////////////////////
516/// Slot to add a variable.
517
519{
520 if (fAvoidSignal) return;
521
522 fParallel->AddVariable(fAddVariable->GetText());
524 Update();
525}
526
527////////////////////////////////////////////////////////////////////////////////
528/// Slot to apply a selection to the tree.
529
531{
532 //FIXME I forgot to update the slider over the entries
533 // (nentries and firstentry might have changed after applying the selection)
534
535 if (fAvoidSignal) return;
536
537 fParallel->ApplySelectionToTree();
538 Update();
540}
541
542////////////////////////////////////////////////////////////////////////////////
543/// Slot to delay the drawing.
544
546{
547 if (fAvoidSignal) return;
548
549 fDelay = on;
550 fParallel->SetLiveRangesUpdate(!on);
551}
552
553////////////////////////////////////////////////////////////////////////////////
554/// Slot to delete a selection.
555
557{
558 if (fAvoidSignal) return;
559
560 fParallel->DeleteSelection(fParallel->GetCurrentSelection());
561
563 Update();
564}
565
566////////////////////////////////////////////////////////////////////////////////
567/// Slot to delete a variable().
568
570{
571 if (fAvoidSignal) return;
572
573 bool hasDeleted = fParallel->RemoveVariable(((TGTextLBEntry*)fVariables->GetSelectedEntry())->GetTitle());
575 if (hasDeleted) Update();
576}
577
578////////////////////////////////////////////////////////////////////////////////
579/// Slot to set the line dot spacing.
580
582{
583 if (fAvoidSignal) return;
584
585 fParallel->SetDotsSpacing(fDotsSpacing->GetPosition());
586 fDotsSpacingField->SetNumber((Int_t)fDotsSpacing->GetPosition());
587 Update();
588}
589
590////////////////////////////////////////////////////////////////////////////////
591/// Slot to set the line dot spacing from the entry field.
592
594{
595 if (fAvoidSignal) return;
596
597 fParallel->SetDotsSpacing((Int_t)fDotsSpacingField->GetNumber());
598 fDotsSpacing->SetPosition((Int_t)fDotsSpacingField->GetNumber());
599 Update();
600}
601
602////////////////////////////////////////////////////////////////////////////////
603/// Slot to set the alpha value from the entry field.
604
606{
607 if (fAvoidSignal) return;
608
609 if (TColor *color = gROOT->GetColor(fParallel->GetLineColor())) {
610 color->SetAlpha((Float_t)fAlphaField->GetNumber());
611 fAlpha->SetPosition((Int_t)fAlphaField->GetNumber()*1000);
612 }
613 Update();
614}
615
616////////////////////////////////////////////////////////////////////////////////
617/// Slot to set the alpha value
618
620{
621 if (fAvoidSignal) return;
622
623 if (TColor *color = gROOT->GetColor(fParallel->GetLineColor())) {
624 color->SetAlpha((Float_t)fAlpha->GetPosition()/1000);
625 fAlphaField->SetNumber((Float_t)fAlpha->GetPosition()/1000);
626 }
627 Update();
628}
629
630////////////////////////////////////////////////////////////////////////////////
631/// Slot to select the entries to be drawn.
632
634{
635 if (fAvoidSignal) return;
636
637 Long64_t nentries,firstentry;
638 firstentry = fEntriesToDraw->GetMinPositionL();
639 nentries = (Long64_t)(fEntriesToDraw->GetMaxPositionD() - fEntriesToDraw->GetMinPositionD() + 1);
640
641 fParallel->SetCurrentFirst(firstentry);
642 fParallel->SetCurrentN(nentries);
643 Update();
644}
645
646////////////////////////////////////////////////////////////////////////////////
647/// Slot to set the first entry.
648
650{
651 if (fAvoidSignal) return;
652
653 fParallel->SetCurrentFirst((Long64_t)fFirstEntry->GetNumber());
654 fEntriesToDraw->SetPosition((Long64_t)fFirstEntry->GetNumber(),(Long64_t)fFirstEntry->GetNumber()+fParallel->GetCurrentN());
655 Update();
656}
657
658////////////////////////////////////////////////////////////////////////////////
659/// Slot to set the global line color.
660
662{
663 if (fAvoidSignal) return;
664
665 if (TColor *color = gROOT->GetColor(fParallel->GetLineColor())) {
666 color->SetAlpha(1);
667 color = gROOT->GetColor(TColor::GetColor(a));
668 if (color) {
669 color->SetAlpha((Float_t)fAlphaField->GetNumber());
670 fParallel->SetLineColor(color->GetNumber());
671 }
672 }
673 Update();
674}
675
676////////////////////////////////////////////////////////////////////////////////
677/// Slot to set the global line width.
678
680{
681 if (fAvoidSignal) return;
682
683 fParallel->SetLineWidth(wid);
684 Update();
685}
686
687////////////////////////////////////////////////////////////////////////////////
688/// Slot to hide all the ranges.
689
691{
692 if (fAvoidSignal) return;
693
694 TIter next(fParallel->GetSelectList());
696 while((sel = (TParallelCoordSelect*)next())) sel->SetShowRanges(!on);
697 fShowRanges->SetOn(!on);
698 fShowRanges->SetEnabled(!on);
699 fShowRanges->SetOn(!on);
700 Update();
701}
702
703////////////////////////////////////////////////////////////////////////////////
704/// Slot to set the axes histogram binning.
705
707{
708 if (fAvoidSignal) return;
709
710 fParallel->SetAxisHistogramBinning((Int_t)fHistBinning->GetNumber());
711 Update();
712}
713
714////////////////////////////////////////////////////////////////////////////////
715/// Slot to set the histograms color.
716
718{
719 if (fAvoidSignal) return;
720
721 Color_t col = TColor::GetColor(p);
722 TIter next(fParallel->GetVarList());
723 TParallelCoordVar *var = nullptr;
724 while ((var = (TParallelCoordVar*)next())) var->SetFillColor(col);
725 Update();
726}
727
728////////////////////////////////////////////////////////////////////////////////
729/// Slot to set histogram height.
730
732{
733 if (fAvoidSignal) return;
734
735 TIter next(fParallel->GetVarList());
737 while ((var = (TParallelCoordVar*)next())) var->SetBit(TParallelCoordVar::kShowBarHisto,s);
738 Update();
739}
740
741////////////////////////////////////////////////////////////////////////////////
742/// Slot to set the histograms fill style.
743
745{
746 if (fAvoidSignal) return;
747
748 TIter next(fParallel->GetVarList());
749 TParallelCoordVar *var = nullptr;
750 while ((var = (TParallelCoordVar*)next())) var->SetFillStyle(sty);
751 Update();
752}
753
754////////////////////////////////////////////////////////////////////////////////
755/// Slot to set histogram width.
756
758{
759 if (fAvoidSignal) return;
760
761 fParallel->SetAxisHistogramLineWidth((Int_t)fHistWidth->GetNumber());
762 Update();
763}
764
765////////////////////////////////////////////////////////////////////////////////
766/// Slot to set the line type.
767
769{
770 if (fAvoidSignal) return;
771
772 if (fLineTypePoly->GetState() == kButtonDown) fParallel->SetCurveDisplay(false);
773 else fParallel->SetCurveDisplay(true);
774 Update();
775}
776
777////////////////////////////////////////////////////////////////////////////////
778/// Slot to set the dots spacing online.
779
781{
782 if (fAvoidSignal) return;
783 fDotsSpacingField->SetNumber(a);
784 fParallel->SetDotsSpacing(a);
785 if (!fDelay) Update();
786}
787
788////////////////////////////////////////////////////////////////////////////////
789/// Slot to set alpha value online.
790
792{
793 if (fAvoidSignal) return;
794 fAlphaField->SetNumber((Float_t)a/1000);
795
796 if (TColor *color = gROOT->GetColor(fParallel->GetLineColor())) color->SetAlpha((Float_t)a/1000);
797 if (!fDelay) Update();
798}
799
800////////////////////////////////////////////////////////////////////////////////
801/// Slot to update the entries fields from the slider position.
802
804{
805 if (fAvoidSignal) return;
806
807 Long64_t nentries,firstentry;
808 firstentry = fEntriesToDraw->GetMinPositionL();
809 nentries = (Long64_t)(fEntriesToDraw->GetMaxPositionD() - fEntriesToDraw->GetMinPositionD() + 1);
810
811 fFirstEntry->SetNumber(firstentry);
812 fNentries->SetNumber(nentries);
813
814 if (!fDelay) {
815 fParallel->SetCurrentFirst(firstentry);
816 fParallel->SetCurrentN(nentries);
817 Update();
818 }
819}
820
821////////////////////////////////////////////////////////////////////////////////
822/// Slot to update the weight cut entry field from the slider position.
823
825{
826 if (fAvoidSignal) return;
827
828 fWeightCutField->SetNumber(n);
829 if (!fDelay) {
830 fParallel->SetWeightCut(n);
831 Update();
832 }
833}
834
835////////////////////////////////////////////////////////////////////////////////
836/// Slot to set the number of entries to display.
837
839{
840 if (fAvoidSignal) return;
841
842 fParallel->SetCurrentN((Long64_t)fNentries->GetNumber());
843 fEntriesToDraw->SetPosition(fParallel->GetCurrentFirst(),fParallel->GetCurrentFirst()+fParallel->GetCurrentN());
844 Update();
845}
846
847////////////////////////////////////////////////////////////////////////////////
848/// Slot to postpone the entries drawing.
849
851{
852 if (fAvoidSignal) return;
853
855 Update();
856}
857
858////////////////////////////////////////////////////////////////////////////////
859/// Slot to set the line color of selection.
860
862{
863 if (fAvoidSignal) return;
864
865 TParallelCoordSelect* sel = fParallel->GetCurrentSelection();
866 if (sel) sel->SetLineColor(TColor::GetColor(a));
867 fSelectionSelect->GetSelectedEntry()->SetBackgroundColor(a);
868 Update();
869}
870
871////////////////////////////////////////////////////////////////////////////////
872/// Slot to set the line width of selection.
873
875{
876 if (fAvoidSignal) return;
877
878 TParallelCoordSelect* sel = fParallel->GetCurrentSelection();
879 if (sel) {
880 sel->SetLineWidth(wid);
881 Update();
882 }
883}
884
885////////////////////////////////////////////////////////////////////////////////
886/// Slot to set the selection being edited.
887
889{
890 if (fAvoidSignal) return;
891
892 if (!fParallel->SetCurrentSelection(title)) return;
893
894 Color_t c = fParallel->GetCurrentSelection()->GetLineColor();
896 fSelectLineColor->SetColor(p,false);
897
898 fSelectLineWidth->Select(fParallel->GetCurrentSelection()->GetLineWidth(),false);
899
900 fActivateSelection->SetOn(fParallel->GetCurrentSelection()->TestBit(TParallelCoordSelect::kActivated));
901 fShowRanges->SetOn(fParallel->GetCurrentSelection()->TestBit(TParallelCoordSelect::kShowRanges));
902}
903
904////////////////////////////////////////////////////////////////////////////////
905/// Slot to show or not the ranges on the pad.
906
908{
909 if (fAvoidSignal) return;
910
911 TParallelCoordSelect *select = fParallel->GetCurrentSelection();
912 if (select) {
913 select->SetShowRanges(s);
914 Update();
915 }
916}
917
918////////////////////////////////////////////////////////////////////////////////
919/// Slot to reset the tree entry list to the original one.
920
922{
923 if (fAvoidSignal) return;
924
925 fParallel->ResetTree();
926 Update();
928}
929
930////////////////////////////////////////////////////////////////////////////////
931/// Slot to select a variable.
932
934{
935}
936
937////////////////////////////////////////////////////////////////////////////////
938/// Slot to update the weight cut.
939
941{
942 if (fAvoidSignal) return;
943
944 Int_t n = (Int_t)fWeightCutField->GetNumber();
945 fParallel->SetWeightCut(n);
946 Update();
947}
948
949////////////////////////////////////////////////////////////////////////////////
950/// Pick up the used parallel coordinates plot attributes.
951
953{
954 if (!obj) return;
955 fParallel = dynamic_cast<TParallelCoord*>(obj);
956 if (!fParallel) return;
957 fAvoidSignal = true;
958
959 Color_t c = fParallel->GetLineColor();
961 fGlobalLineColor->SetColor(p);
962
963 fGlobalLineWidth->Select(fParallel->GetLineWidth());
964
966
967 if (!TCanvas::SupportAlpha()) {
968 fDotsSpacing->SetPosition(fParallel->GetDotsSpacing());
969 fDotsSpacingField->SetNumber(fParallel->GetDotsSpacing());
970 }
971 else {
972 if (TColor *color = gROOT->GetColor(fParallel->GetLineColor())) {
973 fAlpha->SetPosition((Int_t)color->GetAlpha()*1000);
974 fAlphaField->SetNumber(color->GetAlpha());
975 }
976 }
977
978 bool cur = fParallel->GetCurveDisplay();
979 if (cur) fLineTypeBgroup->SetButton(kLineTypeCurves,true);
980 else fLineTypeBgroup->SetButton(kLineTypePoly,true);
981
982 if (fInit) fHideAllRanges->SetOn(false);
983
986
987 if (fInit) fEntriesToDraw->SetRange(0LL,fParallel->GetNentries());
988 fEntriesToDraw->SetPosition(fParallel->GetCurrentFirst(), fParallel->GetCurrentFirst()+fParallel->GetCurrentN());
989
990 fFirstEntry->SetNumber(fParallel->GetCurrentFirst());
991 fNentries->SetNumber(fParallel->GetCurrentN());
992
993 fDelayDrawing->SetOn(fDelay);
994
995 fWeightCut->SetRange(0,(Int_t)(fParallel->GetNentries()/10)); // Maybe search here for better boundaries.
996 fWeightCut->SetPosition(fParallel->GetWeightCut());
997 fWeightCutField->SetNumber(fParallel->GetWeightCut());
998
999 fHistColorSelect->SetColor(TColor::Number2Pixel(((TParallelCoordVar*)fParallel->GetVarList()->Last())->GetFillColor()), false);
1000 fHistPatternSelect->SetPattern(((TParallelCoordVar*)fParallel->GetVarList()->Last())->GetFillStyle(),false);
1001
1003
1004 fAvoidSignal = false;
1005}
@ kChildFrame
Definition GuiTypes.h:380
@ kVerticalFrame
Definition GuiTypes.h:382
@ kHorizontalFrame
Definition GuiTypes.h:383
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:41
#define c(i)
Definition RSha256.hxx:101
#define a(i)
Definition RSha256.hxx:99
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
short Color_t
Color number (short).
Definition RtypesCore.h:99
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:83
short Style_t
Style number (short).
Definition RtypesCore.h:96
float Float_t
Float 4 bytes (float).
Definition RtypesCore.h:71
@ kButtonDown
Definition TGButton.h:54
@ kDoubleScaleNo
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsCenterY
Definition TGLayout.h:28
@ kLHintsTop
Definition TGLayout.h:27
@ kScaleNo
Definition TGSlider.h:34
@ kSlider2
Definition TGSlider.h:31
int nentries
@ kLineTypeCurves
@ kAddSelectionEntry
@ kSelectLineWidth
@ kDotsSpacingField
@ kHistColorSelect
@ kDeleteSelection
@ kHistPatternSelect
@ kSelectLineColor
@ kGlobalLineColor
@ kSelectionSelect
@ kActivateSelection
@ kLineTypeBgroup
@ kGlobalLineWidth
#define gROOT
Definition TROOT.h:417
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2496
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:40
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition TAttFill.h:42
virtual Color_t GetLineColor() const
Return the line color.
Definition TAttLine.h:36
virtual Width_t GetLineWidth() const
Return the line width.
Definition TAttLine.h:38
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition TAttLine.h:47
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:44
static Bool_t SupportAlpha()
Static function returning "true" if transparency is supported.
Definition TCanvas.cxx:2471
static Int_t GetColor(const char *hexcolor)
static ULong_t Number2Pixel(Int_t ci)
Organizes TGButton widgets in a group.
Selects different options.
Definition TGButton.h:264
Like a checkbutton but instead of the check mark there is color area with a little down arrow.
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 void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
TGCompositeFrame(const TGCompositeFrame &)=delete
Dragging the slider will generate the event:
Concrete class for horizontal slider.
Definition TGSlider.h:119
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:387
Basic listbox entries.
Definition TGListBox.h:24
void SetBackgroundColor(Pixel_t col) override
Set background color (override from TGWindow base class).
Definition TGListBox.h:42
This class handles GUI labels.
Definition TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
The TGLineWidthComboBox user callable and it creates a combobox for selecting the line width.
Definition TGComboBox.h:158
@ kNEANonNegative
Non-negative number.
@ kNESReal
Real number.
@ kNESInteger
Style of number entry field.
Selects different options.
Definition TGButton.h:321
Yield an action as soon as it is clicked.
Definition TGButton.h:142
A TGTextEntry is a one line text input widget.
Definition TGTextEntry.h:24
Text string listbox entries.
Definition TGListBox.h:48
A composite frame that layout their children in vertical way.
Definition TGFrame.h:376
ROOT GUI Window base class.
Definition TGWindow.h:23
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
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition TGedFrame.cxx:71
Int_t fPriority
location in GedEditor
Definition TGedFrame.h:53
Bool_t fAvoidSignal
flag for executing slots
Definition TGedFrame.h:50
is a button with pattern area with a little down arrow.
A doubly linked list.
Definition TList.h:38
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:50
Mother of all ROOT objects.
Definition TObject.h:42
Bool_t TestBit(UInt_t f) const
Definition TObject.h:204
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:888
virtual void DoSelectLineColor(Pixel_t)
Slot to set the line color of selection.
~TParallelCoordEditor() override
Destructor.
virtual void DoHistShowBoxes(bool)
Slot to set histogram height.
TGDoubleHSlider * fEntriesToDraw
virtual void DoLiveEntriesToDraw()
Slot to update the entries fields from the slider position.
TGCheckButton * fHideAllRanges
virtual void DoDotsSpacing()
Slot to set the line dot spacing.
virtual void DoAlpha()
Slot to set the alpha value.
virtual void DoApplySelect()
Slot to apply a selection to the tree.
virtual void ConnectSignals2Slots()
Connect signals to slots.
virtual void DoFirstEntry()
Slot to set the first entry.
virtual void DoLiveDotsSpacing(Int_t a)
Slot to set the dots spacing online.
TGTextButton * fDeleteSelection
TGLineWidthComboBox * fSelectLineWidth
virtual void DoLiveWeightCut(Int_t n)
Slot to update the weight cut entry field from the slider position.
TGCheckButton * fActivateSelection
TGedPatternSelect * fHistPatternSelect
virtual void DoDotsSpacingField()
Slot to set the line dot spacing from the entry field.
TGLineWidthComboBox * fGlobalLineWidth
virtual void DoPaintEntries(bool)
Slot to postpone the entries drawing.
void CleanUpSelections()
Clean up the selection combo box.
virtual void DoActivateSelection(bool)
Slot to activate or not a selection.
virtual void DoGlobalLineColor(Pixel_t)
Slot to set the global line color.
TGNumberEntryField * fFirstEntry
virtual void DoLiveAlpha(Int_t a)
Slot to set alpha value online.
virtual void DoDeleteVar()
Slot to delete a variable().
TGNumberEntryField * fDotsSpacingField
virtual void DoSelectionSelect(const char *title)
Slot to set the selection being edited.
TGCompositeFrame * fVarTab
virtual void DoHistColorSelect(Pixel_t)
Slot to set the histograms color.
virtual void DoGlobalLineWidth(Int_t)
Slot to set the global line width.
virtual void DoHistWidth()
Slot to set histogram width.
TGCheckButton * fHistShowBoxes
void SetModel(TObject *obj) override
Pick up the used parallel coordinates plot attributes.
virtual void DoUnApply()
Slot to reset the tree entry list to the original one.
virtual void DoAddVariable()
Slot to add a variable.
TGCheckButton * fPaintEntries
virtual void DoDelayDrawing(bool)
Slot to delay the drawing.
virtual void DoHistPatternSelect(Style_t)
Slot to set the histograms fill style.
TGColorSelect * fSelectLineColor
void MakeVariablesTab()
Make the "variable" tab.
virtual void DoAddSelection()
Slot to add a selection.
TGCheckButton * fDelayDrawing
virtual void DoAlphaField()
Slot to set the alpha value from the entry field.
TGNumberEntryField * fHistWidth
TParallelCoordEditor(const TGWindow *p=nullptr, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Normal constructor.
virtual void DoSelectLineWidth(Int_t)
Slot to set the line width of selection.
virtual void DoEntriesToDraw()
Slot to select the entries to be drawn.
TGColorSelect * fHistColorSelect
TGRadioButton * fLineTypePoly
virtual void DoHideAllRanges(bool)
Slot to hide all the ranges.
virtual void DoLineType()
Slot to set the line type.
TGColorSelect * fGlobalLineColor
TGNumberEntryField * fAlphaField
void CleanUpVariables()
Clean up the variables combo box.
TGNumberEntryField * fWeightCutField
TGRadioButton * fLineTypeCurves
virtual void DoWeightCut()
Slot to update the weight cut.
virtual void DoNentries()
Slot to set the number of entries to display.
TGNumberEntryField * fNentries
TGButtonGroup * fLineTypeBgroup
virtual void DoShowRanges(bool s)
Slot to show or not the ranges on the pad.
virtual void DoHistBinning()
Slot to set the axes histogram binning.
virtual void DoDeleteSelection()
Slot to delete a selection.
TGNumberEntryField * fHistBinning
virtual void DoVariableSelect(const char *var)
Slot to select a variable.
A TParallelCoordSelect is a specialised TList to hold TParallelCoordRanges used by TParallelCoord.
void SetShowRanges(bool s)
Show the ranges needles.
void SetActivated(bool on)
Activate the selection.
const char * GetTitle() const override
Returns title of object.
TParallelCoord axes.
Int_t GetHistBinning() const
Parallel Coordinates class.
@ kPaintEntries
To paint all TParallelCoord entries.
Basic string class.
Definition TString.h:138
const char * Data() const
Definition TString.h:384
TString & Append(const char *cs)
Definition TString.h:581
const Int_t n
Definition legend1.C:16
TF1 * f1
Definition legend1.C:11