Back to home page

EIC code displayed by LXR

 
 

    


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

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