X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_GeomTool.cxx;h=3d54e13f34e87e59f3cb4d8b03723619ca9f2f92;hb=89c7928d864f9be4f35aaa7409896c264849f273;hp=7517677a5653c00d5b6629d706ff6dccfe76a6f7;hpb=660e6f7a98935b2ab471f6734b8be1ce4ce81dd2;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_GeomTool.cxx b/src/HYDROData/HYDROData_GeomTool.cxx index 7517677a..3d54e13f 100644 --- a/src/HYDROData/HYDROData_GeomTool.cxx +++ b/src/HYDROData/HYDROData_GeomTool.cxx @@ -23,6 +23,7 @@ #include #include +#include #ifdef WIN32 #pragma warning ( disable: 4251 ) @@ -31,11 +32,15 @@ #include #include +#include +#include + #ifdef WIN32 #pragma warning ( default: 4251 ) #endif #include +#include #include static int _argc = 0; @@ -155,6 +160,49 @@ GEOM::GEOM_Object_ptr HYDROData_GeomTool::publishShapeInGEOM( return aGeomObj._retn(); } + +GEOM::GEOM_Object_ptr HYDROData_GeomTool::ExplodeShapeInGEOMandPublish( GEOM::GEOM_Gen_var theGeomEngine, + SALOMEDS::Study_ptr theStudy, + const TopoDS_Shape& theShape, + const NCollection_IndexedDataMap& aFacesToNameModif, + const QString& theName, + QString& theGeomObjEntry) +{ + GEOM::GEOM_Object_ptr aGeomObj = HYDROData_GeomTool::publishShapeInGEOM( theGeomEngine, theStudy, theShape, theName, theGeomObjEntry ); + + GEOM::GEOM_IShapesOperations_var anExpOp = theGeomEngine->GetIShapesOperations( theStudy->StudyId() ); + GEOM::ListOfGO* aFc = anExpOp->MakeExplode(aGeomObj, TopAbs_FACE, false); + + TopTools_MapOfShape mapShape; + + NCollection_IndexedDataMap aFF2N; + for (int i = 1; i <= aFacesToNameModif.Extent(); i++) + { + TopExp_Explorer exp (aFacesToNameModif.FindKey(i), TopAbs_FACE); + for (;exp.More(); exp.Next()) + aFF2N.Add(exp.Current(), aFacesToNameModif.FindFromIndex(i)); + } + + TopExp_Explorer exp (theShape, TopAbs_FACE); + QVector Names; + for (; exp.More(); exp.Next()) + { + const TopoDS_Shape& csh = exp.Current(); + if (mapShape.Add(csh)) + { + //listShape.Append(csh); + QString Qstr = aFF2N.FindFromKey(csh); + Names.push_back(Qstr); + } + } + + for (size_t i = 0; i < aFc->length(); i++) + GEOMBase::PublishSubObject(aFc->operator[](i), Names[i]); + + return aGeomObj; +} + + GEOM::GEOM_Object_ptr HYDROData_GeomTool::createFaceInGEOM( GEOM::GEOM_Gen_var theGeomEngine, SALOMEDS::Study_ptr theStudy, const int theWidth,