0032806: Coding - get rid of unused headers [Contap to Extrema]
[occt.git] / src / DBRep / DBRep.hxx
1 // Created on: 1991-06-25
2 // Created by: Christophe MARION
3 // Copyright (c) 1991-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _DBRep_HeaderFile
18 #define _DBRep_HeaderFile
19
20 #include <DBRep_Params.hxx>
21 #include <Draw_Interpretor.hxx>
22 #include <TopoDS_Shape.hxx>
23
24 //! Used to display BRep objects  using the DrawTrSurf
25 //! package.
26 //! The DrawableShape is a Display object build from a
27 //! Shape.
28 //! Provides methods to manage a directory of named shapes.
29 //! Provides a set of Draw commands for Shapes.
30 class DBRep 
31 {
32 public:
33
34   DEFINE_STANDARD_ALLOC
35
36   
37   //! Creation of isoparametric curves.
38   //! Implements ProgressIndicator for DRAW
39   //! Sets  <S> in the  variable  <Name>.  Overwrite the
40   //! variable if already set.
41   Standard_EXPORT static void Set (const Standard_CString Name, const TopoDS_Shape& S);
42   
43   //! Returns the shape in the variable.
44   //! @param theName [in] [out] variable name, or "." to pick up shape interactively (the picked name will be returned then)
45   //! @param theType [in]       shape type filter; function will return NULL if shape has different type
46   //! @param theToComplain [in] when TRUE, prints a message on cout if the variable is not set
47   static TopoDS_Shape Get (Standard_CString& theName, TopAbs_ShapeEnum theType = TopAbs_SHAPE, Standard_Boolean theToComplain = Standard_False)
48   {
49     return getShape (theName, theType, theToComplain);
50   }
51
52   //! Returns the shape in the variable.
53   //! @param theName [in] [out] variable name, or "." to pick up shape interactively (the picked name will be returned then)
54   //! @param theType [in]       shape type filter; function will return NULL if shape has different type
55   //! @param theToComplain [in] when TRUE, prints a message on cout if the variable is not set
56   static TopoDS_Shape Get (TCollection_AsciiString& theName, TopAbs_ShapeEnum theType = TopAbs_SHAPE, Standard_Boolean theToComplain = Standard_False)
57   {
58     Standard_CString aNamePtr = theName.ToCString();
59     TopoDS_Shape aShape = getShape (aNamePtr, theType, theToComplain);
60     if (aNamePtr != theName.ToCString())
61     {
62       theName = aNamePtr;
63     }
64     return aShape;
65   }
66
67   //! Returns the shape in the variable.
68   //! @param theName [in] variable name
69   //! @param theType [in] shape type filter; function will return NULL if shape has different type
70   //! @param theToComplain [in] when TRUE, prints a message on cout if the variable is not set
71   static TopoDS_Shape GetExisting (const TCollection_AsciiString& theName, TopAbs_ShapeEnum theType = TopAbs_SHAPE, Standard_Boolean theToComplain = Standard_False)
72   {
73     if (theName.Length() == 1
74      && theName.Value (1) == '.')
75     {
76       return TopoDS_Shape();
77     }
78
79     Standard_CString aNamePtr = theName.ToCString();
80     return getShape (aNamePtr, theType, theToComplain);
81   }
82
83   //! Defines the basic commands.
84   Standard_EXPORT static void BasicCommands (Draw_Interpretor& theCommands);
85
86   //! Return global parameters.
87   Standard_EXPORT static DBRep_Params& Parameters();
88
89   //! True if HLR, False if wireframe.
90   static Standard_Boolean HLRMode() { return Parameters().WithHLR; }
91
92   //! True if display Rg1Lines.
93   static Standard_Boolean Rg1Mode() { return Parameters().WithRg1; }
94
95   //! True if display RgNLines.
96   static Standard_Boolean RgNMode() { return Parameters().WithRgN; }
97
98   //! True if display HiddenLines.
99   static Standard_Boolean HidMode() { return Parameters().WithHid; }
100
101   //! discretisation angle for edges.
102   static Standard_Real HLRAngle() { return Parameters().HLRAngle; }
103
104   //! number of iso in U and V
105   static Standard_Integer NbIsos() { return Parameters().NbIsos; }
106
107   //! Discretization number of points for curves
108   static Standard_Integer Discretisation() { return Parameters().Discretization; }
109
110 protected:
111
112   //! Returns the shape in the variable.
113   //! @param theName [in] [out] variable name, or "." to pick up shape interactively (the picked name will be returned then)
114   //! @param theType [in]       shape type filter; function will return NULL if shape has different type
115   //! @param theToComplain [in] when TRUE, prints a message on cout if the variable is not set
116   Standard_EXPORT static TopoDS_Shape getShape (Standard_CString& theName,
117                                                 TopAbs_ShapeEnum theType,
118                                                 Standard_Boolean theToComplain);
119
120 };
121
122 #endif // _DBRep_HeaderFile