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> |
5df609e7 |
27 | #include <TopoDS_Shape.hxx> |
28 | |
42cf5bc1 |
29 | class XCAFDoc_ShapeTool; |
30 | class TDF_Label; |
31 | class Standard_GUID; |
32 | class TCollection_HAsciiString; |
33 | class TDF_Attribute; |
34 | class TDF_RelocationTable; |
35 | |
36 | |
37 | class XCAFDoc_DimTolTool; |
38 | DEFINE_STANDARD_HANDLE(XCAFDoc_DimTolTool, TDF_Attribute) |
39 | |
40 | //! Provides tools to store and retrieve attributes (colors) |
41 | //! of TopoDS_Shape in and from TDocStd_Document |
42 | //! A Document is intended to hold different |
43 | //! attributes of ONE shape and it's sub-shapes. |
44 | //! Attribute containing DimTol section of DECAF document. |
45 | //! Provide tools for management of DimTol section of document. |
46 | class XCAFDoc_DimTolTool : public TDF_Attribute |
47 | { |
48 | |
49 | public: |
50 | |
51 | |
52 | Standard_EXPORT XCAFDoc_DimTolTool(); |
53 | |
54 | //! Creates (if not exist) DimTolTool. |
55 | Standard_EXPORT static Handle(XCAFDoc_DimTolTool) Set (const TDF_Label& L); |
56 | |
57 | Standard_EXPORT static const Standard_GUID& GetID(); |
58 | |
59 | //! returns the label under which colors are stored |
60 | Standard_EXPORT TDF_Label BaseLabel() const; |
61 | |
62 | //! Returns internal XCAFDoc_ShapeTool tool |
63 | Standard_EXPORT const Handle(XCAFDoc_ShapeTool)& ShapeTool(); |
9ebaae37 |
64 | |
65 | //! Returns True if label belongs to a dimtoltable and |
66 | //! is a Dimension definition |
67 | Standard_EXPORT Standard_Boolean IsDimension (const TDF_Label& theLab) const; |
68 | |
69 | //! Returns a sequence of Dimensions labels currently stored |
70 | //! in the DGTtable |
71 | Standard_EXPORT void GetDimensionLabels (TDF_LabelSequence& theLabels) const; |
72 | |
1c9d3225 |
73 | //! Sets a link with GUID |
74 | Standard_EXPORT void SetDimension (const TDF_LabelSequence& theFirstLS, const TDF_LabelSequence& theSecondLS, const TDF_Label& theDimTolL) const; |
75 | |
9ebaae37 |
76 | //! Sets a link with GUID |
77 | Standard_EXPORT void SetDimension (const TDF_Label& theFirstL, const TDF_Label& theSecondL, const TDF_Label& theDimTolL) const; |
78 | |
79 | //! Sets a link with GUID |
80 | Standard_EXPORT void SetDimension (const TDF_Label& theL, const TDF_Label& theDimTolL) const; |
81 | |
82 | //! Returns all Dimension labels defined for label ShapeL |
83 | Standard_EXPORT Standard_Boolean GetRefDimensionLabels (const TDF_Label& theShapeL, TDF_LabelSequence& theDimensions) const; |
84 | |
85 | //! Adds a dimension definition to a DGTtable and returns its label |
86 | Standard_EXPORT TDF_Label AddDimension() ; |
87 | |
88 | //! Returns True if label belongs to a dimtoltable and |
89 | //! is a DimTol definition |
90 | Standard_EXPORT Standard_Boolean IsGeomTolerance (const TDF_Label& theLab) const; |
91 | |
92 | //! Returns a sequence of Tolerance labels currently stored |
93 | //! in the DGTtable |
94 | Standard_EXPORT void GetGeomToleranceLabels (TDF_LabelSequence& theLabels) const; |
95 | |
96 | //! Sets a link with GUID |
97 | Standard_EXPORT void SetGeomTolerance (const TDF_Label& theL, const TDF_Label& theDimTolL) const; |
1c9d3225 |
98 | |
99 | //! Sets a link with GUID |
100 | Standard_EXPORT void SetGeomTolerance (const TDF_LabelSequence& theL, const TDF_Label& theDimTolL) const; |
9ebaae37 |
101 | |
102 | //! Returns all GeomTolerance labels defined for label ShapeL |
103 | Standard_EXPORT Standard_Boolean GetRefGeomToleranceLabels (const TDF_Label& theShapeL, TDF_LabelSequence& theDimTols) const; |
104 | |
105 | //! Adds a GeomTolerance definition to a DGTtable and returns its label |
106 | Standard_EXPORT TDF_Label AddGeomTolerance(); |
42cf5bc1 |
107 | |
108 | //! Returns True if label belongs to a dimtoltable and |
109 | //! is a DimTol definition |
110 | Standard_EXPORT Standard_Boolean IsDimTol (const TDF_Label& lab) const; |
111 | |
112 | //! Returns a sequence of D>s currently stored |
113 | //! in the DGTtable |
114 | Standard_EXPORT void GetDimTolLabels (TDF_LabelSequence& Labels) const; |
115 | |
116 | //! Finds a dimtol definition in a DGTtable and returns |
117 | //! its label if found |
118 | //! Returns False if dimtol is not found in DGTtable |
119 | 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; |
120 | |
121 | //! Finds a dimtol definition in a DGTtable and returns |
122 | //! its label if found (or Null label else) |
123 | 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; |
124 | |
125 | //! Adds a dimtol definition to a DGTtable and returns its label |
126 | 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; |
127 | |
128 | //! Sets a link with GUID |
129 | Standard_EXPORT void SetDimTol (const TDF_Label& L, const TDF_Label& DimTolL) const; |
130 | |
131 | //! Sets a link with GUID |
132 | //! Adds a DimTol as necessary |
133 | 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; |
134 | |
135 | //! Returns ShapeL defined for label DimTolL |
136 | //! Returns False if the DimTolL is not in DGTtable |
1c9d3225 |
137 | Standard_EXPORT Standard_Boolean GetRefShapeLabel (const TDF_Label& DimTolL, TDF_LabelSequence& ShapeLFirst, TDF_LabelSequence& ShapeLSecond) const; |
42cf5bc1 |
138 | |
139 | //! Returns all DimTol labels defined for label ShapeL |
140 | Standard_EXPORT Standard_Boolean GetRefDGTLabels (const TDF_Label& ShapeL, TDF_LabelSequence& DimTols) const; |
141 | |
142 | //! Returns dimtol assigned to <DimTolL> |
143 | //! Returns False if no such dimtol is assigned |
144 | 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; |
145 | |
146 | //! Returns True if label belongs to a dimtoltable and |
147 | //! is a Datum definition |
148 | Standard_EXPORT Standard_Boolean IsDatum (const TDF_Label& lab) const; |
149 | |
150 | //! Returns a sequence of Datumss currently stored |
151 | //! in the DGTtable |
152 | Standard_EXPORT void GetDatumLabels (TDF_LabelSequence& Labels) const; |
153 | |
154 | //! Finds a datum and returns its label if found |
155 | Standard_EXPORT Standard_Boolean FindDatum (const Handle(TCollection_HAsciiString)& aName, const Handle(TCollection_HAsciiString)& aDescription, const Handle(TCollection_HAsciiString)& anIdentification, TDF_Label& lab) const; |
156 | |
157 | //! Adds a datum definition to a DGTtable and returns its label |
158 | Standard_EXPORT TDF_Label AddDatum (const Handle(TCollection_HAsciiString)& aName, const Handle(TCollection_HAsciiString)& aDescription, const Handle(TCollection_HAsciiString)& anIdentification) const; |
9ebaae37 |
159 | |
160 | //! Adds a datum definition to a DGTtable and returns its label |
161 | Standard_EXPORT TDF_Label AddDatum() ; |
42cf5bc1 |
162 | |
163 | //! Sets a link with GUID |
164 | Standard_EXPORT void SetDatum (const TDF_Label& L, const TDF_Label& DatumL) const; |
9ebaae37 |
165 | |
166 | //! Sets a link with GUID for Datum |
167 | //! Sets connection between Datum and Tolerance |
168 | Standard_EXPORT void SetDatumToGeomTol (const TDF_Label& theL, const TDF_Label& theTolerL) const; |
42cf5bc1 |
169 | |
170 | //! Sets a link with GUID for Datum |
171 | //! Adds a Datum as necessary |
172 | //! Sets connection between Datum and Tolerance |
173 | 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; |
174 | |
175 | //! Returns datum assigned to <DatumL> |
176 | //! Returns False if no such datum is assigned |
177 | Standard_EXPORT Standard_Boolean GetDatum (const TDF_Label& DatumL, Handle(TCollection_HAsciiString)& aName, Handle(TCollection_HAsciiString)& aDescription, Handle(TCollection_HAsciiString)& anIdentification) const; |
178 | |
179 | //! Returns all Datum labels defined for label DimTolL |
9ebaae37 |
180 | Standard_EXPORT Standard_Boolean GetDatumOfTolerLabels (const TDF_Label& DimTolL, TDF_LabelSequence& Datums) const; |
181 | |
6595eee7 |
182 | //! Returns all Datum labels with XCAFDimTolObjects_DatumObject defined for label DimTolL |
183 | Standard_EXPORT Standard_Boolean GetDatumWithObjectOfTolerLabels (const TDF_Label& DimTolL, TDF_LabelSequence& Datums) const; |
184 | |
9ebaae37 |
185 | //! Returns all GeomToleranses labels defined for label DatumL |
186 | Standard_EXPORT Standard_Boolean GetTolerOfDatumLabels (const TDF_Label& theDatumL, TDF_LabelSequence& theTols) const; |
187 | |
188 | //! Returns Datum label defined for label ShapeL |
1c9d3225 |
189 | Standard_EXPORT Standard_Boolean GetRefDatumLabel (const TDF_Label& theShapeL, TDF_LabelSequence& theDatum) const; |
5df609e7 |
190 | |
79104795 |
191 | Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE; |
42cf5bc1 |
192 | |
79104795 |
193 | Standard_EXPORT void Restore (const Handle(TDF_Attribute)& with) Standard_OVERRIDE; |
42cf5bc1 |
194 | |
79104795 |
195 | Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE; |
42cf5bc1 |
196 | |
79104795 |
197 | Standard_EXPORT void Paste (const Handle(TDF_Attribute)& into, const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE; |
42cf5bc1 |
198 | |
199 | |
200 | |
201 | |
92efcf78 |
202 | DEFINE_STANDARD_RTTIEXT(XCAFDoc_DimTolTool,TDF_Attribute) |
42cf5bc1 |
203 | |
204 | protected: |
205 | |
206 | |
207 | |
208 | |
209 | private: |
210 | |
211 | |
212 | Handle(XCAFDoc_ShapeTool) myShapeTool; |
213 | |
214 | |
215 | }; |
216 | |
217 | |
218 | |
219 | |
220 | |
221 | |
222 | |
223 | #endif // _XCAFDoc_DimTolTool_HeaderFile |