// Get faces
bool isAllNotSubmersible = true;
- TopTools_ListOfShape aFaces;
HYDROData_SequenceOfObjects aCaseRegions = GetRegions();
HYDROData_SequenceOfObjects::Iterator aRegionIter( aCaseRegions );
+ NCollection_IndexedDataMap<TopoDS_Shape, QString> aFacesToNames;
for ( ; aRegionIter.More(); aRegionIter.Next() )
{
Handle(HYDROData_Region) aRegion =
isAllNotSubmersible = false;
TopoDS_Shape aRegionShape = aRegion->GetShape( &aSeqOfGroupsDefs );
- aFaces.Append( aRegionShape );
+ aFacesToNames.Add( aRegionShape, aRegion->GetName() );
}
bool aRes = false;
} else if ( isAllNotSubmersible ) {
theErrorMsg = QString("there are no submersible regions.");
} else {
- aRes = Export( theGeomEngine, theStudy, aFaces, aSeqOfGroupsDefs, theGeomObjEntry );;
+ aRes = Export( theGeomEngine, theStudy, aFacesToNames, aSeqOfGroupsDefs, theGeomObjEntry );;
}
if( aRes && !GetLandCoverMap().IsNull() && !GetStricklerTable().IsNull() )
bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine,
SALOMEDS::Study_ptr theStudy,
- const TopTools_ListOfShape& theFaces,
+ const NCollection_IndexedDataMap<TopoDS_Shape, QString>& aFacesToName,
const HYDROData_ShapesGroup::SeqOfGroupsDefs& theGroupsDefs,
QString& theGeomObjEntry ) const
{
TCollection_AsciiString aNam("Sh_");
int i=1;
#endif
- TopTools_ListIteratorOfListOfShape aFaceIter( theFaces );
- for ( ; aFaceIter.More(); aFaceIter.Next() )
+ for ( int i = 1; i <= aFacesToName.Extent(); i++ )
{
- TopoDS_Shape aShape = aFaceIter.Value();
+ const TopoDS_Shape& aShape = aFacesToName.FindKey(i);
if ( aShape.IsNull() )
continue;
aSewing.Perform();
TopoDS_Shape aSewedShape = aSewing.SewedShape();
+ NCollection_IndexedDataMap<TopoDS_Shape, QString> aFacesToNameModif;
+
+ for ( int i = 1; i <= aFacesToName.Extent(); i++ )
+ {
+ const TopoDS_Shape& CurShape = aFacesToName.FindKey(i);
+ const QString& Qstr = aFacesToName.FindFromIndex(i);
+ if (aSewing.IsModified(CurShape))
+ aFacesToNameModif.Add(aSewing.Modified(CurShape), Qstr);
+ else
+ aFacesToNameModif.Add(CurShape, Qstr);
+ }
+
+
// If the sewed shape is empty - return false
if ( aSewedShape.IsNull() || !TopoDS_Iterator( aSewedShape ).More() )
return false;
// Publish the sewed shape
QString aName = EXPORT_NAME;
GEOM::GEOM_Object_ptr aMainShape =
- HYDROData_GeomTool::publishShapeInGEOM( theGeomEngine, theStudy, aSewedShape, aName, theGeomObjEntry );
+ HYDROData_GeomTool::ExplodeShapeInGEOMandPublish( theGeomEngine, theStudy, aSewedShape, aFacesToNameModif, aName, theGeomObjEntry );
if ( aMainShape->_is_nil() )
return false;
#include <TopoDS_Shape.hxx>
#include <BRepTools.hxx>
+#include <GEOMBase.h>
#ifdef WIN32
#pragma warning ( disable: 4251 )
#include <SALOME_NamingService.hxx>
#include <SALOME_LifeCycleCORBA.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopExp_Explorer.hxx>
+
#ifdef WIN32
#pragma warning ( default: 4251 )
#endif
#include <QStringList>
+#include <QVector>
#include <QSet>
static int _argc = 0;
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<TopoDS_Shape, QString>& 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;
+
+ TopExp_Explorer exp (theShape, TopAbs_FACE);
+ QVector<QString> Names;
+ for (; exp.More(); exp.Next())
+ {
+ const TopoDS_Shape& csh = exp.Current();
+ if (mapShape.Add(csh))
+ {
+ //listShape.Append(csh);
+ QString Qstr = aFacesToNameModif.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,
#define HYDROData_GeomTool_HeaderFile
#include "HYDROData.h"
+#include <NCollection_IndexedDataMap.hxx>
#ifdef WIN32
#pragma warning ( disable: 4251 )
GEOM::GEOM_Object_ptr theGeomObj,
const QString& theName );
+ static GEOM::GEOM_Object_ptr ExplodeShapeInGEOMandPublish( GEOM::GEOM_Gen_var theGeomEngine,
+ SALOMEDS::Study_ptr theStudy,
+ const TopoDS_Shape& theShape,
+ const NCollection_IndexedDataMap<TopoDS_Shape, QString>& aFacesToNameModif,
+ const QString& theName,
+ QString& theGeomObjEntry);
+
};
#endif