0029570: Visualization, Graphic3d_Aspect - merge Graphic3d_Group aspects
[occt.git] / src / StdPrs / StdPrs_WFShape.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_WFShape_H__
15 #define _StdPrs_WFShape_H__
16
17 #include <Prs3d_Root.hxx>
18 #include <Prs3d_Drawer.hxx>
19 #include <Prs3d_Presentation.hxx>
20 #include <Prs3d_PointAspect.hxx>
21 #include <Prs3d_LineAspect.hxx>
22 #include <Prs3d_NListOfSequenceOfPnt.hxx>
23 #include <TColgp_SequenceOfPnt.hxx>
24 #include <TopoDS_Shape.hxx>
25 #include <TopTools_ListOfShape.hxx>
26
27 class Graphic3d_ArrayOfPoints;
28
29 //! Tool for computing wireframe presentation of a TopoDS_Shape.
30 class StdPrs_WFShape : public Prs3d_Root
31 {
32 public:
33
34   //! Computes wireframe presentation of a shape.
35   //! @param thePresentation [in] the presentation.
36   //! @param theShape [in] the shape.
37   //! @param theDrawer [in] the draw settings.
38   //! @param theIsParallel [in] perform algorithm using multiple threads
39   Standard_EXPORT static void Add (const Handle(Prs3d_Presentation)& thePresentation,
40                                    const TopoDS_Shape& theShape,
41                                    const Handle(Prs3d_Drawer)& theDrawer,
42                                    Standard_Boolean theIsParallel = Standard_False);
43
44   //! Compute free and boundary edges on a triangulation of each face in the given shape.
45   //! @param theShape              [in] the list of triangulated faces
46   //! @param theToExcludeGeometric [in] flag indicating that Faces with defined Surface should be skipped
47   Standard_EXPORT static Handle(Graphic3d_ArrayOfPrimitives) AddEdgesOnTriangulation (const TopoDS_Shape&    theShape,
48                                                                                       const Standard_Boolean theToExcludeGeometric = Standard_True);
49
50   //! Compute free and boundary edges on a triangulation of each face in the given shape.
51   //! @param theSegments           [in] the sequence of points defining segments
52   //! @param theShape              [in] the list of triangulated faces
53   //! @param theToExcludeGeometric [in] flag indicating that Faces with defined Surface should be skipped
54   Standard_EXPORT static void AddEdgesOnTriangulation (TColgp_SequenceOfPnt&  theSegments,
55                                                        const TopoDS_Shape&    theShape,
56                                                        const Standard_Boolean theToExcludeGeometric = Standard_True);
57
58   //! Compute all edges (wire, free, unfree) and put them into single primitive array.
59   //! @param theShape [in] the shape
60   //! @param theDrawer [in] the drawer settings (deviation angle and maximal parameter value)
61   Standard_EXPORT static Handle(Graphic3d_ArrayOfPrimitives) AddAllEdges (const TopoDS_Shape& theShape,
62                                                                           const Handle(Prs3d_Drawer)& theDrawer);
63
64   //! Compute vertex presentation for a shape.
65   //! @param theShape [in] the shape
66   //! @param theVertexMode [in] vertex filter
67   Standard_EXPORT static Handle(Graphic3d_ArrayOfPoints) AddVertexes (const TopoDS_Shape& theShape,
68                                                                       Prs3d_VertexDrawMode theVertexMode);
69
70 private:
71
72   //! Compute edge presentations for a shape.
73   //! @param theShape [in] the shape
74   //! @param theDrawer [in] the drawer settings (deviation angle and maximal parameter value)
75   //! @param theShapeDeflection [in] the deflection for the wireframe shape
76   //! @param theWire [out] output polylines for lonely wires
77   //! @param theFree [out] output polylines for free edges
78   //! @param theUnFree [out] output polylines for non-free edges
79   Standard_EXPORT static void addEdges (const TopoDS_Shape& theShape,
80                                         const Handle(Prs3d_Drawer)& theDrawer,
81                                         Standard_Real theShapeDeflection,
82                                         Prs3d_NListOfSequenceOfPnt* theWire,
83                                         Prs3d_NListOfSequenceOfPnt* theFree,
84                                         Prs3d_NListOfSequenceOfPnt* theUnFree);
85
86   //! Compute edge presentations for a shape.
87   //! @param theEdges [in] the list of edges
88   //! @param theDrawer [in] the drawer settings (deviation angle and maximal parameter value)
89   //! @param theShapeDeflection [in] the deflection for the wireframe shape
90   //! @param thePolylines [out] output polylines
91   static void addEdges (const TopTools_ListOfShape& theEdges,
92                         const Handle(Prs3d_Drawer)& theDrawer,
93                         const Standard_Real         theShapeDeflection,
94                         Prs3d_NListOfSequenceOfPnt& thePolylines);
95
96 };
97
98 #endif // _StdPrs_WFShape_H__