Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:21

0001 // Created on: 1997-03-17
0002 // Created by: Yves FRICAUD
0003 // Copyright (c) 1997-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _TNaming_HeaderFile
0018 #define _TNaming_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TopTools_DataMapOfShapeShape.hxx>
0025 #include <TopTools_MapOfShape.hxx>
0026 #include <TopTools_HArray1OfShape.hxx>
0027 #include <TDF_IDList.hxx>
0028 #include <Standard_OStream.hxx>
0029 #include <TNaming_Evolution.hxx>
0030 #include <TNaming_NameType.hxx>
0031 class TDF_Label;
0032 class TopLoc_Location;
0033 class gp_Trsf;
0034 class TNaming_NamedShape;
0035 class TopoDS_Shape;
0036 class TopoDS_Face;
0037 class TopoDS_Wire;
0038 class TopoDS_Solid;
0039 class TopoDS_Shell;
0040 
0041 
0042 //! A topological attribute can be seen as a hook
0043 //! into the topological structure. To this hook,
0044 //! data can be attached and references defined.
0045 //! It is used for keeping and access to
0046 //! topological objects and their evolution. All
0047 //! topological objects are stored in the one
0048 //! user-protected TNaming_UsedShapes
0049 //! attribute at the root label of the data
0050 //! framework. This attribute contains map with all
0051 //! topological shapes, used in this document.
0052 //! To all other labels TNaming_NamedShape
0053 //! attribute can be added. This attribute contains
0054 //! references (hooks) to shapes from the
0055 //! TNaming_UsedShapes attribute and evolution
0056 //! of these shapes. TNaming_NamedShape
0057 //! attribute contains a set of pairs of hooks: old
0058 //! shape and new shape (see the figure below).
0059 //! It allows not only get the topological shapes by
0060 //! the labels, but also trace evolution of the
0061 //! shapes and correctly resolve dependent
0062 //! shapes by the changed one.
0063 //! If shape is just-created, then the old shape for
0064 //! accorded named shape is an empty shape. If
0065 //! a shape is deleted, then the new shape in this named shape is empty.
0066 //! Different algorithms may dispose sub-shapes
0067 //! of the result shape at the individual label depending on necessity:
0068 //! -  If a sub-shape must have some extra attributes (material of
0069 //! each face or color of each edge). In this case a specific sub-shape is
0070 //! placed to the separate label (usually, sub-label of the result shape label)
0071 //! with all attributes of this sub-shape.
0072 //! -  If topological naming is needed, a necessary and sufficient
0073 //! (for selected sub-shapes identification) set of sub-shapes is
0074 //! placed to the child labels of the result
0075 //! shape label. As usual, as far as basic solids and closed shells are
0076 //! concerned, all faces of the shape are disposed. Edges and vertices
0077 //! sub-shapes can be identified as intersection of contiguous faces.
0078 //! Modified/generated shapes may be placed to one named shape and
0079 //! identified as this named shape and source named shape that also can be
0080 //! identified with used algorithms.
0081 //! TNaming_NamedShape may contain a few
0082 //! pairs of hooks with the same evolution. In this
0083 //! case topology shape, which belongs to the
0084 //! named shape, is a compound of new shapes.
0085 //! The data model contains both the topology
0086 //! and the hooks, and functions handle both
0087 //! topological entities and hooks. Consider the
0088 //! case of a box function, which creates a solid
0089 //! with six faces and six hooks. Each hook is
0090 //! attached to a face. If you want, you can also
0091 //! have this function create hooks for edges and
0092 //! vertices as well as for faces. For the sake of
0093 //! simplicity though, let's limit the example.
0094 //! Not all functions can define explicit hooks for
0095 //! all topological entities they create, but all
0096 //! topological entities can be turned into hooks
0097 //! when necessary. This is where topological naming is necessary.
0098 class TNaming 
0099 {
0100 public:
0101 
0102   DEFINE_STANDARD_ALLOC
0103 
0104   
0105   //! Subtituter les  shapes  sur les structures de   source
0106   //! vers cible
0107   Standard_EXPORT static void Substitute (const TDF_Label& labelsource, const TDF_Label& labelcible, TopTools_DataMapOfShapeShape& mapOldNew);
0108   
0109   //! Mise a jour des shapes du label  et de ses fils en
0110   //! tenant compte des  substitutions decrite par
0111   //! mapOldNew.
0112   //!
0113   //! Warning: le  remplacement du shape est  fait    dans tous
0114   //! les    attributs  qui  le contiennent meme si ceux
0115   //! ci ne sont pas associees a des sous-labels de <Label>.
0116   Standard_EXPORT static void Update (const TDF_Label& label, TopTools_DataMapOfShapeShape& mapOldNew);
0117   
0118   //! Application de la Location sur les shapes du label
0119   //! et  de   ses   sous   labels.
0120   Standard_EXPORT static void Displace (const TDF_Label& label, const TopLoc_Location& aLocation, const Standard_Boolean WithOld = Standard_True);
0121   
0122   //! Remplace  les  shapes du label et  des sous-labels
0123   //! par des copies.
0124   Standard_EXPORT static void ChangeShapes (const TDF_Label& label, TopTools_DataMapOfShapeShape& M);
0125   
0126   //! Application de la transformation sur les shapes du
0127   //! label et de ses sous labels.
0128   //! Warning: le  remplacement du shape est  fait    dans tous
0129   //! les    attributs  qui  le contiennent meme si ceux
0130   //! ci ne sont pas associees a des sous-labels de <Label>.
0131   Standard_EXPORT static void Transform (const TDF_Label& label, const gp_Trsf& aTransformation);
0132   
0133   //! Replicates the named shape with the transformation <T>
0134   //! on the label <L> (and sub-labels if necessary)
0135   //! (TNaming_GENERATED is set)
0136   Standard_EXPORT static void Replicate (const Handle(TNaming_NamedShape)& NS, const gp_Trsf& T, const TDF_Label& L);
0137   
0138   //! Replicates the shape with the transformation <T>
0139   //! on the label <L> (and sub-labels if necessary)
0140   //! (TNaming_GENERATED is set)
0141   Standard_EXPORT static void Replicate (const TopoDS_Shape& SH, const gp_Trsf& T, const TDF_Label& L);
0142   
0143   //! Builds shape from map content
0144   Standard_EXPORT static TopoDS_Shape MakeShape (const TopTools_MapOfShape& MS);
0145   
0146   //! Find unique context of shape <S>
0147   Standard_EXPORT static TopoDS_Shape FindUniqueContext (const TopoDS_Shape& S, const TopoDS_Shape& Context);
0148   
0149   //! Find unique context of shape <S>,which is pure concatenation
0150   //! of atomic shapes (Compound). The result is concatenation of
0151   //! single contexts
0152   Standard_EXPORT static TopoDS_Shape FindUniqueContextSet (const TopoDS_Shape& S, const TopoDS_Shape& Context, Handle(TopTools_HArray1OfShape)& Arr);
0153   
0154   //! Substitutes shape in source structure
0155   Standard_EXPORT static Standard_Boolean SubstituteSShape (const TDF_Label& accesslabel, const TopoDS_Shape& From, TopoDS_Shape& To);
0156   
0157   //! Returns True if outer wire is found and the found wire in <theWire>.
0158   Standard_EXPORT static Standard_Boolean OuterWire (const TopoDS_Face& theFace, TopoDS_Wire& theWire);
0159   
0160   //! Returns True if outer Shell is found and the found shell in <theShell>.
0161   //! Print of TNaming enumeration
0162   //! =============================
0163   Standard_EXPORT static Standard_Boolean OuterShell (const TopoDS_Solid& theSolid, TopoDS_Shell& theShell);
0164   
0165   //! Appends to <anIDList> the list of the attributes
0166   //! IDs of this package. CAUTION: <anIDList> is NOT
0167   //! cleared before use.
0168   Standard_EXPORT static void IDList (TDF_IDList& anIDList);
0169   
0170   //! Prints the  evolution  <EVOL> as  a String on  the
0171   //! Stream <S> and returns <S>.
0172   Standard_EXPORT static Standard_OStream& Print (const TNaming_Evolution EVOL, Standard_OStream& S);
0173   
0174   //! Prints the name of name type <NAME> as a String on
0175   //! the Stream <S> and returns <S>.
0176   Standard_EXPORT static Standard_OStream& Print (const TNaming_NameType NAME, Standard_OStream& S);
0177   
0178   //! Prints the content of UsedShapes private  attribute as a String Table on
0179   //! the Stream <S> and returns <S>.
0180   Standard_EXPORT static Standard_OStream& Print (const TDF_Label& ACCESS, Standard_OStream& S);
0181 
0182 };
0183 
0184 #endif // _TNaming_HeaderFile