5 #include "AlignPlugin.hh"
9 sourceMeshCombo_ =
new QComboBox;
10 sourceMeshCombo_->setModel(&sourceMeshList_);
11 connect(sourceMeshCombo_, SIGNAL(currentIndexChanged(
int)),
12 this, SLOT(slotSourceMeshChanged(
int)));
14 targetMeshCombo_ =
new QComboBox;
15 targetMeshCombo_->setModel(&targetMeshList_);
16 connect(targetMeshCombo_, SIGNAL(currentIndexChanged(
int)),
17 this, SLOT(slotTargetMeshChanged(
int)));
19 doScaleCheckBox_ =
new QCheckBox(tr(
"Scale to target's bounding box"));
20 doScaleCheckBox_->setChecked(
true);
22 alignMeshesButton_ =
new QPushButton(tr(
"Align meshes"));
23 connect(alignMeshesButton_, SIGNAL(clicked()),
24 this, SLOT(slotAlignMeshes()));
26 QFormLayout *layout =
new QFormLayout;
27 layout->addRow(
new QLabel(
"Source mesh"), sourceMeshCombo_);
28 layout->addRow(
new QLabel(
"Target mesh"), targetMeshCombo_);
29 layout->addRow(doScaleCheckBox_);
30 layout->addRow(alignMeshesButton_);
32 QWidget *toolbox =
new QWidget;
33 toolbox->setLayout(layout);
37 emit addToolbox(tr(
"Align"), toolbox, NULL);
40 void AlignPlugin::pluginsInitialized()
44 void AlignPlugin::slotSourceMeshChanged(
int objectId)
46 sourceId_ = sourceMeshCombo_->itemData(sourceMeshCombo_->currentIndex()).toInt();
50 void AlignPlugin::slotTargetMeshChanged(
int objectId)
52 targetId_ = targetMeshCombo_->itemData(targetMeshCombo_->currentIndex()).toInt();
56 void AlignPlugin::slotObjectSelectionChanged(
int)
58 sourceMeshList_.refresh();
59 targetMeshList_.refresh();
63 void AlignPlugin::slotObjectUpdated(
int,
UpdateType const&)
65 sourceMeshList_.refresh();
66 targetMeshList_.refresh();
70 void AlignPlugin::objectDeleted(
int objectId)
72 sourceMeshList_.removeObject(objectId);
73 targetMeshList_.removeObject(objectId);
75 if (objectId == sourceId_) {
77 sourceMeshCombo_->setCurrentIndex(-1);
80 if (objectId == targetId_) {
82 targetMeshCombo_->setCurrentIndex(-1);
88 void AlignPlugin::updateGui()
90 alignMeshesButton_->setEnabled(sourceId_ != -1 && targetId_ != -1);