Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:55

0001 // Created on: 1998-06-03
0002 // Created by: data exchange team
0003 // Copyright (c) 1998-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 _ShapeExtend_Explorer_HeaderFile
0018 #define _ShapeExtend_Explorer_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TopTools_HSequenceOfShape.hxx>
0025 #include <TopTools_ListOfShape.hxx>
0026 #include <TopAbs_ShapeEnum.hxx>
0027 class TopoDS_Shape;
0028 
0029 
0030 //! This class is intended to
0031 //! explore shapes and convert different representations
0032 //! (list, sequence, compound) of complex shapes. It provides tools for:
0033 //! - obtaining type of the shapes in context of TopoDS_Compound,
0034 //! - exploring shapes in context of  TopoDS_Compound,
0035 //! - converting different representations of shapes (list, sequence, compound).
0036 class ShapeExtend_Explorer 
0037 {
0038 public:
0039 
0040   DEFINE_STANDARD_ALLOC
0041 
0042   
0043   //! Creates an object Explorer
0044   Standard_EXPORT ShapeExtend_Explorer();
0045   
0046   //! Converts a sequence of Shapes to a Compound
0047   Standard_EXPORT TopoDS_Shape CompoundFromSeq (const Handle(TopTools_HSequenceOfShape)& seqval) const;
0048   
0049   //! Converts a Compound to a list of Shapes
0050   //! if <comp> is not a compound, the list contains only <comp>
0051   //! if <comp> is Null, the list is empty
0052   //! if <comp> is a Compound, its sub-shapes are put into the list
0053   //! then if <expcomp> is True, if a sub-shape is a Compound, it
0054   //! is not put to the list but its sub-shapes are (recursive)
0055   Standard_EXPORT Handle(TopTools_HSequenceOfShape) SeqFromCompound (const TopoDS_Shape& comp, const Standard_Boolean expcomp) const;
0056   
0057   //! Converts a Sequence of Shapes to a List of Shapes
0058   //! <clear> if True (D), commands the list to start from scratch
0059   //! else, the list is cumulated
0060   Standard_EXPORT void ListFromSeq (const Handle(TopTools_HSequenceOfShape)& seqval, TopTools_ListOfShape& lisval, const Standard_Boolean clear = Standard_True) const;
0061   
0062   //! Converts a List of Shapes to a Sequence of Shapes
0063   Standard_EXPORT Handle(TopTools_HSequenceOfShape) SeqFromList (const TopTools_ListOfShape& lisval) const;
0064   
0065   //! Returns the type of a Shape: true type if <compound> is False
0066   //! If <compound> is True and <shape> is a Compound, iterates on
0067   //! its items. If all are of the same type, returns this type.
0068   //! Else, returns COMPOUND. If it is empty, returns SHAPE
0069   //! For a Null Shape, returns SHAPE
0070   Standard_EXPORT TopAbs_ShapeEnum ShapeType (const TopoDS_Shape& shape, const Standard_Boolean compound) const;
0071   
0072   //! Builds a COMPOUND from the given shape.
0073   //! It explores the shape level by level, according to the
0074   //! <explore> argument. If <explore> is False, only COMPOUND
0075   //! items are explored, else all items are.
0076   //! The following shapes are added to resulting compound:
0077   //! - shapes which comply to <type>
0078   //! - if <type> is WIRE, considers also free edges (and makes wires)
0079   //! - if <type> is SHELL, considers also free faces (and makes shells)
0080   //! If <compound> is True, gathers items in compounds which
0081   //! correspond to starting COMPOUND,SOLID or SHELL containers, or
0082   //! items directly contained in a Compound
0083   Standard_EXPORT TopoDS_Shape SortedCompound (const TopoDS_Shape& shape, const TopAbs_ShapeEnum type, const Standard_Boolean explore, const Standard_Boolean compound) const;
0084   
0085   //! Dispatches starting list of shapes according to their type,
0086   //! to the appropriate resulting lists
0087   //! For each of these lists, if it is null, it is firstly created
0088   //! else, new items are appended to the already existing ones
0089   Standard_EXPORT void DispatchList (const Handle(TopTools_HSequenceOfShape)& list, Handle(TopTools_HSequenceOfShape)& vertices, Handle(TopTools_HSequenceOfShape)& edges, Handle(TopTools_HSequenceOfShape)& wires, Handle(TopTools_HSequenceOfShape)& faces, Handle(TopTools_HSequenceOfShape)& shells, Handle(TopTools_HSequenceOfShape)& solids, Handle(TopTools_HSequenceOfShape)& compsols, Handle(TopTools_HSequenceOfShape)& compounds) const;
0090 
0091 
0092 
0093 
0094 protected:
0095 
0096 
0097 
0098 
0099 
0100 private:
0101 
0102 
0103 
0104 
0105 
0106 };
0107 
0108 
0109 
0110 
0111 
0112 
0113 
0114 #endif // _ShapeExtend_Explorer_HeaderFile