]> SALOME platform Git repositories - modules/geom.git/blob - src/OBJECT/GEOM_OCCReader.h
Salome HOME
bos #29484 Merge branch 'vsr/29484'
[modules/geom.git] / src / OBJECT / GEOM_OCCReader.h
1 // Copyright (C) 2007-2021  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 namespace GEOMUtils
43 {
44   class Hatcher;
45 }
46
47 // OpenCASCADE
48 #include <TopoDS_Edge.hxx>
49 #include <TopoDS_Shape.hxx>
50 #include <TopoDS_Vertex.hxx>
51 #include <GeomAbs_IsoType.hxx>
52 #include <BRepAdaptor_Surface.hxx>
53
54 class GEOM_OBJECT_EXPORT GEOM_OCCReader : public vtkAlgorithm {
55
56   // methods    
57
58  public:        
59
60   static GEOM_OCCReader* New();
61
62   const TopoDS_Shape& getTopo();
63
64   void setTopo(const TopoDS_Shape& ashape, bool isVector = false);
65
66   int  getDisplayMode();
67   void setDisplayMode(int);
68
69   void setForceUpdate(Standard_Boolean bol);
70
71  protected:
72
73   GEOM_OCCReader();
74   ~GEOM_OCCReader();
75
76   virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
77
78   void ComputeShading(vtkPoints* Pts,vtkCellArray* Cells);
79   void ComputeWireframe(vtkPoints* Pts,vtkCellArray* Cells);
80
81   void TransferFaceSData(const TopoDS_Face& aFace,
82                          vtkPoints* Pts,
83                          vtkCellArray* Cells);
84
85   void TransferFaceWData(const TopoDS_Face& aFace,
86                          vtkPoints* Pts,
87                          vtkCellArray* Cells);
88
89   void TransferEdgeSData(const TopoDS_Edge& aEdge,
90                          vtkPoints* Pts,
91                          vtkCellArray* Cells);
92
93   void TransferEdgeWData(const TopoDS_Edge& aEdge,
94                          vtkPoints* Pts,
95                          vtkCellArray* Cells);
96
97   void TransferVertexWData(const TopoDS_Vertex& aVertex,
98                            vtkPoints* Pts,
99                            vtkCellArray* Cells);
100
101   void createISO(const TopoDS_Face &, 
102                  int,
103                  vtkPoints* Pts,
104                  vtkCellArray* Cells);
105
106   void createIsos(const GEOMUtils::Hatcher &theHatcher,
107                   const Standard_Boolean   IsUIso,
108                   Standard_Integer  &pt_start_idx,
109                   vtkPoints         *Pts,
110                   vtkCellArray      *Cell);
111   
112   void DrawIso(GeomAbs_IsoType aType,
113                Standard_Real PParm,
114                Standard_Real p1,
115                Standard_Real p2,
116                vtkPoints* Pts,
117                vtkCellArray* Cells,
118                Standard_Integer& startidx);
119   
120   void MoveTo(gp_Pnt P,
121               vtkPoints* Pts);
122
123   void DrawTo(gp_Pnt P,
124               vtkPoints* Pts,
125               vtkCellArray* Cells);
126
127   void PlotIso(BRepAdaptor_Surface& S, 
128                GeomAbs_IsoType T,
129                Standard_Real& U, 
130                Standard_Real& V, 
131                Standard_Real Step, 
132                Standard_Boolean& halt,
133                vtkPoints* Pts,
134                vtkCellArray* Cells);
135
136   // fields
137
138  private:
139
140   Standard_Boolean       forced;
141   int                    discretiso;
142   int                    amode;
143   int                    nbisos;
144   TopoDS_Shape           myShape;
145   bool                   myIsVector;
146
147 };
148
149 #endif //GEOM_OCCREADER_H