00001
00002
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00022
00029 #include <exotkDX_Root.hxx>
00030 #ifndef _TopoDS_Shape_HeaderFile
00031 #include <TopoDS_Shape.hxx>
00032 #endif
00033 #ifndef _TopTools_HSequenceOfShape_HeaderFile
00034 #include <TopTools_HSequenceOfShape.hxx>
00035 #endif
00036 #ifndef _exotkUtils_BRep_HeaderFile
00037 #include <exotkUtils_BRep.hxx>
00038 #endif
00039 #ifndef _OSD_Path_HeaderFile
00040 #include <OSD_Path.hxx>
00041 #endif
00042 #ifndef _TColStd_HSequenceOfAsciiString_HeaderFile
00043 #include <TColStd_HSequenceOfAsciiString.hxx>
00044 #endif
00045 #ifndef _Standard_DefineHandle_HeaderFile
00046 #include <Standard_DefineHandle.hxx>
00047 #endif
00048
00049
00050 IMPLEMENT_STANDARD_HANDLE(exotkDX_Root, MMgt_TShared)
00051 IMPLEMENT_STANDARD_RTTI(exotkDX_Root, MMgt_TShared)
00052
00053
00054
00055
00056
00057
00058
00059 IMPLEMENT_STANDARD_TYPE(exotkDX_Root)
00060 IMPLEMENT_STANDARD_SUPERTYPE(MMgt_TShared)
00061 IMPLEMENT_STANDARD_SUPERTYPE(Standard_Transient)
00062 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY()
00063 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(MMgt_TShared)
00064 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(Standard_Transient)
00065 IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END()
00066 IMPLEMENT_STANDARD_TYPE_END(exotkDX_Root)
00067
00068 exotkDX_Root::exotkDX_Root()
00069 {
00070 myAllowExport = Standard_False;
00071 myAllowImport = Standard_False;
00072 }
00073
00074 exotkDX_Root::~exotkDX_Root()
00075 {
00076
00077 }
00078
00079 Standard_Boolean exotkDX_Root::AllowImport()
00080 {
00081 return myAllowImport;
00082 }
00083 Standard_Boolean exotkDX_Root::AllowExport()
00084 {
00085 return myAllowExport;
00086 }
00087
00088 TCollection_AsciiString exotkDX_Root::Filename()
00089 {
00090 return myFileName;
00091 }
00092 void exotkDX_Root::SetFilename(const TCollection_AsciiString& aFilename)
00093 {
00094 myFileName = aFilename;
00095 }
00096
00097 TopoDS_Shape exotkDX_Root::LoadShape()
00098 {
00099 TopoDS_Shape theComputedShape;
00100
00101 Handle_TopTools_HSequenceOfShape theShapes = LoadShapes();
00102 if ( !theShapes.IsNull() && !theShapes->IsEmpty() )
00103 {
00104 TopoDS_Shape theConvertedShape;
00105 if ( exotkUtils_BRep::BuildShape(theConvertedShape,theShapes) )
00106 {
00107 theComputedShape = theConvertedShape;
00108 }
00109 }
00110
00111 return theComputedShape;
00112 }
00113 Standard_Boolean exotkDX_Root::SaveShapes(const Handle_TopTools_HSequenceOfShape& aSequenceOfShapes)
00114 {
00115 Standard_Boolean theSaveIsDone = Standard_False;
00116 if ( !aSequenceOfShapes.IsNull() && !aSequenceOfShapes->IsEmpty() )
00117 {
00118 TopoDS_Shape theConvertedShape;
00119 if ( exotkUtils_BRep::BuildShape(theConvertedShape,aSequenceOfShapes) )
00120 {
00121 theSaveIsDone = SaveShape(theConvertedShape);
00122 }
00123 }
00124 return theSaveIsDone;
00125
00126 }
00127
00128 Standard_Boolean exotkDX_Root::Match(const TCollection_AsciiString& aFilename)
00129 {
00130 Standard_Boolean theFilenameIsKnown = Standard_False;
00131
00132 if ( !aFilename.IsEmpty() )
00133 {
00134 OSD_Path thePath(aFilename);
00135 TCollection_AsciiString theExtension = thePath.Extension();
00136 if ( !theExtension.IsEmpty() )
00137 {
00138 theExtension.LowerCase();
00139 Handle_TColStd_HSequenceOfAsciiString theExtensions = FormatExtensions();
00140 if ( !theExtensions.IsNull() && !theExtensions->IsEmpty())
00141 {
00142 for ( int iter = 1 ; (iter <= theExtensions->Length()) && (!theFilenameIsKnown) ; iter++ )
00143 {
00144 TCollection_AsciiString theCurrentExtension = theExtensions->Value(iter);
00145 if ( !theCurrentExtension.IsEmpty() )
00146 {
00147 theCurrentExtension.LowerCase();
00148 if ( theCurrentExtension == theExtension )
00149 {
00150 theFilenameIsKnown = Standard_True;
00151 }
00152 }
00153 }
00154 }
00155 }
00156 }
00157
00158
00159 return theFilenameIsKnown;
00160 }