From: Clarisse Genrault Date: Mon, 7 Sep 2020 14:44:13 +0000 (+0200) Subject: Add the box by two points in root export X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4dd517b2c33abf4fea86466ff62043d3859081d2;p=modules%2Fshaper.git Add the box by two points in root export --- diff --git a/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp index c87694870..0d2752db7 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp @@ -142,14 +142,10 @@ void ExchangePlugin_ExportFeature::execute() AttributeStringPtr aFormatAttr = this->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID()); std::string aFormat = aFormatAttr->value(); - std::cout<<"FORMAT"<string(ExchangePlugin_ExportFeature::FILE_PATH_ID()); std::string aFilePath = aFilePathAttr->value(); - std::cout<<"FILE"< debut"<value(); std::string aTitle = string(ExchangePlugin_ExportFeature::ROOT_MANAGER_TITLE_ID())->value(); std::string aFileMat = string(ExchangePlugin_ExportFeature::MAT_FILE_ID())->value(); @@ -616,8 +607,6 @@ void ExchangePlugin_ExportFeature::exportROOT(const std::string& theFileName) std::map > aMat; std::map > aMedium; ExchangePlugin_ExportRoot::readFileMat(aFileMat, aMat, aMedium); - std::cout<<"Size "<buildMatAndMedium(aMat, aMedium); @@ -640,8 +629,6 @@ void ExchangePlugin_ExportFeature::exportROOT(const std::string& theFileName) } } - std::cout<<"Nb of elements :: " << aListNamesOfFeatures.size() << std::endl; - // Add all groups in the file itExport = theExport.begin(); for (; itExport != theExport.end(); ++itExport) diff --git a/src/ExchangePlugin/ExchangePlugin_ExportRoot.cpp b/src/ExchangePlugin/ExchangePlugin_ExportRoot.cpp index 61aabc2a6..a4244a2db 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportRoot.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ExportRoot.cpp @@ -19,6 +19,8 @@ #include +#include + #include #include #include @@ -30,6 +32,8 @@ #include #include +#include "math.h" + void ExchangePlugin_ExportRoot::readFileMat(const std::string theFileMat, std::map >& aMat, std::map >& aMedias) @@ -56,8 +60,8 @@ void ExchangePlugin_ExportRoot::readFileMat(const std::string theFileMat, aData.push_back(anElem); } } - std::cout<<"aType :: "<data()->selection(PrimitivesPlugin_Box::POINT_FIRST_ID()); + AttributeSelectionPtr aRef2 = theCurFeature->data()->selection(PrimitivesPlugin_Box::POINT_SECOND_ID()); + GeomShapePtr aShape1 = aRef1->value(); + if (!aShape1.get()) + aShape1 = aRef1->context()->shape(); + GeomShapePtr aShape2 = aRef2->value(); + if (!aShape2.get()) + aShape2 = aRef2->context()->shape(); + std::shared_ptr aFirstPoint = GeomAlgoAPI_PointBuilder::point(aShape1); + std::shared_ptr aSecondPoint = GeomAlgoAPI_PointBuilder::point(aShape2); + double x1 = aFirstPoint->x(); + double y1 = aFirstPoint->y(); + double z1 = aFirstPoint->z(); + double x2 = aSecondPoint->x(); + double y2 = aSecondPoint->y(); + double z2 = aSecondPoint->z(); + DX = fabs(x2 -x1)/2; + DY = fabs(y2 -y1)/2; + DZ = fabs(z2 -z1)/2; + OX = fmin(x1,x2)+DX; + OY = fmin(y1,y2)+DY; + OZ = fmin(z1,z2)+DZ; } else if (aMethodName == "BoxByOnePointAndDims") { DX = theCurFeature->data()->real(PrimitivesPlugin_Box::HALF_DX_ID())->value(); DY = theCurFeature->data()->real(PrimitivesPlugin_Box::HALF_DY_ID())->value(); @@ -100,7 +125,7 @@ void ExchangePlugin_ExportRoot::computeBox(FeaturePtr theCurFeature, void ExchangePlugin_ExportRoot::computeGroup(FeaturePtr theCurFeature, std::vector& theListNames) { - std::cout<<"COMPUTE GROUP"<data()->selectionList(CollectionPlugin_Group::LIST_ID()); @@ -109,7 +134,7 @@ void ExchangePlugin_ExportRoot::computeGroup(FeaturePtr theCurFeature, anObjectsSelList->value(anObjectsIndex); ObjectPtr anObject = anObjectAttr->contextObject(); std::string aName = anObject->data()->name(); - std::cout<<"NAME :: "<