Salome HOME
Update copyrights 2014.
[modules/geom.git] / src / OBJECT / GEOM_OCCReader.h
1 // Copyright (C) 2007-2014  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, or (at your option) any later version.
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 <vtkAlgorithm.h>
39
40 class vtkPoints;
41 class vtkCellArray;
42 class GEOMUtils_Hatcher;
43
44 // OpenCASCADE
45 #include <TopoDS_Edge.hxx>
46 #include <TopoDS_Shape.hxx>
47 #include <TopoDS_Vertex.hxx>
48 #include <GeomAbs_IsoType.hxx>
49 #include <BRepAdaptor_Surface.hxx>
50
51 class GEOM_OBJECT_EXPORT GEOM_OCCReader : public vtkAlgorithm {
52
53   // methods    
54
55  public:        
56
57   static GEOM_OCCReader* New();
58
59   const TopoDS_Shape& getTopo();
60
61   void setTopo(const TopoDS_Shape& ashape, bool isVector = false);
62
63   int  getDisplayMode();
64   void setDisplayMode(int);
65
66   void setForceUpdate(Standard_Boolean bol);
67
68  protected:
69
70   GEOM_OCCReader();
71   ~GEOM_OCCReader();
72
73   virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
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                  int,
100                  vtkPoints* Pts,
101                  vtkCellArray* Cells);
102
103   void createIsos(const GEOMUtils_Hatcher &theHatcher,
104                   const Standard_Boolean   IsUIso,
105                         Standard_Integer  &pt_start_idx,
106                         vtkPoints         *Pts,
107                         vtkCellArray      *Cell);
108
109   void DrawIso(GeomAbs_IsoType aType,
110                Standard_Real PParm,
111                Standard_Real p1,
112                Standard_Real p2,
113                vtkPoints* Pts,
114                vtkCellArray* Cells,
115                Standard_Integer& startidx);
116   
117   void MoveTo(gp_Pnt P,
118               vtkPoints* Pts);
119
120   void DrawTo(gp_Pnt P,
121               vtkPoints* Pts,
122               vtkCellArray* Cells);
123
124   void PlotIso(BRepAdaptor_Surface& S, 
125                GeomAbs_IsoType T,
126                Standard_Real& U, 
127                Standard_Real& V, 
128                Standard_Real Step, 
129                Standard_Boolean& halt,
130                vtkPoints* Pts,
131                vtkCellArray* Cells);
132
133   // fields
134
135  private:
136
137   Standard_Boolean       forced;
138   int                    discretiso;
139   int                    amode;
140   int                    nbisos;
141   TopoDS_Shape           myShape;
142   bool                   myIsVector;
143
144 };
145
146 #endif //GEOM_OCCREADER_H