SketchOrientationDialog.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "PreCompiled.h"
00024
00025 #ifndef _PreComp_
00026 # include <QDialog>
00027 #endif
00028
00029 #include <Gui/MainWindow.h>
00030 #include <Base/Tools.h>
00031
00032 #include "ui_SketchOrientationDialog.h"
00033 #include "SketchOrientationDialog.h"
00034
00035 using namespace SketcherGui;
00036
00037 SketchOrientationDialog::SketchOrientationDialog(void)
00038 {
00039
00040 }
00041
00042 SketchOrientationDialog::~SketchOrientationDialog()
00043 {
00044
00045 }
00046
00047 int SketchOrientationDialog::exec()
00048 {
00049
00050
00051
00052 QDialog dlg(Gui::getMainWindow());
00053
00054 Ui::SketchOrientationDialog ui_SketchOrientationDialog;
00055 ui_SketchOrientationDialog.setupUi(&dlg);
00056
00057 int res;
00058 if (res=dlg.exec()) {
00059 double offset = ui_SketchOrientationDialog.Offset_doubleSpinBox->value();
00060 bool reverse = ui_SketchOrientationDialog.Reverse_checkBox->isChecked();
00061 if (ui_SketchOrientationDialog.XY_radioButton->isChecked()) {
00062 if (reverse) {
00063 Pos = Base::Placement(Base::Vector3d(0,0,offset),Base::Rotation(-1.0,0.0,0.0,0.0));
00064 DirType = 1;
00065 }
00066 else {
00067 Pos = Base::Placement(Base::Vector3d(0,0,offset),Base::Rotation());
00068 DirType = 0;
00069 }
00070 }
00071 else if (ui_SketchOrientationDialog.XZ_radioButton->isChecked()) {
00072 if (reverse) {
00073 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));
00074 DirType = 3;
00075 }
00076 else {
00077 Pos = Base::Placement(Base::Vector3d(0,offset,0),Base::Rotation(Base::Vector3d(-1,0,0),1.5*M_PI));
00078 DirType = 2;
00079 }
00080 }
00081 else if (ui_SketchOrientationDialog.YZ_radioButton->isChecked()) {
00082 if (reverse) {
00083 Pos = Base::Placement(Base::Vector3d(offset,0,0),Base::Rotation(-0.5,0.5,0.5,-0.5));
00084 DirType = 5;
00085 }
00086 else {
00087 Pos = Base::Placement(Base::Vector3d(offset,0,0),Base::Rotation(0.5,0.5,0.5,0.5));
00088 DirType = 4;
00089 }
00090 }
00091 }
00092
00093 return res;
00094 }