0026411: Necessary to improve XCAF to store and querying GD&T data.
[occt.git] / src / StdPrs / StdPrs_WFDeflectionShape.hxx
1 // Copyright (c) 2013-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #ifndef _StdPrs_WFDeflectionShape_H__
15 #define _StdPrs_WFDeflectionShape_H__
16
17 #include <Prs3d_Presentation.hxx>
18 #include <Prs3d_WFShape.hxx>
19 #include <Prs3d_Drawer.hxx>
20 #include <Prs3d_Root.hxx>
21 #include <StdPrs_WFDeflectionRestrictedFace.hxx>
22 #include <StdPrs_DeflectionCurve.hxx>
23 #include <StdPrs_Vertex.hxx>
24 #include <TopoDS_Shape.hxx>
25 #include <TopTools_HSequenceOfShape.hxx>
26
27 // Computes the wireframe presentation of surfaces
28 // by displaying planar sections.
29
30 class StdPrs_WFDeflectionShape : public Prs3d_Root
31 {
32
33 public:
34
35   //! Add shape to presentation
36   static inline void Add (const Handle (Prs3d_Presentation)& thePrs,
37                           const TopoDS_Shape&                theShape,
38                           const Handle (Prs3d_Drawer)&       theDrawer)
39   {
40     Face  aFaceAlgo;
41     Curve aCurveAlgo;
42     Prs3d_WFShape anAlgo (aFaceAlgo, aCurveAlgo);
43     anAlgo.Add (thePrs, theShape, theDrawer);
44   }
45
46   static inline Handle(TopTools_HSequenceOfShape) PickCurve
47       (const Quantity_Length        theX,
48        const Quantity_Length        theY,
49        const Quantity_Length        theZ,
50        const Quantity_Length        theDistance,
51        const TopoDS_Shape&          theShape,
52        const Handle (Prs3d_Drawer)& theDrawer)
53   {
54     Face  aFaceAlgo;
55     Curve aCurveAlgo;
56     Prs3d_WFShape anAlgo (aFaceAlgo, aCurveAlgo);
57     return anAlgo.PickCurve (theX, theY, theZ, theDistance, theShape, theDrawer);
58   }
59
60   static inline Handle(TopTools_HSequenceOfShape) PickPatch
61       (const Quantity_Length       theX,
62        const Quantity_Length       theY,
63        const Quantity_Length       theZ,
64        const Quantity_Length       theDistance,
65        const TopoDS_Shape&         theShape,
66        const Handle(Prs3d_Drawer)& theDrawer)
67   {
68     Face  aFaceAlgo;
69     Curve aCurveAlgo;
70     Prs3d_WFShape anAlgo (aFaceAlgo, aCurveAlgo);
71     return anAlgo.PickPatch (theX, theY, theZ, theDistance, theShape, theDrawer);
72   }
73
74 private:
75
76   class Face : public Prs3d_WFShape::Face
77   {
78   public:
79     virtual void Add (const Handle(Prs3d_Presentation)&   thePrs,
80                       const Handle(BRepAdaptor_HSurface)& theFace,
81                       const Standard_Boolean              theToDrawUIso,
82                       const Standard_Boolean              theToDrawVIso,
83                       const Quantity_Length               theDeflection,
84                       const Standard_Integer              theNBUiso,
85                       const Standard_Integer              theNBViso,
86                       const Handle(Prs3d_Drawer)&         theDrawer,
87                       Prs3d_NListOfSequenceOfPnt&         theCurves) const
88     {
89       StdPrs_WFDeflectionRestrictedFace::Add (thePrs, theFace, theToDrawUIso, theToDrawVIso, theDeflection,
90                                               theNBUiso, theNBViso, theDrawer, theCurves);
91     }
92
93     virtual Standard_Boolean Match (const Quantity_Length               theX,
94                                     const Quantity_Length               theY,
95                                     const Quantity_Length               theZ,
96                                     const Quantity_Length               theDistance,
97                                     const Handle(BRepAdaptor_HSurface)& theFace,
98                                     const Handle(Prs3d_Drawer)&         theDrawer) const
99     {
100       return StdPrs_WFDeflectionRestrictedFace::Match (theX, theY, theZ, theDistance, theFace, theDrawer);
101     }
102   };
103
104   class Curve : public Prs3d_WFShape::Curve
105   {
106   public:
107     virtual void Add (const Handle(Prs3d_Presentation)& thePrs,
108                       Adaptor3d_Curve&                  theCurve,
109                       const Quantity_Length             theDeflection,
110                       const Handle(Prs3d_Drawer)&       theDrawer,
111                       TColgp_SequenceOfPnt&             thePoints,
112                       const Standard_Boolean            theToDrawCurve) const
113     {
114       StdPrs_DeflectionCurve::Add (thePrs, theCurve, theDeflection, theDrawer, thePoints, theToDrawCurve);
115     }
116
117     virtual Standard_Boolean Match (const Quantity_Length       theX,
118                                     const Quantity_Length       theY,
119                                     const Quantity_Length       theZ,
120                                     const Quantity_Length       theDistance,
121                                     const Adaptor3d_Curve&      theCurve,
122                                     const Handle(Prs3d_Drawer)& theDrawer) const
123     {
124       return StdPrs_DeflectionCurve::Match (theX, theY, theZ, theDistance, theCurve, theDrawer);
125     }
126   };
127
128 };
129
130 #endif // _StdPrs_WFDeflectionShape_H__