Image: Merge taskboxes into one 'Image plane Settings'

- Allow user to position the image with a X / Y distance.
- Allow user to rotate the image on its plane.
- Adds Transparency.
- Image sizes change from PX to System unit as PX don't make sense for the user.
This commit is contained in:
Paddle
2023-04-06 22:35:49 +02:00
parent 7a13209a32
commit 1071fb1cdd
6 changed files with 654 additions and 242 deletions

View File

@@ -342,8 +342,8 @@ SET(Gui_UIC_SRCS
Placement.ui
TextureMapping.ui
TaskView/TaskAppearance.ui
TaskView/TaskImageScale.ui
TaskView/TaskOrientation.ui
TaskView/TaskImage.ui
TaskView/TaskSelectLinkProperty.ui
TaskElementColors.ui
DlgObjectSelection.ui
@@ -720,12 +720,12 @@ SET(Task_View_SRCS
TaskView/TaskAppearance.cpp
TaskView/TaskAppearance.h
TaskView/TaskAppearance.ui
TaskView/TaskImageScale.cpp
TaskView/TaskImageScale.h
TaskView/TaskImageScale.ui
TaskView/TaskOrientation.cpp
TaskView/TaskOrientation.h
TaskView/TaskOrientation.ui
TaskView/TaskImage.cpp
TaskView/TaskImage.h
TaskView/TaskImage.ui
TaskView/TaskSelectLinkProperty.cpp
TaskView/TaskSelectLinkProperty.h
TaskView/TaskSelectLinkProperty.ui
@@ -1235,8 +1235,8 @@ if(MSVC)
propertyeditor/PropertyItemDelegate.cpp
propertyeditor/PropertyModel.cpp
TaskView/TaskAppearance.cpp
TaskView/TaskImageScale.cpp
TaskView/TaskOrientation.cpp
TaskView/TaskImage.cpp
TaskView/TaskSelectLinkProperty.cpp
TaskView/TaskEditControl.cpp
TaskView/TaskView.cpp

View File

@@ -48,38 +48,31 @@
#include <Gui/ViewProviderDocumentObject.h>
#include <Gui/TaskView/TaskView.h>
#include "TaskImageScale.h"
#include "ui_TaskImageScale.h"
#include "TaskImage.h"
#include "ui_TaskImage.h"
using namespace Gui;
/* TRANSLATOR Gui::TaskImageScale */
/* TRANSLATOR Gui::TaskImage */
TaskImageScale::TaskImageScale(Image::ImagePlane* obj, QWidget* parent)
TaskImage::TaskImage(Image::ImagePlane* obj, QWidget* parent)
: QWidget(parent)
, ui(new Ui_TaskImageScale)
, ui(new Ui_TaskImage)
, feature(obj)
, aspectRatio{1.0}
, aspectRatio(1.0)
{
ui->setupUi(this);
ui->pushButtonCancel->hide();
ui->spinBoxWidth->setValue(obj->getXSizeInPixel());
ui->spinBoxHeight->setValue(obj->getYSizeInPixel());
initialiseTransparency();
aspectRatio = obj->XSize.getValue() / obj->YSize.getValue();
connect(ui->spinBoxWidth, qOverload<int>(&QSpinBox::valueChanged),
this, &TaskImageScale::changeWidth);
connect(ui->spinBoxHeight, qOverload<int>(&QSpinBox::valueChanged),
this, &TaskImageScale::changeHeight);
connect(ui->pushButtonScale, &QPushButton::clicked,
this, &TaskImageScale::onInteractiveScale);
connect(ui->pushButtonCancel, &QPushButton::clicked,
this, &TaskImageScale::rejectScale);
connectSignals();
}
TaskImageScale::~TaskImageScale()
TaskImage::~TaskImage()
{
if (scale) {
if (scale->isActive()) {
@@ -89,33 +82,93 @@ TaskImageScale::~TaskImageScale()
}
}
void TaskImageScale::changeWidth()
void TaskImage::connectSignals()
{
connect(ui->Reverse_checkBox, &QCheckBox::clicked,
this, &TaskImage::onPreview);
connect(ui->XY_radioButton, &QRadioButton::clicked,
this, &TaskImage::onPreview);
connect(ui->XZ_radioButton, &QRadioButton::clicked,
this, &TaskImage::onPreview);
connect(ui->YZ_radioButton, &QRadioButton::clicked,
this, &TaskImage::onPreview);
connect(ui->spinBoxZ, qOverload<double>(&QuantitySpinBox::valueChanged),
this, &TaskImage::onPreview);
connect(ui->spinBoxX, qOverload<double>(&QuantitySpinBox::valueChanged),
this, &TaskImage::onPreview);
connect(ui->spinBoxY, qOverload<double>(&QuantitySpinBox::valueChanged),
this, &TaskImage::onPreview);
connect(ui->spinBoxRotation, qOverload<double>(&QuantitySpinBox::valueChanged),
this, &TaskImage::onPreview);
connect(ui->spinBoxTransparency, qOverload<int>(&QSpinBox::valueChanged),
this, &TaskImage::changeTransparency);
connect(ui->sliderTransparency, qOverload<int>(&QSlider::valueChanged),
this, &TaskImage::changeTransparency);
connect(ui->spinBoxWidth, qOverload<double>(&QuantitySpinBox::valueChanged),
this, &TaskImage::changeWidth);
connect(ui->spinBoxHeight, qOverload<double>(&QuantitySpinBox::valueChanged),
this, &TaskImage::changeHeight);
connect(ui->pushButtonScale, &QPushButton::clicked,
this, &TaskImage::onInteractiveScale);
connect(ui->pushButtonCancel, &QPushButton::clicked,
this, &TaskImage::rejectScale);
}
void TaskImage::initialiseTransparency()
{
auto vp = Application::Instance->getViewProvider(feature.get());
App::Property* prop = vp->getPropertyByName("Transparency");
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyInteger::getClassTypeId())) {
auto Transparency = static_cast<App::PropertyInteger*>(prop);
ui->spinBoxTransparency->setValue(Transparency->getValue());
ui->sliderTransparency->setValue(Transparency->getValue());
}
}
void TaskImage::changeTransparency(int val)
{
if (feature.expired())
return;
auto vp = Application::Instance->getViewProvider(feature.get());
App::Property* prop = vp->getPropertyByName("Transparency");
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyInteger::getClassTypeId())) {
auto Transparency = static_cast<App::PropertyInteger*>(prop);
Transparency->setValue(val);
QSignalBlocker block(ui->spinBoxTransparency);
QSignalBlocker blocks(ui->sliderTransparency);
ui->spinBoxTransparency->setValue(val);
ui->sliderTransparency->setValue(val);
}
}
void TaskImage::changeWidth(double val)
{
if (!feature.expired()) {
int value = ui->spinBoxWidth->value();
feature->setXSizeInPixel(value);
feature->XSize.setValue(val);
if (ui->checkBoxRatio->isChecked()) {
QSignalBlocker block(ui->spinBoxWidth);
ui->spinBoxHeight->setValue(int(double(value) / aspectRatio));
ui->spinBoxHeight->setValue(val / aspectRatio);
}
}
}
void TaskImageScale::changeHeight()
void TaskImage::changeHeight(double val)
{
if (!feature.expired()) {
int value = ui->spinBoxHeight->value();
feature->setYSizeInPixel(value);
feature->YSize.setValue(val);
if (ui->checkBoxRatio->isChecked()) {
QSignalBlocker block(ui->spinBoxHeight);
ui->spinBoxWidth->setValue(int(double(value) * aspectRatio));
ui->spinBoxWidth->setValue(val * aspectRatio);
}
}
}
View3DInventorViewer* TaskImageScale::getViewer() const
View3DInventorViewer* TaskImage::getViewer() const
{
if (!feature.expired()) {
auto vp = Application::Instance->getViewProvider(feature.get());
@@ -129,7 +182,7 @@ View3DInventorViewer* TaskImageScale::getViewer() const
return nullptr;
}
void TaskImageScale::selectedPoints(size_t num)
void TaskImage::selectedPoints(size_t num)
{
if (num == 1) {
ui->labelInstruction->setText(tr("Select second point"));
@@ -139,23 +192,24 @@ void TaskImageScale::selectedPoints(size_t num)
ui->pushButtonScale->setEnabled(true);
ui->quantitySpinBox->setEnabled(true);
ui->quantitySpinBox->setValue(scale->getDistance());
ui->quantitySpinBox->setFocus();
}
}
void TaskImageScale::scaleImage(double factor)
void TaskImage::scaleImage(double factor)
{
if (!feature.expired()) {
feature->XSize.setValue(feature->XSize.getValue() * factor);
feature->YSize.setValue(feature->YSize.getValue() * factor);
QSignalBlocker blockW(ui->spinBoxWidth);
ui->spinBoxWidth->setValue(feature->getXSizeInPixel());
ui->spinBoxWidth->setValue(feature->XSize.getValue());
QSignalBlocker blockH(ui->spinBoxHeight);
ui->spinBoxHeight->setValue(feature->getYSizeInPixel());
ui->spinBoxHeight->setValue(feature->YSize.getValue());
}
}
void TaskImageScale::startScale()
void TaskImage::startScale()
{
scale->activate(ui->checkBoxOutside->isChecked());
if (ui->checkBoxOutside->isChecked()) {
@@ -171,13 +225,13 @@ void TaskImageScale::startScale()
ui->quantitySpinBox->setEnabled(false);
}
void TaskImageScale::acceptScale()
void TaskImage::acceptScale()
{
scaleImage(ui->quantitySpinBox->value().getValue() / scale->getDistance());
rejectScale();
}
void TaskImageScale::rejectScale()
void TaskImage::rejectScale()
{
scale->deactivate();
ui->labelInstruction->clear();
@@ -190,7 +244,7 @@ void TaskImageScale::rejectScale()
scale->clearPoints();
}
void TaskImageScale::onInteractiveScale()
void TaskImage::onInteractiveScale()
{
if (!feature.expired() && !scale) {
View3DInventorViewer* viewer = getViewer();
@@ -198,7 +252,7 @@ void TaskImageScale::onInteractiveScale()
auto vp = Application::Instance->getViewProvider(feature.get());
scale = new InteractiveScale(viewer, vp);
connect(scale, &InteractiveScale::selectedPoints,
this, &TaskImageScale::selectedPoints);
this, &TaskImage::selectedPoints);
}
}
@@ -212,6 +266,143 @@ void TaskImageScale::onInteractiveScale()
}
}
void TaskImage::open()
{
if (!feature.expired()) {
App::Document* doc = feature->getDocument();
doc->openTransaction(QT_TRANSLATE_NOOP("Command", "Edit image"));
restore(feature->Placement.getValue());
}
}
void TaskImage::accept()
{
if (!feature.expired()) {
App::Document* doc = feature->getDocument();
doc->commitTransaction();
doc->recompute();
}
}
void TaskImage::reject()
{
if (!feature.expired()) {
App::Document* doc = feature->getDocument();
doc->abortTransaction();
feature->purgeTouched();
}
}
void TaskImage::onPreview()
{
updateIcon();
updatePlacement();
}
void TaskImage::restore(const Base::Placement& plm)
{
if (feature.expired())
return;
QSignalBlocker blockW(ui->spinBoxWidth);
QSignalBlocker blockH(ui->spinBoxHeight);
ui->spinBoxWidth->setValue(feature->XSize.getValue());
ui->spinBoxHeight->setValue(feature->YSize.getValue());
Base::Rotation rot = plm.getRotation();
Base::Vector3d pos = plm.getPosition();
double yaw, pitch, roll;
rot.getYawPitchRoll(yaw, pitch, roll);
double tol = 1.0e-5;
bool reverse = false;
if (fabs(pitch) < tol && (fabs(roll) < tol || fabs(roll - 180.) < tol)) {
if (fabs(roll - 180.) < tol)
reverse = true;
int inv = reverse ? -1 : 1;
ui->XY_radioButton->setChecked(true);
ui->spinBoxX->setValue(pos.x);
ui->spinBoxY->setValue(pos.y * inv);
ui->spinBoxZ->setValue(pos.z * inv);
ui->spinBoxRotation->setValue(yaw * inv);
}
else if (fabs(roll - 90.) < tol && (fabs(yaw) < tol || fabs(yaw - 180.) < tol)) {
if (fabs(yaw - 180.) < tol)
reverse = true;
int inv = reverse ? -1 : 1;
ui->XZ_radioButton->setChecked(true);
ui->spinBoxX->setValue(- inv * pos.x);
ui->spinBoxY->setValue(pos.z);
ui->spinBoxZ->setValue(inv * pos.y);
ui->spinBoxRotation->setValue(- pitch);
}
else if (fabs(roll - 90.) < tol && (fabs(yaw - 90.) < tol || fabs(yaw + 90.) < tol)) {
if (fabs(yaw + 90.) < tol)
reverse = true;
int inv = reverse ? -1 : 1;
ui->YZ_radioButton->setChecked(true);
ui->spinBoxX->setValue(-inv * pos.y);
ui->spinBoxY->setValue(pos.z);
ui->spinBoxZ->setValue(inv * pos.x);
ui->spinBoxRotation->setValue(-pitch);
}
ui->Reverse_checkBox->setChecked(reverse);
onPreview();
}
void TaskImage::updatePlacement()
{
Base::Placement Pos;
double offsetX = ui->spinBoxX->value().getValue();
double offsetY = ui->spinBoxY->value().getValue();
double offsetZ = ui->spinBoxZ->value().getValue();
double angle = ui->spinBoxRotation->value().getValue();
bool reverse = ui->Reverse_checkBox->isChecked();
Base::Rotation rot;
double dir = reverse ? 180. : 0.;
int inv = reverse ? -1 : 1;
if (ui->XY_radioButton->isChecked()) {
rot.setYawPitchRoll(inv * angle, 0., dir);
Pos = Base::Placement(Base::Vector3d(offsetX, inv * offsetY, inv * offsetZ), rot);
}
else if (ui->XZ_radioButton->isChecked()) {
rot.setYawPitchRoll(dir, -angle, 90.);
Pos = Base::Placement(Base::Vector3d(- inv * offsetX, inv * offsetZ, offsetY), rot);
}
else if (ui->YZ_radioButton->isChecked()) {
rot.setYawPitchRoll(90. - dir, -angle, 90.);
Pos = Base::Placement(Base::Vector3d(inv * offsetZ, - inv * offsetX, offsetY), rot);
}
if (!feature.expired()) {
feature->Placement.setValue(Pos);
}
}
void TaskImage::updateIcon()
{
std::string icon;
bool reverse = ui->Reverse_checkBox->isChecked();
if (ui->XY_radioButton->isChecked()) {
icon = reverse ? "view-bottom" : "view-top";
}
else if (ui->XZ_radioButton->isChecked()) {
icon = reverse ? "view-rear" : "view-front";
}
else if (ui->YZ_radioButton->isChecked()) {
icon = reverse ? "view-left" : "view-right";
}
ui->previewLabel->setPixmap(
Gui::BitmapFactory().pixmapFromSvg(icon.c_str(),
ui->previewLabel->size()));
}
// ----------------------------------------------------------------------------
InteractiveScale::InteractiveScale(View3DInventorViewer* view, ViewProvider* vp)
@@ -366,4 +557,32 @@ void InteractiveScale::getMousePosition(void * ud, SoEventCallback * ecb)
}
}
#include "moc_TaskImageScale.cpp"
// ----------------------------------------------------------------------------
TaskImageDialog::TaskImageDialog(Image::ImagePlane* obj)
{
widget = new TaskImage(obj);
Gui::TaskView::TaskBox* taskbox = new Gui::TaskView::TaskBox(
QPixmap(), widget->windowTitle(), true, nullptr);
taskbox->groupLayout()->addWidget(widget);
Content.push_back(taskbox);
}
void TaskImageDialog::open()
{
widget->open();
}
bool TaskImageDialog::accept()
{
widget->accept();
return true;
}
bool TaskImageDialog::reject()
{
widget->reject();
return true;
}
#include "moc_TaskImage.cpp"

View File

@@ -21,8 +21,8 @@
* *
**************************************************************************/
#ifndef GUI_TASKIMAGESCALE_H
#define GUI_TASKIMAGESCALE_H
#ifndef GUI_TASKIMAGE_H
#define GUI_TASKIMAGE_H
#include <QPointer>
#include <Gui/TaskView/TaskDialog.h>
@@ -78,18 +78,23 @@ private:
std::vector<SbVec3f> points;
};
class Ui_TaskImageScale;
class TaskImageScale : public QWidget
class Ui_TaskImage;
class TaskImage : public QWidget
{
Q_OBJECT
public:
explicit TaskImageScale(Image::ImagePlane* obj, QWidget* parent = nullptr);
~TaskImageScale() override;
explicit TaskImage(Image::ImagePlane* obj, QWidget* parent = nullptr);
~TaskImage() override;
void open();
void accept();
void reject();
private:
void changeWidth();
void changeHeight();
void initialiseTransparency();
void connectSignals();
void onInteractiveScale();
View3DInventorViewer* getViewer() const;
void selectedPoints(size_t num);
@@ -98,13 +103,43 @@ private:
void acceptScale();
void rejectScale();
void restore(const Base::Placement&);
void onPreview();
void updateIcon();
void updatePlacement();
private Q_SLOTS:
void changeTransparency(int val);
void changeWidth(double val);
void changeHeight(double val);
private:
std::unique_ptr<Ui_TaskImageScale> ui;
std::unique_ptr<Ui_TaskImage> ui;
QPointer<InteractiveScale> scale;
App::WeakPtrT<Image::ImagePlane> feature;
double aspectRatio;
};
class TaskImageDialog : public Gui::TaskView::TaskDialog
{
Q_OBJECT
public:
explicit TaskImageDialog(Image::ImagePlane* obj);
public:
void open() override;
bool accept() override;
bool reject() override;
QDialogButtonBox::StandardButtons getStandardButtons() const override {
return QDialogButtonBox::Ok | QDialogButtonBox::Cancel;
}
private:
TaskImage* widget;
};
}
#endif // GUI_TASKIMAGESCALE_H
#endif // GUI_TASKIMAGE_H

View File

@@ -0,0 +1,346 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Gui::TaskImage</class>
<widget class="QWidget" name="Gui::TaskImage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>421</width>
<height>267</height>
</rect>
</property>
<property name="windowTitle">
<string>Image plane settings</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Planes</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="XY_radioButton">
<property name="text">
<string>XY-Plane</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="XZ_radioButton">
<property name="text">
<string>XZ-Plane</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="YZ_radioButton">
<property name="text">
<string>YZ-Plane</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="previewLabel">
<property name="minimumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="text">
<string notr="true">Preview</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="Reverse_checkBox">
<property name="text">
<string>Reverse direction</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelZ">
<property name="text">
<string>Offset:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::QuantitySpinBox" name="spinBoxZ">
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
<property name="minimum" stdset="0">
<double>-999999999.000000000000000</double>
</property>
<property name="maximum" stdset="0">
<double>999999999.000000000000000</double>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelX">
<property name="text">
<string>X distance:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Gui::QuantitySpinBox" name="spinBoxX">
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
<property name="minimum" stdset="0">
<double>-999999999.000000000000000</double>
</property>
<property name="maximum" stdset="0">
<double>999999999.000000000000000</double>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="labelY">
<property name="text">
<string>Y distance:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="Gui::QuantitySpinBox" name="spinBoxY">
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
<property name="minimum" stdset="0">
<double>-999999999.000000000000000</double>
</property>
<property name="maximum" stdset="0">
<double>999999999.000000000000000</double>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelRotation">
<property name="text">
<string>Rotation :</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="Gui::QuantitySpinBox" name="spinBoxRotation">
<property name="unit" stdset="0">
<string notr="true">deg</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="labelTransparency">
<property name="text">
<string>Transparency :</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="sliderTransparency">
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBoxTransparency">
<property name="value">
<number>0</number>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="7" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox1">
<property name="title">
<string>Image size</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Width:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::QuantitySpinBox" name="spinBoxWidth">
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
<property name="minimum" stdset="0">
<double>0.00000001</double>
</property>
<property name="maximum" stdset="0">
<double>999999999.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Height:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::QuantitySpinBox" name="spinBoxHeight">
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
<property name="minimum" stdset="0">
<double>0.00000001</double>
</property>
<property name="maximum" stdset="0">
<double>999999999.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBoxRatio">
<property name="text">
<string>Keep aspect ratio</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="8" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pushButtonScale">
<property name="toolTip">
<string>Interactively scale the image</string>
</property>
<property name="text">
<string>Interactive</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonCancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>136</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="checkBoxOutside">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Allow points outside the image</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="labelDistance">
<property name="text">
<string>Desired distance:</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::QuantitySpinBox" name="quantitySpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelInstruction">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -1,184 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Gui::TaskImageScale</class>
<widget class="QWidget" name="Gui::TaskImageScale">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>421</width>
<height>267</height>
</rect>
</property>
<property name="windowTitle">
<string>Scale image</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Image size</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Width:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spinBoxWidth">
<property name="suffix">
<string notr="true"> px</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100000000</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Height:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBoxHeight">
<property name="suffix">
<string notr="true"> px</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100000000</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBoxRatio">
<property name="text">
<string>Keep aspect ratio</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pushButtonScale">
<property name="toolTip">
<string>Interactively scale the image</string>
</property>
<property name="text">
<string>Interactive</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonCancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>136</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="checkBoxOutside">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Allow points outside the image</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="labelDistance">
<property name="text">
<string>Desired distance:</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::QuantitySpinBox" name="quantitySpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelInstruction">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>spinBoxWidth</tabstop>
<tabstop>spinBoxHeight</tabstop>
<tabstop>checkBoxRatio</tabstop>
<tabstop>pushButtonScale</tabstop>
<tabstop>pushButtonCancel</tabstop>
<tabstop>checkBoxOutside</tabstop>
<tabstop>quantitySpinBox</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@@ -41,8 +41,7 @@
#include <Gui/ActionFunction.h>
#include <Gui/BitmapFactory.h>
#include <Gui/Control.h>
#include <Gui/TaskView/TaskOrientation.h>
#include <Gui/TaskView/TaskImageScale.h>
#include <Gui/TaskView/TaskImage.h>
#include <App/ImagePlane.h>
#include "ViewProviderImagePlane.h"
@@ -159,12 +158,9 @@ bool ViewProviderImagePlane::doubleClicked()
void ViewProviderImagePlane::manipulateImage()
{
auto dialog = new TaskOrientationDialog(
dynamic_cast<App::GeoFeature*>(getObject())
);
dialog->addTaskBox(new TaskImageScale(
auto dialog = new TaskImageDialog(
dynamic_cast<Image::ImagePlane*>(getObject())
));
);
Gui::Control().showDialog(dialog);
}