1 -- Created on: 2000-09-26
2 -- Created by: Pavel TELKOV.
3 -- Copyright (c) 2000-2012 OPEN CASCADE SAS
5 -- The content of this file is subject to the Open CASCADE Technology Public
6 -- License Version 6.5 (the "License"). You may not use the content of this file
7 -- except in compliance with the License. Please obtain a copy of the License
8 -- at http://www.opencascade.org and read it completely before using this file.
10 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 -- The Original Code and all software distributed under the License is
14 -- distributed on an "AS IS" basis, without warranty of any kind, and the
15 -- Initial Developer hereby disclaims all such warranties, including without
16 -- limitation, any warranties of merchantability, fitness for a particular
17 -- purpose or non-infringement. Please see the License for the specific terms
18 -- and conditions governing the rights and limitations under the License.
22 class LayerTool from XCAFDoc inherits Attribute from TDF
24 ---Purpose: Provides tools to store and retrieve attributes (Layers)
25 -- of TopoDS_Shape in and from TDocStd_Document
26 -- A Document is intended to hold different
27 -- attributes of ONE shape and it's sub-shapes
32 LabelSequence from TDF,
33 Document from TDocStd,
34 ShapeTool from XCAFDoc,
35 RelocationTable from TDF,
36 GraphNode from XCAFDoc,
37 ExtendedString from TCollection,
38 HSequenceOfExtendedString from TColStd
40 Create returns LayerTool from XCAFDoc;
42 Set (myclass; L : Label from TDF) returns LayerTool from XCAFDoc;
43 ---Purpose: Creates (if not exist) LayerTool.
46 ---C++: return const &
47 returns GUID from Standard;
50 ---API: General structure
52 BaseLabel(me) returns Label from TDF;
53 ---Purpose: returns the label under which Layers are stored
55 ShapeTool (me: mutable) returns ShapeTool from XCAFDoc;
56 ---Purpose: Returns internal XCAFDoc_ShapeTool tool
57 ---C++: return const &
60 ---API: Layer table management
62 IsLayer (me; lab: Label from TDF) returns Boolean;
63 ---Purpose: Returns True if label belongs to a Layertable and
64 -- is a Layer definition
66 GetLayer (me; lab: Label from TDF; aLayer: out ExtendedString from TCollection)
68 ---Purpose: Returns Layer defined by label lab
69 -- Returns False if the label is not in Layertable
70 -- or does not define a Layer
72 FindLayer (me; aLayer : ExtendedString from TCollection; lab: out Label from TDF)
74 ---Purpose: Finds a Layer definition in a Layertable and returns
76 -- Returns False if Layer is not found in Layertable
78 FindLayer (me; aLayer : ExtendedString from TCollection) returns Label from TDF;
79 ---Purpose: Finds a Layer definition in a Layertable and returns
80 -- its label if found (or Null label else)
82 AddLayer (me; aLayer : ExtendedString from TCollection) returns Label from TDF;
83 ---Purpose: Adds a Layer definition to a Layertable and returns
84 -- its label (returns existing label if the same Layer
85 -- is already defined)
87 RemoveLayer (me; lab: Label from TDF);
88 ---Purpose: Removes Layer from the Layertable
90 GetLayerLabels (me; Labels: out LabelSequence from TDF);
91 ---Purpose: Returns a sequence of Layers currently stored
94 ---API: Assignment of Layers to labels
96 SetLayer (me; L: Label from TDF;
97 LayerL: Label from TDF;
98 shapeInOneLayer: Boolean = Standard_False);
99 ---Purpose: Sets a link from label <L> to Layer
100 -- defined by <LayerL>
101 -- optional parametr <shapeInOneLayer> show could shape be
102 -- in number of layers or only in one.
104 SetLayer (me; L: Label from TDF;
105 aLayer : ExtendedString from TCollection;
106 shapeInOneLayer: Boolean = Standard_False);
107 ---Purpose: Sets a link from label <L> to Layer <aLayer>
109 -- Adds a Layer as necessary
110 -- optional parametr <shapeInOneLayer> show could shape be
111 -- in number of layers or only in one.
113 UnSetLayers (me; L: Label from TDF);
114 ---Purpose: Removes a link from label <L> to all layers
116 UnSetOneLayer (me; L: Label from TDF;
117 aLayer : ExtendedString from TCollection) returns Boolean;
118 ---Purpose: Remove link from label <L> and Layer <aLayer>.
119 -- returns FALSE if no such layer.
121 IsSet (me; L: Label from TDF;
122 aLayer : ExtendedString from TCollection) returns Boolean;
123 ---Purpose: Returns True if label <L> has a Layer assosiated
124 -- with the <aLayer>.
126 GetLayers (me: mutable; L: Label from TDF;
127 aLayerS : out HSequenceOfExtendedString from TColStd)
129 ---Purpose: Return sequence of strings <aLayerS> that assosiated with label <L>.
131 GetLayers (me: mutable; L: Label from TDF) returns HSequenceOfExtendedString from TColStd;
132 ---Purpose: Return sequence of strings that assosiated with label <L>.
134 GetShapesOfLayer (me; layerL: Label from TDF; ShLabels: out LabelSequence from TDF);
135 ---Purpose: Return sequanese of shape labels that assigned with layers to <ShLabels>.
137 IsVisible (me; layerL: Label from TDF)
138 ---Purpose: Return TRUE if layer is visible, FALSE if invisible.
141 SetVisibility(me; layerL: Label from TDF;
142 isvisible: Boolean = Standard_True);
143 ---Purpose: Set the visibility of layer. If layer is invisible when on it's layer
144 -- will set UAttribute with corresponding GUID.
146 ---API: Assignment of Layers to shapes in Shapes section
148 SetLayer (me: mutable; Sh: Shape from TopoDS;
149 LayerL: Label from TDF;
150 shapeInOneLayer: Boolean = Standard_False)
152 ---Purpose: Sets a link from label that containig shape <Sh>
153 -- with layer that situated at label <LayerL>.
154 -- optional parametr <shapeInOneLayer> show could shape be
155 -- in number of layers or only in one.
156 -- return FALSE if no such shape <Sh> or label <LayerL>
158 SetLayer (me: mutable; Sh: Shape from TopoDS;
159 aLayer : ExtendedString from TCollection;
160 shapeInOneLayer: Boolean = Standard_False)
162 ---Purpose: Sets a link from label that containig shape <Sh>
163 -- with layer <aLayer>. Add <aLayer> to LayerTable if nessesery.
164 -- optional parametr <shapeInOneLayer> show could shape be
165 -- in number of layers or only in one.
166 -- return FALSE if no such shape <Sh>.
168 UnSetLayers (me: mutable; Sh: Shape from TopoDS) returns Boolean;
169 ---Purpose: Remove link between shape <Sh> and all Layers at LayerTable.
170 -- return FALSE if no such shape <Sh> in XCAF Document.
172 UnSetOneLayer (me: mutable; Sh: Shape from TopoDS;
173 aLayer : ExtendedString from TCollection) returns Boolean;
174 ---Purpose: Remove link between shape <Sh> and layer <aLayer>.
175 -- returns FALSE if no such layer <aLayer> or shape <Sh>.
177 IsSet (me: mutable; Sh: Shape from TopoDS;
178 aLayer : ExtendedString from TCollection) returns Boolean;
179 ---Purpose: Returns True if shape <Sh> has a Layer assosiated
180 -- with the <aLayer>.
182 GetLayers (me: mutable; Sh: Shape from TopoDS;
183 aLayerS : out HSequenceOfExtendedString from TColStd) returns Boolean;
184 ---Purpose: Return sequence of strings <aLayerS> that assosiated with shape <Sh>.
186 GetLayers (me: mutable; Sh: Shape from TopoDS) returns HSequenceOfExtendedString from TColStd;
187 ---Purpose: Return sequence of strings that assosiated with shape <Sh>.
189 ---Category: TDF_Attribute methods
190 -- =====================
193 ---C++: return const &
194 returns GUID from Standard;
196 Restore (me: mutable; with : Attribute from TDF);
199 returns mutable Attribute from TDF;
201 Paste (me; into : mutable Attribute from TDF;
202 RT : mutable RelocationTable from TDF);
206 myShapeTool: ShapeTool from XCAFDoc;