0000611: Explanatory illustrations for Choose orientation dialog
This commit is contained in:
parent
95925687ec
commit
7511f16541
|
@ -23,9 +23,11 @@
|
|||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <QPixmap>
|
||||
# include <QDialog>
|
||||
#endif
|
||||
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
|
@ -34,9 +36,16 @@
|
|||
|
||||
using namespace SketcherGui;
|
||||
|
||||
SketchOrientationDialog::SketchOrientationDialog(void)
|
||||
SketchOrientationDialog::SketchOrientationDialog(void)
|
||||
: QDialog(Gui::getMainWindow()), ui(new Ui_SketchOrientationDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
onPreview();
|
||||
|
||||
connect(ui->Reverse_checkBox, SIGNAL(clicked(bool)), this, SLOT(onPreview()));
|
||||
connect(ui->XY_radioButton , SIGNAL(clicked(bool)), this, SLOT(onPreview()));
|
||||
connect(ui->XZ_radioButton , SIGNAL(clicked(bool)), this, SLOT(onPreview()));
|
||||
connect(ui->YZ_radioButton , SIGNAL(clicked(bool)), this, SLOT(onPreview()));
|
||||
}
|
||||
|
||||
SketchOrientationDialog::~SketchOrientationDialog()
|
||||
|
@ -44,51 +53,70 @@ SketchOrientationDialog::~SketchOrientationDialog()
|
|||
|
||||
}
|
||||
|
||||
int SketchOrientationDialog::exec()
|
||||
void SketchOrientationDialog::accept()
|
||||
{
|
||||
//Gui::MDIView *mdi = Gui::Application::Instance->activeDocument()->getActiveView();
|
||||
//Gui::View3DInventorViewer *viewer = static_cast<Gui::View3DInventor *>(mdi)->getViewer();
|
||||
|
||||
QDialog dlg(Gui::getMainWindow());
|
||||
|
||||
Ui::SketchOrientationDialog ui_SketchOrientationDialog;
|
||||
ui_SketchOrientationDialog.setupUi(&dlg);
|
||||
|
||||
int res;
|
||||
if (res=dlg.exec()) {
|
||||
double offset = ui_SketchOrientationDialog.Offset_doubleSpinBox->value();
|
||||
bool reverse = ui_SketchOrientationDialog.Reverse_checkBox->isChecked();
|
||||
if (ui_SketchOrientationDialog.XY_radioButton->isChecked()) {
|
||||
if (reverse) {
|
||||
Pos = Base::Placement(Base::Vector3d(0,0,offset),Base::Rotation(-1.0,0.0,0.0,0.0));
|
||||
DirType = 1;
|
||||
}
|
||||
else {
|
||||
Pos = Base::Placement(Base::Vector3d(0,0,offset),Base::Rotation());
|
||||
DirType = 0;
|
||||
}
|
||||
double offset = ui->Offset_doubleSpinBox->value();
|
||||
bool reverse = ui->Reverse_checkBox->isChecked();
|
||||
if (ui->XY_radioButton->isChecked()) {
|
||||
if (reverse) {
|
||||
Pos = Base::Placement(Base::Vector3d(0,0,offset),Base::Rotation(-1.0,0.0,0.0,0.0));
|
||||
DirType = 1;
|
||||
}
|
||||
else if (ui_SketchOrientationDialog.XZ_radioButton->isChecked()) {
|
||||
if (reverse) {
|
||||
Pos = Base::Placement(Base::Vector3d(0,offset,0),Base::Rotation(Base::Vector3d(0,sqrt(2.0)/2.0,sqrt(2.0)/2.0),M_PI));
|
||||
DirType = 3;
|
||||
}
|
||||
else {
|
||||
Pos = Base::Placement(Base::Vector3d(0,offset,0),Base::Rotation(Base::Vector3d(-1,0,0),1.5*M_PI));
|
||||
DirType = 2;
|
||||
}
|
||||
else {
|
||||
Pos = Base::Placement(Base::Vector3d(0,0,offset),Base::Rotation());
|
||||
DirType = 0;
|
||||
}
|
||||
else if (ui_SketchOrientationDialog.YZ_radioButton->isChecked()) {
|
||||
if (reverse) {
|
||||
Pos = Base::Placement(Base::Vector3d(offset,0,0),Base::Rotation(-0.5,0.5,0.5,-0.5));
|
||||
DirType = 5;
|
||||
}
|
||||
else {
|
||||
Pos = Base::Placement(Base::Vector3d(offset,0,0),Base::Rotation(0.5,0.5,0.5,0.5));
|
||||
DirType = 4;
|
||||
}
|
||||
}
|
||||
else if (ui->XZ_radioButton->isChecked()) {
|
||||
if (reverse) {
|
||||
Pos = Base::Placement(Base::Vector3d(0,offset,0),Base::Rotation(Base::Vector3d(0,sqrt(2.0)/2.0,sqrt(2.0)/2.0),M_PI));
|
||||
DirType = 3;
|
||||
}
|
||||
else {
|
||||
Pos = Base::Placement(Base::Vector3d(0,offset,0),Base::Rotation(Base::Vector3d(-1,0,0),1.5*M_PI));
|
||||
DirType = 2;
|
||||
}
|
||||
}
|
||||
else if (ui->YZ_radioButton->isChecked()) {
|
||||
if (reverse) {
|
||||
Pos = Base::Placement(Base::Vector3d(offset,0,0),Base::Rotation(-0.5,0.5,0.5,-0.5));
|
||||
DirType = 5;
|
||||
}
|
||||
else {
|
||||
Pos = Base::Placement(Base::Vector3d(offset,0,0),Base::Rotation(0.5,0.5,0.5,0.5));
|
||||
DirType = 4;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void SketchOrientationDialog::onPreview()
|
||||
{
|
||||
std::string icon;
|
||||
bool reverse = ui->Reverse_checkBox->isChecked();
|
||||
if (ui->XY_radioButton->isChecked()) {
|
||||
if (reverse)
|
||||
icon = "view-bottom";
|
||||
else
|
||||
icon = "view-top";
|
||||
}
|
||||
else if (ui->XZ_radioButton->isChecked()) {
|
||||
if (reverse)
|
||||
icon = "view-rear";
|
||||
else
|
||||
icon = "view-front";
|
||||
}
|
||||
else if (ui->YZ_radioButton->isChecked()) {
|
||||
if (reverse)
|
||||
icon = "view-left";
|
||||
else
|
||||
icon = "view-right";
|
||||
}
|
||||
|
||||
ui->previewLabel->setPixmap(
|
||||
Gui::BitmapFactory().pixmapFromSvg(icon.c_str(),
|
||||
ui->previewLabel->size()));
|
||||
}
|
||||
|
||||
#include "moc_SketchOrientationDialog.cpp"
|
||||
|
|
|
@ -24,20 +24,31 @@
|
|||
#define SKETCHERGUI_SketchOrientationDialog_H
|
||||
|
||||
#include <Base/Placement.h>
|
||||
#include <QDialog>
|
||||
|
||||
namespace SketcherGui {
|
||||
|
||||
class SketchOrientationDialog {
|
||||
class Ui_SketchOrientationDialog;
|
||||
class SketchOrientationDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SketchOrientationDialog(void);
|
||||
~SketchOrientationDialog();
|
||||
|
||||
int exec();
|
||||
|
||||
Base::Placement Pos;
|
||||
int DirType;
|
||||
|
||||
|
||||
void accept();
|
||||
|
||||
protected Q_SLOTS:
|
||||
void onPreview();
|
||||
|
||||
private:
|
||||
Ui_SketchOrientationDialog* ui;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // SKETCHERGUI_SketchOrientationDialog_H
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SketchOrientationDialog</class>
|
||||
<widget class="QDialog" name="SketchOrientationDialog">
|
||||
<class>SketcherGui::SketchOrientationDialog</class>
|
||||
<widget class="QDialog" name="SketcherGui::SketchOrientationDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
|
@ -13,8 +13,8 @@
|
|||
<property name="windowTitle">
|
||||
<string>Choose orientation</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Sketch orientation</string>
|
||||
|
@ -47,14 +47,33 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<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>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="Reverse_checkBox">
|
||||
<property name="text">
|
||||
<string>Reverse direction</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
|
@ -81,7 +100,7 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -98,7 +117,7 @@
|
|||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>SketchOrientationDialog</receiver>
|
||||
<receiver>SketcherGui::SketchOrientationDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
|
@ -114,7 +133,7 @@
|
|||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>SketchOrientationDialog</receiver>
|
||||
<receiver>SketcherGui::SketchOrientationDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
|
|
Loading…
Reference in New Issue
Block a user