Salome HOME
sources v1.2
[modules/geom.git] / src / OBJECT / GEOM_OCCReader.h
1 //  GEOM OBJECT : interactive object for Geometry entities visualization
2 //
3 //  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
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 // VTK
38 #include "VTKViewer_Common.h"
39
40 // OpenCASCADE
41 #include <TopoDS_Shape.hxx>
42 #include <TopoDS.hxx>
43 #include <Poly_Polygon3D.hxx>
44 #include <Poly_PolygonOnTriangulation.hxx>
45 #include <GeomAbs_IsoType.hxx>
46 #include <BRepAdaptor_Surface.hxx>
47
48 #ifdef _WIN_32
49 #define VTKOCC_EXPORT __declspec (dllexport)
50 #else
51 #define VTKOCC_EXPORT
52 #endif
53 class VTKOCC_EXPORT GEOM_OCCReader : public vtkPolyDataSource {
54
55   // methods    
56
57  public:        
58
59   static GEOM_OCCReader* New();
60
61   const TopoDS_Shape& getTopo();
62
63   void setTopo(const TopoDS_Shape& ashape);
64
65   int  getDisplayMode();
66   void setDisplayMode(int);
67
68   void setForceUpdate(Standard_Boolean bol);
69
70  protected:
71
72   GEOM_OCCReader();
73   ~GEOM_OCCReader();
74   void Execute();       
75
76   void ComputeShading(vtkPoints* Pts,vtkCellArray* Cells);
77   void ComputeWireframe(vtkPoints* Pts,vtkCellArray* Cells);
78
79   void TransferFaceSData(const TopoDS_Face& aFace,
80                          vtkPoints* Pts,
81                          vtkCellArray* Cells);
82
83   void TransferFaceWData(const TopoDS_Face& aFace,
84                          vtkPoints* Pts,
85                          vtkCellArray* Cells);
86
87   void TransferEdgeSData(const TopoDS_Edge& aEdge,
88                          vtkPoints* Pts,
89                          vtkCellArray* Cells);
90
91   void TransferEdgeWData(const TopoDS_Edge& aEdge,
92                          vtkPoints* Pts,
93                          vtkCellArray* Cells);
94
95   void TransferVertexWData(const TopoDS_Vertex& aVertex,
96                            vtkPoints* Pts,
97                            vtkCellArray* Cells);
98
99   void createISO(const TopoDS_Face &, 
100                  double, int,
101                  vtkPoints* Pts,
102                  vtkCellArray* Cells);
103   
104   void DrawIso(GeomAbs_IsoType aType,
105                Standard_Real PParm,
106                Standard_Real p1,
107                Standard_Real p2,
108                vtkPoints* Pts,
109                vtkCellArray* Cells,
110                Standard_Integer& startidx);
111   
112   void MoveTo(gp_Pnt P,
113               vtkPoints* Pts);
114
115   void DrawTo(gp_Pnt P,
116               vtkPoints* Pts,
117               vtkCellArray* Cells);
118
119   void PlotIso(BRepAdaptor_Surface& S, 
120                GeomAbs_IsoType T,
121                Standard_Real& U, 
122                Standard_Real& V, 
123                Standard_Real Step, 
124                Standard_Boolean& halt,
125                vtkPoints* Pts,
126                vtkCellArray* Cells);
127
128   // fields
129
130  private:
131
132   Standard_Boolean       forced;
133   int                    discretiso;
134   int                    amode;
135   int                    nbisos;
136   TopoDS_Shape           myShape;
137
138 };
139
140 #endif //GEOM_OCCREADER_H