0000641: Make Clipping-Plane-placement editable + support multiple planes
This commit is contained in:
parent
f43f63d3b6
commit
fc845d6fae
|
@ -122,6 +122,7 @@ set(Gui_MOC_HDRS
|
|||
CallTips.h
|
||||
CombiView.h
|
||||
Control.h
|
||||
Clipping.h
|
||||
DemoMode.h
|
||||
DownloadDialog.h
|
||||
DownloadItem.h
|
||||
|
@ -213,6 +214,7 @@ fc_wrap_cpp(Gui_MOC_SRCS ${Gui_MOC_HDRS})
|
|||
|
||||
SET(Gui_UIC_SRCS
|
||||
AboutApplication.ui
|
||||
Clipping.ui
|
||||
DemoMode.ui
|
||||
DlgActions.ui
|
||||
DlgActivateWindow.ui
|
||||
|
@ -289,6 +291,7 @@ SOURCE_GROUP("Command" FILES ${Command_SRCS})
|
|||
|
||||
# The dialog sources
|
||||
SET(Dialog_CPP_SRCS
|
||||
Clipping.cpp
|
||||
DemoMode.cpp
|
||||
DlgActivateWindowImp.cpp
|
||||
DlgDisplayPropertiesImp.cpp
|
||||
|
@ -316,6 +319,7 @@ SET(Dialog_CPP_SRCS
|
|||
)
|
||||
|
||||
SET(Dialog_HPP_SRCS
|
||||
Clipping.h
|
||||
DemoMode.h
|
||||
DlgActivateWindowImp.h
|
||||
DlgDisplayPropertiesImp.h
|
||||
|
@ -346,11 +350,14 @@ SET(Dialog_SRCS
|
|||
${Dialog_CPP_SRCS}
|
||||
${Dialog_HPP_SRCS}
|
||||
AboutApplication.ui
|
||||
Clipping.ui
|
||||
DemoMode.ui
|
||||
DlgActivateWindow.ui
|
||||
DlgAuthorization.ui
|
||||
DlgDisplayProperties.ui
|
||||
DlgInputDialog.ui
|
||||
DlgLocationAngle.ui
|
||||
DlgLocationPos.ui
|
||||
DlgMacroExecute.ui
|
||||
DlgRunExternal.ui
|
||||
DlgMacroRecord.ui
|
||||
|
|
314
src/Gui/Clipping.cpp
Normal file
314
src/Gui/Clipping.cpp
Normal file
|
@ -0,0 +1,314 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2013 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <Inventor/nodes/SoClipPlane.h>
|
||||
# include <Inventor/nodes/SoGroup.h>
|
||||
# include <QPointer>
|
||||
#endif
|
||||
# include <Inventor/sensors/SoTimerSensor.h>
|
||||
|
||||
#include "Clipping.h"
|
||||
#include "ui_Clipping.h"
|
||||
#include "Application.h"
|
||||
#include "View3DInventor.h"
|
||||
#include "View3DInventorViewer.h"
|
||||
|
||||
using namespace Gui::Dialog;
|
||||
|
||||
class Clipping::Private {
|
||||
public:
|
||||
Ui_Clipping ui;
|
||||
QPointer<Gui::View3DInventor> view;
|
||||
SoGroup* node;
|
||||
SoClipPlane* clipX;
|
||||
SoClipPlane* clipY;
|
||||
SoClipPlane* clipZ;
|
||||
SoClipPlane* clipView;
|
||||
bool flipX;
|
||||
bool flipY;
|
||||
bool flipZ;
|
||||
SoTimerSensor* sensor;
|
||||
Private() : flipX(false), flipY(false), flipZ(false)
|
||||
{
|
||||
clipX = new SoClipPlane();
|
||||
clipX->on.setValue(false);
|
||||
clipX->plane.setValue(SbPlane(SbVec3f(1,0,0),0));
|
||||
clipX->ref();
|
||||
|
||||
clipY = new SoClipPlane();
|
||||
clipY->on.setValue(false);
|
||||
clipY->plane.setValue(SbPlane(SbVec3f(0,1,0),0));
|
||||
clipY->ref();
|
||||
|
||||
clipZ = new SoClipPlane();
|
||||
clipZ->on.setValue(false);
|
||||
clipZ->plane.setValue(SbPlane(SbVec3f(0,0,1),0));
|
||||
clipZ->ref();
|
||||
|
||||
clipView = new SoClipPlane();
|
||||
clipView->on.setValue(false);
|
||||
clipView->plane.setValue(SbPlane(SbVec3f(0,0,1),0));
|
||||
clipView->ref();
|
||||
|
||||
sensor = new SoTimerSensor(moveCallback, this);
|
||||
}
|
||||
~Private()
|
||||
{
|
||||
clipX->unref();
|
||||
clipY->unref();
|
||||
clipZ->unref();
|
||||
clipView->unref();
|
||||
delete sensor;
|
||||
}
|
||||
static void moveCallback(void * data, SoSensor * sensor)
|
||||
{
|
||||
Private* self = reinterpret_cast<Private*>(data);
|
||||
if (self->view) {
|
||||
Gui::View3DInventorViewer* view = self->view->getViewer();
|
||||
SoClipPlane* clip = self->clipView;
|
||||
SbPlane pln = clip->plane.getValue();
|
||||
clip->plane.setValue(SbPlane(view->getViewDirection(),pln.getDistanceFromOrigin()));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* TRANSLATOR Gui::Dialog::Clipping */
|
||||
|
||||
Clipping::Clipping(Gui::View3DInventor* view, QWidget* parent)
|
||||
: QWidget(parent), d(new Private)
|
||||
{
|
||||
// create widgets
|
||||
d->ui.setupUi(this);
|
||||
d->ui.clipView->setRange(-INT_MAX,INT_MAX);
|
||||
d->ui.clipView->setSingleStep(0.1f);
|
||||
d->ui.clipX->setRange(-INT_MAX,INT_MAX);
|
||||
d->ui.clipX->setSingleStep(0.1f);
|
||||
d->ui.clipY->setRange(-INT_MAX,INT_MAX);
|
||||
d->ui.clipY->setSingleStep(0.1f);
|
||||
d->ui.clipZ->setRange(-INT_MAX,INT_MAX);
|
||||
d->ui.clipZ->setSingleStep(0.1f);
|
||||
|
||||
d->ui.dirX->setRange(-INT_MAX,INT_MAX);
|
||||
d->ui.dirX->setSingleStep(0.1f);
|
||||
d->ui.dirY->setRange(-INT_MAX,INT_MAX);
|
||||
d->ui.dirY->setSingleStep(0.1f);
|
||||
d->ui.dirZ->setRange(-INT_MAX,INT_MAX);
|
||||
d->ui.dirZ->setSingleStep(0.1f);
|
||||
d->ui.dirZ->setValue(1.0f);
|
||||
|
||||
d->view = view;
|
||||
View3DInventorViewer* viewer = view->getViewer();
|
||||
d->node = static_cast<SoGroup*>(viewer->getSceneGraph());
|
||||
d->node->ref();
|
||||
d->node->insertChild(d->clipX, 0);
|
||||
d->node->insertChild(d->clipY, 0);
|
||||
d->node->insertChild(d->clipZ, 0);
|
||||
d->node->insertChild(d->clipView, 0);
|
||||
|
||||
SoGetBoundingBoxAction action(viewer->getViewportRegion());
|
||||
action.apply(viewer->getSceneGraph());
|
||||
SbBox3f box = action.getBoundingBox();
|
||||
|
||||
if (!box.isEmpty()) {
|
||||
SbVec3f cnt = box.getCenter();
|
||||
d->ui.clipView->setValue(cnt[2]);
|
||||
d->ui.clipX->setValue(cnt[0]);
|
||||
d->ui.clipY->setValue(cnt[1]);
|
||||
d->ui.clipZ->setValue(cnt[2]);
|
||||
}
|
||||
}
|
||||
|
||||
/** Destroys the object and frees any allocated resources */
|
||||
Clipping::~Clipping()
|
||||
{
|
||||
d->node->removeChild(d->clipX);
|
||||
d->node->removeChild(d->clipY);
|
||||
d->node->removeChild(d->clipZ);
|
||||
d->node->removeChild(d->clipView);
|
||||
d->node->unref();
|
||||
delete d;
|
||||
}
|
||||
|
||||
void Clipping::on_groupBoxX_toggled(bool on)
|
||||
{
|
||||
if (on) {
|
||||
d->ui.groupBoxView->setChecked(false);
|
||||
}
|
||||
|
||||
d->clipX->on.setValue(on);
|
||||
}
|
||||
|
||||
void Clipping::on_groupBoxY_toggled(bool on)
|
||||
{
|
||||
if (on) {
|
||||
d->ui.groupBoxView->setChecked(false);
|
||||
}
|
||||
|
||||
d->clipY->on.setValue(on);
|
||||
}
|
||||
|
||||
void Clipping::on_groupBoxZ_toggled(bool on)
|
||||
{
|
||||
if (on) {
|
||||
d->ui.groupBoxView->setChecked(false);
|
||||
}
|
||||
|
||||
d->clipZ->on.setValue(on);
|
||||
}
|
||||
|
||||
void Clipping::on_clipX_valueChanged(double val)
|
||||
{
|
||||
SbPlane pln = d->clipX->plane.getValue();
|
||||
d->clipX->plane.setValue(SbPlane(pln.getNormal(),d->flipX ? -val : val));
|
||||
}
|
||||
|
||||
void Clipping::on_clipY_valueChanged(double val)
|
||||
{
|
||||
SbPlane pln = d->clipY->plane.getValue();
|
||||
d->clipY->plane.setValue(SbPlane(pln.getNormal(),d->flipY ? -val : val));
|
||||
}
|
||||
|
||||
void Clipping::on_clipZ_valueChanged(double val)
|
||||
{
|
||||
SbPlane pln = d->clipZ->plane.getValue();
|
||||
d->clipZ->plane.setValue(SbPlane(pln.getNormal(),d->flipZ ? -val : val));
|
||||
}
|
||||
|
||||
void Clipping::on_flipClipX_clicked()
|
||||
{
|
||||
d->flipX = !d->flipX;
|
||||
SbPlane pln = d->clipX->plane.getValue();
|
||||
d->clipX->plane.setValue(SbPlane(-pln.getNormal(),-pln.getDistanceFromOrigin()));
|
||||
}
|
||||
|
||||
void Clipping::on_flipClipY_clicked()
|
||||
{
|
||||
d->flipY = !d->flipY;
|
||||
SbPlane pln = d->clipY->plane.getValue();
|
||||
d->clipY->plane.setValue(SbPlane(-pln.getNormal(),-pln.getDistanceFromOrigin()));
|
||||
}
|
||||
|
||||
void Clipping::on_flipClipZ_clicked()
|
||||
{
|
||||
d->flipZ = !d->flipZ;
|
||||
SbPlane pln = d->clipZ->plane.getValue();
|
||||
d->clipZ->plane.setValue(SbPlane(-pln.getNormal(),-pln.getDistanceFromOrigin()));
|
||||
}
|
||||
|
||||
void Clipping::on_groupBoxView_toggled(bool on)
|
||||
{
|
||||
if (on) {
|
||||
d->ui.groupBoxX->setChecked(false);
|
||||
d->ui.groupBoxY->setChecked(false);
|
||||
d->ui.groupBoxZ->setChecked(false);
|
||||
}
|
||||
|
||||
d->clipView->on.setValue(on);
|
||||
}
|
||||
|
||||
void Clipping::on_clipView_valueChanged(double val)
|
||||
{
|
||||
SbPlane pln = d->clipView->plane.getValue();
|
||||
d->clipView->plane.setValue(SbPlane(pln.getNormal(),val));
|
||||
}
|
||||
|
||||
void Clipping::on_fromView_clicked()
|
||||
{
|
||||
if (d->view) {
|
||||
Gui::View3DInventorViewer* view = d->view->getViewer();
|
||||
SbVec3f dir = view->getViewDirection();
|
||||
SbPlane pln = d->clipView->plane.getValue();
|
||||
d->clipView->plane.setValue(SbPlane(dir,pln.getDistanceFromOrigin()));
|
||||
}
|
||||
}
|
||||
|
||||
void Clipping::on_adjustViewdirection_toggled(bool on)
|
||||
{
|
||||
d->ui.dirX->setDisabled(on);
|
||||
d->ui.dirY->setDisabled(on);
|
||||
d->ui.dirZ->setDisabled(on);
|
||||
d->ui.fromView->setDisabled(on);
|
||||
|
||||
if (on)
|
||||
d->sensor->schedule();
|
||||
else
|
||||
d->sensor->unschedule();
|
||||
}
|
||||
|
||||
void Clipping::on_dirX_valueChanged(double)
|
||||
{
|
||||
double x = d->ui.dirX->value();
|
||||
double y = d->ui.dirY->value();
|
||||
double z = d->ui.dirZ->value();
|
||||
|
||||
SbPlane pln = d->clipView->plane.getValue();
|
||||
SbVec3f normal(x,y,z);
|
||||
if (normal.sqrLength() > 0.0f)
|
||||
d->clipView->plane.setValue(SbPlane(normal,pln.getDistanceFromOrigin()));
|
||||
}
|
||||
|
||||
void Clipping::on_dirY_valueChanged(double)
|
||||
{
|
||||
double x = d->ui.dirX->value();
|
||||
double y = d->ui.dirY->value();
|
||||
double z = d->ui.dirZ->value();
|
||||
|
||||
SbPlane pln = d->clipView->plane.getValue();
|
||||
SbVec3f normal(x,y,z);
|
||||
if (normal.sqrLength() > 0.0f)
|
||||
d->clipView->plane.setValue(SbPlane(normal,pln.getDistanceFromOrigin()));
|
||||
}
|
||||
|
||||
void Clipping::on_dirZ_valueChanged(double)
|
||||
{
|
||||
double x = d->ui.dirX->value();
|
||||
double y = d->ui.dirY->value();
|
||||
double z = d->ui.dirZ->value();
|
||||
|
||||
SbPlane pln = d->clipView->plane.getValue();
|
||||
SbVec3f normal(x,y,z);
|
||||
if (normal.sqrLength() > 0.0f)
|
||||
d->clipView->plane.setValue(SbPlane(normal,pln.getDistanceFromOrigin()));
|
||||
}
|
||||
|
||||
// ---------------------------------------
|
||||
|
||||
/* TRANSLATOR Gui::Dialog::TaskClipping */
|
||||
|
||||
TaskClipping::TaskClipping(Gui::View3DInventor* view)
|
||||
{
|
||||
QWidget* widget = new Clipping(view);
|
||||
Gui::TaskView::TaskBox* taskbox = new Gui::TaskView::TaskBox(
|
||||
QPixmap(), widget->windowTitle(), false, 0);
|
||||
taskbox->groupLayout()->addWidget(widget);
|
||||
Content.push_back(taskbox);
|
||||
}
|
||||
|
||||
TaskClipping::~TaskClipping()
|
||||
{
|
||||
// automatically deleted in the sub-class
|
||||
}
|
||||
|
||||
#include "moc_Clipping.cpp"
|
88
src/Gui/Clipping.h
Normal file
88
src/Gui/Clipping.h
Normal file
|
@ -0,0 +1,88 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2013 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef GUI_DIALOG_CLIPPING_H
|
||||
#define GUI_DIALOG_CLIPPING_H
|
||||
|
||||
#include <Gui/TaskView/TaskDialog.h>
|
||||
#include <Gui/TaskView/TaskView.h>
|
||||
#include <QWidget>
|
||||
|
||||
namespace Gui {
|
||||
class View3DInventor;
|
||||
namespace Dialog {
|
||||
|
||||
/**
|
||||
* @author Werner Mayer
|
||||
*/
|
||||
class GuiExport Clipping : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Clipping(Gui::View3DInventor* view, QWidget* parent = 0);
|
||||
~Clipping();
|
||||
|
||||
protected Q_SLOTS:
|
||||
void on_groupBoxX_toggled(bool);
|
||||
void on_groupBoxY_toggled(bool);
|
||||
void on_groupBoxZ_toggled(bool);
|
||||
void on_clipX_valueChanged(double);
|
||||
void on_clipY_valueChanged(double);
|
||||
void on_clipZ_valueChanged(double);
|
||||
void on_flipClipX_clicked();
|
||||
void on_flipClipY_clicked();
|
||||
void on_flipClipZ_clicked();
|
||||
void on_groupBoxView_toggled(bool);
|
||||
void on_clipView_valueChanged(double);
|
||||
void on_fromView_clicked();
|
||||
void on_adjustViewdirection_toggled(bool);
|
||||
void on_dirX_valueChanged(double);
|
||||
void on_dirY_valueChanged(double);
|
||||
void on_dirZ_valueChanged(double);
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
class Private;
|
||||
Private* d;
|
||||
};
|
||||
|
||||
/**
|
||||
* Embed the panel into a task dialog.
|
||||
*/
|
||||
class TaskClipping : public Gui::TaskView::TaskDialog
|
||||
{
|
||||
public:
|
||||
TaskClipping(Gui::View3DInventor* view);
|
||||
~TaskClipping();
|
||||
|
||||
public:
|
||||
virtual QDialogButtonBox::StandardButtons getStandardButtons() const
|
||||
{ return QDialogButtonBox::Close; }
|
||||
};
|
||||
|
||||
} // namespace Dialog
|
||||
} // namespace Gui
|
||||
|
||||
#endif // GUI_DIALOG_CLIPPING_H
|
244
src/Gui/Clipping.ui
Normal file
244
src/Gui/Clipping.ui
Normal file
|
@ -0,0 +1,244 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Gui::Dialog::Clipping</class>
|
||||
<widget class="QWidget" name="Gui::Dialog::Clipping">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>304</width>
|
||||
<height>430</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Clipping</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBoxX">
|
||||
<property name="title">
|
||||
<string>Clipping X</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="clipX"/>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="flipClipX">
|
||||
<property name="text">
|
||||
<string>Flip</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Offset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBoxY">
|
||||
<property name="title">
|
||||
<string>Clipping Y</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="clipY"/>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="flipClipY">
|
||||
<property name="text">
|
||||
<string>Flip</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Offset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="groupBoxZ">
|
||||
<property name="title">
|
||||
<string>Clipping Z</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="clipZ"/>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="flipClipZ">
|
||||
<property name="text">
|
||||
<string>Flip</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Offset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QGroupBox" name="groupBoxView">
|
||||
<property name="title">
|
||||
<string>Clipping custom direction</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="3">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>84</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QPushButton" name="fromView">
|
||||
<property name="text">
|
||||
<string>View</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="5">
|
||||
<widget class="QCheckBox" name="adjustViewdirection">
|
||||
<property name="text">
|
||||
<string>Adjust to view direction</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="5">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Direction</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QDoubleSpinBox" name="dirX"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dirY"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QDoubleSpinBox" name="dirZ"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Offset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QDoubleSpinBox" name="clipView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>groupBoxX</tabstop>
|
||||
<tabstop>clipX</tabstop>
|
||||
<tabstop>flipClipX</tabstop>
|
||||
<tabstop>groupBoxY</tabstop>
|
||||
<tabstop>clipY</tabstop>
|
||||
<tabstop>flipClipY</tabstop>
|
||||
<tabstop>groupBoxZ</tabstop>
|
||||
<tabstop>clipZ</tabstop>
|
||||
<tabstop>flipClipZ</tabstop>
|
||||
<tabstop>groupBoxView</tabstop>
|
||||
<tabstop>clipView</tabstop>
|
||||
<tabstop>fromView</tabstop>
|
||||
<tabstop>adjustViewdirection</tabstop>
|
||||
<tabstop>dirX</tabstop>
|
||||
<tabstop>dirY</tabstop>
|
||||
<tabstop>dirZ</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -38,6 +38,7 @@
|
|||
#include "Application.h"
|
||||
#include "BitmapFactory.h"
|
||||
#include "Control.h"
|
||||
#include "Clipping.h"
|
||||
#include "FileDialog.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Tree.h"
|
||||
|
@ -474,12 +475,15 @@ StdCmdToggleClipPlane::StdCmdToggleClipPlane()
|
|||
Action * StdCmdToggleClipPlane::createAction(void)
|
||||
{
|
||||
Action *pcAction = (Action*)Command::createAction();
|
||||
#if 0
|
||||
pcAction->setCheckable(true);
|
||||
#endif
|
||||
return pcAction;
|
||||
}
|
||||
|
||||
void StdCmdToggleClipPlane::activated(int iMsg)
|
||||
{
|
||||
#if 0
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
if (iMsg > 0 && !view->hasClippingPlane())
|
||||
|
@ -487,10 +491,17 @@ void StdCmdToggleClipPlane::activated(int iMsg)
|
|||
else if (iMsg == 0 && view->hasClippingPlane())
|
||||
view->toggleClippingPlane();
|
||||
}
|
||||
#else
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
Gui::Control().showDialog(new Gui::Dialog::TaskClipping(view));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool StdCmdToggleClipPlane::isActive(void)
|
||||
{
|
||||
#if 0
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
Action* action = qobject_cast<Action*>(_pcAction);
|
||||
|
@ -504,6 +515,11 @@ bool StdCmdToggleClipPlane::isActive(void)
|
|||
action->setChecked(false);
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
if (Gui::Control().activeDialog())
|
||||
return false;
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
DEF_STD_CMD_ACL(StdCmdDrawStyle);
|
||||
|
|
Loading…
Reference in New Issue
Block a user