From: spo Date: Mon, 29 Jun 2015 11:02:41 +0000 (+0300) Subject: Issue #608: Usage of OCCT in interface -- Wrap classes by SWIG X-Git-Tag: V_1.3.0~168 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0479361746467f244b7ccfd1d25443677bdea8a6;p=modules%2Fshaper.git Issue #608: Usage of OCCT in interface -- Wrap classes by SWIG --- diff --git a/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp index 1cf82bb0b..f4e87b76e 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp @@ -120,11 +120,11 @@ bool ExchangePlugin_ExportFeature::exportFile(const std::string& theFileName, TopoDS_Shape aShape(theShape->impl()); bool aResult = false; if (aFormatName == "BREP") { - aResult = BREPExport::Export(theFileName, aFormatName, aShape, anError); + aResult = BREPExport(theFileName, aFormatName, aShape, anError); } else if (aFormatName == "STEP") { - aResult = STEPExport::Export(theFileName, aFormatName, aShape, anError); + aResult = STEPExport(theFileName, aFormatName, aShape, anError); } else if (aFormatName.substr(0, 4) == "IGES") { - aResult = IGESExport::Export(theFileName, aFormatName, aShape, anError); + aResult = IGESExport(theFileName, aFormatName, aShape, anError); } else { anError = "Unsupported format " + aFormatName; } diff --git a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp index 1716adb37..adc678657 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp @@ -81,11 +81,11 @@ bool ExchangePlugin_ImportFeature::importFile(const std::string& theFileName) TopoDS_Shape aShape; if (anExtension == "BREP" || anExtension == "BRP") { - aShape = BREPImport::Import(theFileName, anExtension, anError); + aShape = BREPImport(theFileName, anExtension, anError); } else if (anExtension == "STEP" || anExtension == "STP") { - aShape = STEPImport::Import(theFileName, anExtension, anError); + aShape = STEPImport(theFileName, anExtension, anError); } else if (anExtension == "IGES" || anExtension == "IGS") { - aShape = IGESImport::Import(theFileName, anExtension, anError); + aShape = IGESImport(theFileName, anExtension, anError); } // Check if shape is valid if ( aShape.IsNull() ) { diff --git a/src/GeomAlgoAPI/GeomAlgoAPI.i b/src/GeomAlgoAPI/GeomAlgoAPI.i index 806c443c9..6a49f1fae 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI.i +++ b/src/GeomAlgoAPI/GeomAlgoAPI.i @@ -18,6 +18,12 @@ #include "GeomAlgoAPI_Rotation.h" #include "GeomAlgoAPI_ShapeProps.h" #include "GeomAlgoAPI_SketchBuilder.h" + #include "GeomAlgoAPI_BREPExport.h" + #include "GeomAlgoAPI_IGESExport.h" + #include "GeomAlgoAPI_STEPExport.h" + #include "GeomAlgoAPI_BREPImport.h" + #include "GeomAlgoAPI_IGESImport.h" + #include "GeomAlgoAPI_STEPImport.h" #include "GeomAlgoAPI_Tools.h" #include @@ -51,6 +57,12 @@ %include "GeomAlgoAPI_Rotation.h" %include "GeomAlgoAPI_ShapeProps.h" %include "GeomAlgoAPI_SketchBuilder.h" +%include "GeomAlgoAPI_BREPExport.h" +%include "GeomAlgoAPI_IGESExport.h" +%include "GeomAlgoAPI_STEPExport.h" +%include "GeomAlgoAPI_BREPImport.h" +%include "GeomAlgoAPI_IGESImport.h" +%include "GeomAlgoAPI_STEPImport.h" %include "GeomAlgoAPI_Tools.h" %typemap(out) std::list< std::shared_ptr< GeomAPI_Shape > >::value_type & { diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.cpp index 8a6c36f11..d85ae6b4f 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.cpp @@ -16,12 +16,10 @@ * */ //============================================================================= -namespace BREPExport { - -bool Export(const std::string& theFileName, - const std::string&, - const TopoDS_Shape& theShape, - std::string& theError) +bool BREPExport(const std::string& theFileName, + const std::string&, + const TopoDS_Shape& theShape, + std::string& theError) { #ifdef _DEBUG std::cout << "Export BREP into file " << theFileName << std::endl; @@ -36,5 +34,3 @@ bool Export(const std::string& theFileName, } return true; } - -} // namespace BREPExport diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.h b/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.h index 2b51e43f7..de545479e 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_BREPExport.h @@ -13,15 +13,11 @@ #include -namespace BREPExport { - /// Implementation of the export BREP files algorithms GEOMALGOAPI_EXPORT -bool Export(const std::string& theFileName, - const std::string& theFormatName, - const TopoDS_Shape& theShape, - std::string& theError); - -} // namespace BREPExport +bool BREPExport(const std::string& theFileName, + const std::string& theFormatName, + const TopoDS_Shape& theShape, + std::string& theError); #endif /* GEOMALGOAPI_BREPEXPORT_H_ */ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.cpp index 9cb93117d..62d63ac24 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.cpp @@ -10,11 +10,9 @@ * */ //============================================================================= -namespace BREPImport { - -TopoDS_Shape Import(const std::string& theFileName, - const std::string&, - std::string& theError) +TopoDS_Shape BREPImport(const std::string& theFileName, + const std::string&, + std::string& theError) { #ifdef _DEBUG std::cout << "Import BREP from file " << theFileName << std::endl; @@ -27,5 +25,3 @@ TopoDS_Shape Import(const std::string& theFileName, } return aShape; } - -} // namespace BREPImport diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.h b/src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.h index 93fce71fd..a06f1db1b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.h @@ -16,14 +16,10 @@ #include -namespace BREPImport { - /// Implementation of the import BREP files algorithms GEOMALGOAPI_EXPORT -TopoDS_Shape Import(const std::string& theFileName, - const std::string& theFormatName, - std::string& theError); - -} // namespace BREPImport +TopoDS_Shape BREPImport(const std::string& theFileName, + const std::string& theFormatName, + std::string& theError); #endif /* GEOMALGOAPI_BREPIMPORT_H_ */ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp index 0f7182a8f..93fb05b02 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.cpp @@ -78,14 +78,10 @@ int KindOfBRep (const TopoDS_Shape& theShape) } //============================================================================= -//extern "C" { - -namespace IGESExport { - -bool Export(const TCollection_AsciiString& theFileName, - const TCollection_AsciiString& theFormatName, - const TopoDS_Shape& theShape, - TCollection_AsciiString& theError) +bool IGESExport(const TCollection_AsciiString& theFileName, + const TCollection_AsciiString& theFormatName, + const TopoDS_Shape& theShape, + TCollection_AsciiString& theError) { // theFormatName expected "IGES-5.1", "IGES-5.3"... TCollection_AsciiString aVersion = theFormatName.Token("-", 2); @@ -136,7 +132,3 @@ bool Export(const TCollection_AsciiString& theFileName, } return false; } - -} - -//} diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.h b/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.h index a583ae804..f70172342 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_IGESExport.h @@ -13,15 +13,11 @@ #include -namespace IGESExport { - /// Implementation of the export IGES files algorithms GEOMALGOAPI_EXPORT -bool Export(const std::string& theFileName, - const std::string& theFormatName, - const TopoDS_Shape& theShape, - std::string& theError); - -} // namespace IGESExport +bool IGESExport(const std::string& theFileName, + const std::string& theFormatName, + const TopoDS_Shape& theShape, + std::string& theError); #endif /* GEOMALGOAPI_IGESEXPORT_H_ */ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.cpp index b15b0d19e..872d8b3f5 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.cpp @@ -11,11 +11,9 @@ * */ //============================================================================= -namespace IGESImport { - -TopoDS_Shape Import(const std::string& theFileName, - const std::string&, - std::string& theError) +TopoDS_Shape IGESImport(const std::string& theFileName, + const std::string&, + std::string& theError) { #ifdef _DEBUG std::cout << "Import IGES from file " << theFileName << std::endl; @@ -66,5 +64,3 @@ TopoDS_Shape Import(const std::string& theFileName, return aResShape; } - -} // namespace IGESImport diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.h b/src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.h index f2a3e2dc7..57fc754d1 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_IGESImport.h @@ -16,14 +16,10 @@ #include -namespace IGESImport { - /// Implementation of the import IGES files algorithms GEOMALGOAPI_EXPORT -TopoDS_Shape Import(const std::string& theFileName, - const std::string& theFormatName, - std::string& theError); - -} // namespace IGESImport +TopoDS_Shape IGESImport(const std::string& theFileName, + const std::string& theFormatName, + std::string& theError); #endif /* GEOMALGOAPI_IGESIMPORT_H_ */ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp index 6ec05e477..fbf7f718b 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.cpp @@ -13,12 +13,10 @@ #include #include -namespace STEPExport { - -bool Export(const std::string& theFileName, - const std::string& theFormatName, - const TopoDS_Shape& theShape, - std::string& theError) +bool STEPExport(const std::string& theFileName, + const std::string& theFormatName, + const TopoDS_Shape& theShape, + std::string& theError) { #ifdef _DEBUG std::cout << "Export STEP into file " << theFileName << std::endl; @@ -50,5 +48,3 @@ bool Export(const std::string& theFileName, } return false; } - -} // namespace STEPExport diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.h b/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.h index 09fa129e1..2011617af 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPExport.h @@ -13,15 +13,11 @@ #include -namespace STEPExport { - /// Implementation of the export STEP files algorithms GEOMALGOAPI_EXPORT -bool Export(const std::string& theFileName, - const std::string& theFormatName, - const TopoDS_Shape& theShape, - std::string& theError); - -} // namespace STEPExport +bool STEPExport(const std::string& theFileName, + const std::string& theFormatName, + const TopoDS_Shape& theShape, + std::string& theError); #endif /* GEOMALGOAPI_STEPEXPORT_H_ */ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp index bb304eea9..7ff22b0f0 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp @@ -43,7 +43,6 @@ #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC -namespace STEPImport { //============================================================================= /*! * GetShape() @@ -364,9 +363,9 @@ Handle(TCollection_HAsciiString) GetValue (const TCollection_AsciiString& theFil return aValue; } -TopoDS_Shape Import (const std::string& theFileName, - const std::string& theFormatName, - std::string& theError) +TopoDS_Shape STEPImport(const std::string& theFileName, + const std::string& theFormatName, + std::string& theError) { TopoDS_Shape aResShape; @@ -494,5 +493,3 @@ TopoDS_Shape Import (const std::string& theFileName, // Return previous locale return aResShape; } - -} // namespace STEPImport diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.h b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.h index 6f3506248..adf7c2f18 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.h @@ -16,14 +16,10 @@ #include -namespace STEPImport { - /// Implementation of the import STEP files algorithms GEOMALGOAPI_EXPORT -TopoDS_Shape Import(const std::string& theFileName, - const std::string& theFormatName, - std::string& theError); - -} // namespace STEPImport +TopoDS_Shape STEPImport(const std::string& theFileName, + const std::string& theFormatName, + std::string& theError); #endif /* GEOMALGOAPI_STEPIMPORT_H_ */ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Tools.h b/src/GeomAlgoAPI/GeomAlgoAPI_Tools.h index 3524e188e..f53385c81 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Tools.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Tools.h @@ -27,11 +27,11 @@ public: /** * Returns an extension of theFileName */ - static std::string extension(const std::string& theFileName); + GEOMALGOAPI_EXPORT static std::string extension(const std::string& theFileName); /** * Returns a name of theFileName */ - static std::string name(const std::string& theFileName); + GEOMALGOAPI_EXPORT static std::string name(const std::string& theFileName); }; } // GeomAlgoAPI_Tools