42cf5bc1 |
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 | |
42cf5bc1 |
20 | #include <Draw_Interpretor.hxx> |
1c8fc6be |
21 | #include <TCollection_AsciiString.hxx> |
22 | #include <TopAbs_ShapeEnum.hxx> |
23 | #include <TopoDS_Shape.hxx> |
42cf5bc1 |
24 | |
25 | //! Used to display BRep objects using the DrawTrSurf |
26 | //! package. |
27 | //! The DrawableShape is a Display object build from a |
28 | //! Shape. |
29 | //! Provides methods to manage a directory of named shapes. |
30 | //! Provides a set of Draw commands for Shapes. |
31 | class DBRep |
32 | { |
33 | public: |
34 | |
35 | DEFINE_STANDARD_ALLOC |
36 | |
37 | |
38 | //! Creation of isoparametric curves. |
39 | //! Implements ProgressIndicator for DRAW |
40 | //! Sets <S> in the variable <Name>. Overwrite the |
41 | //! variable if already set. |
42 | Standard_EXPORT static void Set (const Standard_CString Name, const TopoDS_Shape& S); |
43 | |
1c8fc6be |
44 | //! Returns the shape in the variable. |
45 | //! @param theName [in] [out] variable name, or "." to pick up shape interactively (the picked name will be returned then) |
46 | //! @param theType [in] shape type filter; function will return NULL if shape has different type |
47 | //! @param theToComplain [in] when TRUE, prints a message on cout if the variable is not set |
48 | static TopoDS_Shape Get (Standard_CString& theName, TopAbs_ShapeEnum theType = TopAbs_SHAPE, Standard_Boolean theToComplain = Standard_False) |
49 | { |
50 | return getShape (theName, theType, theToComplain); |
51 | } |
52 | |
53 | //! Returns the shape in the variable. |
54 | //! @param theName [in] [out] variable name, or "." to pick up shape interactively (the picked name will be returned then) |
55 | //! @param theType [in] shape type filter; function will return NULL if shape has different type |
56 | //! @param theToComplain [in] when TRUE, prints a message on cout if the variable is not set |
57 | static TopoDS_Shape Get (TCollection_AsciiString& theName, TopAbs_ShapeEnum theType = TopAbs_SHAPE, Standard_Boolean theToComplain = Standard_False) |
58 | { |
59 | Standard_CString aNamePtr = theName.ToCString(); |
60 | TopoDS_Shape aShape = getShape (aNamePtr, theType, theToComplain); |
61 | if (aNamePtr != theName.ToCString()) |
62 | { |
63 | theName = aNamePtr; |
64 | } |
65 | return aShape; |
66 | } |
67 | |
68 | //! Returns the shape in the variable. |
69 | //! @param theName [in] variable name |
70 | //! @param theType [in] shape type filter; function will return NULL if shape has different type |
71 | //! @param theToComplain [in] when TRUE, prints a message on cout if the variable is not set |
72 | static TopoDS_Shape GetExisting (const TCollection_AsciiString& theName, TopAbs_ShapeEnum theType = TopAbs_SHAPE, Standard_Boolean theToComplain = Standard_False) |
73 | { |
74 | if (theName.Length() == 1 |
75 | && theName.Value (1) == '.') |
76 | { |
77 | return TopoDS_Shape(); |
78 | } |
79 | |
80 | Standard_CString aNamePtr = theName.ToCString(); |
81 | return getShape (aNamePtr, theType, theToComplain); |
82 | } |
83 | |
42cf5bc1 |
84 | //! Defines the basic commands. |
85 | Standard_EXPORT static void BasicCommands (Draw_Interpretor& theCommands); |
86 | |
87 | //! True if HLR, False if wireframe. |
88 | Standard_EXPORT static Standard_Boolean HLRMode(); |
89 | |
90 | //! True if display Rg1Lines. |
91 | Standard_EXPORT static Standard_Boolean Rg1Mode(); |
92 | |
93 | //! True if display RgNLines. |
94 | Standard_EXPORT static Standard_Boolean RgNMode(); |
95 | |
96 | //! True if display HiddenLines. |
97 | Standard_EXPORT static Standard_Boolean HidMode(); |
98 | |
99 | //! discretisation angle for edges. |
100 | Standard_EXPORT static Standard_Real HLRAngle(); |
101 | |
102 | //! number of iso in U and V |
103 | Standard_EXPORT static Standard_Integer NbIsos(); |
104 | |
105 | //! discretisation number of points for curves |
106 | //! set progress indicator |
107 | //! get progress indicator |
108 | Standard_EXPORT static Standard_Integer Discretisation(); |
109 | |
42cf5bc1 |
110 | protected: |
111 | |
1c8fc6be |
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); |
42cf5bc1 |
119 | |
120 | }; |
121 | |
42cf5bc1 |
122 | #endif // _DBRep_HeaderFile |