+ TopoDS_Shape aLandCoverMapShape = GetShape();
+ TopTools_ListOfShape aListOfFaces;
+ TopExp_Explorer anExp( aLandCoverMapShape, TopAbs_FACE );
+ for( ; anExp.More(); anExp.Next() )
+ aListOfFaces.Append( anExp.Current() );
+
+ TopoDS_Shape aShape = MergeFaces( aListOfFaces, false );
+
+ NCollection_IndexedMap<gp_Pnt> aVerticesMap;
+ NCollection_IndexedDataMap< TopoDS_Edge, QList<int> > anEdgesMap;
+ NCollection_IndexedDataMap< TopoDS_Face, QList<int> > aFacesMap;
+
+ // add into the map all edges existing in the shell
+ TopExp_Explorer anExp1( aShape, TopAbs_EDGE );
+ for( ; anExp1.More(); anExp1.Next() )
+ {
+ TopoDS_Edge anEdge = TopoDS::Edge( anExp1.Current() );
+ QList<int> aVerticesIdsList;
+ if( EdgeDiscretization( anEdge, theDeflection, aVerticesMap, aVerticesIdsList ) )
+ anEdgesMap.Add( anEdge, aVerticesIdsList );
+ }
+
+ // add into the map all faces existing in the shell and correspondence between face and edges ids
+ TopExp_Explorer anExp2( aShape, TopAbs_FACE );
+ for( ; anExp2.More(); anExp2.Next() )
+ {
+ TopoDS_Face aFace = TopoDS::Face( anExp2.Current() );
+ TopExp_Explorer anExp3( aFace, TopAbs_EDGE );
+ QList<int> anEdgesIdsList;
+ for( ; anExp3.More(); anExp3.Next() )
+ {
+ TopoDS_Edge anEdge = TopoDS::Edge( anExp3.Current() );
+ int anEdgeId = anEdgesMap.FindIndex( anEdge );
+ anEdgesIdsList.append( anEdgeId );
+ }
+ aFacesMap.Add( aFace, anEdgesIdsList );
+ }
+
+ QFile aFile( theFileName );
+ if( !aFile.open( QFile::WriteOnly | QFile::Text ) )
+ return false;
+
+ QTextStream aStream( &aFile );
+ aStream << "# nodes\n";
+ NCollection_IndexedMap<gp_Pnt>::Iterator anIt1( aVerticesMap );
+ for( ; anIt1.More(); anIt1.Next() )
+ {
+ gp_Pnt aPnt = anIt1.Value();
+ aStream << QString::number( aPnt.X(), TELEMAC_FORMAT, TELEMAC_PRECISION );
+ aStream << " ";
+ aStream << QString::number( aPnt.Y(), TELEMAC_FORMAT, TELEMAC_PRECISION );
+ aStream << " ";
+ aStream << QString::number( aPnt.Z(), TELEMAC_FORMAT, TELEMAC_PRECISION );
+ aStream << "\n";
+ }
+ aStream << "\n";
+
+ aStream << "# edges\n";
+ NCollection_IndexedDataMap< TopoDS_Edge, QList<int> >::Iterator anIt2( anEdgesMap );
+ for( ; anIt2.More(); anIt2.Next() )
+ {
+ QList<int> aVerticesIds = anIt2.Value();
+ foreach( int anId, aVerticesIds )
+ aStream << anId << " ";
+ aStream << "\n";
+ }
+ aStream << "\n";
+
+ aStream << "# faces\n";
+ NCollection_IndexedDataMap< TopoDS_Face, QList<int> >::Iterator anIt3( aFacesMap );
+ for( ; anIt3.More(); anIt3.Next() )
+ {
+ QList<int> anEdgesIds = anIt3.Value();
+ foreach( int anId, anEdgesIds )
+ aStream << anId << " ";
+ aStream << "\n";
+ }
+ aStream << "\n";
+
+ aFile.close();
+ return true;