3 #include "GEOM_IBasicOperations_i.hh"
7 #include "Utils_ExceptHandlers.hxx"
9 #include "GEOM_Engine.hxx"
10 #include "GEOM_Object.hxx"
12 //=============================================================================
16 //=============================================================================
17 GEOM_IBasicOperations_i::GEOM_IBasicOperations_i (PortableServer::POA_ptr thePOA,
18 GEOM::GEOM_Gen_ptr theEngine,
19 ::GEOMImpl_IBasicOperations* theImpl)
20 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
22 MESSAGE("GEOM_IBasicOperations_i::GEOM_IBasicOperations_i");
25 //=============================================================================
29 //=============================================================================
30 GEOM_IBasicOperations_i::~GEOM_IBasicOperations_i()
32 MESSAGE("GEOM_IBasicOperations_i::~GEOM_IBasicOperations_i");
36 //=============================================================================
40 //=============================================================================
41 GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointXYZ
42 (CORBA::Double theX, CORBA::Double theY, CORBA::Double theZ)
44 GEOM::GEOM_Object_var aGEOMObject;
47 GetOperations()->SetNotDone();
51 Handle(GEOM_Object) anObject = GetOperations()->MakePointXYZ(theX, theY, theZ);
52 if (!GetOperations()->IsDone() || anObject.IsNull())
53 return aGEOMObject._retn();
55 return GetObject(anObject);
58 //=============================================================================
60 * MakePointWithReference
62 //=============================================================================
63 GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointWithReference
64 (GEOM::GEOM_Object_ptr theReference, CORBA::Double theX, CORBA::Double theY, CORBA::Double theZ)
66 GEOM::GEOM_Object_var aGEOMObject;
69 GetOperations()->SetNotDone();
71 if(theReference == NULL) return aGEOMObject._retn();
73 //Get the reference point
75 Handle(GEOM_Object) aRefernce = GetOperations()->GetEngine()->GetObject
76 (theReference->GetStudyID(), theReference->GetEntry());
77 if (aRefernce.IsNull()) return aGEOMObject._retn();
81 Handle(GEOM_Object) anObject =
82 GetOperations()->MakePointWithReference(aRefernce, theX, theY, theZ);
83 if (!GetOperations()->IsDone() || anObject.IsNull())
84 return aGEOMObject._retn();
86 return GetObject(anObject);
89 //=============================================================================
93 //=============================================================================
94 GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurve
95 (GEOM::GEOM_Object_ptr theCurve, CORBA::Double theParameter)
97 GEOM::GEOM_Object_var aGEOMObject;
100 GetOperations()->SetNotDone();
102 if (theCurve == NULL) return aGEOMObject._retn();
104 //Get the reference curve
106 Handle(GEOM_Object) aRefernce = GetOperations()->GetEngine()->GetObject
107 (theCurve->GetStudyID(), theCurve->GetEntry());
108 if (aRefernce.IsNull()) return aGEOMObject._retn();
112 Handle(GEOM_Object) anObject =
113 GetOperations()->MakePointOnCurve(aRefernce, theParameter);
114 if (!GetOperations()->IsDone() || anObject.IsNull())
115 return aGEOMObject._retn();
117 return GetObject(anObject);
121 //=============================================================================
125 //=============================================================================
126 GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeVectorDXDYDZ
127 (CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ)
129 GEOM::GEOM_Object_var aGEOMObject;
131 //Set a not done flag
132 GetOperations()->SetNotDone();
136 Handle(GEOM_Object) anObject = GetOperations()->MakeVectorDXDYDZ(theDX, theDY, theDZ);
137 if (!GetOperations()->IsDone() || anObject.IsNull())
138 return aGEOMObject._retn();
140 return GetObject(anObject);
143 //=============================================================================
147 //=============================================================================
148 GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeVectorTwoPnt
149 (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2)
151 GEOM::GEOM_Object_var aGEOMObject;
153 //Set a not done flag
154 GetOperations()->SetNotDone();
156 if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn();
158 //Get the reference points
160 Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject
161 (thePnt1->GetStudyID(), thePnt1->GetEntry());
162 Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject
163 (thePnt2->GetStudyID(), thePnt2->GetEntry());
164 if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn();
168 Handle(GEOM_Object) anObject =
169 GetOperations()->MakeVectorTwoPnt(aRef1, aRef2);
170 if (!GetOperations()->IsDone() || anObject.IsNull())
171 return aGEOMObject._retn();
173 return GetObject(anObject);
177 //=============================================================================
181 //=============================================================================
182 GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeLine
183 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theDir)
185 GEOM::GEOM_Object_var aGEOMObject;
187 //Set a not done flag
188 GetOperations()->SetNotDone();
190 if (thePnt == NULL || theDir == NULL) return aGEOMObject._retn();
192 //Get the reference objects
194 Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject
195 (thePnt->GetStudyID(), thePnt->GetEntry());
196 Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject
197 (theDir->GetStudyID(), theDir->GetEntry());
198 if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn();
202 Handle(GEOM_Object) anObject =
203 GetOperations()->MakeLine(aRef1, aRef2);
204 if (!GetOperations()->IsDone() || anObject.IsNull())
205 return aGEOMObject._retn();
207 return GetObject(anObject);
210 //=============================================================================
214 //=============================================================================
215 GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeLineTwoPnt
216 (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2)
218 GEOM::GEOM_Object_var aGEOMObject;
220 //Set a not done flag
221 GetOperations()->SetNotDone();
223 if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn();
225 //Get the reference points
227 Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject
228 (thePnt1->GetStudyID(), thePnt1->GetEntry());
229 Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject
230 (thePnt2->GetStudyID(), thePnt2->GetEntry());
231 if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn();
235 Handle(GEOM_Object) anObject =
236 GetOperations()->MakeLineTwoPnt(aRef1, aRef2);
237 if (!GetOperations()->IsDone() || anObject.IsNull())
238 return aGEOMObject._retn();
240 return GetObject(anObject);
244 //=============================================================================
248 //=============================================================================
249 GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePlanePntVec
250 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
251 CORBA::Double theTrimSize)
253 GEOM::GEOM_Object_var aGEOMObject;
255 //Set a not done flag
256 GetOperations()->SetNotDone();
258 if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
262 Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject
263 (thePnt->GetStudyID(), thePnt->GetEntry());
264 Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject
265 (theVec->GetStudyID(), theVec->GetEntry());
266 if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn();
270 Handle(GEOM_Object) anObject =
271 GetOperations()->MakePlanePntVec(aRef1, aRef2, theTrimSize);
272 if (!GetOperations()->IsDone() || anObject.IsNull())
273 return aGEOMObject._retn();
275 return GetObject(anObject);
278 //=============================================================================
282 //=============================================================================
283 GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePlaneThreePnt
284 (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2,
285 GEOM::GEOM_Object_ptr thePnt3, CORBA::Double theTrimSize)
287 GEOM::GEOM_Object_var aGEOMObject;
289 //Set a not done flag
290 GetOperations()->SetNotDone();
292 if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL)
293 return aGEOMObject._retn();
295 //Get the reference points
297 Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject
298 (thePnt1->GetStudyID(), thePnt1->GetEntry());
299 Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject
300 (thePnt2->GetStudyID(), thePnt2->GetEntry());
301 Handle(GEOM_Object) aRef3 = GetOperations()->GetEngine()->GetObject
302 (thePnt3->GetStudyID(), thePnt3->GetEntry());
303 if (aRef1.IsNull() || aRef2.IsNull() || aRef3.IsNull())
304 return aGEOMObject._retn();
308 Handle(GEOM_Object) anObject =
309 GetOperations()->MakePlaneThreePnt(aRef1, aRef2, aRef3, theTrimSize);
310 if (!GetOperations()->IsDone() || anObject.IsNull())
311 return aGEOMObject._retn();
313 return GetObject(anObject);
316 //=============================================================================
320 //=============================================================================
321 GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePlaneFace
322 (GEOM::GEOM_Object_ptr theFace, CORBA::Double theTrimSize)
324 GEOM::GEOM_Object_var aGEOMObject;
326 //Set a not done flag
327 GetOperations()->SetNotDone();
329 if (theFace == NULL) return aGEOMObject._retn();
331 //Get the reference face
333 Handle(GEOM_Object) aRef = GetOperations()->GetEngine()->GetObject
334 (theFace->GetStudyID(), theFace->GetEntry());
335 if (aRef.IsNull()) return aGEOMObject._retn();
339 Handle(GEOM_Object) anObject =
340 GetOperations()->MakePlaneFace(aRef, theTrimSize);
341 if (!GetOperations()->IsDone() || anObject.IsNull())
342 return aGEOMObject._retn();
344 return GetObject(anObject);
348 //=============================================================================
352 //=============================================================================
353 GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeMarker
354 (CORBA::Double theOX , CORBA::Double theOY , CORBA::Double theOZ,
355 CORBA::Double theXDX, CORBA::Double theXDY, CORBA::Double theXDZ,
356 CORBA::Double theYDX, CORBA::Double theYDY, CORBA::Double theYDZ)
358 GEOM::GEOM_Object_var aGEOMObject;
360 //Set a not done flag
361 GetOperations()->SetNotDone();
364 Handle(GEOM_Object) anObject = GetOperations()->MakeMarker(theOX , theOY , theOZ,
365 theXDX, theXDY, theXDZ,
366 theYDX, theYDY, theYDZ);
367 if (!GetOperations()->IsDone() || anObject.IsNull())
368 return aGEOMObject._retn();
370 return GetObject(anObject);