Salome HOME
c69b67d357cb2c9498bf653222d75cb44622ed09
[modules/geom.git] / src / OBJECT / GEOM_OCCReader.h
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
10 //
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 GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  GEOM OBJECT : interactive object for Geometry entities visualization
24 //  File   : GEOM_OCCReader.h
25 //  Author : Christophe ATTANASIO
26 //  Module : GEOM
27 //
28 /*!
29   \class GEOM_OCCReader GEOM_OCCReader.h
30   \brief This class allow to display a OpenCASCADE CAD model in a VTK viewer.
31 */
32
33 #ifndef GEOM_OCCREADER_H
34 #define GEOM_OCCREADER_H
35
36 #include "GEOM_OBJECT_defs.hxx"
37
38 #include <vtkPolyDataSource.h>
39
40 class vtkPoints;
41 class vtkCellArray;
42
43 // OpenCASCADE
44 #include <TopoDS_Shape.hxx>
45 #include <TopoDS.hxx>
46 #include <GeomAbs_IsoType.hxx>
47 #include <BRepAdaptor_Surface.hxx>
48
49 class GEOM_OBJECT_EXPORT GEOM_OCCReader : public vtkPolyDataSource {
50
51   // methods    
52
53  public:        
54
55   static GEOM_OCCReader* New();
56
57   const TopoDS_Shape& getTopo();
58
59   void setTopo(const TopoDS_Shape& ashape, bool isVector = false);
60
61   int  getDisplayMode();
62   void setDisplayMode(int);
63
64   void setForceUpdate(Standard_Boolean bol);
65
66  protected:
67
68   GEOM_OCCReader();
69   ~GEOM_OCCReader();
70   void Execute();       
71
72   void ComputeShading(vtkPoints* Pts,vtkCellArray* Cells);
73   void ComputeWireframe(vtkPoints* Pts,vtkCellArray* Cells);
74
75   void TransferFaceSData(const TopoDS_Face& aFace,
76                          vtkPoints* Pts,
77                          vtkCellArray* Cells);
78
79   void TransferFaceWData(const TopoDS_Face& aFace,
80                          vtkPoints* Pts,
81                          vtkCellArray* Cells);
82
83   void TransferEdgeSData(const TopoDS_Edge& aEdge,
84                          vtkPoints* Pts,
85                          vtkCellArray* Cells);
86
87   void TransferEdgeWData(const TopoDS_Edge& aEdge,
88                          vtkPoints* Pts,
89                          vtkCellArray* Cells);
90
91   void TransferVertexWData(const TopoDS_Vertex& aVertex,
92                            vtkPoints* Pts,
93                            vtkCellArray* Cells);
94
95   void createISO(const TopoDS_Face &, 
96                  double, int,
97                  vtkPoints* Pts,
98                  vtkCellArray* Cells);
99   
100   void DrawIso(GeomAbs_IsoType aType,
101                Standard_Real PParm,
102                Standard_Real p1,
103                Standard_Real p2,
104                vtkPoints* Pts,
105                vtkCellArray* Cells,
106                Standard_Integer& startidx);
107   
108   void MoveTo(gp_Pnt P,
109               vtkPoints* Pts);
110
111   void DrawTo(gp_Pnt P,
112               vtkPoints* Pts,
113               vtkCellArray* Cells);
114
115   void PlotIso(BRepAdaptor_Surface& S, 
116                GeomAbs_IsoType T,
117                Standard_Real& U, 
118                Standard_Real& V, 
119                Standard_Real Step, 
120                Standard_Boolean& halt,
121                vtkPoints* Pts,
122                vtkCellArray* Cells);
123
124   // fields
125
126  private:
127
128   Standard_Boolean       forced;
129   int                    discretiso;
130   int                    amode;
131   int                    nbisos;
132   TopoDS_Shape           myShape;
133   bool                   myIsVector;
134
135 };
136
137 #endif //GEOM_OCCREADER_H