]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Reve/NLTPolygonSetEditor.cxx
Hardwired "ideal" coordinates replaced with those from the DCDB.
[u/mrichter/AliRoot.git] / EVE / Reve / NLTPolygonSetEditor.cxx
CommitLineData
debf9f47 1#include "NLTPolygonSetEditor.h"
2#include <Reve/NLTPolygonSet.h>
3
4#include <TColor.h>
5
6#include <TGLabel.h>
7#include <TGNumberEntry.h>
8#include <TGColorSelect.h>
9#include <TGColorDialog.h>
10
11using namespace Reve;
12
13
14ClassImp(NLTPolygonSetEditor)
15
16 NLTPolygonSetEditor::NLTPolygonSetEditor(const TGWindow *p,
17 Int_t width, Int_t height,
18 UInt_t options, Pixel_t back) :
19 TGedFrame(p, width, height, options | kVerticalFrame, back),
20 fPS(0),
21 fFillColor(0),
22 fLineWidth(0),
23 fLineColor(0),
24 fZDepth()
25{
26 MakeTitle("NLTPolygonSet");
27 {
28 TGCompositeFrame *f1 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
29 TGLabel *l = new TGLabel(f1, "FillColor:");
30 f1->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 25, 2, 1, 1));
31 fFillColor = new TGColorSelect(f1, 0, -1);
32 fFillColor->Connect("ColorSelected(Pixel_t)", "Reve::NLTPolygonSetEditor", this, "DoFillColor(Pixel_t)");
33 f1->AddFrame(fFillColor, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
34 AddFrame(f1, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
35 }
36
37 {
38 TGCompositeFrame *f = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
39
40 TGLabel *l = new TGLabel(f, "LineColor:");
41 f->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 25, 2, 1, 1));
42 fLineColor = new TGColorSelect(f, 0, -1);
43 fLineColor->Connect("ColorSelected(Pixel_t)", "Reve::NLTPolygonSetEditor", this, "DoLineColor(Pixel_t)");
44 f->AddFrame(fLineColor, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
45
46 fLineWidth = new TGNumberEntry(f, 0., 6, -1,
47 TGNumberFormat::kNESRealOne, TGNumberFormat::kNEAPositive,
48 TGNumberFormat::kNELLimitMinMax, 0.1, 2000.0);
49 fLineWidth->GetNumberEntry()->SetToolTipText("Line witdth of outline.");
50 fLineWidth->Connect("ValueSet(Long_t)", "Reve::NLTPolygonSetEditor", this, "DoLineWidth()");
51 f->AddFrame(fLineWidth, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
52
53 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
54 }
55
56 {
57 TGHorizontalFrame* f = new TGHorizontalFrame(this);
58 TGLabel *l = new TGLabel(f, "Z Depth:");
59 f->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 24, 2, 1, 1));
60 fZDepth = new TGNumberEntry(f, 0., 6, -1,
61 TGNumberFormat::kNESRealOne, TGNumberFormat::kNEAPositive,
62 TGNumberFormat::kNELLimitMinMax, 0.1, 2000.0);
63 fZDepth->GetNumberEntry()->SetToolTipText("Maximum z-coordinate to which the tracks will be drawn.");
64 f->AddFrame(fZDepth, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
65 fZDepth->Connect("ValueSet(Long_t)", "Reve::NLTPolygonSetEditor", this, "DoZDepth()");
66 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
67 }
68
69}
70
71
72/**************************************************************************/
73NLTPolygonSetEditor::~NLTPolygonSetEditor()
74{}
75
76/**************************************************************************/
77void NLTPolygonSetEditor::DoFillColor(Pixel_t pixel)
78{
79 printf("do fill color \n");
80 fPS->SetFillColor(pixel);
81 Update();
82}
83/**************************************************************************/
84void NLTPolygonSetEditor::DoLineWidth()
85{
86 // Double_t lw = fLineWidth->GetNumber();
87 //fPS->SetLineWidth(lw);
88 fPS->fLineWidth = fLineWidth->GetNumber();
89 Update();
90}
91
92/**************************************************************************/
93void NLTPolygonSetEditor::DoLineColor(Pixel_t pixel)
94{
95 fPS->SetLineColor(pixel);
96 Update();
97}
98
99/**************************************************************************/
100void NLTPolygonSetEditor::DoZDepth()
101{
102 fPS->fZDepth = fZDepth->GetNumber();
103 fPS->ResetBBox();
104 Update();
105}
106
107/**************************************************************************/
108
109void NLTPolygonSetEditor::SetModel(TObject* obj)
110{
111 fPS = dynamic_cast<NLTPolygonSet*>(obj);
112 fFillColor->SetColor(TColor::Number2Pixel(fPS->GetFillColor()), kFALSE);
113 fLineWidth->SetNumber(fPS->fLineWidth);
114 fLineColor->SetColor(TColor::Number2Pixel(fPS->GetLineColor()), kFALSE);
115 fZDepth->SetNumber(fPS->fZDepth);
116}