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.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "VISU_Engine_i.hh"
21 #include "utilities.h"
23 #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog)
25 #include "SALOME_NamingService.hxx"
26 #include "Utils_ExceptHandlers.hxx"
31 static int MYDEBUG = 1;
33 static int MYDEBUG = 0;
37 #ifdef VISU_ENGINE_EXPORTS
38 #define VISU_ENGINE_EXPORT __declspec(dllexport)
40 #define VISU_ENGINE_EXPORT __declspec(dllimport)
43 #define VISU_ENGINE_EXPORT
46 UNEXPECT_CATCH(SalomeException, SALOME::SALOME_Exception);
50 PortableServer::ObjectId *
51 VISUEngine_factory(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId,
52 const char *instanceName, const char *interfaceName)
54 MESSAGE("VisuEngine_factory : "<<interfaceName);
55 // Check session: MZN: 24.11.2006 PAL 13948
56 SALOME_NamingService aNamingService(orb);
57 CORBA::Object_ptr anObject = aNamingService.Resolve("/Kernel/Session");
58 SALOME::Session_var aSession = SALOME::Session::_narrow(anObject);
59 if (CORBA::is_nil(aSession))
62 VISU::VISU_Gen_i * pVISU_Gen = new VISU::VISU_Gen_i(aSession, orb, poa, contId, instanceName, interfaceName);
63 return pVISU_Gen->getId() ;
68 //===========================================================================
69 VISU_Gen_i::VISU_Gen_i(SALOME::Session_ptr session,
71 PortableServer::POA_ptr poa,
72 PortableServer::ObjectId * contId,
73 const char *instanceName,
74 const char *interfaceName) :
75 Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
78 _id = _poa->activate_object(_thisObj);
80 Engines::Component_var aComponent = session->GetComponent("libVISUEngineImpl.so");
82 Engines::Component_var aComponent = session->GetComponent("VISUEngineImpl.dll");
84 myVisuGen = VISU::VISU_Gen::_narrow(aComponent);
87 VISU_Gen_i::~VISU_Gen_i(){
88 if(MYDEBUG) MESSAGE("VISU_Gen_i::~VISU_Gen_i");
91 VISU::VISUType VISU_Gen_i::GetType() {
92 return myVisuGen->GetType();
95 //===========================================================================
96 bool VISU_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
97 const SALOMEDS::TMPFile & theStream,
101 return myVisuGen->Load(theComponent,theStream,theURL,isMultiFile);
104 bool VISU_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent,
105 const SALOMEDS::TMPFile & theStream,
109 return Load(theComponent, theStream, theURL, isMultiFile);
112 char* VISU_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
113 const char* aLocalPersistentID,
114 CORBA::Boolean isMultiFile,
115 CORBA::Boolean isASCII)
117 return myVisuGen->LocalPersistentIDToIOR(theSObject, aLocalPersistentID, isMultiFile, isASCII);
121 //===========================================================================
122 SALOMEDS::TMPFile* VISU_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
126 return myVisuGen->Save(theComponent,theURL,isMultiFile);
129 SALOMEDS::TMPFile* VISU_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent,
133 return myVisuGen->Save(theComponent,theURL,isMultiFile);
137 char* VISU_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
138 const char* IORString,
139 CORBA::Boolean isMultiFile,
140 CORBA::Boolean isASCII)
142 return myVisuGen->IORToLocalPersistentID(theSObject, IORString, isMultiFile, isASCII);
146 char* VISU_Gen_i::GetID(){
147 return myVisuGen->GetID();
151 void VISU_Gen_i::SetCurrentStudy(SALOMEDS::Study_ptr theStudy){
152 myVisuGen->SetCurrentStudy(theStudy);
156 SALOMEDS::Study_ptr VISU_Gen_i::GetCurrentStudy(){
157 return myVisuGen->GetCurrentStudy();
161 ViewManager_ptr VISU_Gen_i::GetViewManager(){
162 return myVisuGen->GetViewManager();
166 SALOMEDS::SObject_ptr VISU_Gen_i::ImportTables(const char* theFileName){
167 return myVisuGen->ImportTables(theFileName);
171 CORBA::Boolean VISU_Gen_i::ExportTableToFile(SALOMEDS::SObject_ptr theTable,
172 const char* theFileName)
174 return myVisuGen->ExportTableToFile(theTable, theFileName);
178 Result_ptr VISU_Gen_i::ImportFile(const char* theFileName){
179 return myVisuGen->ImportFile(theFileName);
183 Result_ptr VISU_Gen_i::CreateResult(const char* theFileName){
184 return myVisuGen->CreateResult(theFileName);
188 Result_ptr VISU_Gen_i::CopyAndImportFile(const char* theFileName){
189 return myVisuGen->CopyAndImportFile(theFileName);
193 Result_ptr VISU_Gen_i::ImportMed(SALOMEDS::SObject_ptr theMedSObject){
194 return myVisuGen->ImportMed(theMedSObject);
198 Result_ptr VISU_Gen_i::ImportMedField(SALOME_MED::FIELD_ptr theField){
199 return myVisuGen->ImportMedField(theField);
203 Mesh_ptr VISU_Gen_i::MeshOnEntity(Result_ptr theResult,
204 const char* theMeshName,
205 VISU::Entity theEntity)
207 return myVisuGen->MeshOnEntity(theResult,theMeshName,theEntity);
210 Mesh_ptr VISU_Gen_i::FamilyMeshOnEntity(Result_ptr theResult,
211 const char* theMeshName,
212 VISU::Entity theEntity,
213 const char* theFamilyName)
215 return myVisuGen->FamilyMeshOnEntity(theResult,theMeshName,theEntity,theFamilyName);
218 Mesh_ptr VISU_Gen_i::GroupMesh(Result_ptr theResult,
219 const char* theMeshName,
220 const char* theGroupName)
222 return myVisuGen->GroupMesh(theResult,theMeshName,theGroupName);
226 void VISU_Gen_i::RenameEntityInStudy(Result_ptr theResult, const char* theMeshName,
227 VISU::Entity theEntity, const char* theNewName)
229 myVisuGen->RenameEntityInStudy(theResult,theMeshName,theEntity,theNewName);
232 void VISU_Gen_i::RenameFamilyInStudy(Result_ptr theResult, const char* theMeshName,
233 VISU::Entity theEntity, const char* theFamilyName,
234 const char* theNewName)
236 myVisuGen->RenameFamilyInStudy(theResult,theMeshName,theEntity,theFamilyName,theNewName);
239 void VISU_Gen_i::RenameGroupInStudy(Result_ptr theResult, const char* theMeshName,
240 const char* theGroupName, const char* theNewName)
242 myVisuGen->RenameGroupInStudy(theResult,theMeshName,theGroupName,theNewName);
248 ::ScalarMapOnField(Result_ptr theResult,
249 const char* theMeshName,
250 VISU::Entity theEntity,
251 const char* theFieldName,
252 CORBA::Long theIteration)
254 return myVisuGen->ScalarMapOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
260 ::GaussPointsOnField(Result_ptr theResult,
261 const char* theMeshName,
262 VISU::Entity theEntity,
263 const char* theFieldName,
264 CORBA::Long theIteration)
266 return myVisuGen->GaussPointsOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
272 ::DeformedShapeOnField(Result_ptr theResult,
273 const char* theMeshName,
274 VISU::Entity theEntity,
275 const char* theFieldName,
276 CORBA::Long theIteration)
278 return myVisuGen->DeformedShapeOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
281 ScalarMapOnDeformedShape_ptr
283 ::ScalarMapOnDeformedShapeOnField(Result_ptr theResult,
284 const char* theMeshName,
285 VISU::Entity theEntity,
286 const char* theFieldName,
287 CORBA::Long theIteration)
289 return myVisuGen->ScalarMapOnDeformedShapeOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
294 ::VectorsOnField(Result_ptr theResult,
295 const char* theMeshName,
296 VISU::Entity theEntity,
297 const char* theFieldName,
298 CORBA::Long theIteration)
300 return myVisuGen->VectorsOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
305 ::IsoSurfacesOnField(Result_ptr theResult,
306 const char* theMeshName,
307 VISU::Entity theEntity,
308 const char* theFieldName,
309 CORBA::Long theIteration)
311 return myVisuGen->IsoSurfacesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
317 ::StreamLinesOnField(Result_ptr theResult,
318 const char* theMeshName,
319 VISU::Entity theEntity,
320 const char* theFieldName,
321 CORBA::Long theIteration)
323 return myVisuGen->StreamLinesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
329 ::CutPlanesOnField(Result_ptr theResult,
330 const char* theMeshName,
331 VISU::Entity theEntity,
332 const char* theFieldName,
333 CORBA::Long theIteration)
335 return myVisuGen->CutPlanesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
341 ::CutLinesOnField(Result_ptr theResult,
342 const char* theMeshName,
343 VISU::Entity theEntity,
344 const char* theFieldName,
345 CORBA::Long theIteration)
347 return myVisuGen->CutLinesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
353 ::Plot3DOnField(Result_ptr theResult,
354 const char* theMeshName,
355 VISU::Entity theEntity,
356 const char* theFieldName,
357 CORBA::Long theIteration)
359 return myVisuGen->Plot3DOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
362 Table_ptr VISU_Gen_i::CreateTable(const char* theTableEntry){
363 return myVisuGen->CreateTable(theTableEntry);
367 Curve_ptr VISU_Gen_i::CreateCurve(Table_ptr theTable,
371 return myVisuGen->CreateCurve(theTable,theHRow,theVRow);
374 Curve_ptr VISU_Gen_i::CreateCurveWithZ(Table_ptr theTable,
379 return myVisuGen->CreateCurveWithZ(theTable,theHRow,theVRow,theZRow);
383 Container_ptr VISU_Gen_i::CreateContainer(){
384 return myVisuGen->CreateContainer();
388 Animation_ptr VISU_Gen_i::CreateAnimation(View3D_ptr theView3D){
389 return myVisuGen->CreateAnimation(theView3D);
393 void VISU_Gen_i::DeleteResult(Result_ptr theResult){
394 myVisuGen->DeleteResult(theResult);
398 void VISU_Gen_i::DeletePrs3d(Prs3d_ptr thePrs3d){
399 myVisuGen->DeletePrs3d(thePrs3d);
403 void VISU_Gen_i::Close(SALOMEDS::SComponent_ptr theComponent){
404 myVisuGen->Close(theComponent);
408 char* VISU_Gen_i::ComponentDataType(){
409 return CORBA::string_dup("VISU");
413 CORBA::Boolean VISU_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR) {
414 return myVisuGen->CanPublishInStudy(theIOR);
418 SALOMEDS::SObject_ptr VISU_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
419 SALOMEDS::SObject_ptr theSObject,
420 CORBA::Object_ptr theObject,
422 throw (SALOME::SALOME_Exception)
424 return myVisuGen->PublishInStudy(theStudy, theSObject, theObject, theName);
428 CORBA::Boolean VISU_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) {
429 return myVisuGen->CanCopy(theObject);
433 SALOMEDS::TMPFile* VISU_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) {
434 return myVisuGen->CopyFrom(theObject, theObjectID);
438 CORBA::Boolean VISU_Gen_i::CanPaste(const char* theComponentName, CORBA::Long theObjectID) {
439 return myVisuGen->CanPaste(theComponentName, theObjectID);
443 SALOMEDS::SObject_ptr VISU_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream,
444 CORBA::Long theObjectID,
445 SALOMEDS::SObject_ptr theObject)
447 return myVisuGen->PasteInto(theStream,theObjectID,theObject);
449 Engines::TMPFile* VISU_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
450 CORBA::Boolean theIsPublished,
451 CORBA::Boolean& theIsValidScript)
453 return myVisuGen->DumpPython(theStudy, theIsPublished, theIsValidScript);
456 VISU::ColoredPrs3dCache_ptr
458 GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy)
460 return myVisuGen->GetColoredPrs3dCache(theStudy);