Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/ShapeExtend_Explorer.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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