From: Jérôme Date: Wed, 7 Oct 2020 16:21:26 +0000 (+0200) Subject: Improvement coding style X-Git-Tag: V9_6_0b1~6^2~4^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3193d560d4d6b51db0ae90418c7f92420c69f42e;p=modules%2Fshaper.git Improvement coding style --- diff --git a/src/ExchangeAPI/ExchangeAPI_Export.cpp b/src/ExchangeAPI/ExchangeAPI_Export.cpp index 4e9b4b9c3..ba11e3920 100644 --- a/src/ExchangeAPI/ExchangeAPI_Export.cpp +++ b/src/ExchangeAPI/ExchangeAPI_Export.cpp @@ -199,7 +199,7 @@ void ExchangeAPI_Export::dump(ModelHighAPI_Dumper& theDumper) const aBase->selection(ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED()); theDumper<<","<< aShapeSelected; - + theDumper <<","<< stlabsolute() <<","<< stlrelative(); if (stldeflectionType()->value() == ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_RELATIVE()) { @@ -208,7 +208,7 @@ void ExchangeAPI_Export::dump(ModelHighAPI_Dumper& theDumper) const else { theDumper <<","<< "False"; } - + if (stlfileType()->value() == ExchangePlugin_ExportFeature::STL_FILE_TYPE_BINARY()) { theDumper << "False"; } @@ -255,10 +255,10 @@ ExportPtr exportToXAO(const std::shared_ptr & thePart, ExportPtr exportToSTL(const std::shared_ptr & thePart, const std::string & theFilePath, const ModelHighAPI_Selection& theSelectedShape, - double aDeflectionRelative, - double aDeflectionAbsolute, - const bool anIsRelative, - const bool anIsASCII) + double theDeflectionRelative, + double theDeflectionAbsolute, + const bool theIsRelative, + const bool theIsASCII) { apply(); // finish previous operation to make sure all previous operations are done std::shared_ptr aFeature = @@ -267,10 +267,10 @@ ExportPtr exportToSTL(const std::shared_ptr & thePart, return ExportPtr(new ExchangeAPI_Export(aFeature, theFilePath, theSelectedShape, - aDeflectionRelative, - aDeflectionAbsolute, - anIsRelative, - anIsASCII)); + theDeflectionRelative, + theDeflectionAbsolute, + theIsRelative, + theIsASCII)); } ExportPtr exportToXAO(const std::shared_ptr & thePart, diff --git a/src/ExchangeAPI/ExchangeAPI_Export.h b/src/ExchangeAPI/ExchangeAPI_Export.h index d867da1bf..89f360a07 100644 --- a/src/ExchangeAPI/ExchangeAPI_Export.h +++ b/src/ExchangeAPI/ExchangeAPI_Export.h @@ -57,18 +57,18 @@ public: explicit ExchangeAPI_Export(const std::shared_ptr& theFeature, const std::string & theFilePath, const ModelHighAPI_Selection& theSelectedShape, - double aDeflectionRelative , - double aDeflectionAbsolute, - const bool anIsRelative, - const bool anIsASCII); + double theDeflectionRelative , + double theDeflectionAbsolute, + const bool theIsRelative, + const bool theIsASCII); /// Constructor with values for XAO of selected result export. EXCHANGEAPI_EXPORT explicit ExchangeAPI_Export(const std::shared_ptr& theFeature, - const std::string & theFilePath, - const ModelHighAPI_Selection& theResult, - const std::string & theAuthor, - const std::string & theGeometryName = std::string()); + const std::string & theFilePath, + const ModelHighAPI_Selection& theResult, + const std::string & theAuthor, + const std::string & theGeometryName = std::string()); /// Constructor with values for export in other formats than XAO. EXCHANGEAPI_EXPORT @@ -126,30 +126,30 @@ typedef std::shared_ptr ExportPtr; */ EXCHANGEAPI_EXPORT ExportPtr exportToFile(const std::shared_ptr & thePart, - const std::string & theFilePath, - const std::list & theSelectionList, - const std::string & theFileFormat = std::string()); + const std::string & theFilePath, + const std::list & theSelectionList, + const std::string & theFileFormat = std::string()); /**\ingroup CPPHighAPI * \brief Exports to XAO file all results of the current document */ EXCHANGEAPI_EXPORT ExportPtr exportToXAO(const std::shared_ptr & thePart, - const std::string & theFilePath, - const std::string & theAuthor = std::string(), - const std::string & theGeometryName = std::string()); + const std::string & theFilePath, + const std::string & theAuthor = std::string(), + const std::string & theGeometryName = std::string()); /**\ingroup CPPHighAPI * \brief Exports to STL file the result of the current document */ EXCHANGEAPI_EXPORT ExportPtr exportToSTL(const std::shared_ptr & thePart, - const std::string & theFilePath, - const ModelHighAPI_Selection& theSelectedShape, - double aDeflectionRelative, - double aDeflectionAbsolute, - const bool anIsRelative, - const bool anIsASCII); + const std::string & theFilePath, + const ModelHighAPI_Selection& theSelectedShape, + double theDeflectionRelative, + double theDeflectionAbsolute, + const bool theIsRelative, + const bool theIsASCII); /**\ingroup CPPHighAPI * \brief Exports to XAO file the selected result with groups parts related to it only. diff --git a/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp index 0d38d857c..0205960b1 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp @@ -103,17 +103,17 @@ void ExchangePlugin_ExportFeature::initAttributes() ModelAPI_AttributeSelectionList::typeId()); data()->addAttribute(ExchangePlugin_ExportFeature::STL_FILE_PATH_ID(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED(), + data()->addAttribute(ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(ExchangePlugin_ExportFeature::STL_RELATIVE(), + data()->addAttribute(ExchangePlugin_ExportFeature::STL_RELATIVE(), ModelAPI_AttributeDouble::typeId()); double defelection = Config_PropManager::real("Visualization", "body_deflection"); real(ExchangePlugin_ExportFeature::STL_RELATIVE())->setValue(defelection); - data()->addAttribute(ExchangePlugin_ExportFeature::STL_ABSOLUTE(), + data()->addAttribute(ExchangePlugin_ExportFeature::STL_ABSOLUTE(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(ExchangePlugin_ExportFeature::STL_FILE_TYPE(), ModelAPI_AttributeString::typeId()); @@ -368,16 +368,15 @@ void ExchangePlugin_ExportFeature::exportSTL(const std::string& theFileName) if (string(STL_FILE_TYPE())->value() == STL_FILE_TYPE_ASCII()) { anIsASCII = true; - } + } // Perform the export std::string anError; bool aResult = false; aResult = STLExport(theFileName, - "STL", aShape, aValue, - anIsRelative, + anIsRelative, anIsASCII, anError); diff --git a/src/ExchangePlugin/export_widget.xml b/src/ExchangePlugin/export_widget.xml index d77786ee5..d0fcd3967 100644 --- a/src/ExchangePlugin/export_widget.xml +++ b/src/ExchangePlugin/export_widget.xml @@ -42,7 +42,7 @@ + shape_types="faces shells solids compsolids compounds"> @@ -62,8 +62,7 @@ tooltip="Value indicate by user"> @@ -80,14 +79,6 @@ - diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STLExport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_STLExport.cpp index e7d82b642..bf30792b2 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STLExport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STLExport.cpp @@ -38,12 +38,11 @@ #define MAX3(X, Y, Z) ( MAX2 ( MAX2(X, Y) , Z ) ) bool STLExport(const std::string& theFileName, - const std::string& /*theFormatName*/, - const std::shared_ptr& theShape, - const double aDeflection, - const bool anIsRelative, - const bool anIsASCII, - std::string& theError) + const std::shared_ptr& theShape, + const double theDeflection, + const bool theIsRelative, + const bool theIsASCII, + std::string& theError) { #ifdef _DEBUG std::cout << "Export STl into file " << theFileName << std::endl; @@ -56,25 +55,22 @@ bool STLExport(const std::string& theFileName, try { - // Set "C" numeric locale to save numbers correctly - GeomAlgoAPI_Tools::Localizer loc; - double lDeflection = aDeflection; + double lDeflection = theDeflection; StlAPI_Writer aWriter; // copy source shape BRepBuilderAPI_Copy aCopy( theShape->impl(), Standard_False ); TopoDS_Shape aCopyShape = aCopy.Shape(); // ASCII mode - aWriter.ASCIIMode() = anIsASCII; - if ( anIsRelative ) { + aWriter.ASCIIMode() = theIsASCII; + if ( theIsRelative ) { Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; Bnd_Box bndBox; BRepBndLib::Add( theShape->impl(), bndBox ); bndBox.Get( aXmin, aYmin, aZmin, aXmax, aYmax, aZmax ); - lDeflection = MAX3( aXmax-aXmin, aYmax-aYmin, aZmax-aZmin ) * aDeflection; + lDeflection = MAX3( aXmax-aXmin, aYmax-aYmin, aZmax-aZmin ) * theDeflection; } //Compute triangulation - BRepTools::Clean( aCopyShape ); BRepMesh_IncrementalMesh aMesh( aCopyShape, lDeflection ); aWriter.Write( aCopyShape, theFileName.c_str() ); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STLExport.h b/src/GeomAlgoAPI/GeomAlgoAPI_STLExport.h index 327dce41e..a08549e06 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STLExport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STLExport.h @@ -29,11 +29,10 @@ /// Implementation of the export STL files algorithms GEOMALGOAPI_EXPORT bool STLExport(const std::string& theFileName, - const std::string& /*theFormatName*/, - const std::shared_ptr& theShape, - const double aDeflection, - const bool anIsRelative, - const bool anIsASCII, - std::string& theError); + const std::shared_ptr& theShape, + const double theDeflection, + const bool theIsRelative, + const bool theIsASCII, + std::string& theError); #endif /* GEOMALGOAPI_STLEXPORT_H_ */