Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1993-07-19
0002 // Created by: Remi LEQUETTE
0003 // Copyright (c) 1993-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 _BRepTools_ShapeSet_HeaderFile
0018 #define _BRepTools_ShapeSet_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <BRep_Builder.hxx>
0025 #include <GeomTools_SurfaceSet.hxx>
0026 #include <GeomTools_CurveSet.hxx>
0027 #include <GeomTools_Curve2dSet.hxx>
0028 #include <TColStd_IndexedMapOfTransient.hxx>
0029 #include <TopTools_ShapeSet.hxx>
0030 #include <Standard_OStream.hxx>
0031 #include <Standard_IStream.hxx>
0032 #include <TopAbs_ShapeEnum.hxx>
0033 
0034 class TopoDS_Shape;
0035 
0036 
0037 //! Contains a Shape and all  its subshapes, locations
0038 //! and geometries.
0039 //!
0040 //! The topology is inherited from TopTools.
0041 class BRepTools_ShapeSet  : public TopTools_ShapeSet
0042 {
0043 public:
0044 
0045   DEFINE_STANDARD_ALLOC
0046 
0047   //! Builds an empty ShapeSet.
0048   //! @param theWithTriangles flag to write triangulation data
0049   Standard_EXPORT BRepTools_ShapeSet (const Standard_Boolean theWithTriangles = Standard_True,
0050                                       const Standard_Boolean theWithNormals = Standard_False);
0051   
0052   //! Builds an empty ShapeSet.
0053   //! @param theWithTriangles flag to write triangulation data
0054   Standard_EXPORT BRepTools_ShapeSet (const BRep_Builder& theBuilder,
0055                                       const Standard_Boolean theWithTriangles = Standard_True,
0056                                       const Standard_Boolean theWithNormals = Standard_False);
0057 
0058   Standard_EXPORT virtual ~BRepTools_ShapeSet();
0059 
0060   //! Return true if shape should be stored with triangles.
0061   Standard_Boolean IsWithTriangles() const { return myWithTriangles; }
0062   //! Return true if shape should be stored triangulation with normals.
0063   Standard_Boolean IsWithNormals() const { return myWithNormals; }
0064 
0065   //! Define if shape will be stored with triangles.
0066   //! Ignored (always written) if face defines only triangulation (no surface).
0067   void SetWithTriangles (const Standard_Boolean theWithTriangles) { myWithTriangles = theWithTriangles; }
0068   //! Define if shape will be stored triangulation with normals.
0069   //! Ignored (always written) if face defines only triangulation (no surface).
0070   void SetWithNormals (const Standard_Boolean theWithNormals) { myWithNormals = theWithNormals; }
0071 
0072   //! Clears the content of the set.
0073   Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
0074   
0075   //! Stores the goemetry of <S>.
0076   Standard_EXPORT virtual void AddGeometry (const TopoDS_Shape& S) Standard_OVERRIDE;
0077   
0078   //! Dumps the geometry of me on the stream <OS>.
0079   Standard_EXPORT virtual void DumpGeometry (Standard_OStream& OS) const Standard_OVERRIDE;
0080   
0081   //! Writes the geometry of  me  on the stream <OS> in a
0082   //! format that can be read back by Read.
0083   Standard_EXPORT virtual void WriteGeometry (Standard_OStream& OS,
0084                                               const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
0085   
0086   //! Reads the geometry of me from the  stream  <IS>.
0087   Standard_EXPORT virtual void ReadGeometry (Standard_IStream& IS,
0088                                              const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
0089   
0090   //! Dumps the geometry of <S> on the stream <OS>.
0091   Standard_EXPORT virtual void DumpGeometry (const TopoDS_Shape& S, Standard_OStream& OS) const Standard_OVERRIDE;
0092   
0093   //! Writes the geometry of <S>  on the stream <OS> in a
0094   //! format that can be read back by Read.
0095   Standard_EXPORT virtual void WriteGeometry (const TopoDS_Shape& S, Standard_OStream& OS) const Standard_OVERRIDE;
0096   
0097   //! Reads the geometry of a shape of type <T> from the
0098   //! stream <IS> and returns it in <S>.
0099   Standard_EXPORT virtual void ReadGeometry (const TopAbs_ShapeEnum T, Standard_IStream& IS, TopoDS_Shape& S) Standard_OVERRIDE;
0100   
0101   //! Inserts  the shape <S2> in  the  shape <S1>.  This
0102   //! method must be   redefined  to  use   the  correct
0103   //! builder.
0104   Standard_EXPORT virtual void AddShapes (TopoDS_Shape& S1, const TopoDS_Shape& S2) Standard_OVERRIDE;
0105   
0106   Standard_EXPORT virtual void Check (const TopAbs_ShapeEnum T, TopoDS_Shape& S) Standard_OVERRIDE;
0107   
0108   //! Reads the 3d polygons  of me
0109   //! from the  stream  <IS>.
0110   Standard_EXPORT void ReadPolygon3D (Standard_IStream& IS,
0111                                       const Message_ProgressRange& theProgress = Message_ProgressRange());
0112   
0113   //! Writes the 3d polygons
0114   //! on the stream <OS> in a format that can
0115   //! be read back by Read.
0116   Standard_EXPORT void WritePolygon3D (Standard_OStream& OS,
0117                                        const Standard_Boolean Compact = Standard_True,
0118                                        const Message_ProgressRange& theProgress = Message_ProgressRange()) const;
0119   
0120   //! Dumps the 3d polygons
0121   //! on the stream <OS>.
0122   Standard_EXPORT void DumpPolygon3D (Standard_OStream& OS) const;
0123   
0124   //! Reads the triangulation of me
0125   //! from the  stream  <IS>.
0126   Standard_EXPORT void ReadTriangulation (Standard_IStream& IS,
0127                                           const Message_ProgressRange& theProgress = Message_ProgressRange());
0128   
0129   //! Writes the triangulation
0130   //! on the stream <OS> in a format that can
0131   //! be read back by Read.
0132   Standard_EXPORT void WriteTriangulation (Standard_OStream& OS,
0133                                            const Standard_Boolean Compact = Standard_True,
0134                                            const Message_ProgressRange& theProgress = Message_ProgressRange()) const;
0135   
0136   //! Dumps the triangulation
0137   //! on the stream <OS>.
0138   Standard_EXPORT void DumpTriangulation (Standard_OStream& OS) const;
0139   
0140   //! Reads the polygons on triangulation of me
0141   //! from the  stream  <IS>.
0142   Standard_EXPORT void ReadPolygonOnTriangulation (Standard_IStream& IS,
0143                                                    const Message_ProgressRange& theProgress = Message_ProgressRange());
0144   
0145   //! Writes the polygons on triangulation
0146   //! on the stream <OS> in a format that can
0147   //! be read back by Read.
0148   Standard_EXPORT void WritePolygonOnTriangulation (Standard_OStream& OS,
0149                                                     const Standard_Boolean Compact = Standard_True,
0150                                                     const Message_ProgressRange& theProgress = Message_ProgressRange()) const;
0151   
0152   //! Dumps the polygons on triangulation
0153   //! on the stream <OS>.
0154   Standard_EXPORT void DumpPolygonOnTriangulation (Standard_OStream& OS) const;
0155 
0156 
0157 
0158 
0159 protected:
0160 
0161 
0162 
0163 
0164 
0165 private:
0166 
0167 
0168 
0169   BRep_Builder myBuilder;
0170   GeomTools_SurfaceSet mySurfaces;
0171   GeomTools_CurveSet myCurves;
0172   GeomTools_Curve2dSet myCurves2d;
0173   TColStd_IndexedMapOfTransient myPolygons2D;
0174   TColStd_IndexedMapOfTransient myPolygons3D;
0175   NCollection_IndexedDataMap<Handle(Poly_Triangulation),
0176                              Standard_Boolean> myTriangulations; //!< Contains a boolean flag with information
0177                                                                  //!  to save normals for triangulation
0178   TColStd_IndexedMapOfTransient myNodes;
0179   Standard_Boolean myWithTriangles;
0180   Standard_Boolean myWithNormals;
0181 
0182 };
0183 
0184 #endif // _BRepTools_ShapeSet_HeaderFile