Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1996-12-24
0002 // Created by: Yves FRICAUD
0003 // Copyright (c) 1996-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_Tool_HeaderFile
0018 #define _TNaming_Tool_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TDF_LabelMap.hxx>
0025 #include <TNaming_MapOfNamedShape.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <TDF_LabelList.hxx>
0028 #include <TopTools_IndexedMapOfShape.hxx>
0029 class TNaming_NamedShape;
0030 class TNaming_OldShapeIterator;
0031 class TopoDS_Shape;
0032 class TDF_Label;
0033 class TNaming_UsedShapes;
0034 
0035 
0036 //! A tool to get information on the topology of a
0037 //! named shape attribute.
0038 //! This information is typically a TopoDS_Shape object.
0039 //! Using this tool, relations between named shapes
0040 //! are also accessible.
0041 class TNaming_Tool 
0042 {
0043 public:
0044 
0045   DEFINE_STANDARD_ALLOC
0046 
0047   
0048   //! Returns the last Modification of <NS>.
0049   //! Returns the shape CurrentShape contained in
0050   //! the named shape attribute NS.
0051   //! CurrentShape is the current state of the entities
0052   //! if they have been modified in other attributes of the same data structure.
0053   //! Each call to this function creates a new compound.
0054   Standard_EXPORT static TopoDS_Shape CurrentShape (const Handle(TNaming_NamedShape)& NS);
0055   
0056   //! Returns the shape CurrentShape contained in
0057   //! the named shape attribute NS, and present in
0058   //! the updated attribute map Updated.
0059   //! CurrentShape is the current state of the entities
0060   //! if they have been modified in other attributes of the same data structure.
0061   //! Each call to this function creates a new compound.
0062   //! Warning
0063   //! Only the contents of Updated are searched.R
0064   Standard_EXPORT static TopoDS_Shape CurrentShape (const Handle(TNaming_NamedShape)& NS, const TDF_LabelMap& Updated);
0065   
0066   //! Returns the NamedShape of the last Modification of <NS>.
0067   //! This shape is identified by a label.
0068   Standard_EXPORT static Handle(TNaming_NamedShape) CurrentNamedShape (const Handle(TNaming_NamedShape)& NS, const TDF_LabelMap& Updated);
0069   
0070   //! Returns NamedShape the last Modification of <NS>.
0071   Standard_EXPORT static Handle(TNaming_NamedShape) CurrentNamedShape (const Handle(TNaming_NamedShape)& NS);
0072   
0073   //! Returns the named shape attribute defined by
0074   //! the shape aShape and the label anAccess.
0075   //! This attribute is returned as a new shape.
0076   //! You call this function, if you need to create a
0077   //! topological attribute for existing data.
0078   //! Example
0079   //! class MyPkg_MyClass
0080   //! {
0081   //! public: Standard_Boolean
0082   //! SameEdge(const
0083   //! Handle(OCafTest_Line)& , const
0084   //! Handle(CafTest_Line)& );
0085   //! };
0086   //!
0087   //! Standard_Boolean
0088   //! MyPkg_MyClass::SameEdge
0089   //! (const Handle(OCafTest_Line)& L1
0090   //! const Handle(OCafTest_Line)& L2)
0091   //! { Handle(TNaming_NamedShape)
0092   //! NS1 = L1->NamedShape();
0093   //! Handle(TNaming_NamedShape)
0094   //! NS2 = L2->NamedShape();
0095   //!
0096   //! return
0097   //! BRepTools::Compare(NS1->Get(),NS2->Get());
0098   //! }
0099   //! In the example above, the function SameEdge is
0100   //! created to compare the edges having two lines
0101   //! for geometric supports. If these edges are found
0102   //! by BRepTools::Compare to be within the same
0103   //! tolerance, they are considered to be the same.
0104   //! Warning
0105   //! To avoid sharing of names, a SELECTED
0106   //! attribute will not be returned. Sharing of names
0107   //! makes it harder to manage the data structure.
0108   //! When the user of the name is removed, for
0109   //! example, it is difficult to know whether the name
0110   //! should be destroyed.
0111   Standard_EXPORT static Handle(TNaming_NamedShape) NamedShape (const TopoDS_Shape& aShape, const TDF_Label& anAcces);
0112   
0113   //! Returns the entities stored in the named shape attribute NS.
0114   //! If there is only one old-new pair, the new shape
0115   //! is returned. Otherwise, a Compound is returned.
0116   //! This compound is made out of all the new shapes found.
0117   //! Each call to this function creates a new compound.
0118   Standard_EXPORT static TopoDS_Shape GetShape (const Handle(TNaming_NamedShape)& NS);
0119   
0120   //! Returns the shape contained as OldShape in <NS>
0121   Standard_EXPORT static TopoDS_Shape OriginalShape (const Handle(TNaming_NamedShape)& NS);
0122   
0123   //! Returns the shape generated from S or by a
0124   //! modification of S and contained in the named
0125   //! shape Generation.
0126   Standard_EXPORT static TopoDS_Shape GeneratedShape (const TopoDS_Shape& S, const Handle(TNaming_NamedShape)& Generation);
0127   
0128   Standard_EXPORT static void Collect (const Handle(TNaming_NamedShape)& NS, TNaming_MapOfNamedShape& Labels, const Standard_Boolean OnlyModif = Standard_True);
0129   
0130   //! Returns True if <aShape> appears under a label.(DP)
0131   Standard_EXPORT static Standard_Boolean HasLabel (const TDF_Label& access, const TopoDS_Shape& aShape);
0132   
0133   //! Returns  the label  of   the first apparition  of
0134   //! <aShape>.  Transdef  is a value of the transaction
0135   //! of the first apparition of <aShape>.
0136   Standard_EXPORT static TDF_Label Label (const TDF_Label& access, const TopoDS_Shape& aShape, Standard_Integer& TransDef);
0137   
0138 
0139   //! Returns the shape created from the shape
0140   //! aShape contained in the attribute anAcces.
0141   Standard_EXPORT static TopoDS_Shape InitialShape (const TopoDS_Shape& aShape, const TDF_Label& anAcces, TDF_LabelList& Labels);
0142   
0143   //! Returns the last transaction where the creation of S
0144   //! is valid.
0145   Standard_EXPORT static Standard_Integer ValidUntil (const TDF_Label& access, const TopoDS_Shape& S);
0146   
0147   //! Returns the current shape (a Wire or a Shell) built (in the data framework)
0148   //! from the shapes of the argument named shape.
0149   //! It is used for IDENTITY name type computation.
0150   Standard_EXPORT static void FindShape (const TDF_LabelMap& Valid, const TDF_LabelMap& Forbiden, const Handle(TNaming_NamedShape)& Arg, TopoDS_Shape& S);
0151 
0152 
0153 friend class TNaming_Localizer;
0154 friend class TNaming_NamedShape;
0155 friend class TNaming_OldShapeIterator;
0156 
0157 
0158 protected:
0159 
0160 
0161 
0162 
0163 
0164 private:
0165 
0166   
0167   //! Returns True if <aShape> appears under a label.
0168   Standard_EXPORT static Standard_Boolean HasLabel (const Handle(TNaming_UsedShapes)& Shapes, const TopoDS_Shape& aShape);
0169   
0170   //! Returns the last transaction where the creation of S
0171   //! is valid.
0172   Standard_EXPORT static Standard_Integer ValidUntil (const TopoDS_Shape& S, const Handle(TNaming_UsedShapes)& US);
0173   
0174   //! Returns  the label  of   the first apparition  of
0175   //! <aShape>.  Transdef  is a value of the transaction
0176   //! of the first apparition of <aShape>.
0177   Standard_EXPORT static TDF_Label Label (const Handle(TNaming_UsedShapes)& Shapes, const TopoDS_Shape& aShape, Standard_Integer& TransDef);
0178   
0179   Standard_EXPORT static void FirstOlds (const Handle(TNaming_UsedShapes)& Shapes, const TopoDS_Shape& S, TNaming_OldShapeIterator& it, TopTools_IndexedMapOfShape& MS, TDF_LabelList& Labels);
0180 
0181 
0182 
0183 
0184 };
0185 
0186 
0187 
0188 
0189 
0190 
0191 
0192 #endif // _TNaming_Tool_HeaderFile