cgma
|
00001 // File: OCCShapeAttributeSet.hxx 00002 // Created: Thur Jul 10 2008 00003 // Author: Jane Hu 00004 00005 #ifndef _OCCShapeAttributeSet_HeaderFile 00006 #define _OCCShapeAttributeSet_HeaderFile 00007 00008 class TopoDS_Shape; 00009 class TDF_Label; 00010 class TopTools_DataMapOfShapeInteger; 00011 #include <map> 00012 00013 #ifndef _TopTools_LocationSet_HeaderFile 00014 #include <TopTools_LocationSet.hxx> 00015 #endif 00016 #ifndef _BRep_Builder_HeaderFile 00017 #include <BRep_Builder.hxx> 00018 #endif 00019 #ifndef _TopTools_IndexedMapOfShape_HeaderFile 00020 #include <TopTools_IndexedMapOfShape.hxx> 00021 #endif 00022 #ifndef _GeomTools_SurfaceSet_HeaderFile 00023 #include <GeomTools_SurfaceSet.hxx> 00024 #endif 00025 #ifndef _GeomTools_CurveSet_HeaderFile 00026 #include <GeomTools_CurveSet.hxx> 00027 #endif 00028 #ifndef _GeomTools_Curve2dSet_HeaderFile 00029 #include <GeomTools_Curve2dSet.hxx> 00030 #endif 00031 #ifndef _TColStd_IndexedMapOfTransient_HeaderFile 00032 #include <TColStd_IndexedMapOfTransient.hxx> 00033 #endif 00034 #ifndef _TopAbs_ShapeEnum_HeaderFile 00035 #include <TopAbs_ShapeEnum.hxx> 00036 #endif 00037 #ifndef _Standard_HeaderFile 00038 #include <Standard.hxx> 00039 #endif 00040 #ifndef _Standard_Macro_HeaderFile 00041 #include <Standard_Macro.hxx> 00042 #endif 00043 00047 // It's re-write version of BRepTools_ShapeSet 00048 class OCCShapeAttributeSet { 00049 00050 public: 00051 00052 void* operator new(size_t,void* anAddress) 00053 { 00054 return anAddress; 00055 } 00056 void* operator new(size_t size) 00057 { 00058 return Standard::Allocate(size); 00059 } 00060 void operator delete(void *anAddress) 00061 { 00062 if (anAddress) Standard::Free((Standard_Address&)anAddress); 00063 } 00064 // Methods PUBLIC 00065 // 00066 00068 OCCShapeAttributeSet(); 00069 00070 OCCShapeAttributeSet(const BRep_Builder& B); 00071 00072 ~OCCShapeAttributeSet(){Clear();} ; 00073 00075 void AddGeometry(const TopoDS_Shape& S) ; 00076 00079 void WriteAttribute(const TopoDS_Shape& S, 00080 Standard_OStream& OS, 00081 TDF_Label& l_attr); 00082 00083 void ReadAttribute(TopoDS_Shape& S, 00084 Standard_IStream& IS, 00085 TDF_Label& l_attr); 00086 00089 Standard_Integer Add(const TopoDS_Shape& S) ; 00090 00091 void Write(Standard_OStream& OS); 00092 00093 void Read(Standard_IStream& IS, bool print); 00094 00095 void Read(TopoDS_Shape& S,Standard_IStream& IS, const int nbshapes, 00096 TDF_Label* l_attr = NULL) ; 00097 00100 void WriteGeometry(Standard_OStream& OS) ; 00101 00102 void ReadGeometry(Standard_IStream& IS); 00103 00106 void WriteGeometry(const TopoDS_Shape& S,Standard_OStream& OS); 00107 00108 void ReadGeometry(const TopAbs_ShapeEnum T, 00109 Standard_IStream& IS, 00110 TopoDS_Shape& S); 00111 00115 void Write(const TopoDS_Shape& S, 00116 Standard_OStream& OS, 00117 TDF_Label* l_attr = NULL) ; 00118 00122 Standard_EXPORT void WritePolygon3D(Standard_OStream& OS,const Standard_Boolean Compact = Standard_True) ; 00123 00124 void ReadPolygon3D(Standard_IStream& IS); 00125 00129 Standard_EXPORT void WritePolygonOnTriangulation(Standard_OStream& OS,const Standard_Boolean Compact = Standard_True) ; 00130 00131 void ReadPolygonOnTriangulation(Standard_IStream& IS); 00132 00136 Standard_EXPORT void WriteTriangulation(Standard_OStream& OS,const Standard_Boolean Compact = Standard_True) ; 00137 00138 void ReadTriangulation(Standard_IStream& IS); 00139 00141 void Clear(); 00142 00143 void Check(const TopAbs_ShapeEnum T,TopoDS_Shape& S); 00144 00145 int NbShapes() ; 00146 00147 protected: 00148 // Methods PROTECTED 00149 // 00150 00151 00152 // Fields PROTECTED 00153 // 00154 00155 00156 private: 00157 00158 // Methods PRIVATE 00159 // 00160 00161 00162 // Fields PRIVATE 00163 // 00164 BRep_Builder myBuilder; 00165 TopTools_IndexedMapOfShape myShapes; 00166 std::map<int,int> my_ShapeNum_Location; 00167 TopTools_LocationSet myLocations; 00168 Standard_Integer myFormatNb; 00169 GeomTools_SurfaceSet mySurfaces; 00170 GeomTools_CurveSet myCurves; 00171 GeomTools_Curve2dSet myCurves2d; 00172 TColStd_IndexedMapOfTransient myPolygons2D; 00173 TColStd_IndexedMapOfTransient myPolygons3D; 00174 TColStd_IndexedMapOfTransient myTriangulations; 00175 TColStd_IndexedMapOfTransient myNodes; 00176 }; 00177 00178 00179 00180 00181 00182 // other Inline functions and methods (like "C++: function call" methods) 00183 // 00184 00185 00186 #endif