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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _DBRep_HeaderFile
18 #define _DBRep_HeaderFile
20 #include <DBRep_Params.hxx>
21 #include <Draw_Interpretor.hxx>
22 #include <TopoDS_Shape.hxx>
24 //! Used to display BRep objects using the DrawTrSurf
26 //! The DrawableShape is a Display object build from a
28 //! Provides methods to manage a directory of named shapes.
29 //! Provides a set of Draw commands for Shapes.
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);
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)
49 return getShape (theName, theType, theToComplain);
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)
58 Standard_CString aNamePtr = theName.ToCString();
59 TopoDS_Shape aShape = getShape (aNamePtr, theType, theToComplain);
60 if (aNamePtr != theName.ToCString())
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)
73 if (theName.Length() == 1
74 && theName.Value (1) == '.')
76 return TopoDS_Shape();
79 Standard_CString aNamePtr = theName.ToCString();
80 return getShape (aNamePtr, theType, theToComplain);
83 //! Defines the basic commands.
84 Standard_EXPORT static void BasicCommands (Draw_Interpretor& theCommands);
86 //! Return global parameters.
87 Standard_EXPORT static DBRep_Params& Parameters();
89 //! True if HLR, False if wireframe.
90 static Standard_Boolean HLRMode() { return Parameters().WithHLR; }
92 //! True if display Rg1Lines.
93 static Standard_Boolean Rg1Mode() { return Parameters().WithRg1; }
95 //! True if display RgNLines.
96 static Standard_Boolean RgNMode() { return Parameters().WithRgN; }
98 //! True if display HiddenLines.
99 static Standard_Boolean HidMode() { return Parameters().WithHid; }
101 //! discretisation angle for edges.
102 static Standard_Real HLRAngle() { return Parameters().HLRAngle; }
104 //! number of iso in U and V
105 static Standard_Integer NbIsos() { return Parameters().NbIsos; }
107 //! Discretization number of points for curves
108 static Standard_Integer Discretisation() { return Parameters().Discretization; }
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);
122 #endif // _DBRep_HeaderFile