Version: 6.3.1

src/VISUGUI/VisuGUI_ClippingPanel.h

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef DIALOGBOX_CLIPPINGPANEL_H
00021 #define DIALOGBOX_CLIPPINGPANEL_H
00022 
00023 
00024 class VisuGUI;
00025 class QListWidget;
00026 class QTableWidget;
00027 class VisuGUI_ClippingPlaneDlg;
00028 class QCheckBox;
00029 class SVTK_ViewWindow;
00030 class SUIT_ViewWindow;
00031 class vtkPolyDataMapper;
00032 class vtkImageData;
00033 class vtkCutter;
00034 
00035 #include "VISU_Prs3d_i.hh"
00036 #include "VisuGUI_Panel.h"
00037 //#include <VisuGUI_SegmentationMgr.h>
00038 #include <VISU_ClippingPlaneMgr.hxx>
00039 
00040 #include <QList>
00041 #include <vtkActor.h>
00042 #include <vtkPlane.h>
00043 
00044 #include <SALOMEDSClient_SObject.hxx>
00045 
00046 
00047 /*class CutPlaneFunction: public vtkPlane
00048 {
00049 public:
00050   static CutPlaneFunction* New();
00051 
00052   vtkTypeMacro(CutPlaneFunction, vtkPlane);
00053 
00054   virtual double EvaluateFunction(double x[3]);
00055   virtual double EvaluateFunction(double x, double y, double z);
00056 
00057   void setActive(bool theActive);
00058   bool isActive() const { return myIsActive; }
00059 
00060   void setPlaneObject(_PTR(SObject) aSOPlane) { mySObject = aSOPlane; }
00061   _PTR(SObject) getPlaneObject() const { return mySObject; }
00062 
00063 protected:
00064   CutPlaneFunction();
00065   ~CutPlaneFunction();
00066 
00067 private:
00068   bool myIsActive;
00069   _PTR(SObject) mySObject;
00070 };
00071 
00072 
00073 
00074 struct PlaneDef
00075 {
00076   vtkSmartPointer<CutPlaneFunction> plane;
00077   bool isAuto;
00078   QString name;
00079 };
00080 */
00081 
00082 class PreviewPlane
00083 {
00084 public:
00085   //PreviewPlane(SVTK_ViewWindow* theWindow, const PlaneDef& thePlane, const double* theBounds);
00086   PreviewPlane(SVTK_ViewWindow* theWindow, VISU_CutPlaneFunction* thePlane, const double* theBounds);
00087   ~PreviewPlane();
00088 
00089   void setVisible(bool theVisible)
00090   { myActor->SetVisibility(theVisible); }
00091 
00092 private:
00093   SVTK_ViewWindow* myWindow;
00094 
00095   vtkActor* myActor;
00096   vtkPolyDataMapper* myMapper;
00097   const double* myBounds;
00098   vtkPlane* myPlane;
00099   vtkImageData* myBox;
00100   vtkCutter* myCutter;
00101 };
00102 
00103 
00104 //typedef QList<PlaneDef> QListOfPlanes;
00105 typedef QList<vtkPlane*> ListOfvtkPlanes;
00106 typedef QList<PreviewPlane*> ListOfPreview;
00107 
00108 
00109 
00110 
00111 
00112 class VisuGUI_ClippingPanel: public VisuGUI_Panel
00113 {
00114   Q_OBJECT
00115 public:
00116   VisuGUI_ClippingPanel(VisuGUI* theModule, QWidget* theParent = 0);
00117   ~VisuGUI_ClippingPanel();
00118 
00119   void init();
00120 
00121   //protected:
00122   //virtual void showEvent(QShowEvent* event);
00123   //virtual void hideEvent(QHideEvent* event);
00124 
00125 public slots:
00126   void onPresentationCreate(VISU::Prs3d_i* thePrs);
00127 
00128 protected slots:
00129   virtual void onApply();
00130   virtual void onHelp();
00131 
00132 private slots:
00133   void onNew();
00134   void onNewPlane();
00135   void onEdit();
00136   void onPlaneEdited();
00137   void onPlaneDelete();
00138   void onCancelDialog();
00139   void setPlanesNonActive(bool theState);
00140   void setPlanesVisible(bool theVisible);
00141   void onWindowActivated(SUIT_ViewWindow* theWindow);
00142   void onCellChanged(int row, int col);
00143   void onObjectDelete(QString theEntry);
00144   void onPrsSelected(int thePrs);
00145   void onWindowDestroyed(QObject* theWnd);
00146 
00147  private:
00148   void fillPrsList();
00149   void fillPlanesList();
00150 
00151   bool isAutoApply() const;
00152 
00153   VISU_ClippingPlaneMgr& getPlanesMgr() const;
00154 
00155 
00156   //void updatePlane(_PTR(SObject) theObject, PlaneDef& thePlane);
00157   //PlaneDef createEmptyPlane();
00158   //static bool containsPlane(VISU::Prs3d_i* thePrs, const PlaneDef& thePlane);
00159 
00160   QString getPrsName(VISU::Prs3d_i* thePrs);
00161 
00162   bool isVISUDataReady();
00163 
00164   void applyPlaneToPrs(int thePlaneNum, int thePrsNum, bool isChecked);
00165 
00166   //QList<VISU::Prs3d_i*> getPrsList(_PTR(Study) theStudy, _PTR(SObject) theObject);
00167   QStringList getPrsList(_PTR(Study) theStudy, _PTR(SObject) theObject);
00168   VISU::Prs3d_i* getPrs(QString theEntry);
00169 
00170   QListWidget* myPrsList;
00171   QTableWidget* myPlanesList;
00172 
00173   QCheckBox* myShowPlanes;
00174   QCheckBox* myNonActivePlanes;
00175   QCheckBox* myAutoApply;
00176   
00177   //QListOfPlanes myPlanes;
00178   //  QList<VISU::Prs3d_i*> myPresentations;
00179   QStringList myPresentations; // Stores entries of presentation objects
00180   ListOfPreview myPreview;
00181 
00182   VisuGUI_ClippingPlaneDlg* myPlaneDlg;
00183   //int myEditingPlanePos;
00184   SVTK_ViewWindow* myViewWindow;
00185   bool myIsApplied;
00186   //QList<int> myCheckedPlanes;
00187 };
00188 
00189 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS