Salome HOME
Update copyright
[modules/geom.git] / src / OBJECT / GEOM_OCCReader.h
1 // Copyright (C) 2007-2011  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 //  $Header$
28 //
29 /*!
30   \class GEOM_OCCReader GEOM_OCCReader.h
31   \brief This class allow to display a OpenCASCADE CAD model in a VTK viewer.
32 */
33
34 #ifndef GEOM_OCCREADER_H
35 #define GEOM_OCCREADER_H
36
37 #include "GEOM_OBJECT_defs.hxx"
38
39 #include <vtkPolyDataSource.h>
40
41 class vtkPoints;
42 class vtkCellArray;
43
44 // OpenCASCADE
45 #include <TopoDS_Shape.hxx>
46 #include <TopoDS.hxx>
47 #include <GeomAbs_IsoType.hxx>
48 #include <BRepAdaptor_Surface.hxx>
49
50 class GEOM_OBJECT_EXPORT GEOM_OCCReader : public vtkPolyDataSource {
51
52   // methods    
53
54  public:        
55
56   static GEOM_OCCReader* New();
57
58   const TopoDS_Shape& getTopo();
59
60   void setTopo(const TopoDS_Shape& ashape, bool isVector = false);
61
62   int  getDisplayMode();
63   void setDisplayMode(int);
64
65   void setForceUpdate(Standard_Boolean bol);
66
67  protected:
68
69   GEOM_OCCReader();
70   ~GEOM_OCCReader();
71   void Execute();       
72
73   void ComputeShading(vtkPoints* Pts,vtkCellArray* Cells);
74   void ComputeWireframe(vtkPoints* Pts,vtkCellArray* Cells);
75
76   void TransferFaceSData(const TopoDS_Face& aFace,
77                          vtkPoints* Pts,
78                          vtkCellArray* Cells);
79
80   void TransferFaceWData(const TopoDS_Face& aFace,
81                          vtkPoints* Pts,
82                          vtkCellArray* Cells);
83
84   void TransferEdgeSData(const TopoDS_Edge& aEdge,
85                          vtkPoints* Pts,
86                          vtkCellArray* Cells);
87
88   void TransferEdgeWData(const TopoDS_Edge& aEdge,
89                          vtkPoints* Pts,
90                          vtkCellArray* Cells);
91
92   void TransferVertexWData(const TopoDS_Vertex& aVertex,
93                            vtkPoints* Pts,
94                            vtkCellArray* Cells);
95
96   void createISO(const TopoDS_Face &, 
97                  double, int,
98                  vtkPoints* Pts,
99                  vtkCellArray* Cells);
100   
101   void DrawIso(GeomAbs_IsoType aType,
102                Standard_Real PParm,
103                Standard_Real p1,
104                Standard_Real p2,
105                vtkPoints* Pts,
106                vtkCellArray* Cells,
107                Standard_Integer& startidx);
108   
109   void MoveTo(gp_Pnt P,
110               vtkPoints* Pts);
111
112   void DrawTo(gp_Pnt P,
113               vtkPoints* Pts,
114               vtkCellArray* Cells);
115
116   void PlotIso(BRepAdaptor_Surface& S, 
117                GeomAbs_IsoType T,
118                Standard_Real& U, 
119                Standard_Real& V, 
120                Standard_Real Step, 
121                Standard_Boolean& halt,
122                vtkPoints* Pts,
123                vtkCellArray* Cells);
124
125   // fields
126
127  private:
128
129   Standard_Boolean       forced;
130   int                    discretiso;
131   int                    amode;
132   int                    nbisos;
133   TopoDS_Shape           myShape;
134   bool                   myIsVector;
135
136 };
137
138 #endif //GEOM_OCCREADER_H