55 #include "QtCoordFrameDialog.hh" 56 #include "../Scenegraph/CoordFrameNode.hh" 70 QtCoordFrameDialog( QWidget* _parent,
71 SceneGraph::CoordFrameNode* _node,
74 : QDialog(_parent, _fl),
80 connect( ui_.OkButton, SIGNAL( clicked() ),
this, SLOT( apply_changes() ) );
81 connect( ui_.OkButton, SIGNAL( clicked() ),
this, SLOT( accept() ) );
82 connect( ui_.ApplyButton, SIGNAL( clicked() ),
this, SLOT( apply_changes() ) );
83 connect( ui_.CancelButton, SIGNAL( clicked() ),
this, SLOT( reject() ) );
84 connect( ui_.CancelButton, SIGNAL( clicked() ),
this, SLOT( undo_changes() ) );
85 connect( ui_.x_add_button, SIGNAL( clicked() ),
this, SLOT( add_x_plane() ) );
86 connect( ui_.x_mod_button, SIGNAL( clicked() ),
this, SLOT( mod_x_plane() ) );
87 connect( ui_.x_del_button, SIGNAL( clicked() ),
this, SLOT( del_x_plane() ) );
88 connect( ui_.y_add_button, SIGNAL( clicked() ),
this, SLOT( add_y_plane() ) );
89 connect( ui_.y_mod_button, SIGNAL( clicked() ),
this, SLOT( mod_y_plane() ) );
90 connect( ui_.y_del_button, SIGNAL( clicked() ),
this, SLOT( del_y_plane() ) );
91 connect( ui_.z_add_button, SIGNAL( clicked() ),
this, SLOT( add_z_plane() ) );
92 connect( ui_.z_mod_button, SIGNAL( clicked() ),
this, SLOT( mod_z_plane() ) );
93 connect( ui_.z_del_button, SIGNAL( clicked() ),
this, SLOT( del_z_plane() ) );
103 QtCoordFrameDialog::show()
114 QtCoordFrameDialog::update_values()
116 x_planes_bak_ = node_->x_planes();
117 y_planes_bak_ = node_->y_planes();
118 z_planes_bak_ = node_->z_planes();
120 planes2combo(x_planes_bak_, ui_.x_combobox);
121 planes2combo(y_planes_bak_, ui_.y_combobox);
122 planes2combo(z_planes_bak_, ui_.z_combobox);
127 title = ( QString(
"X-Planes: [") +
128 s.setNum(node_->bb_min()[0],
'f', 4) +
130 s.setNum(node_->bb_max()[0],
'f', 4) +
132 ui_.x_groupbox->setTitle(title);
134 title = ( QString(
"Y-Planes: [") +
135 s.setNum(node_->bb_min()[1],
'f', 4) +
137 s.setNum(node_->bb_max()[1],
'f', 4) +
139 ui_.y_groupbox->setTitle(title);
141 title = ( QString(
"Z-Planes: [") +
142 s.setNum(node_->bb_min()[2],
'f', 4) +
144 s.setNum(node_->bb_max()[2],
'f', 4) +
146 ui_.z_groupbox->setTitle(title);
154 QtCoordFrameDialog::combo2planes(
const QComboBox* _combo,
155 std::vector<float>& _planes)
157 unsigned int i(0), N(_combo->count());
163 _planes.push_back(_combo->itemText(i).toFloat());
168 QtCoordFrameDialog::planes2combo(
const std::vector<float>& _planes,
171 std::vector<float>::const_iterator p_it, p_end;
175 for (p_it=_planes.begin(), p_end=_planes.end(); p_it!=p_end; ++p_it)
176 _combo->addItem(s.setNum(*p_it,
'f', 3));
183 void QtCoordFrameDialog::apply_changes()
185 std::vector<float> planes;
187 combo2planes(ui_.x_combobox, planes);
188 node_->set_x_planes(planes);
190 combo2planes(ui_.y_combobox, planes);
191 node_->set_y_planes(planes);
193 combo2planes(ui_.z_combobox, planes);
194 node_->set_z_planes(planes);
196 emit signalNodeChanged(node_);
203 void QtCoordFrameDialog::undo_changes()
205 node_->set_x_planes(x_planes_bak_);
206 node_->set_y_planes(y_planes_bak_);
207 node_->set_z_planes(z_planes_bak_);
209 emit signalNodeChanged(node_);
216 void QtCoordFrameDialog::add_x_plane()
218 ui_.x_combobox->addItem(ui_.x_combobox->currentText());
222 void QtCoordFrameDialog::mod_x_plane()
224 ui_.x_combobox->setItemText(ui_.x_combobox->currentIndex(),ui_.x_combobox->currentText());
228 void QtCoordFrameDialog::del_x_plane()
230 ui_.x_combobox->removeItem(ui_.x_combobox->currentIndex());
238 void QtCoordFrameDialog::add_y_plane()
240 ui_.y_combobox->addItem(ui_.y_combobox->currentText());
244 void QtCoordFrameDialog::mod_y_plane()
246 ui_.y_combobox->setItemText(ui_.y_combobox->currentIndex(),ui_.y_combobox->currentText());
250 void QtCoordFrameDialog::del_y_plane()
252 ui_.y_combobox->removeItem(ui_.y_combobox->currentIndex());
260 void QtCoordFrameDialog::add_z_plane()
262 ui_.z_combobox->addItem(ui_.z_combobox->currentText());
266 void QtCoordFrameDialog::mod_z_plane()
268 ui_.z_combobox->setItemText(ui_.z_combobox->currentIndex(),ui_.z_combobox->currentText());
272 void QtCoordFrameDialog::del_z_plane()
274 ui_.z_combobox->removeItem(ui_.z_combobox->currentIndex());
Namespace providing different geometric functions concerning angles.