Developer documentation | Axl-2.5.1

axlInspectorObjectSceneWidgetFieldVector.cpp
Go to the documentation of this file.
1 /* axlInspectorObjectSceneWidgetFieldVector.cpp ---
2  *
3  * Author: Julien Wintz
4  * Copyright (C) 2008 - Julien Wintz, Inria.
5  * Created: Fri Dec 17 22:48:33 2010 (+0100)
6  * Version: $Id$
7  * Last-Updated: Fri Sep 9 15:41:42 2011 (+0200)
8  * By: Julien Wintz
9  * Update #: 132
10  */
11 
12 /* Commentary:
13  *
14  */
15 
16 /* Change log:
17  *
18  */
19 
23 
26 
27 #include <dtkCoreSupport/dtkGlobal.h>
28 
29 #include <QtGui>
30 
31 class axlInspectorObjectSceneWidgetFieldVectorPrivate
32 {
33 public:
34  axlAbstractField *field;
37  axlAbstractView *view;
38 
39 public:
40  QPushButton *disp_none_button;
41  QPushButton *disp_hedge_button;
42  QPushButton *disp_glyph_button;
43  QPushButton *disp_strea_button;
44 
45  QVBoxLayout *layout;
46 };
47 
48 axlInspectorObjectSceneWidgetFieldVector::axlInspectorObjectSceneWidgetFieldVector(QWidget *parent) : QWidget(parent), d(new axlInspectorObjectSceneWidgetFieldVectorPrivate)
49 {
50  d->field = NULL;
51  d->glyph = NULL;
52  d->stream = NULL;
53  d->view = NULL;
54 
55  d->disp_none_button = new QPushButton("Nothing");
56  d->disp_none_button->setCheckable(true);
57  d->disp_none_button->setChecked(false);
58  d->disp_none_button->setObjectName("overLeft");
59 
60  d->disp_hedge_button = new QPushButton("Hedgehog");
61  d->disp_hedge_button->setCheckable(true);
62  d->disp_hedge_button->setChecked(false);
63  d->disp_hedge_button->setObjectName("left");
64 
65  d->disp_glyph_button = new QPushButton("Glyphs");
66  d->disp_glyph_button->setCheckable(true);
67  d->disp_glyph_button->setChecked(false);
68  d->disp_glyph_button->setObjectName("middle");
69 
70  d->disp_strea_button = new QPushButton("Stream");
71  d->disp_strea_button->setCheckable(true);
72  d->disp_strea_button->setChecked(false);
73  d->disp_strea_button->setObjectName("right");
74 
75  QButtonGroup *disp_group = new QButtonGroup(this);
76  disp_group->addButton(d->disp_none_button);
77  disp_group->addButton(d->disp_hedge_button);
78  disp_group->addButton(d->disp_glyph_button);
79  disp_group->addButton(d->disp_strea_button);
80 
81  QHBoxLayout *disp_layout = new QHBoxLayout;
82  disp_layout->setContentsMargins(0, 0, 0, 0);
83  disp_layout->setSpacing(0);
84  disp_layout->addWidget(d->disp_none_button);
85  disp_layout->addSpacerItem(new QSpacerItem(10, 1));
86  disp_layout->addWidget(d->disp_hedge_button);
87  disp_layout->addSpacerItem(new QSpacerItem(10, 1));
88  disp_layout->addWidget(d->disp_glyph_button);
89  disp_layout->addSpacerItem(new QSpacerItem(10, 1));
90  disp_layout->addWidget(d->disp_strea_button);
91 
92  d->layout = new QVBoxLayout(this);
93  d->layout->setContentsMargins(0, 0, 0, 0);
94  d->layout->addWidget(new QLabel("Display", this));
95  d->layout->addLayout(disp_layout);
96 
97  connect(d->disp_none_button, SIGNAL(clicked()), this, SLOT(onDisplayAsNone()));
98  connect(d->disp_hedge_button, SIGNAL(clicked()), this, SLOT(onDisplayAsHedge()));
99  connect(d->disp_glyph_button, SIGNAL(clicked()), this, SLOT(onDisplayAsGlyph()));
100  connect(d->disp_strea_button, SIGNAL(clicked()), this, SLOT(onDisplayAsStream()));
101 
102 }
103 
105 {
106  delete d;
107 
108  d = NULL;
109 }
110 
112 {
113  d->field = field;
114 }
115 
117 {
118  d->view = view;
119 }
120 
122 {
123  if (d->glyph) {
124  d->layout->removeWidget(d->glyph);
125  delete d->glyph;
126  d->glyph = NULL;
127  }
128 
129  if (d->stream) {
130  d->layout->removeWidget(d->stream);
131  delete d->stream;
132  d->stream = NULL;
133  }
134 
135  emit displayAsNone();
136 }
137 
139 {
140  if (d->glyph) {
141  d->layout->removeWidget(d->glyph);
142  delete d->glyph;
143  d->glyph = NULL;
144  }
145 
146  if (d->stream) {
147  d->layout->removeWidget(d->stream);
148  delete d->stream;
149  d->stream = NULL;
150  }
151 
152  emit displayAsHedge();
153 }
154 
156 {
157  if (d->glyph) {
158  d->layout->removeWidget(d->glyph);
159  delete d->glyph;
160  d->glyph = NULL;
161  }
162 
163  if (d->stream) {
164  d->layout->removeWidget(d->stream);
165  delete d->stream;
166  d->stream = NULL;
167  }
168 
170 
171  connect(d->glyph, SIGNAL(glyphScaleValueChanged(double)), this, SIGNAL(glyphScaleValueChanged(double)));
172 
173  d->layout->addWidget(d->glyph);
174 
175  emit displayAsGlyph();
176 }
177 
179 {
180  if (d->glyph) {
181  d->layout->removeWidget(d->glyph);
182  delete d->glyph;
183  d->glyph = NULL;
184  }
185 
186  if (d->stream) {
187  d->layout->removeWidget(d->stream);
188  delete d->stream;
189  d->stream = NULL;
190  }
191 
193 
194  connect(d->stream, SIGNAL(streamRadiusValueChanged(double)), this, SIGNAL(streamRadiusValueChanged(double)));
195  connect(d->stream, SIGNAL(streamPropagationValueChanged(double)), this, SIGNAL(streamPropagationValueChanged(double)));
196  connect(d->stream, SIGNAL(streamDirectionValueChanged(int)), this, SIGNAL(streamDirectionValueChanged(int)));
197 
198  d->layout->addWidget(d->stream);
199 
200  emit displayAsStream();
201 }
Class axlAbstractField defines an API for arrays of numeric data.