Attacher: add superPlacement to UI

Expose superPlacement as X,Y,Z,yaw,pitch,roll quantity boxes. With partial expression support.
This commit is contained in:
DeepSOIC 2016-05-05 16:30:25 +03:00 committed by wmayer
parent 472af4bf59
commit 2f6aaf3742
3 changed files with 312 additions and 187 deletions

View File

@ -40,6 +40,8 @@
#include <App/Origin.h> #include <App/Origin.h>
#include <App/OriginFeature.h> #include <App/OriginFeature.h>
#include <App/Part.h> #include <App/Part.h>
#include <App/ObjectIdentifier.h>
#include <App/PropertyExpressionEngine.h>
#include <Gui/Application.h> #include <Gui/Application.h>
#include <Gui/Document.h> #include <Gui/Document.h>
#include <Gui/BitmapFactory.h> #include <Gui/BitmapFactory.h>
@ -120,14 +122,12 @@ TaskDatumParameters::TaskDatumParameters(ViewProviderDatum *DatumView,QWidget *p
ui->setupUi(proxy); ui->setupUi(proxy);
QMetaObject::connectSlotsByName(this); QMetaObject::connectSlotsByName(this);
connect(ui->spinOffset, SIGNAL(valueChanged(double)), connect(ui->superplacementX, SIGNAL(valueChanged(double)), this, SLOT(onSuperplacementXChanged(double)));
this, SLOT(onOffsetChanged(double))); connect(ui->superplacementY, SIGNAL(valueChanged(double)), this, SLOT(onSuperplacementYChanged(double)));
connect(ui->spinOffset2, SIGNAL(valueChanged(double)), connect(ui->superplacementZ, SIGNAL(valueChanged(double)), this, SLOT(onSuperplacementZChanged(double)));
this, SLOT(onOffset2Changed(double))); connect(ui->superplacementYaw, SIGNAL(valueChanged(double)), this, SLOT(onSuperplacementYawChanged(double)));
connect(ui->spinOffset3, SIGNAL(valueChanged(double)), connect(ui->superplacementPitch, SIGNAL(valueChanged(double)), this, SLOT(onSuperplacementPitchChanged(double)));
this, SLOT(onOffset3Changed(double))); connect(ui->superplacementRoll, SIGNAL(valueChanged(double)), this, SLOT(onSuperplacementRollChanged(double)));
connect(ui->spinAngle, SIGNAL(valueChanged(double)),
this, SLOT(onAngleChanged(double)));
connect(ui->checkBoxFlip, SIGNAL(toggled(bool)), connect(ui->checkBoxFlip, SIGNAL(toggled(bool)),
this, SLOT(onCheckFlip(bool))); this, SLOT(onCheckFlip(bool)));
connect(ui->buttonRef1, SIGNAL(clicked(bool)), connect(ui->buttonRef1, SIGNAL(clicked(bool)),
@ -152,10 +152,6 @@ TaskDatumParameters::TaskDatumParameters(ViewProviderDatum *DatumView,QWidget *p
this->groupLayout()->addWidget(proxy); this->groupLayout()->addWidget(proxy);
// Temporarily prevent unnecessary feature recomputes // Temporarily prevent unnecessary feature recomputes
ui->spinOffset->blockSignals(true);
ui->spinOffset2->blockSignals(true);
ui->spinOffset3->blockSignals(true);
ui->spinAngle->blockSignals(true);
ui->checkBoxFlip->blockSignals(true); ui->checkBoxFlip->blockSignals(true);
ui->buttonRef1->blockSignals(true); ui->buttonRef1->blockSignals(true);
ui->lineRef1->blockSignals(true); ui->lineRef1->blockSignals(true);
@ -172,20 +168,7 @@ TaskDatumParameters::TaskDatumParameters(ViewProviderDatum *DatumView,QWidget *p
//std::vector<App::DocumentObject*> refs = pcDatum->Support.getValues(); //std::vector<App::DocumentObject*> refs = pcDatum->Support.getValues();
std::vector<std::string> refnames = pcDatum->Support.getSubValues(); std::vector<std::string> refnames = pcDatum->Support.getSubValues();
//bool checked1 = pcDatum->Checked.getValue(); ui->checkBoxFlip->setChecked(pcDatum->MapReversed.getValue());
double offset = pcDatum->superPlacement.getValue().getPosition().z;
double offset2 = pcDatum->superPlacement.getValue().getPosition().y;
double offset3 = pcDatum->superPlacement.getValue().getPosition().x;
double angle = 0;
Base::Vector3d val;
pcDatum->superPlacement.getValue().getRotation().getValue(val, angle);
// Fill data into dialog elements
ui->spinOffset->setValue(offset);
ui->spinOffset2->setValue(offset2);
ui->spinOffset3->setValue(offset3);
ui->spinAngle->setValue(angle);
//ui->checkBoxFlip->setChecked(checked1);
std::vector<QString> refstrings; std::vector<QString> refstrings;
makeRefStrings(refstrings, refnames); makeRefStrings(refstrings, refnames);
ui->lineRef1->setText(refstrings[0]); ui->lineRef1->setText(refstrings[0]);
@ -198,10 +181,6 @@ TaskDatumParameters::TaskDatumParameters(ViewProviderDatum *DatumView,QWidget *p
ui->lineRef4->setProperty("RefName", QByteArray(refnames[3].c_str())); ui->lineRef4->setProperty("RefName", QByteArray(refnames[3].c_str()));
// activate and de-activate dialog elements as appropriate // activate and de-activate dialog elements as appropriate
ui->spinOffset->blockSignals(false);
ui->spinOffset2->blockSignals(false);
ui->spinOffset3->blockSignals(false);
ui->spinAngle->blockSignals(false);
ui->checkBoxFlip->blockSignals(false); ui->checkBoxFlip->blockSignals(false);
ui->buttonRef1->blockSignals(false); ui->buttonRef1->blockSignals(false);
ui->lineRef1->blockSignals(false); ui->lineRef1->blockSignals(false);
@ -220,7 +199,11 @@ TaskDatumParameters::TaskDatumParameters(ViewProviderDatum *DatumView,QWidget *p
autoNext = false; autoNext = false;
} }
updateUI(); ui->superplacementX->bind(App::ObjectIdentifier::parse(pcDatum,std::string("superPlacement.Base.x")));
ui->superplacementY->bind(App::ObjectIdentifier::parse(pcDatum,std::string("superPlacement.Base.y")));
ui->superplacementZ->bind(App::ObjectIdentifier::parse(pcDatum,std::string("superPlacement.Base.z")));
updateSuperplacementUI();
updateReferencesUI();
updateListOfModes(eMapMode(pcDatum->MapMode.getValue())); updateListOfModes(eMapMode(pcDatum->MapMode.getValue()));
updatePreview(); updatePreview();
@ -290,22 +273,10 @@ const QString makeHintText(std::set<eRefType> hint)
return result; return result;
} }
void TaskDatumParameters::updateUI() void TaskDatumParameters::updateReferencesUI()
{ {
ui->checkBoxFlip->setVisible(false);
ui->labelOffset->setVisible(true);
ui->spinOffset->setVisible(true);
ui->labelOffset2->setVisible(true);
ui->spinOffset2->setVisible(true);
ui->labelOffset3->setVisible(true);
ui->spinOffset3->setVisible(true);
Part::Datum* pcDatum = static_cast<Part::Datum*>(DatumView->getObject()); Part::Datum* pcDatum = static_cast<Part::Datum*>(DatumView->getObject());
if (pcDatum->isDerivedFrom(Part::Datum::getClassTypeId())) {
ui->labelAngle->setVisible(true);
ui->spinAngle->setVisible(true);
}
std::vector<App::DocumentObject*> refs = pcDatum->Support.getValues(); std::vector<App::DocumentObject*> refs = pcDatum->Support.getValues();
completed = false; completed = false;
@ -326,13 +297,6 @@ void TaskDatumParameters::updateUI()
completed = true; completed = true;
} }
double angle = 0;
Base::Vector3d val;
pcDatum->superPlacement.getValue().getRotation().getValue(val, angle);
ui->labelAngle->setEnabled(true);
ui->spinAngle->setEnabled(true);
updateRefButton(0); updateRefButton(0);
updateRefButton(1); updateRefButton(1);
updateRefButton(2); updateRefButton(2);
@ -343,6 +307,7 @@ bool TaskDatumParameters::updatePreview()
{ {
Part::Datum* pcDatum = static_cast<Part::Datum*>(DatumView->getObject()); Part::Datum* pcDatum = static_cast<Part::Datum*>(DatumView->getObject());
QString errMessage; QString errMessage;
bool attached;
try{ try{
pcDatum->positionBySupport(); pcDatum->positionBySupport();
} catch (Base::Exception &err){ } catch (Base::Exception &err){
@ -355,18 +320,22 @@ bool TaskDatumParameters::updatePreview()
if (errMessage.length()>0){ if (errMessage.length()>0){
ui->message->setText(tr("Attachment mode failed: %1").arg(errMessage)); ui->message->setText(tr("Attachment mode failed: %1").arg(errMessage));
ui->message->setStyleSheet(QString::fromLatin1("QLabel{color: red;}")); ui->message->setStyleSheet(QString::fromLatin1("QLabel{color: red;}"));
return false; attached = false;
} else { } else {
if (pcDatum->MapMode.getValue() == mmDeactivated){ if (pcDatum->MapMode.getValue() == mmDeactivated){
ui->message->setText(tr("Not attached")); ui->message->setText(tr("Not attached"));
ui->message->setStyleSheet(QString()); ui->message->setStyleSheet(QString());
attached = false;
} else { } else {
std::vector<QString> strs = AttacherGui::getUIStrings(pcDatum->attacher().getTypeId(),eMapMode(pcDatum->MapMode.getValue())); std::vector<QString> strs = AttacherGui::getUIStrings(pcDatum->attacher().getTypeId(),eMapMode(pcDatum->MapMode.getValue()));
ui->message->setText(tr("Attached with mode %1").arg(strs[0])); ui->message->setText(tr("Attached with mode %1").arg(strs[0]));
ui->message->setStyleSheet(QString::fromLatin1("QLabel{color: green;}")); ui->message->setStyleSheet(QString::fromLatin1("QLabel{color: green;}"));
attached = true;
} }
return true;
} }
QString splmLabelText = attached ? tr("Extra placement:") : tr("Extra placement (inactive - not attached):");
ui->label_superplacement->setText(splmLabelText);
return attached;
} }
QLineEdit* TaskDatumParameters::getLine(unsigned idx) QLineEdit* TaskDatumParameters::getLine(unsigned idx)
@ -460,60 +429,73 @@ void TaskDatumParameters::onSelectionChanged(const Gui::SelectionChanges& msg)
} }
} }
updateUI(); updateReferencesUI();
} }
} }
void TaskDatumParameters::onOffsetChanged(double val) void TaskDatumParameters::onSuperplacementChanged(double val, int idx)
{ {
Part::Datum* pcDatum = static_cast<Part::Datum*>(DatumView->getObject()); Part::Datum* pcDatum = static_cast<Part::Datum*>(DatumView->getObject());
Base::Placement pl = pcDatum->superPlacement.getValue(); Base::Placement pl = pcDatum->superPlacement.getValue();
Base::Vector3d pos = pl.getPosition();
pos.z = val;
pl.setPosition(pos);
pcDatum->superPlacement.setValue(pl);
pcDatum->getDocument()->recomputeFeature(pcDatum);
updateUI();
}
void TaskDatumParameters::onOffset2Changed(double val)
{
Part::Datum* pcDatum = static_cast<Part::Datum*>(DatumView->getObject());
Base::Placement pl = pcDatum->superPlacement.getValue();
Base::Vector3d pos = pl.getPosition(); Base::Vector3d pos = pl.getPosition();
pos.y = val; if (idx == 0) {
pl.setPosition(pos); pos.x = ui->superplacementX->value().getValueAs(Base::Quantity::MilliMetre);
pcDatum->superPlacement.setValue(pl); }
pcDatum->getDocument()->recomputeFeature(pcDatum); if (idx == 1) {
updateUI(); pos.y = ui->superplacementY->value().getValueAs(Base::Quantity::MilliMetre);
} }
if (idx == 2) {
pos.z = ui->superplacementZ->value().getValueAs(Base::Quantity::MilliMetre);
}
if (idx >= 0 && idx <= 2){
pl.setPosition(pos);
}
void TaskDatumParameters::onOffset3Changed(double val)
{
Part::Datum* pcDatum = static_cast<Part::Datum*>(DatumView->getObject());
Base::Placement pl = pcDatum->superPlacement.getValue();
Base::Vector3d pos = pl.getPosition();
pos.x = val;
pl.setPosition(pos);
pcDatum->superPlacement.setValue(pl);
pcDatum->getDocument()->recomputeFeature(pcDatum);
updateUI();
}
void TaskDatumParameters::onAngleChanged(double val)
{
Part::Datum* pcDatum = static_cast<Part::Datum*>(DatumView->getObject());
Base::Placement pl = pcDatum->superPlacement.getValue();
Base::Rotation rot = pl.getRotation(); Base::Rotation rot = pl.getRotation();
Base::Vector3d ax; double yaw, pitch, roll;
double ang; rot.getYawPitchRoll(yaw, pitch, roll);
rot.getValue(ax,ang); if (idx == 3) {
ang = val; yaw = ui->superplacementYaw->value().getValueAs(Base::Quantity::Degree);
rot.setValue(ax,ang); }
pl.setRotation(rot); if (idx == 4) {
pitch = ui->superplacementPitch->value().getValueAs(Base::Quantity::Degree);
}
if (idx == 5) {
roll = ui->superplacementRoll->value().getValueAs(Base::Quantity::Degree);
}
if (idx >= 3 && idx <= 5){
rot.setYawPitchRoll(yaw,pitch,roll);
pl.setRotation(rot);
}
pcDatum->superPlacement.setValue(pl); pcDatum->superPlacement.setValue(pl);
pcDatum->getDocument()->recomputeFeature(pcDatum); updatePreview();
updateUI(); }
void TaskDatumParameters::onSuperplacementXChanged(double val)
{
onSuperplacementChanged(val, 0);
}
void TaskDatumParameters::onSuperplacementYChanged(double val)
{
onSuperplacementChanged(val, 1);
}
void TaskDatumParameters::onSuperplacementZChanged(double val)
{
onSuperplacementChanged(val, 2);
}
void TaskDatumParameters::onSuperplacementYawChanged(double val)
{
onSuperplacementChanged(val, 3);
}
void TaskDatumParameters::onSuperplacementPitchChanged(double val)
{
onSuperplacementChanged(val, 4);
}
void TaskDatumParameters::onSuperplacementRollChanged(double val)
{
onSuperplacementChanged(val, 5);
} }
void TaskDatumParameters::onCheckFlip(bool on) void TaskDatumParameters::onCheckFlip(bool on)
@ -594,7 +576,7 @@ void TaskDatumParameters::onRefName(const QString& text, unsigned idx)
ui->lineRef3->setProperty("RefName", QByteArray(newrefnames[2].c_str())); ui->lineRef3->setProperty("RefName", QByteArray(newrefnames[2].c_str()));
ui->lineRef4->setText(refstrings[3]); ui->lineRef4->setText(refstrings[3]);
ui->lineRef4->setProperty("RefName", QByteArray(newrefnames[3].c_str())); ui->lineRef4->setProperty("RefName", QByteArray(newrefnames[3].c_str()));
updateUI(); updateReferencesUI();
return; return;
} }
@ -662,7 +644,7 @@ void TaskDatumParameters::onRefName(const QString& text, unsigned idx)
updateListOfModes(); updateListOfModes();
pcDatum->MapMode.setValue(getActiveMapMode()); pcDatum->MapMode.setValue(getActiveMapMode());
updateUI(); updateReferencesUI();
} }
void TaskDatumParameters::updateRefButton(int idx) void TaskDatumParameters::updateRefButton(int idx)
@ -698,6 +680,59 @@ void TaskDatumParameters::updateRefButton(int idx)
} }
} }
void TaskDatumParameters::updateSuperplacementUI()
{
Part::Datum* pcDatum = static_cast<Part::Datum*>(DatumView->getObject());
Base::Placement pl = pcDatum->superPlacement.getValue();
Base::Vector3d pos = pl.getPosition();
Base::Rotation rot = pl.getRotation();
double yaw, pitch, roll;
rot.getYawPitchRoll(yaw, pitch, roll);
bool bBlock = true;
ui->superplacementX->blockSignals(bBlock);
ui->superplacementY->blockSignals(bBlock);
ui->superplacementZ->blockSignals(bBlock);
ui->superplacementYaw->blockSignals(bBlock);
ui->superplacementPitch->blockSignals(bBlock);
ui->superplacementRoll->blockSignals(bBlock);
ui->superplacementX->setValue(Base::Quantity(pos.x,Base::Unit::Length));
ui->superplacementY->setValue(Base::Quantity(pos.y,Base::Unit::Length));
ui->superplacementZ->setValue(Base::Quantity(pos.z,Base::Unit::Length));
ui->superplacementYaw->setValue(yaw);
ui->superplacementPitch->setValue(pitch);
ui->superplacementRoll->setValue(roll);
auto expressions = pcDatum->ExpressionEngine.getExpressions();
bool bRotationBound = false;
bRotationBound = bRotationBound ||
expressions.find(App::ObjectIdentifier::parse(pcDatum,std::string("superPlacement.Rotation.Angle"))) != expressions.end();
bRotationBound = bRotationBound ||
expressions.find(App::ObjectIdentifier::parse(pcDatum,std::string("superPlacement.Rotation.Axis.x"))) != expressions.end();
bRotationBound = bRotationBound ||
expressions.find(App::ObjectIdentifier::parse(pcDatum,std::string("superPlacement.Rotation.Axis.y"))) != expressions.end();
bRotationBound = bRotationBound ||
expressions.find(App::ObjectIdentifier::parse(pcDatum,std::string("superPlacement.Rotation.Axis.z"))) != expressions.end();
ui->superplacementYaw->setEnabled(!bRotationBound);
ui->superplacementPitch->setEnabled(!bRotationBound);
ui->superplacementRoll->setEnabled(!bRotationBound);
QString tooltip = bRotationBound ? tr("Not editable because rotation part of superplacement is bound by expressions.") : QString();
ui->superplacementYaw->setToolTip(tooltip);
ui->superplacementPitch->setToolTip(tooltip);
ui->superplacementRoll->setToolTip(tooltip);
bBlock = false;
ui->superplacementX->blockSignals(bBlock);
ui->superplacementY->blockSignals(bBlock);
ui->superplacementZ->blockSignals(bBlock);
ui->superplacementYaw->blockSignals(bBlock);
ui->superplacementPitch->blockSignals(bBlock);
ui->superplacementRoll->blockSignals(bBlock);
}
void TaskDatumParameters::updateListOfModes(eMapMode curMode) void TaskDatumParameters::updateListOfModes(eMapMode curMode)
{ {
//first up, remember currently selected mode. //first up, remember currently selected mode.
@ -807,25 +842,6 @@ void TaskDatumParameters::onRefName4(const QString &text)
onRefName(text, 3); onRefName(text, 3);
} }
double TaskDatumParameters::getOffset() const
{
return ui->spinOffset->value();
}
double TaskDatumParameters::getOffset2() const
{
return ui->spinOffset2->value();
}
double TaskDatumParameters::getOffset3() const
{
return ui->spinOffset3->value();
}
double TaskDatumParameters::getAngle() const
{
return ui->spinAngle->value();
}
bool TaskDatumParameters::getFlip() const bool TaskDatumParameters::getFlip() const
{ {
@ -836,10 +852,6 @@ void TaskDatumParameters::changeEvent(QEvent *e)
{ {
TaskBox::changeEvent(e); TaskBox::changeEvent(e);
if (e->type() == QEvent::LanguageChange) { if (e->type() == QEvent::LanguageChange) {
ui->spinOffset->blockSignals(true);
ui->spinOffset2->blockSignals(true);
ui->spinOffset3->blockSignals(true);
ui->spinAngle->blockSignals(true);
ui->checkBoxFlip->blockSignals(true); ui->checkBoxFlip->blockSignals(true);
ui->buttonRef1->blockSignals(true); ui->buttonRef1->blockSignals(true);
ui->lineRef1->blockSignals(true); ui->lineRef1->blockSignals(true);
@ -859,12 +871,7 @@ void TaskDatumParameters::changeEvent(QEvent *e)
ui->lineRef3->setText(refstrings[2]); ui->lineRef3->setText(refstrings[2]);
ui->lineRef3->setText(refstrings[3]); ui->lineRef3->setText(refstrings[3]);
updateListOfModes(); updateListOfModes();
// TODO: Translate DatumView->datumType ?
ui->spinOffset->blockSignals(false);
ui->spinOffset2->blockSignals(false);
ui->spinOffset3->blockSignals(false);
ui->spinAngle->blockSignals(false);
ui->checkBoxFlip->blockSignals(false); ui->checkBoxFlip->blockSignals(false);
ui->buttonRef1->blockSignals(false); ui->buttonRef1->blockSignals(false);
ui->lineRef1->blockSignals(false); ui->lineRef1->blockSignals(false);
@ -974,16 +981,22 @@ bool TaskDlgDatumParameters::accept()
} }
try { try {
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.superPlacement.Base.z = %f",name.c_str(),parameter->getOffset()); //DeepSOIC: changed this to heavily rely on dialog constantly updating feature properties
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.superPlacement.Base.y = %f",name.c_str(),parameter->getOffset2()); if (pcDatum->superPlacement.isTouched()){
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.superPlacement.Base.x = %f",name.c_str(),parameter->getOffset3()); Base::Placement plm = pcDatum->superPlacement.getValue();
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.superPlacement.Rotation.Angle = %f",name.c_str(),parameter->getAngle()); double yaw, pitch, roll;
//Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Checked = %i",name.c_str(),parameter->getCheckBox1()?1:0); plm.getRotation().getYawPitchRoll(yaw,pitch,roll);
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.superPlacement = App.Placement(App.Vector(%.10f, %.10f, %.10f), App.Rotation(%.10f, %.10f, %.10f))",
name.c_str(),
plm.getPosition().x, plm.getPosition().y, plm.getPosition().z,
yaw, pitch, roll);
}
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.MapReversed = %s", name.c_str(), pcDatum->MapReversed.getValue() ? "True" : "False");
//here it is assumed that the support was already assigned, it just outputs a dummy Python command to the console
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Support = %s", name.c_str(), pcDatum->Support.getPyReprString().c_str()); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Support = %s", name.c_str(), pcDatum->Support.getPyReprString().c_str());
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.MapMode = '%s'", name.c_str(), AttachEngine::getModeName(parameter->getActiveMapMode()).c_str()); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.MapMode = '%s'", name.c_str(), AttachEngine::getModeName(eMapMode(pcDatum->MapMode.getValue())).c_str());
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()"); Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()");
if (!DatumView->getObject()->isValid()) if (!DatumView->getObject()->isValid())

View File

@ -54,10 +54,6 @@ public:
TaskDatumParameters(ViewProviderDatum *DatumView,QWidget *parent = 0); TaskDatumParameters(ViewProviderDatum *DatumView,QWidget *parent = 0);
~TaskDatumParameters(); ~TaskDatumParameters();
double getOffset(void) const;
double getOffset2(void) const;
double getOffset3(void) const;
double getAngle(void) const;
bool getFlip(void) const; bool getFlip(void) const;
/** /**
@ -70,10 +66,13 @@ public:
const bool isCompleted() const { return completed; } const bool isCompleted() const { return completed; }
private Q_SLOTS: private Q_SLOTS:
void onOffsetChanged(double); void onSuperplacementChanged(double, int idx);
void onOffset2Changed(double); void onSuperplacementXChanged(double);
void onOffset3Changed(double); void onSuperplacementYChanged(double);
void onAngleChanged(double); void onSuperplacementZChanged(double);
void onSuperplacementYawChanged(double);
void onSuperplacementPitchChanged(double);
void onSuperplacementRollChanged(double);
void onCheckFlip(bool); void onCheckFlip(bool);
void onRefName1(const QString& text); void onRefName1(const QString& text);
void onRefName2(const QString& text); void onRefName2(const QString& text);
@ -92,7 +91,7 @@ private:
void resetViewMode(); void resetViewMode();
void objectDeleted(const Gui::ViewProviderDocumentObject&); void objectDeleted(const Gui::ViewProviderDocumentObject&);
void onSelectionChanged(const Gui::SelectionChanges& msg); void onSelectionChanged(const Gui::SelectionChanges& msg);
void updateUI(); void updateReferencesUI();
/** /**
* @brief updatePreview: calculate attachment, update 3d view, update status message * @brief updatePreview: calculate attachment, update 3d view, update status message
@ -105,6 +104,7 @@ private:
void onButtonRef(const bool checked, unsigned idx); void onButtonRef(const bool checked, unsigned idx);
void onRefName(const QString& text, unsigned idx); void onRefName(const QString& text, unsigned idx);
void updateRefButton(int idx); void updateRefButton(int idx);
void updateSuperplacementUI();
/** /**
* @brief updateListOfModes Fills the mode list with modes that apply to * @brief updateListOfModes Fills the mode list with modes that apply to

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>272</width> <width>272</width>
<height>560</height> <height>583</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -109,28 +109,38 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="label_superplacement">
<property name="toolTip">
<string>Mirror of superPlacement property. Extra placement is expressed in local space of object being attached.</string>
</property>
<property name="text">
<string>Extra placement:</string>
</property>
</widget>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
<widget class="QLabel" name="labelOffset"> <widget class="QLabel" name="labelOffset">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string>OffsetZ</string> <string>X</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QDoubleSpinBox" name="spinOffset"> <widget class="Gui::PrefQuantitySpinBox" name="superplacementX" native="true">
<property name="minimum"> <property name="sizePolicy">
<double>-999999999.000000000000000</double> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
</property> <horstretch>0</horstretch>
<property name="maximum"> <verstretch>0</verstretch>
<double>999999999.000000000000000</double> </sizepolicy>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
@ -140,24 +150,24 @@
<layout class="QHBoxLayout" name="horizontalLayout_9"> <layout class="QHBoxLayout" name="horizontalLayout_9">
<item> <item>
<widget class="QLabel" name="labelOffset2"> <widget class="QLabel" name="labelOffset2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string>OffsetY</string> <string>Y</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QDoubleSpinBox" name="spinOffset2"> <widget class="Gui::PrefQuantitySpinBox" name="superplacementY" native="true">
<property name="minimum"> <property name="sizePolicy">
<double>-999999999.000000000000000</double> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
</property> <horstretch>0</horstretch>
<property name="maximum"> <verstretch>0</verstretch>
<double>999999999.000000000000000</double> </sizepolicy>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
@ -167,23 +177,62 @@
<layout class="QHBoxLayout" name="horizontalLayout_8"> <layout class="QHBoxLayout" name="horizontalLayout_8">
<item> <item>
<widget class="QLabel" name="labelOffset3"> <widget class="QLabel" name="labelOffset3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string>OffsetX</string> <string>Z</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QDoubleSpinBox" name="spinOffset3"> <widget class="Gui::PrefQuantitySpinBox" name="superplacementZ" native="true">
<property name="minimum"> <property name="sizePolicy">
<double>-999999999.000000000000000</double> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="maximum"> </widget>
<double>999999999.000000000000000</double> </item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2_yaw">
<item>
<widget class="QLabel" name="labelYaw">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="singleStep"> <property name="text">
<double>1.000000000000000</double> <string>Yaw</string>
</property> </property>
<property name="value"> </widget>
</item>
<item>
<widget class="Gui::QuantitySpinBox" name="superplacementYaw" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true">deg</string>
</property>
<property name="minimum" stdset="0">
<double>-360.000000000000000</double>
</property>
<property name="maximum" stdset="0">
<double>360.000000000000000</double>
</property>
<property name="value" stdset="0">
<double>0.000000000000000</double> <double>0.000000000000000</double>
</property> </property>
</widget> </widget>
@ -191,26 +240,77 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2_pitch">
<item> <item>
<widget class="QLabel" name="labelAngle"> <widget class="QLabel" name="labelPitch">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string>RotateXY</string> <string>Pitch</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QDoubleSpinBox" name="spinAngle"> <widget class="Gui::QuantitySpinBox" name="superplacementPitch" native="true">
<property name="minimum"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true">deg</string>
</property>
<property name="minimum" stdset="0">
<double>-360.000000000000000</double> <double>-360.000000000000000</double>
</property> </property>
<property name="maximum"> <property name="maximum" stdset="0">
<double>360.000000000000000</double> <double>360.000000000000000</double>
</property> </property>
<property name="singleStep"> <property name="value" stdset="0">
<double>1.000000000000000</double> <double>0.000000000000000</double>
</property> </property>
<property name="value"> </widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2_roll">
<item>
<widget class="QLabel" name="labelRoll">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Roll</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::QuantitySpinBox" name="superplacementRoll" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true">deg</string>
</property>
<property name="minimum" stdset="0">
<double>-360.000000000000000</double>
</property>
<property name="maximum" stdset="0">
<double>360.000000000000000</double>
</property>
<property name="value" stdset="0">
<double>0.000000000000000</double> <double>0.000000000000000</double>
</property> </property>
</widget> </widget>
@ -226,6 +326,18 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<header location="global">Gui/QuantitySpinBox.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefQuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>