2 //=============================================================================
3 // File : SMESHDS_Document.cxx
5 // Author : Yves FRICAUD, OCC
7 // Copyright : OCC 2002
9 //=============================================================================
11 #include "SMESHDS_Document.ixx"
12 #include "SMESHDS_Hypothesis.hxx"
14 #include <Standard_OutOfRange.hxx>
16 //=======================================================================
19 //=======================================================================
20 SMESHDS_Document::SMESHDS_Document(const Standard_Integer UserID): myUserID(UserID)
23 //=======================================================================
26 //=======================================================================
27 Standard_Integer SMESHDS_Document::NewMesh()
29 static Standard_Integer NewMeshID = 0;
31 Handle (SMESHDS_Mesh) aNewMesh = new SMESHDS_Mesh (NewMeshID);
32 myMeshes.Bind(NewMeshID ,aNewMesh);
36 //=======================================================================
39 //=======================================================================
40 Handle(SMESHDS_Mesh) SMESHDS_Document::GetMesh(const Standard_Integer MeshID)
42 if (!myMeshes.IsBound(MeshID))
43 Standard_OutOfRange::Raise("SMESHDS_Document::RemoveMesh");
44 return myMeshes.Find(MeshID);
47 //=======================================================================
48 //function : RemoveMesh
50 //=======================================================================
51 void SMESHDS_Document::RemoveMesh(const Standard_Integer MeshID)
53 if (!myMeshes.IsBound(MeshID))
54 Standard_OutOfRange::Raise("SMESHDS_Document::RemoveMesh");
55 myMeshes.UnBind(MeshID);
58 //=======================================================================
59 //function : AddHypothesis
61 //=======================================================================
62 void SMESHDS_Document::AddHypothesis(const SMESHDS_PtrHypothesis& H)
64 myHypothesis.Bind (H->GetID(), H);
67 //=======================================================================
68 //function : GetHypothesis
70 //=======================================================================
71 SMESHDS_PtrHypothesis SMESHDS_Document::GetHypothesis(const Standard_Integer HypID)
73 if (!myHypothesis.IsBound(HypID))
74 Standard_OutOfRange::Raise("SMESHDS_Document::GetHypothesis");
75 return myHypothesis.Find(HypID);
78 //=======================================================================
79 //function : RemoveHypothesis
81 //=======================================================================
82 void SMESHDS_Document::RemoveHypothesis(const Standard_Integer HypID)
84 if (!myHypothesis.IsBound(HypID))
85 Standard_OutOfRange::Raise("SMESHDS_Document::RemoveHypothesis");
86 myMeshes.UnBind(HypID);
89 //=======================================================================
92 //=======================================================================
93 Standard_Integer SMESHDS_Document::NbMeshes()
95 return myMeshes.Extent();
98 //=======================================================================
99 //function : NbHypothesis
101 //=======================================================================
102 Standard_Integer SMESHDS_Document::NbHypothesis()
104 return myHypothesis.Extent();
107 //=======================================================================
108 //function : InitMeshesIterator
110 //=======================================================================
111 void SMESHDS_Document::InitMeshesIterator()
113 myMeshesIt.Initialize(myMeshes);
115 //=======================================================================
116 //function : NextMesh
118 //=======================================================================
119 void SMESHDS_Document::NextMesh()
123 //=======================================================================
124 //function : MoreMesh
126 //=======================================================================
127 Standard_Boolean SMESHDS_Document::MoreMesh()
129 return myMeshesIt.More();
131 //=======================================================================
132 //function : CurrentMesh
134 //=======================================================================
135 Handle_SMESHDS_Mesh SMESHDS_Document::CurrentMesh()
137 return myMeshesIt.Value();
140 //=======================================================================
141 //function : InitHypothesisIterator
143 //=======================================================================
144 void SMESHDS_Document::InitHypothesisIterator()
146 myHypothesisIt.Initialize(myHypothesis);
148 //=======================================================================
149 //function : NextMesh
151 //=======================================================================
152 void SMESHDS_Document::NextHypothesis()
154 myHypothesisIt.Next();
156 //=======================================================================
157 //function : MoreMesh
159 //=======================================================================
160 Standard_Boolean SMESHDS_Document::MoreHypothesis()
162 return myHypothesisIt.More();
164 //=======================================================================
165 //function : CurrentMesh
167 //=======================================================================
168 SMESHDS_PtrHypothesis SMESHDS_Document::CurrentHypothesis()
170 return myHypothesisIt.Value();