Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-26 09:03:42

0001 // Created on: 1994-05-31
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1994-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 _IGESSelect_ViewSorter_HeaderFile
0018 #define _IGESSelect_ViewSorter_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Standard_Transient.hxx>
0024 #include <NCollection_IndexedMap.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <NCollection_Sequence.hxx>
0027 #include <NCollection_HSequence.hxx>
0028 class IGESData_IGESModel;
0029 class IGESData_IGESEntity;
0030 class Interface_InterfaceModel;
0031 class Interface_Graph;
0032 class IFSelect_PacketList;
0033 
0034 //! Sorts IGES Entities on the views and drawings.
0035 //! In a first step, it splits a set of entities according the
0036 //! different views they are attached to.
0037 //! Then, packets according single views (+ drawing frames), or
0038 //! according drawings (which refer to the views) can be determined
0039 //!
0040 //! It is a TShared, hence it can be a workomg field of a non-
0041 //! mutable object (a Dispatch for instance)
0042 class IGESSelect_ViewSorter : public Standard_Transient
0043 {
0044 
0045 public:
0046   //! Creates a ViewSorter, empty. SetModel remains to be called
0047   Standard_EXPORT IGESSelect_ViewSorter();
0048 
0049   //! Sets the Model (for PacketList)
0050   Standard_EXPORT void SetModel(const occ::handle<IGESData_IGESModel>& model);
0051 
0052   //! Clears recorded data
0053   Standard_EXPORT void Clear();
0054 
0055   //! Adds an item according its type : AddEntity,AddList,AddModel
0056   Standard_EXPORT bool Add(const occ::handle<Standard_Transient>& ent);
0057 
0058   //! Adds an IGES entity. Records the view it is attached to.
0059   //! Records directly <ent> if it is a ViewKindEntity or a Drawing
0060   //! Returns True if added, False if already in the map
0061   Standard_EXPORT bool AddEntity(const occ::handle<IGESData_IGESEntity>& igesent);
0062 
0063   //! Adds a list of entities by adding each of the items
0064   Standard_EXPORT void AddList(
0065     const occ::handle<NCollection_HSequence<occ::handle<Standard_Transient>>>& list);
0066 
0067   //! Adds all the entities contained in a Model
0068   Standard_EXPORT void AddModel(const occ::handle<Interface_InterfaceModel>& model);
0069 
0070   //! Returns the count of already recorded
0071   Standard_EXPORT int NbEntities() const;
0072 
0073   //! Prepares the result to keep only sets attached to Single Views
0074   //! If <alsoframes> is given True, it keeps also the Drawings as
0075   //! specific sets, in order to get their frames.
0076   //! Entities attached to no single view are put in Remaining List.
0077   //!
0078   //! Result can then be read by the methods NbSets,SetItem,SetList,
0079   //! RemainingList(final = True)
0080   Standard_EXPORT void SortSingleViews(const bool alsoframes);
0081 
0082   //! Prepares the result to the sets attached to Drawings :
0083   //! All the single views referenced by a Drawing become bound to
0084   //! the set for this Drawing
0085   //!
0086   //! Entities or Views which correspond to no Drawing are put into
0087   //! the Remaining List.
0088   //!
0089   //! Result can then be read by the methods NbSets,SetItem,SetList,
0090   //! RemainingList(final = True)
0091   Standard_EXPORT void SortDrawings(const Interface_Graph& G);
0092 
0093   //! Returns the count of sets recorded, one per distinct item.
0094   //! The Remaining List is not counted.
0095   //! If <final> is False, the sets are attached to distinct views
0096   //! determined by the method Add.
0097   //! If <final> is True, they are the sets determined by the last
0098   //! call to, either SortSingleViews, or SortDrawings.
0099   //!
0100   //! Warning : Drawings directly recorded are also counted as sets, because
0101   //! of their Frame (which is made of Annotations)
0102   Standard_EXPORT int NbSets(const bool final) const;
0103 
0104   //! Returns the Item which is attached to a set of entities
0105   //! For <final> and definition of sets, see method NbSets.
0106   //! This item can be a kind of View or a Drawing
0107   Standard_EXPORT occ::handle<IGESData_IGESEntity> SetItem(const int num, const bool final) const;
0108 
0109   //! Returns the complete content of the determined Sets, which
0110   //! include Duplicated and Remaining (duplication 0) lists
0111   //! For <final> and definition of sets, see method NbSets.
0112   Standard_EXPORT occ::handle<IFSelect_PacketList> Sets(const bool final) const;
0113 
0114   DEFINE_STANDARD_RTTIEXT(IGESSelect_ViewSorter, Standard_Transient)
0115 
0116 private:
0117   occ::handle<IGESData_IGESModel>                         themodel;
0118   NCollection_IndexedMap<occ::handle<Standard_Transient>> themap;
0119   NCollection_IndexedMap<occ::handle<Standard_Transient>> theitems;
0120   NCollection_IndexedMap<occ::handle<Standard_Transient>> thefinals;
0121   NCollection_Sequence<int>                               theinditem;
0122   NCollection_Sequence<int>                               theindfin;
0123 };
0124 
0125 #endif // _IGESSelect_ViewSorter_HeaderFile