61 #include "QtCoordFrameDialog.hh"
62 #include "../Scenegraph/CoordFrameNode.hh"
76 QtCoordFrameDialog( QWidget* _parent,
77 SceneGraph::CoordFrameNode* _node,
80 : QDialog(_parent, _fl),
86 connect( ui_.OkButton, SIGNAL( clicked() ),
this, SLOT( apply_changes() ) );
87 connect( ui_.OkButton, SIGNAL( clicked() ),
this, SLOT( accept() ) );
88 connect( ui_.ApplyButton, SIGNAL( clicked() ),
this, SLOT( apply_changes() ) );
89 connect( ui_.CancelButton, SIGNAL( clicked() ),
this, SLOT( reject() ) );
90 connect( ui_.CancelButton, SIGNAL( clicked() ),
this, SLOT( undo_changes() ) );
91 connect( ui_.x_add_button, SIGNAL( clicked() ),
this, SLOT( add_x_plane() ) );
92 connect( ui_.x_mod_button, SIGNAL( clicked() ),
this, SLOT( mod_x_plane() ) );
93 connect( ui_.x_del_button, SIGNAL( clicked() ),
this, SLOT( del_x_plane() ) );
94 connect( ui_.y_add_button, SIGNAL( clicked() ),
this, SLOT( add_y_plane() ) );
95 connect( ui_.y_mod_button, SIGNAL( clicked() ),
this, SLOT( mod_y_plane() ) );
96 connect( ui_.y_del_button, SIGNAL( clicked() ),
this, SLOT( del_y_plane() ) );
97 connect( ui_.z_add_button, SIGNAL( clicked() ),
this, SLOT( add_z_plane() ) );
98 connect( ui_.z_mod_button, SIGNAL( clicked() ),
this, SLOT( mod_z_plane() ) );
99 connect( ui_.z_del_button, SIGNAL( clicked() ),
this, SLOT( del_z_plane() ) );
109 QtCoordFrameDialog::show()
120 QtCoordFrameDialog::update_values()
122 x_planes_bak_ = node_->x_planes();
123 y_planes_bak_ = node_->y_planes();
124 z_planes_bak_ = node_->z_planes();
126 planes2combo(x_planes_bak_, ui_.x_combobox);
127 planes2combo(y_planes_bak_, ui_.y_combobox);
128 planes2combo(z_planes_bak_, ui_.z_combobox);
133 title = ( QString(
"X-Planes: [") +
134 s.setNum(node_->bb_min()[0],
'f', 4) +
136 s.setNum(node_->bb_max()[0],
'f', 4) +
138 ui_.x_groupbox->setTitle(title);
140 title = ( QString(
"Y-Planes: [") +
141 s.setNum(node_->bb_min()[1],
'f', 4) +
143 s.setNum(node_->bb_max()[1],
'f', 4) +
145 ui_.y_groupbox->setTitle(title);
147 title = ( QString(
"Z-Planes: [") +
148 s.setNum(node_->bb_min()[2],
'f', 4) +
150 s.setNum(node_->bb_max()[2],
'f', 4) +
152 ui_.z_groupbox->setTitle(title);
160 QtCoordFrameDialog::combo2planes(
const QComboBox* _combo,
161 std::vector<float>& _planes)
163 unsigned int i(0), N(_combo->count());
169 _planes.push_back(_combo->itemText(i).toFloat());
174 QtCoordFrameDialog::planes2combo(
const std::vector<float>& _planes,
177 std::vector<float>::const_iterator p_it, p_end;
181 for (p_it=_planes.begin(), p_end=_planes.end(); p_it!=p_end; ++p_it)
182 _combo->addItem(s.setNum(*p_it,
'f', 3));
189 void QtCoordFrameDialog::apply_changes()
191 std::vector<float> planes;
193 combo2planes(ui_.x_combobox, planes);
194 node_->set_x_planes(planes);
196 combo2planes(ui_.y_combobox, planes);
197 node_->set_y_planes(planes);
199 combo2planes(ui_.z_combobox, planes);
200 node_->set_z_planes(planes);
202 emit signalNodeChanged(node_);
209 void QtCoordFrameDialog::undo_changes()
211 node_->set_x_planes(x_planes_bak_);
212 node_->set_y_planes(y_planes_bak_);
213 node_->set_z_planes(z_planes_bak_);
215 emit signalNodeChanged(node_);
222 void QtCoordFrameDialog::add_x_plane()
224 ui_.x_combobox->addItem(ui_.x_combobox->currentText());
228 void QtCoordFrameDialog::mod_x_plane()
230 ui_.x_combobox->setItemText(ui_.x_combobox->currentIndex(),ui_.x_combobox->currentText());
234 void QtCoordFrameDialog::del_x_plane()
236 ui_.x_combobox->removeItem(ui_.x_combobox->currentIndex());
244 void QtCoordFrameDialog::add_y_plane()
246 ui_.y_combobox->addItem(ui_.y_combobox->currentText());
250 void QtCoordFrameDialog::mod_y_plane()
252 ui_.y_combobox->setItemText(ui_.y_combobox->currentIndex(),ui_.y_combobox->currentText());
256 void QtCoordFrameDialog::del_y_plane()
258 ui_.y_combobox->removeItem(ui_.y_combobox->currentIndex());
266 void QtCoordFrameDialog::add_z_plane()
268 ui_.z_combobox->addItem(ui_.z_combobox->currentText());
272 void QtCoordFrameDialog::mod_z_plane()
274 ui_.z_combobox->setItemText(ui_.z_combobox->currentIndex(),ui_.z_combobox->currentText());
278 void QtCoordFrameDialog::del_z_plane()
280 ui_.z_combobox->removeItem(ui_.z_combobox->currentIndex());
Namespace providing different geometric functions concerning angles.