Salome HOME
PAL14047 : Problem to select merged face with Create group window
[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.salome-platform.org/ or email : webmaster.salome@opencascade.com
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 #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 <Poly_Polygon3D.hxx>
48 #include <Poly_PolygonOnTriangulation.hxx>
49 #include <GeomAbs_IsoType.hxx>
50 #include <BRepAdaptor_Surface.hxx>
51
52 class GEOM_OBJECT_EXPORT GEOM_OCCReader : public vtkPolyDataSource {
53
54   // methods    
55
56  public:        
57
58   static GEOM_OCCReader* New();
59
60   const TopoDS_Shape& getTopo();
61
62   void setTopo(const TopoDS_Shape& ashape, bool isVector = false);
63
64   int  getDisplayMode();
65   void setDisplayMode(int);
66
67   void setForceUpdate(Standard_Boolean bol);
68
69  protected:
70
71   GEOM_OCCReader();
72   ~GEOM_OCCReader();
73   void Execute();       
74
75   void ComputeShading(vtkPoints* Pts,vtkCellArray* Cells);
76   void ComputeWireframe(vtkPoints* Pts,vtkCellArray* Cells);
77
78   void TransferFaceSData(const TopoDS_Face& aFace,
79                          vtkPoints* Pts,
80                          vtkCellArray* Cells);
81
82   void TransferFaceWData(const TopoDS_Face& aFace,
83                          vtkPoints* Pts,
84                          vtkCellArray* Cells);
85
86   void TransferEdgeSData(const TopoDS_Edge& aEdge,
87                          vtkPoints* Pts,
88                          vtkCellArray* Cells);
89
90   void TransferEdgeWData(const TopoDS_Edge& aEdge,
91                          vtkPoints* Pts,
92                          vtkCellArray* Cells);
93
94   void TransferVertexWData(const TopoDS_Vertex& aVertex,
95                            vtkPoints* Pts,
96                            vtkCellArray* Cells);
97
98   void createISO(const TopoDS_Face &, 
99                  double, int,
100                  vtkPoints* Pts,
101                  vtkCellArray* Cells);
102   
103   void DrawIso(GeomAbs_IsoType aType,
104                Standard_Real PParm,
105                Standard_Real p1,
106                Standard_Real p2,
107                vtkPoints* Pts,
108                vtkCellArray* Cells,
109                Standard_Integer& startidx);
110   
111   void MoveTo(gp_Pnt P,
112               vtkPoints* Pts);
113
114   void DrawTo(gp_Pnt P,
115               vtkPoints* Pts,
116               vtkCellArray* Cells);
117
118   void PlotIso(BRepAdaptor_Surface& S, 
119                GeomAbs_IsoType T,
120                Standard_Real& U, 
121                Standard_Real& V, 
122                Standard_Real Step, 
123                Standard_Boolean& halt,
124                vtkPoints* Pts,
125                vtkCellArray* Cells);
126
127   // fields
128
129  private:
130
131   Standard_Boolean       forced;
132   int                    discretiso;
133   int                    amode;
134   int                    nbisos;
135   TopoDS_Shape           myShape;
136   bool                   myIsVector;
137
138 };
139
140 #endif //GEOM_OCCREADER_H