1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef DIALOGBOX_CLIPPINGPANEL_H
21 #define DIALOGBOX_CLIPPINGPANEL_H
27 class VisuGUI_ClippingPlaneDlg;
29 class SVTK_ViewWindow;
30 class SUIT_ViewWindow;
31 class vtkPolyDataMapper;
35 #include "VISU_Prs3d_i.hh"
36 #include "VisuGUI_Panel.h"
37 //#include <VisuGUI_SegmentationMgr.h>
38 #include <VISU_ClippingPlaneMgr.hxx>
44 #include <SALOMEDSClient_SObject.hxx>
47 /*class CutPlaneFunction: public vtkPlane
50 static CutPlaneFunction* New();
52 vtkTypeMacro(CutPlaneFunction, vtkPlane);
54 virtual double EvaluateFunction(double x[3]);
55 virtual double EvaluateFunction(double x, double y, double z);
57 void setActive(bool theActive);
58 bool isActive() const { return myIsActive; }
60 void setPlaneObject(_PTR(SObject) aSOPlane) { mySObject = aSOPlane; }
61 _PTR(SObject) getPlaneObject() const { return mySObject; }
69 _PTR(SObject) mySObject;
76 vtkSmartPointer<CutPlaneFunction> plane;
85 //PreviewPlane(SVTK_ViewWindow* theWindow, const PlaneDef& thePlane, const double* theBounds);
86 PreviewPlane(SVTK_ViewWindow* theWindow, VISU_CutPlaneFunction* thePlane, const double* theBounds);
89 void setVisible(bool theVisible)
90 { myActor->SetVisibility(theVisible); }
93 SVTK_ViewWindow* myWindow;
96 vtkPolyDataMapper* myMapper;
97 const double* myBounds;
104 //typedef QList<PlaneDef> QListOfPlanes;
105 typedef QList<vtkPlane*> ListOfvtkPlanes;
106 typedef QList<PreviewPlane*> ListOfPreview;
112 class VisuGUI_ClippingPanel: public VisuGUI_Panel
116 VisuGUI_ClippingPanel(VisuGUI* theModule, QWidget* theParent = 0);
117 ~VisuGUI_ClippingPanel();
122 //virtual void showEvent(QShowEvent* event);
123 //virtual void hideEvent(QHideEvent* event);
126 void onPresentationCreate(VISU::Prs3d_i* thePrs);
129 virtual void onApply();
130 virtual void onHelp();
136 void onPlaneEdited();
137 void onPlaneDelete();
138 void onCancelDialog();
139 void setPlanesNonActive(bool theState);
140 void setPlanesVisible(bool theVisible);
141 void onWindowActivated(SUIT_ViewWindow* theWindow);
142 void onCellChanged(int row, int col);
143 void onObjectDelete(QString theEntry);
144 void onPrsSelected(int thePrs);
145 void onWindowDestroyed(QObject* theWnd);
149 void fillPlanesList();
151 bool isAutoApply() const;
153 VISU_ClippingPlaneMgr& getPlanesMgr() const;
156 //void updatePlane(_PTR(SObject) theObject, PlaneDef& thePlane);
157 //PlaneDef createEmptyPlane();
158 //static bool containsPlane(VISU::Prs3d_i* thePrs, const PlaneDef& thePlane);
160 QString getPrsName(VISU::Prs3d_i* thePrs);
162 bool isVISUDataReady();
164 void applyPlaneToPrs(int thePlaneNum, int thePrsNum, bool isChecked);
166 //QList<VISU::Prs3d_i*> getPrsList(_PTR(Study) theStudy, _PTR(SObject) theObject);
167 QStringList getPrsList(_PTR(Study) theStudy, _PTR(SObject) theObject);
168 VISU::Prs3d_i* getPrs(QString theEntry);
170 QListWidget* myPrsList;
171 QTableWidget* myPlanesList;
173 QCheckBox* myShowPlanes;
174 QCheckBox* myNonActivePlanes;
175 QCheckBox* myAutoApply;
177 //QListOfPlanes myPlanes;
178 // QList<VISU::Prs3d_i*> myPresentations;
179 QStringList myPresentations; // Stores entries of presentation objects
180 ListOfPreview myPreview;
182 VisuGUI_ClippingPlaneDlg* myPlaneDlg;
183 //int myEditingPlanePos;
184 SVTK_ViewWindow* myViewWindow;
186 //QList<int> myCheckedPlanes;