CrossSections.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2010 Werner Mayer <wmayer[at]users.sourceforge.net>     *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  is distributed in the hope that it will be useful,      *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 #ifndef PARTGUI_CROSSSECTIONS_H
00024 #define PARTGUI_CROSSSECTIONS_H
00025 
00026 #include <Gui/TaskView/TaskDialog.h>
00027 #include <Gui/TaskView/TaskView.h>
00028 #include <Base/BoundBox.h>
00029 #include <QDialog>
00030 #include <QPointer>
00031 
00032 namespace Gui {
00033 class View3DInventor;
00034 }
00035 
00036 namespace PartGui {
00037 
00038 class ViewProviderCrossSections;
00039 class Ui_CrossSections;
00040 class CrossSections : public QDialog
00041 {
00042     Q_OBJECT
00043 
00044     enum Plane { XY, XZ, YZ };
00045 
00046 public:
00047     CrossSections(const Base::BoundBox3d& bb, QWidget* parent = 0, Qt::WFlags fl = 0);
00048     ~CrossSections();
00049     void accept();
00050     void apply();
00051 
00052 protected:
00053     void changeEvent(QEvent *e);
00054 
00055 private Q_SLOTS:
00056     void on_xyPlane_clicked();
00057     void on_xzPlane_clicked();
00058     void on_yzPlane_clicked();
00059     void on_position_valueChanged(double);
00060     void on_distance_valueChanged(double);
00061     void on_countSections_valueChanged(int);
00062     void on_checkBothSides_toggled(bool);
00063     void on_sectionsBox_toggled(bool);
00064 
00065 private:
00066     std::vector<double> getPlanes() const;
00067     void calcPlane(Plane, double);
00068     void calcPlanes(Plane/*, double, bool, int*/);
00069     void makePlanes(Plane, const std::vector<double>&, double[4]);
00070     Plane plane() const;
00071 
00072 private:
00073     Ui_CrossSections* ui;
00074     Base::BoundBox3d bbox;
00075     ViewProviderCrossSections* vp;
00076     QPointer<Gui::View3DInventor> view;
00077 };
00078 
00079 class TaskCrossSections : public Gui::TaskView::TaskDialog
00080 {
00081     Q_OBJECT
00082 
00083 public:
00084     TaskCrossSections(const Base::BoundBox3d& bb);
00085     ~TaskCrossSections();
00086 
00087 public:
00088     bool accept();
00089     void clicked(int id);
00090 
00091     virtual QDialogButtonBox::StandardButtons getStandardButtons() const
00092     { return QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel; }
00093 
00094 private:
00095     CrossSections* widget;
00096     Gui::TaskView::TaskBox* taskbox;
00097 };
00098 
00099 } // namespace PartGui
00100 
00101 #endif // PARTGUI_CROSSSECTIONS_H

Generated on Wed Nov 23 19:00:04 2011 for FreeCAD by  doxygen 1.6.1