if ( anObject.IsNull() )
continue;
- ShapeMap aMap;
+ ShapeInfoList aList;
switch ( anObject->GetKind() )
{
case KIND_STREAM:
- aMap = extract( Handle(HYDROData_Stream)::DownCast( anObject ) );
+ aList = extract( Handle(HYDROData_Stream)::DownCast( anObject ) );
break;
case KIND_DIGUE:
case KIND_CHANNEL:
- aMap = extract( Handle(HYDROData_Channel)::DownCast( anObject ) );
+ aList = extract( Handle(HYDROData_Channel)::DownCast( anObject ) );
break;
case KIND_OBSTACLE:
- aMap = extract( Handle(HYDROData_Obstacle)::DownCast( anObject ) );
+ aList = extract( Handle(HYDROData_Obstacle)::DownCast( anObject ) );
break;
}
startDocOperation();
- for ( ShapeMap::Iterator it( aMap ); it.More(); it.Next() )
+ for ( ShapeInfoList::const_iterator it = aList.begin(); it != aList.end(); ++it )
{
- TopoDS_Shape aLine = it.Key();
- QString aName = QString( "%1_%2" ).arg( anObject->GetName() ).arg( it.Value() );
+ const ShapeInfo& inf = *it;
+ TopoDS_Shape aLine = inf.shape();
+ QString aName = QString( "%1_%2" ).arg( anObject->GetName() ).arg( inf.name() );
if ( !HYDROGUI_Tool::FindObjectByName( aModule, aName ).IsNull() )
{
int num = 1;
commit();
}
-HYDROGUI_PolylineExtractionOp::ShapeMap HYDROGUI_PolylineExtractionOp::extract( const Handle(HYDROData_Stream)& theStream )
+HYDROGUI_PolylineExtractionOp::ShapeInfoList HYDROGUI_PolylineExtractionOp::extract( const Handle(HYDROData_Stream)& theStream ) const
{
- ShapeMap aMap;
+ ShapeInfoList aList;
if ( !theStream.IsNull() )
{
- aMap.Bind( theStream->GetLeftShape(), "Left bank" );
- aMap.Bind( theStream->GetRightShape(), "Right bank" );
+ aList.append( ShapeInfo( theStream->GetLeftShape(), QString( "Left bank" ) ) );
+ aList.append( ShapeInfo( theStream->GetRightShape(), QString( "Right bank" ) ) );
HYDROData_SequenceOfObjects aProfiles = theStream->GetProfiles();
for ( int i = 1; i <= aProfiles.Length(); i++ )
{
Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast( aProfiles.Value( i ) );
- aMap.Bind( aProfile->GetTopShape(), aProfile->GetName() );
+ aList.append( ShapeInfo( aProfile->GetTopShape(), QString( "Profile_%1" ).arg( i ) ) );
}
}
- return aMap;
+ return aList;
}
-HYDROGUI_PolylineExtractionOp::ShapeMap HYDROGUI_PolylineExtractionOp::extract( const Handle(HYDROData_Channel)& aChannel )
+HYDROGUI_PolylineExtractionOp::ShapeInfoList HYDROGUI_PolylineExtractionOp::extract( const Handle(HYDROData_Channel)& aChannel ) const
{
- ShapeMap aMap;
+ ShapeInfoList aList;
if ( !aChannel.IsNull() )
{
HYDROData_SequenceOfObjects aGroups = aChannel->GetGroups();
for ( int s = 1; s <= aShapes.Length(); s++ )
aBuilder.Add( aWire, aShapes.Value( s ) );
- aMap.Bind( aWire, i > 1 ? "Right bank" : "Left bank" );
+ aList.append( ShapeInfo( aWire, i > 1 ? "Right bank" : "Left bank" ) );
}
}
}
- return aMap;
+ return aList;
}
-HYDROGUI_PolylineExtractionOp::ShapeMap HYDROGUI_PolylineExtractionOp::extract( const Handle(HYDROData_Obstacle)& theObstacle )
+HYDROGUI_PolylineExtractionOp::ShapeInfoList HYDROGUI_PolylineExtractionOp::extract( const Handle(HYDROData_Obstacle)& theObstacle ) const
{
- ShapeMap aMap;
+ ShapeInfoList aList;
if ( !theObstacle.IsNull() )
{
TopoDS_Wire aWire;
for ( int s = 1; s <= aShapes.Length(); s++ )
aBuilder.Add( aWire, aShapes.Value( s ) );
}
- aMap.Bind( aWire, "Contour" );
+ aList.append( ShapeInfo( aWire, QString( "Contour" ) ) );
}
- return aMap;
+ return aList;
}
virtual void startOperation();
private:
- typedef NCollection_DataMap<TopoDS_Shape, QString> ShapeMap;
+ class ShapeInfo
+ {
+ public:
+ ShapeInfo( const TopoDS_Shape s, const QString& n ) : myShape( s ), myName( n ) {}
+ TopoDS_Shape shape() const { return myShape; }
+ QString name() const { return myName; }
+
+ private:
+ TopoDS_Shape myShape;
+ QString myName;
+ };
+
+ typedef QList<ShapeInfo> ShapeInfoList;
private:
- ShapeMap extract( const Handle(HYDROData_Stream)& );
- ShapeMap extract( const Handle(HYDROData_Channel)& );
- ShapeMap extract( const Handle(HYDROData_Obstacle)& );
+ ShapeInfoList extract( const Handle(HYDROData_Stream)& ) const;
+ ShapeInfoList extract( const Handle(HYDROData_Channel)& ) const;
+ ShapeInfoList extract( const Handle(HYDROData_Obstacle)& ) const;
};
#endif