1 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
20 #include "VISU_Engine_i.hh"
21 #include "utilities.h"
23 #include CORBA_SERVER_HEADER(SALOME_Session)
24 #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog)
26 #include "SALOME_NamingService.hxx"
27 #include "Utils_ExceptHandlers.hxx"
32 static int MYDEBUG = 1;
34 static int MYDEBUG = 0;
37 UNEXPECT_CATCH(SalomeException, SALOME::SALOME_Exception);
40 PortableServer::ObjectId *
41 VISUEngine_factory(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId,
42 const char *instanceName, const char *interfaceName)
44 if(MYDEBUG) MESSAGE("VisuEngine_factory : "<<interfaceName);
45 VISU::VISU_Gen_i * pVISU_Gen = new VISU::VISU_Gen_i(orb, poa, contId, instanceName, interfaceName);
46 return pVISU_Gen->getId() ;
51 //===========================================================================
52 VISU_Gen_i::VISU_Gen_i(CORBA::ORB_ptr orb,
53 PortableServer::POA_ptr poa,
54 PortableServer::ObjectId * contId,
55 const char *instanceName,
56 const char *interfaceName) :
57 Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
60 _id = _poa->activate_object(_thisObj);
61 SALOME_NamingService aNamingService(orb);
62 CORBA::Object_ptr anObject = aNamingService.Resolve("/Kernel/Session");
63 SALOME::Session_var aSession = SALOME::Session::_narrow(anObject);
64 //aSession->GetInterface();
65 Engines::Component_var aComponent = aSession->GetComponent("libVISUEngineImpl.so");
66 myVisuGen = VISU::VISU_Gen::_narrow(aComponent);
69 VISU_Gen_i::~VISU_Gen_i(){
70 if(MYDEBUG) MESSAGE("VISU_Gen_i::~VISU_Gen_i");
73 VISU::VISUType VISU_Gen_i::GetType() {
74 return myVisuGen->GetType();
77 //===========================================================================
78 bool VISU_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
79 const SALOMEDS::TMPFile & theStream,
83 return myVisuGen->Load(theComponent,theStream,theURL,isMultiFile);
86 bool VISU_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent,
87 const SALOMEDS::TMPFile & theStream,
91 return Load(theComponent, theStream, theURL, isMultiFile);
94 char* VISU_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
95 const char* aLocalPersistentID,
96 CORBA::Boolean isMultiFile,
97 CORBA::Boolean isASCII)
99 return myVisuGen->LocalPersistentIDToIOR(theSObject, aLocalPersistentID, isMultiFile, isASCII);
103 //===========================================================================
104 SALOMEDS::TMPFile* VISU_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
108 return myVisuGen->Save(theComponent,theURL,isMultiFile);
111 SALOMEDS::TMPFile* VISU_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent,
115 return myVisuGen->Save(theComponent,theURL,isMultiFile);
119 char* VISU_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
120 const char* IORString,
121 CORBA::Boolean isMultiFile,
122 CORBA::Boolean isASCII)
124 return myVisuGen->IORToLocalPersistentID(theSObject, IORString, isMultiFile, isASCII);
128 char* VISU_Gen_i::GetID(){
129 return myVisuGen->GetID();
133 void VISU_Gen_i::SetCurrentStudy(SALOMEDS::Study_ptr theStudy){
134 myVisuGen->SetCurrentStudy(theStudy);
138 SALOMEDS::Study_ptr VISU_Gen_i::GetCurrentStudy(){
139 return myVisuGen->GetCurrentStudy();
143 ViewManager_ptr VISU_Gen_i::GetViewManager(){
144 return myVisuGen->GetViewManager();
148 SALOMEDS::SObject_ptr VISU_Gen_i::ImportTables(const char* theFileName){
149 return myVisuGen->ImportTables(theFileName);
153 CORBA::Boolean VISU_Gen_i::ExportTableToFile(SALOMEDS::SObject_ptr theTable,
154 const char* theFileName)
156 return myVisuGen->ExportTableToFile(theTable, theFileName);
160 Result_ptr VISU_Gen_i::ImportFile(const char* theFileName){
161 return myVisuGen->ImportFile(theFileName);
165 Result_ptr VISU_Gen_i::CreateResult(const char* theFileName){
166 return myVisuGen->CreateResult(theFileName);
170 Result_ptr VISU_Gen_i::CopyAndImportFile(const char* theFileName){
171 return myVisuGen->CopyAndImportFile(theFileName);
175 Result_ptr VISU_Gen_i::ImportMed(SALOMEDS::SObject_ptr theMedSObject){
176 return myVisuGen->ImportMed(theMedSObject);
180 Result_ptr VISU_Gen_i::ImportMedField(SALOME_MED::FIELD_ptr theField){
181 return myVisuGen->ImportMedField(theField);
185 Mesh_ptr VISU_Gen_i::MeshOnEntity(Result_ptr theResult,
186 const char* theMeshName,
187 VISU::Entity theEntity)
189 return myVisuGen->MeshOnEntity(theResult,theMeshName,theEntity);
192 Mesh_ptr VISU_Gen_i::FamilyMeshOnEntity(Result_ptr theResult,
193 const char* theMeshName,
194 VISU::Entity theEntity,
195 const char* theFamilyName)
197 return myVisuGen->FamilyMeshOnEntity(theResult,theMeshName,theEntity,theFamilyName);
200 Mesh_ptr VISU_Gen_i::GroupMesh(Result_ptr theResult,
201 const char* theMeshName,
202 const char* theGroupName)
204 return myVisuGen->GroupMesh(theResult,theMeshName,theGroupName);
208 void VISU_Gen_i::RenameEntityInStudy(Result_ptr theResult, const char* theMeshName,
209 VISU::Entity theEntity, const char* theNewName)
211 myVisuGen->RenameEntityInStudy(theResult,theMeshName,theEntity,theNewName);
214 void VISU_Gen_i::RenameFamilyInStudy(Result_ptr theResult, const char* theMeshName,
215 VISU::Entity theEntity, const char* theFamilyName,
216 const char* theNewName)
218 myVisuGen->RenameFamilyInStudy(theResult,theMeshName,theEntity,theFamilyName,theNewName);
221 void VISU_Gen_i::RenameGroupInStudy(Result_ptr theResult, const char* theMeshName,
222 const char* theGroupName, const char* theNewName)
224 myVisuGen->RenameGroupInStudy(theResult,theMeshName,theGroupName,theNewName);
228 ScalarMap_ptr VISU_Gen_i::ScalarMapOnField(Result_ptr theResult,
229 const char* theMeshName,
230 VISU::Entity theEntity,
231 const char* theFieldName,
232 CORBA::Double theIteration)
234 return myVisuGen->ScalarMapOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
238 GaussPoints_ptr VISU_Gen_i::GaussPointsOnField(Result_ptr theResult,
239 const char* theMeshName,
240 VISU::Entity theEntity,
241 const char* theFieldName,
242 CORBA::Double theIteration)
244 return myVisuGen->GaussPointsOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
248 DeformedShape_ptr VISU_Gen_i::DeformedShapeOnField(Result_ptr theResult,
249 const char* theMeshName,
250 VISU::Entity theEntity,
251 const char* theFieldName,
252 CORBA::Double theIteration)
254 return myVisuGen->DeformedShapeOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
257 ScalarMapOnDeformedShape_ptr VISU_Gen_i::ScalarMapOnDeformedShapeOnField(Result_ptr theResult,
258 const char* theMeshName,
259 VISU::Entity theEntity,
260 const char* theFieldName,
261 CORBA::Double theIteration)
263 return myVisuGen->ScalarMapOnDeformedShapeOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
266 Vectors_ptr VISU_Gen_i::VectorsOnField(Result_ptr theResult,
267 const char* theMeshName,
268 VISU::Entity theEntity,
269 const char* theFieldName,
270 CORBA::Double theIteration)
272 return myVisuGen->VectorsOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
275 IsoSurfaces_ptr VISU_Gen_i::IsoSurfacesOnField(Result_ptr theResult,
276 const char* theMeshName,
277 VISU::Entity theEntity,
278 const char* theFieldName,
279 CORBA::Double theIteration)
281 return myVisuGen->IsoSurfacesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
285 StreamLines_ptr VISU_Gen_i::StreamLinesOnField(Result_ptr theResult,
286 const char* theMeshName,
287 VISU::Entity theEntity,
288 const char* theFieldName,
289 CORBA::Double theIteration)
291 return myVisuGen->StreamLinesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
295 CutPlanes_ptr VISU_Gen_i::CutPlanesOnField(Result_ptr theResult,
296 const char* theMeshName,
297 VISU::Entity theEntity,
298 const char* theFieldName,
299 CORBA::Double theIteration)
301 return myVisuGen->CutPlanesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
305 CutLines_ptr VISU_Gen_i::CutLinesOnField(Result_ptr theResult,
306 const char* theMeshName,
307 VISU::Entity theEntity,
308 const char* theFieldName,
309 CORBA::Double theIteration)
311 return myVisuGen->CutLinesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
315 Plot3D_ptr VISU_Gen_i::Plot3DOnField(Result_ptr theResult,
316 const char* theMeshName,
317 VISU::Entity theEntity,
318 const char* theFieldName,
319 CORBA::Double theIteration)
321 return myVisuGen->Plot3DOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
325 Table_ptr VISU_Gen_i::CreateTable(const char* theTableEntry){
326 return myVisuGen->CreateTable(theTableEntry);
330 Curve_ptr VISU_Gen_i::CreateCurve(Table_ptr theTable,
334 return myVisuGen->CreateCurve(theTable,theHRow,theVRow);
338 Container_ptr VISU_Gen_i::CreateContainer(){
339 return myVisuGen->CreateContainer();
343 Animation_ptr VISU_Gen_i::CreateAnimation(View3D_ptr theView3D){
344 return myVisuGen->CreateAnimation(theView3D);
348 void VISU_Gen_i::DeleteResult(Result_ptr theResult){
349 myVisuGen->DeleteResult(theResult);
353 void VISU_Gen_i::DeletePrs3d(Prs3d_ptr thePrs3d){
354 myVisuGen->DeletePrs3d(thePrs3d);
358 void VISU_Gen_i::Close(SALOMEDS::SComponent_ptr theComponent){
359 myVisuGen->Close(theComponent);
363 char* VISU_Gen_i::ComponentDataType(){
364 return CORBA::string_dup("VISU");
368 CORBA::Boolean VISU_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR) {
369 return myVisuGen->CanPublishInStudy(theIOR);
373 SALOMEDS::SObject_ptr VISU_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
374 SALOMEDS::SObject_ptr theSObject,
375 CORBA::Object_ptr theObject,
377 throw (SALOME::SALOME_Exception)
379 return myVisuGen->PublishInStudy(theStudy, theSObject, theObject, theName);
383 CORBA::Boolean VISU_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) {
384 return myVisuGen->CanCopy(theObject);
388 SALOMEDS::TMPFile* VISU_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) {
389 return myVisuGen->CopyFrom(theObject, theObjectID);
393 CORBA::Boolean VISU_Gen_i::CanPaste(const char* theComponentName, CORBA::Long theObjectID) {
394 return myVisuGen->CanPaste(theComponentName, theObjectID);
398 SALOMEDS::SObject_ptr VISU_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream,
399 CORBA::Long theObjectID,
400 SALOMEDS::SObject_ptr theObject)
402 return myVisuGen->PasteInto(theStream,theObjectID,theObject);
404 Engines::TMPFile* VISU_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
405 CORBA::Boolean theIsPublished,
406 CORBA::Boolean& theIsValidScript)
408 return myVisuGen->DumpPython(theStudy, theIsPublished, theIsValidScript);