//function : NewMesh
//purpose :
//=======================================================================
-int SMESHDS_Document::NewMesh(bool theIsEmbeddedMode)
-{
- static int aNewMeshID = 0;
- aNewMeshID++;
- SMESHDS_Mesh *aNewMesh = new SMESHDS_Mesh(aNewMeshID,theIsEmbeddedMode);
- myMeshes[aNewMeshID] = aNewMesh;
- return aNewMeshID;
+SMESHDS_Mesh * SMESHDS_Document::NewMesh(bool theIsEmbeddedMode, int MeshID)
+{
+ std::map<int,SMESHDS_Mesh*>::iterator i_m =
+ myMeshes.insert( make_pair( MeshID, (SMESHDS_Mesh*)0 )).first;
+ if ( i_m->second )
+ throw SALOME_Exception("SMESHDS_Document::NewMesh(): ID of existing mesh given");
+ SMESHDS_Mesh *aNewMesh = new SMESHDS_Mesh(MeshID,theIsEmbeddedMode);
+ i_m->second = aNewMesh;
+ return aNewMesh;
}
//=======================================================================
{
public:
SMESHDS_Document(int UserID);
- ~SMESHDS_Document();
- int NewMesh(bool theIsEmbeddedMode);
+ ~SMESHDS_Document();
+ SMESHDS_Mesh * NewMesh(bool theIsEmbeddedMode, int MeshID);
void RemoveMesh(int MeshID);
SMESHDS_Mesh * GetMesh(int MeshID);
void AddHypothesis(SMESHDS_Hypothesis * H);