42cf5bc1 |
1 | // Created on: 2004-01-09 |
2 | // Created by: Sergey KUUL |
3 | // Copyright (c) 2004-2014 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef _XCAFDoc_DimTolTool_HeaderFile |
17 | #define _XCAFDoc_DimTolTool_HeaderFile |
18 | |
19 | #include <Standard.hxx> |
20 | #include <Standard_Type.hxx> |
21 | |
22 | #include <TDF_Attribute.hxx> |
23 | #include <Standard_Boolean.hxx> |
24 | #include <TDF_LabelSequence.hxx> |
25 | #include <Standard_Integer.hxx> |
26 | #include <TColStd_HArray1OfReal.hxx> |
27 | class XCAFDoc_ShapeTool; |
28 | class TDF_Label; |
29 | class Standard_GUID; |
30 | class TCollection_HAsciiString; |
31 | class TDF_Attribute; |
32 | class TDF_RelocationTable; |
33 | |
34 | |
35 | class XCAFDoc_DimTolTool; |
36 | DEFINE_STANDARD_HANDLE(XCAFDoc_DimTolTool, TDF_Attribute) |
37 | |
38 | //! Provides tools to store and retrieve attributes (colors) |
39 | //! of TopoDS_Shape in and from TDocStd_Document |
40 | //! A Document is intended to hold different |
41 | //! attributes of ONE shape and it's sub-shapes. |
42 | //! Attribute containing DimTol section of DECAF document. |
43 | //! Provide tools for management of DimTol section of document. |
44 | class XCAFDoc_DimTolTool : public TDF_Attribute |
45 | { |
46 | |
47 | public: |
48 | |
49 | |
50 | Standard_EXPORT XCAFDoc_DimTolTool(); |
51 | |
52 | //! Creates (if not exist) DimTolTool. |
53 | Standard_EXPORT static Handle(XCAFDoc_DimTolTool) Set (const TDF_Label& L); |
54 | |
55 | Standard_EXPORT static const Standard_GUID& GetID(); |
56 | |
57 | //! returns the label under which colors are stored |
58 | Standard_EXPORT TDF_Label BaseLabel() const; |
59 | |
60 | //! Returns internal XCAFDoc_ShapeTool tool |
61 | Standard_EXPORT const Handle(XCAFDoc_ShapeTool)& ShapeTool(); |
9ebaae37 |
62 | |
63 | //! Returns True if label belongs to a dimtoltable and |
64 | //! is a Dimension definition |
65 | Standard_EXPORT Standard_Boolean IsDimension (const TDF_Label& theLab) const; |
66 | |
67 | //! Returns a sequence of Dimensions labels currently stored |
68 | //! in the DGTtable |
69 | Standard_EXPORT void GetDimensionLabels (TDF_LabelSequence& theLabels) const; |
70 | |
71 | //! Sets a link with GUID |
72 | Standard_EXPORT void SetDimension (const TDF_Label& theFirstL, const TDF_Label& theSecondL, const TDF_Label& theDimTolL) const; |
73 | |
74 | //! Sets a link with GUID |
75 | Standard_EXPORT void SetDimension (const TDF_Label& theL, const TDF_Label& theDimTolL) const; |
76 | |
77 | //! Returns all Dimension labels defined for label ShapeL |
78 | Standard_EXPORT Standard_Boolean GetRefDimensionLabels (const TDF_Label& theShapeL, TDF_LabelSequence& theDimensions) const; |
79 | |
80 | //! Adds a dimension definition to a DGTtable and returns its label |
81 | Standard_EXPORT TDF_Label AddDimension() ; |
82 | |
83 | //! Returns True if label belongs to a dimtoltable and |
84 | //! is a DimTol definition |
85 | Standard_EXPORT Standard_Boolean IsGeomTolerance (const TDF_Label& theLab) const; |
86 | |
87 | //! Returns a sequence of Tolerance labels currently stored |
88 | //! in the DGTtable |
89 | Standard_EXPORT void GetGeomToleranceLabels (TDF_LabelSequence& theLabels) const; |
90 | |
91 | //! Sets a link with GUID |
92 | Standard_EXPORT void SetGeomTolerance (const TDF_Label& theL, const TDF_Label& theDimTolL) const; |
93 | |
94 | //! Returns all GeomTolerance labels defined for label ShapeL |
95 | Standard_EXPORT Standard_Boolean GetRefGeomToleranceLabels (const TDF_Label& theShapeL, TDF_LabelSequence& theDimTols) const; |
96 | |
97 | //! Adds a GeomTolerance definition to a DGTtable and returns its label |
98 | Standard_EXPORT TDF_Label AddGeomTolerance(); |
42cf5bc1 |
99 | |
100 | //! Returns True if label belongs to a dimtoltable and |
101 | //! is a DimTol definition |
102 | Standard_EXPORT Standard_Boolean IsDimTol (const TDF_Label& lab) const; |
103 | |
104 | //! Returns a sequence of D>s currently stored |
105 | //! in the DGTtable |
106 | Standard_EXPORT void GetDimTolLabels (TDF_LabelSequence& Labels) const; |
107 | |
108 | //! Finds a dimtol definition in a DGTtable and returns |
109 | //! its label if found |
110 | //! Returns False if dimtol is not found in DGTtable |
111 | Standard_EXPORT Standard_Boolean FindDimTol (const Standard_Integer kind, const Handle(TColStd_HArray1OfReal)& aVal, const Handle(TCollection_HAsciiString)& aName, const Handle(TCollection_HAsciiString)& aDescription, TDF_Label& lab) const; |
112 | |
113 | //! Finds a dimtol definition in a DGTtable and returns |
114 | //! its label if found (or Null label else) |
115 | Standard_EXPORT TDF_Label FindDimTol (const Standard_Integer kind, const Handle(TColStd_HArray1OfReal)& aVal, const Handle(TCollection_HAsciiString)& aName, const Handle(TCollection_HAsciiString)& aDescription) const; |
116 | |
117 | //! Adds a dimtol definition to a DGTtable and returns its label |
118 | Standard_EXPORT TDF_Label AddDimTol (const Standard_Integer kind, const Handle(TColStd_HArray1OfReal)& aVal, const Handle(TCollection_HAsciiString)& aName, const Handle(TCollection_HAsciiString)& aDescription) const; |
119 | |
120 | //! Sets a link with GUID |
121 | Standard_EXPORT void SetDimTol (const TDF_Label& L, const TDF_Label& DimTolL) const; |
122 | |
123 | //! Sets a link with GUID |
124 | //! Adds a DimTol as necessary |
125 | Standard_EXPORT TDF_Label SetDimTol (const TDF_Label& L, const Standard_Integer kind, const Handle(TColStd_HArray1OfReal)& aVal, const Handle(TCollection_HAsciiString)& aName, const Handle(TCollection_HAsciiString)& aDescription) const; |
126 | |
127 | //! Returns ShapeL defined for label DimTolL |
128 | //! Returns False if the DimTolL is not in DGTtable |
9ebaae37 |
129 | Standard_EXPORT Standard_Boolean GetRefShapeLabel (const TDF_Label& DimTolL, TDF_LabelSequence& ShapeL) const; |
42cf5bc1 |
130 | |
131 | //! Returns all DimTol labels defined for label ShapeL |
132 | Standard_EXPORT Standard_Boolean GetRefDGTLabels (const TDF_Label& ShapeL, TDF_LabelSequence& DimTols) const; |
133 | |
134 | //! Returns dimtol assigned to <DimTolL> |
135 | //! Returns False if no such dimtol is assigned |
136 | Standard_EXPORT Standard_Boolean GetDimTol (const TDF_Label& DimTolL, Standard_Integer& kind, Handle(TColStd_HArray1OfReal)& aVal, Handle(TCollection_HAsciiString)& aName, Handle(TCollection_HAsciiString)& aDescription) const; |
137 | |
138 | //! Returns True if label belongs to a dimtoltable and |
139 | //! is a Datum definition |
140 | Standard_EXPORT Standard_Boolean IsDatum (const TDF_Label& lab) const; |
141 | |
142 | //! Returns a sequence of Datumss currently stored |
143 | //! in the DGTtable |
144 | Standard_EXPORT void GetDatumLabels (TDF_LabelSequence& Labels) const; |
145 | |
146 | //! Finds a datum and returns its label if found |
147 | Standard_EXPORT Standard_Boolean FindDatum (const Handle(TCollection_HAsciiString)& aName, const Handle(TCollection_HAsciiString)& aDescription, const Handle(TCollection_HAsciiString)& anIdentification, TDF_Label& lab) const; |
148 | |
149 | //! Adds a datum definition to a DGTtable and returns its label |
150 | Standard_EXPORT TDF_Label AddDatum (const Handle(TCollection_HAsciiString)& aName, const Handle(TCollection_HAsciiString)& aDescription, const Handle(TCollection_HAsciiString)& anIdentification) const; |
9ebaae37 |
151 | |
152 | //! Adds a datum definition to a DGTtable and returns its label |
153 | Standard_EXPORT TDF_Label AddDatum() ; |
42cf5bc1 |
154 | |
155 | //! Sets a link with GUID |
156 | Standard_EXPORT void SetDatum (const TDF_Label& L, const TDF_Label& DatumL) const; |
9ebaae37 |
157 | |
158 | //! Sets a link with GUID for Datum |
159 | //! Sets connection between Datum and Tolerance |
160 | Standard_EXPORT void SetDatumToGeomTol (const TDF_Label& theL, const TDF_Label& theTolerL) const; |
42cf5bc1 |
161 | |
162 | //! Sets a link with GUID for Datum |
163 | //! Adds a Datum as necessary |
164 | //! Sets connection between Datum and Tolerance |
165 | Standard_EXPORT void SetDatum (const TDF_Label& L, const TDF_Label& TolerL, const Handle(TCollection_HAsciiString)& aName, const Handle(TCollection_HAsciiString)& aDescription, const Handle(TCollection_HAsciiString)& anIdentification) const; |
166 | |
167 | //! Returns datum assigned to <DatumL> |
168 | //! Returns False if no such datum is assigned |
169 | Standard_EXPORT Standard_Boolean GetDatum (const TDF_Label& DatumL, Handle(TCollection_HAsciiString)& aName, Handle(TCollection_HAsciiString)& aDescription, Handle(TCollection_HAsciiString)& anIdentification) const; |
170 | |
171 | //! Returns all Datum labels defined for label DimTolL |
9ebaae37 |
172 | Standard_EXPORT Standard_Boolean GetDatumOfTolerLabels (const TDF_Label& DimTolL, TDF_LabelSequence& Datums) const; |
173 | |
174 | //! Returns all GeomToleranses labels defined for label DatumL |
175 | Standard_EXPORT Standard_Boolean GetTolerOfDatumLabels (const TDF_Label& theDatumL, TDF_LabelSequence& theTols) const; |
176 | |
177 | //! Returns Datum label defined for label ShapeL |
178 | Standard_EXPORT Standard_Boolean GetRefDatumLabel (const TDF_Label& theShapeL, TDF_Label& theDatum) const; |
42cf5bc1 |
179 | |
180 | Standard_EXPORT const Standard_GUID& ID() const; |
181 | |
182 | Standard_EXPORT void Restore (const Handle(TDF_Attribute)& with); |
183 | |
184 | Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const; |
185 | |
186 | Standard_EXPORT void Paste (const Handle(TDF_Attribute)& into, const Handle(TDF_RelocationTable)& RT) const; |
187 | |
188 | |
189 | |
190 | |
191 | DEFINE_STANDARD_RTTI(XCAFDoc_DimTolTool,TDF_Attribute) |
192 | |
193 | protected: |
194 | |
195 | |
196 | |
197 | |
198 | private: |
199 | |
200 | |
201 | Handle(XCAFDoc_ShapeTool) myShapeTool; |
202 | |
203 | |
204 | }; |
205 | |
206 | |
207 | |
208 | |
209 | |
210 | |
211 | |
212 | #endif // _XCAFDoc_DimTolTool_HeaderFile |