0026936: Drawbacks of inlining in new type system in OCCT 7.0 -- automatic
[occt.git] / src / TNaming / TNaming.hxx
CommitLineData
42cf5bc1 1// Created on: 1997-03-17
2// Created by: Yves FRICAUD
3// Copyright (c) 1997-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 _TNaming_HeaderFile
18#define _TNaming_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <TopTools_DataMapOfShapeShape.hxx>
25#include <Standard_Boolean.hxx>
26#include <TopTools_MapOfShape.hxx>
27#include <TopTools_HArray1OfShape.hxx>
28#include <TDF_IDList.hxx>
29#include <Standard_OStream.hxx>
30#include <TNaming_Evolution.hxx>
31#include <TNaming_NameType.hxx>
32class TDF_Label;
33class TopLoc_Location;
34class gp_Trsf;
35class TNaming_NamedShape;
36class TopoDS_Shape;
37class TopoDS_Face;
38class TopoDS_Wire;
39class TopoDS_Solid;
40class TopoDS_Shell;
41class TNaming_CopyShape;
42class TNaming_TranslateTool;
43class TNaming_Translator;
44class TNaming_NamedShape;
45class TNaming_UsedShapes;
46class TNaming_Builder;
47class TNaming_Tool;
48class TNaming_Iterator;
49class TNaming_NewShapeIterator;
50class TNaming_OldShapeIterator;
51class TNaming_SameShapeIterator;
52class TNaming_Name;
53class TNaming_Naming;
54class TNaming_Selector;
55class TNaming_DeltaOnRemoval;
56class TNaming_DeltaOnModification;
57class TNaming_RefShape;
58class TNaming_Scope;
59class TNaming_Identifier;
60class TNaming_Localizer;
61class TNaming_ShapesSet;
62class TNaming_IteratorOnShapesSet;
63class TNaming_NamingTool;
64
65
66//! A topological attribute can be seen as a hook
67//! into the topological structure. To this hook,
68//! data can be attached and references defined.
69//! It is used for keeping and access to
70//! topological objects and their evolution. All
71//! topological objects are stored in the one
72//! user-protected TNaming_UsedShapes
73//! attribute at the root label of the data
74//! framework. This attribute contains map with all
75//! topological shapes, used in this document.
76//! To all other labels TNaming_NamedShape
77//! attribute can be added. This attribute contains
78//! references (hooks) to shapes from the
79//! TNaming_UsedShapes attribute and evolution
80//! of these shapes. TNaming_NamedShape
81//! attribute contains a set of pairs of hooks: old
82//! shape and new shape (see the figure below).
83//! It allows not only get the topological shapes by
84//! the labels, but also trace evolution of the
85//! shapes and correctly resolve dependent
86//! shapes by the changed one.
87//! If shape is just-created, then the old shape for
88//! accorded named shape is an empty shape. If
89//! a shape is deleted, then the new shape in this named shape is empty.
90//! Different algorithms may dispose sub-shapes
91//! of the result shape at the individual label depending on necessity:
92//! - If a sub-shape must have some extra attributes (material of
93//! each face or color of each edge). In this case a specific sub-shape is
94//! placed to the separate label (usually, sub-label of the result shape label)
95//! with all attributes of this sub-shape.
96//! - If topological naming is needed, a necessary and sufficient
97//! (for selected sub-shapes identification) set of sub-shapes is
98//! placed to the child labels of the result
99//! shape label. As usual, as far as basic solids and closed shells are
100//! concerned, all faces of the shape are disposed. Edges and vertices
101//! sub-shapes can be identified as intersection of contiguous faces.
102//! Modified/generated shapes may be placed to one named shape and
103//! identified as this named shape and source named shape that also can be
104//! identified with used algorithms.
105//! TNaming_NamedShape may contain a few
106//! pairs of hooks with the same evolution. In this
107//! case topology shape, which belongs to the
108//! named shape, is a compound of new shapes.
109//! The data model contains both the topology
110//! and the hooks, and functions handle both
111//! topological entities and hooks. Consider the
112//! case of a box function, which creates a solid
113//! with six faces and six hooks. Each hook is
114//! attached to a face. If you want, you can also
115//! have this function create hooks for edges and
116//! vertices as well as for faces. For the sake of
117//! simplicity though, let's limit the example.
118//! Not all functions can define explicit hooks for
119//! all topological entities they create, but all
120//! topological entities can be turned into hooks
121//! when necessary. This is where topological naming is necessary.
122class TNaming
123{
124public:
125
126 DEFINE_STANDARD_ALLOC
127
128
129 //! Subtituter les shapes sur les structures de source
130 //! vers cible
131 Standard_EXPORT static void Substitute (const TDF_Label& labelsource, const TDF_Label& labelcible, TopTools_DataMapOfShapeShape& mapOldNew);
132
133 //! Mise a jour des shapes du label et de ses fils en
134 //! tenant compte des substitutions decrite par
135 //! mapOldNew.
136 //!
137 //! Warning: le remplacement du shape est fait dans tous
138 //! les attributs qui le contiennent meme si ceux
139 //! ci ne sont pas associees a des sous-labels de <Label>.
140 Standard_EXPORT static void Update (const TDF_Label& label, TopTools_DataMapOfShapeShape& mapOldNew);
141
142 //! Application de la Location sur les shapes du label
143 //! et de ses sous labels.
144 Standard_EXPORT static void Displace (const TDF_Label& label, const TopLoc_Location& aLocation, const Standard_Boolean WithOld = Standard_True);
145
146 //! Remplace les shapes du label et des sous-labels
147 //! par des copies.
148 Standard_EXPORT static void ChangeShapes (const TDF_Label& label, TopTools_DataMapOfShapeShape& M);
149
150 //! Application de la transformation sur les shapes du
151 //! label et de ses sous labels.
152 //! Warning: le remplacement du shape est fait dans tous
153 //! les attributs qui le contiennent meme si ceux
154 //! ci ne sont pas associees a des sous-labels de <Label>.
155 Standard_EXPORT static void Transform (const TDF_Label& label, const gp_Trsf& aTransformation);
156
157 //! Replicates the named shape with the transformation <T>
158 //! on the label <L> (and sub-labels if necessary)
159 //! (TNaming_GENERATED is set)
160 Standard_EXPORT static void Replicate (const Handle(TNaming_NamedShape)& NS, const gp_Trsf& T, const TDF_Label& L);
161
162 //! Replicates the shape with the transformation <T>
163 //! on the label <L> (and sub-labels if necessary)
164 //! (TNaming_GENERATED is set)
165 Standard_EXPORT static void Replicate (const TopoDS_Shape& SH, const gp_Trsf& T, const TDF_Label& L);
166
167 //! Builds shape from map content
168 Standard_EXPORT static TopoDS_Shape MakeShape (const TopTools_MapOfShape& MS);
169
170 //! Find unique context of shape <S>
171 Standard_EXPORT static TopoDS_Shape FindUniqueContext (const TopoDS_Shape& S, const TopoDS_Shape& Context);
172
173 //! Find unique context of shape <S>,which is pure concatenation
174 //! of atomic shapes (Compound). The result is concatenation of
175 //! single contexts
176 Standard_EXPORT static TopoDS_Shape FindUniqueContextSet (const TopoDS_Shape& S, const TopoDS_Shape& Context, Handle(TopTools_HArray1OfShape)& Arr);
177
178 //! Subtitutes shape in source structure
179 Standard_EXPORT static Standard_Boolean SubstituteSShape (const TDF_Label& accesslabel, const TopoDS_Shape& From, TopoDS_Shape& To);
180
181 //! Returns True if outer wire is found and the found wire in <theWire>.
182 Standard_EXPORT static Standard_Boolean OuterWire (const TopoDS_Face& theFace, TopoDS_Wire& theWire);
183
184 //! Returns True if outer Shell is found and the found shell in <theShell>.
185 //! Print of TNaming enumeration
186 //! =============================
187 Standard_EXPORT static Standard_Boolean OuterShell (const TopoDS_Solid& theSolid, TopoDS_Shell& theShell);
188
189 //! Appends to <anIDList> the list of the attributes
190 //! IDs of this package. CAUTION: <anIDList> is NOT
191 //! cleared before use.
192 Standard_EXPORT static void IDList (TDF_IDList& anIDList);
193
194 //! Prints the evolution <EVOL> as a String on the
195 //! Stream <S> and returns <S>.
196 Standard_EXPORT static Standard_OStream& Print (const TNaming_Evolution EVOL, Standard_OStream& S);
197
198 //! Prints the name of name type <NAME> as a String on
199 //! the Stream <S> and returns <S>.
200 Standard_EXPORT static Standard_OStream& Print (const TNaming_NameType NAME, Standard_OStream& S);
201
202 //! Prints the content of UsedShapes private attribute as a String Table on
203 //! the Stream <S> and returns <S>.
204 Standard_EXPORT static Standard_OStream& Print (const TDF_Label& ACCESS, Standard_OStream& S);
205
206
207
208
209protected:
210
211
212
213
214
215private:
216
217
218
219
220friend class TNaming_CopyShape;
221friend class TNaming_TranslateTool;
222friend class TNaming_Translator;
223friend class TNaming_NamedShape;
224friend class TNaming_UsedShapes;
225friend class TNaming_Builder;
226friend class TNaming_Tool;
227friend class TNaming_Iterator;
228friend class TNaming_NewShapeIterator;
229friend class TNaming_OldShapeIterator;
230friend class TNaming_SameShapeIterator;
231friend class TNaming_Name;
232friend class TNaming_Naming;
233friend class TNaming_Selector;
234friend class TNaming_DeltaOnRemoval;
235friend class TNaming_DeltaOnModification;
236friend class TNaming_RefShape;
237friend class TNaming_Scope;
238friend class TNaming_Identifier;
239friend class TNaming_Localizer;
240friend class TNaming_ShapesSet;
241friend class TNaming_IteratorOnShapesSet;
242friend class TNaming_NamingTool;
243
244};
245
246
247
248
249
250
251
252#endif // _TNaming_HeaderFile