1
/***************************************************************************
2
* Copyright (c) 2011 Jürgen Riegel <juergen.riegel@web.de> *
4
* This file is part of the FreeCAD CAx development system. *
6
* This library is free software; you can redistribute it and/or *
7
* modify it under the terms of the GNU Library General Public *
8
* License as published by the Free Software Foundation; either *
9
* version 2 of the License, or (at your option) any later version. *
11
* This library is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU Library General Public License for more details. *
16
* You should have received a copy of the GNU Library General Public *
17
* License along with this library; see the file COPYING.LIB. If not, *
18
* write to the Free Software Foundation, Inc., 59 Temple Place, *
19
* Suite 330, Boston, MA 02111-1307, USA *
21
***************************************************************************/
23
#include "PreCompiled.h"
28
#include <Gui/BitmapFactory.h>
29
#include <Gui/MainWindow.h>
31
#include "SketchOrientationDialog.h"
32
#include "ui_SketchOrientationDialog.h"
35
using namespace SketcherGui;
37
SketchOrientationDialog::SketchOrientationDialog()
38
: QDialog(Gui::getMainWindow())
39
, ui(new Ui_SketchOrientationDialog)
45
connect(ui->Reverse_checkBox, &QCheckBox::clicked, this, &SketchOrientationDialog::onPreview);
46
connect(ui->XY_radioButton, &QRadioButton::clicked, this, &SketchOrientationDialog::onPreview);
47
connect(ui->XZ_radioButton, &QRadioButton::clicked, this, &SketchOrientationDialog::onPreview);
48
connect(ui->YZ_radioButton, &QRadioButton::clicked, this, &SketchOrientationDialog::onPreview);
51
SketchOrientationDialog::~SketchOrientationDialog()
54
void SketchOrientationDialog::accept()
56
double offset = ui->Offset_doubleSpinBox->value().getValue();
57
bool reverse = ui->Reverse_checkBox->isChecked();
58
if (ui->XY_radioButton->isChecked()) {
60
Pos = Base::Placement(Base::Vector3d(0, 0, offset), Base::Rotation(1.0, 0.0, 0.0, 0.0));
64
Pos = Base::Placement(Base::Vector3d(0, 0, offset), Base::Rotation());
68
else if (ui->XZ_radioButton->isChecked()) {
70
Pos = Base::Placement(Base::Vector3d(0, offset, 0), Base::Rotation(0.0, 1.0, 1.0, 0.0));
74
Pos = Base::Placement(Base::Vector3d(0, offset, 0), Base::Rotation(1.0, 0.0, 0.0, 1.0));
78
else if (ui->YZ_radioButton->isChecked()) {
81
Base::Placement(Base::Vector3d(offset, 0, 0), Base::Rotation(-1.0, 1.0, 1.0, -1.0));
85
Pos = Base::Placement(Base::Vector3d(offset, 0, 0), Base::Rotation(1.0, 1.0, 1.0, 1.0));
93
void SketchOrientationDialog::onPreview()
96
bool reverse = ui->Reverse_checkBox->isChecked();
97
if (ui->XY_radioButton->isChecked()) {
105
else if (ui->XZ_radioButton->isChecked()) {
113
else if (ui->YZ_radioButton->isChecked()) {
122
ui->previewLabel->setPixmap(
123
Gui::BitmapFactory().pixmapFromSvg(icon.c_str(), ui->previewLabel->size()));
126
#include "moc_SketchOrientationDialog.cpp"