From: yfr Date: Fri, 25 Jun 2004 09:53:27 +0000 (+0000) Subject: DCQ : Merge with Ecole Ete a6. X-Git-Tag: Merge_with_Ecole_Ete_a6~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b29e18d55f7450a42e0f379064bd7881f69164ad;p=modules%2Fvisu.git DCQ : Merge with Ecole Ete a6. --- diff --git a/doc/Makefile.in b/doc/Makefile.in index 01901597..7295ede7 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -11,9 +11,11 @@ top_builddir=.. srcdir=@srcdir@ VPATH=.:@srcdir@ -SUBDIRS=html +SUBDIRS= salome -doc: +@COMMENCE@ + +docs: @@SETX@; for d in $(SUBDIRS); do \ (cd $$d && $(MAKE) $@) || exit 1; \ done @@ -31,3 +33,8 @@ install: @@SETX@; for d in $(SUBDIRS); do \ (cd $$d && $(MAKE) $@) || exit 1; \ done + +uninstall: + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done diff --git a/doc/salome/Makefile.in b/doc/salome/Makefile.in new file mode 100644 index 00000000..5e21efd2 --- /dev/null +++ b/doc/salome/Makefile.in @@ -0,0 +1,43 @@ +# -* Makefile *- +# +# Author : Patrick GOLDBRONN (CEA) +# Date : 30/11/2001 +# $Header$ +# +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ + +SUBDIRS= tui gui + +@COMMENCE@ + +docs: + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done; \ + cp -f $(srcdir)/VISU_index.html VISU_index.html + +clean: + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done + +distclean: clean + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done + +install: + $(MAKE) docs + (cd tui && $(MAKE) install); + (cd gui && $(MAKE) install); + cp -f VISU_index.html $(docdir) + +uninstall: + @@SETX@; for d in $(SUBDIRS); do \ + (cd $$d && $(MAKE) $@) || exit 1; \ + done; \ + rm -fr $(docdir)/VISU_index.html diff --git a/doc/salome/VISU_index.html b/doc/salome/VISU_index.html new file mode 100644 index 00000000..84118080 --- /dev/null +++ b/doc/salome/VISU_index.html @@ -0,0 +1,95 @@ + + + + + + + + Post-Pro Module Documentation + + + +
  +
+
                   +   
+ + + + + + + + + +
+ + + +
+ +
+
+
+

Post-Pro MODULE Documentation

+
+
+ + + + + +
+
+ +
+

Application-About.png +     

+
+ +
+ + + + +
+
+
+
+
+ +
+ +
GUI Documentation
+ +
+ +
+ +

+
+ +
+ +
TUI Documentation
+ +
+ +
+ +

+
+
+
+
+
+
+ + diff --git a/doc/salome/gui/Makefile.in b/doc/salome/gui/Makefile.in new file mode 100644 index 00000000..e03160f1 --- /dev/null +++ b/doc/salome/gui/Makefile.in @@ -0,0 +1,33 @@ +# Copyright (C) 2003 CEA/DEN, EDF R&D +# +# +# +# File : Makefile.in +# Author : Vasily Rusyaev (Open Cascade NN) +# Module : doc +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ + +@COMMENCE@ + +docs: + cp -fr $(srcdir)/VISU ./ + -find $(PWD) -name CVS -exec rm -rf {} \; + +clean: + rm -fr `ls | grep -v "Makefile"` + +distclean: clean + rm -fr VISU + +install: + mkdir -p $(docdir)/gui + cp -rf VISU $(docdir)/gui + -find $(PWD) -name CVS -exec rm -rf {} \; + +uninstall: + rm -rf $(docdir)/gui/VISU diff --git a/src/ENGINE/Makefile.in b/src/ENGINE/Makefile.in new file mode 100644 index 00000000..320f6a4b --- /dev/null +++ b/src/ENGINE/Makefile.in @@ -0,0 +1,50 @@ +# Copyright (C) 2003 CEA/DEN, EDF R&D +# +# +# +# File : Makefile.in +# Author : Alexey Petrov +# Module : VISU +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# Libraries targets +LIB = libVISUEngine.la +LIB_SRC = VISU_Engine_i.cc + +LIB_MOC = + +LIB_SERVER_IDL = VISU_Gen.idl SALOME_Component.idl \ + SALOME_Exception.idl SALOME_GenericObj.idl \ + SALOME_Session.idl MED.idl +LIB_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl + +# Executables targets +BIN = +BIN_SRC = + +BIN_CLIENT_IDL = +BIN_SERVER_IDL = + +EXPORT_HEADERS = + +# additionnal information to compil and link file +CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeContainer + +LIBS+= + +# additional file to be cleaned +MOSTLYCLEAN = +CLEAN = +DISTCLEAN = + +@CONCLUDE@ \ No newline at end of file diff --git a/src/ENGINE/VISU_Engine_i.cc b/src/ENGINE/VISU_Engine_i.cc new file mode 100644 index 00000000..fd0c065e --- /dev/null +++ b/src/ENGINE/VISU_Engine_i.cc @@ -0,0 +1,358 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org + +#include "VISU_Engine_i.hh" +#include "utilities.h" + +#include CORBA_SERVER_HEADER(SALOME_Session) +#include CORBA_SERVER_HEADER(SALOME_ModuleCatalog) + +#include "SALOME_NamingService.hxx" +#include "Utils_ExceptHandlers.hxx" + +using namespace std; + +#ifdef _DEBUG_ +static int MYDEBUG = 1; +#else +static int MYDEBUG = 0; +#endif + +UNEXPECT_CATCH(SalomeException, SALOME::SALOME_Exception); + +extern "C" { + PortableServer::ObjectId * + VISUEngine_factory(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId, + const char *instanceName, const char *interfaceName) + { + if(MYDEBUG) MESSAGE("VisuEngine_factory : "<getId() ; + } +} + +namespace VISU{ + //=========================================================================== + VISU_Gen_i::VISU_Gen_i(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) : + Engines_Component_i(orb, poa, contId, instanceName, interfaceName) + { + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + SALOME_NamingService aNamingService(orb); + CORBA::Object_ptr anObject = aNamingService.Resolve("/Kernel/Session"); + SALOME::Session_var aSession = SALOME::Session::_narrow(anObject); + //aSession->GetInterface(); + Engines::Component_var aComponent = aSession->GetVisuComponent(); + myVisuGen = VISU::VISU_Gen::_narrow(aComponent); + } + + VISU_Gen_i::~VISU_Gen_i(){ + if(MYDEBUG) MESSAGE("VISU_Gen_i::~VISU_Gen_i"); + } + + VISU::VISUType VISU_Gen_i::GetType() { + return myVisuGen->GetType(); + }; + + //=========================================================================== + bool VISU_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile & theStream, + const char* theURL, + bool isMultiFile) + { + return myVisuGen->Load(theComponent,theStream,theURL,isMultiFile); + } + + bool VISU_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile & theStream, + const char* theURL, + bool isMultiFile) + { + return Load(theComponent, theStream, theURL, isMultiFile); + } + + char* VISU_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, + const char* aLocalPersistentID, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII) + { + return myVisuGen->LocalPersistentIDToIOR(theSObject, aLocalPersistentID, isMultiFile, isASCII); + } + + + //=========================================================================== + SALOMEDS::TMPFile* VISU_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + bool isMultiFile) + { + return myVisuGen->Save(theComponent,theURL,isMultiFile); + } + + SALOMEDS::TMPFile* VISU_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + bool isMultiFile) + { + return myVisuGen->Save(theComponent,theURL,isMultiFile); + } + + + char* VISU_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, + const char* IORString, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII) + { + return myVisuGen->IORToLocalPersistentID(theSObject, IORString, isMultiFile, isASCII); + } + + + char* VISU_Gen_i::GetID(){ + return myVisuGen->GetID(); + } + + + void VISU_Gen_i::SetCurrentStudy(SALOMEDS::Study_ptr theStudy){ + myVisuGen->SetCurrentStudy(theStudy); + } + + + SALOMEDS::Study_ptr VISU_Gen_i::GetCurrentStudy(){ + return myVisuGen->GetCurrentStudy(); + } + + + ViewManager_ptr VISU_Gen_i::GetViewManager(){ + return myVisuGen->GetViewManager(); + } + + + SALOMEDS::SObject_ptr VISU_Gen_i::ImportTables(const char* theFileName){ + return myVisuGen->ImportTables(theFileName); + } + + + CORBA::Boolean VISU_Gen_i::ExportTableToFile(SALOMEDS::SObject_ptr theTable, + const char* theFileName) + { + return myVisuGen->ExportTableToFile(theTable, theFileName); + } + + + Result_ptr VISU_Gen_i::ImportFile(const char* theFileName){ + return myVisuGen->ImportFile(theFileName); + } + + + Result_ptr VISU_Gen_i::CopyAndImportFile(const char* theFileName){ + return myVisuGen->CopyAndImportFile(theFileName); + } + + + Result_ptr VISU_Gen_i::ImportMed(SALOMEDS::SObject_ptr theMedSObject){ + return myVisuGen->ImportMed(theMedSObject); + } + + + Result_ptr VISU_Gen_i::ImportMedField(SALOME_MED::FIELD_ptr theField){ + return myVisuGen->ImportMedField(theField); + } + + + Mesh_ptr VISU_Gen_i::MeshOnEntity(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity) + { + return myVisuGen->MeshOnEntity(theResult,theMeshName,theEntity); + } + + + Mesh_ptr VISU_Gen_i::FamilyMeshOnEntity(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFamilyName) + { + return myVisuGen->FamilyMeshOnEntity(theResult,theMeshName,theEntity,theFamilyName); + } + + + Mesh_ptr VISU_Gen_i::GroupMesh(Result_ptr theResult, + const char* theMeshName, + const char* theGroupName) + { + return myVisuGen->GroupMesh(theResult,theMeshName,theGroupName); + } + + + ScalarMap_ptr VISU_Gen_i::ScalarMapOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Double theIteration) + { + return myVisuGen->ScalarMapOnField(theResult,theMeshName,theEntity,theFieldName,theIteration); + } + + + DeformedShape_ptr VISU_Gen_i::DeformedShapeOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Double theIteration) + { + return myVisuGen->DeformedShapeOnField(theResult,theMeshName,theEntity,theFieldName,theIteration); + } + + + Vectors_ptr VISU_Gen_i::VectorsOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Double theIteration) + { + return myVisuGen->VectorsOnField(theResult,theMeshName,theEntity,theFieldName,theIteration); + } + + IsoSurfaces_ptr VISU_Gen_i::IsoSurfacesOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Double theIteration) + { + return myVisuGen->IsoSurfacesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration); + } + + + StreamLines_ptr VISU_Gen_i::StreamLinesOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Double theIteration) + { + return myVisuGen->StreamLinesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration); + } + + + CutPlanes_ptr VISU_Gen_i::CutPlanesOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Double theIteration) + { + return myVisuGen->CutPlanesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration); + } + + + CutLines_ptr VISU_Gen_i::CutLinesOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Double theIteration) + { + return myVisuGen->CutLinesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration); + } + + + Table_ptr VISU_Gen_i::CreateTable(const char* theTableEntry){ + return myVisuGen->CreateTable(theTableEntry); + } + + + Curve_ptr VISU_Gen_i::CreateCurve(Table_ptr theTable, + CORBA::Long theHRow, + CORBA::Long theVRow) + { + return myVisuGen->CreateCurve(theTable,theHRow,theVRow); + } + + + Container_ptr VISU_Gen_i::CreateContainer(){ + return myVisuGen->CreateContainer(); + } + + + Animation_ptr VISU_Gen_i::CreateAnimation(View3D_ptr theView3D){ + return myVisuGen->CreateAnimation(theView3D); + } + + + void VISU_Gen_i::Close(SALOMEDS::SComponent_ptr theComponent){ + myVisuGen->Close(theComponent); + } + + + char* VISU_Gen_i::ComponentDataType(){ + return CORBA::string_dup("VISU"); + } + + + CORBA::Boolean VISU_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR) { + return myVisuGen->CanPublishInStudy(theIOR); + } + + + SALOMEDS::SObject_ptr VISU_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject, + const char* theName) + throw (SALOME::SALOME_Exception) + { + return myVisuGen->PublishInStudy(theStudy, theSObject, theObject, theName); + } + + + CORBA::Boolean VISU_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) { + return myVisuGen->CanCopy(theObject); + } + + + SALOMEDS::TMPFile* VISU_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) { + return myVisuGen->CopyFrom(theObject, theObjectID); + } + + + CORBA::Boolean VISU_Gen_i::CanPaste(const char* theComponentName, CORBA::Long theObjectID) { + return myVisuGen->CanPaste(theComponentName, theObjectID); + } + + + SALOMEDS::SObject_ptr VISU_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream, + CORBA::Long theObjectID, + SALOMEDS::SObject_ptr theObject) + { + return myVisuGen->PasteInto(theStream,theObjectID,theObject); + } + + + /*! SAN & VSR : Test QT_EVENT + >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + */ + void VISU_Gen_i::CreateTestView() { + myVisuGen->CreateTestView(); + } + void VISU_Gen_i::ShowTestObject() { + myVisuGen->ShowTestObject(); + } + /*! SAN & VSR : Test QT_EVENT + <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + */ + +}; diff --git a/src/ENGINE/VISU_Engine_i.hh b/src/ENGINE/VISU_Engine_i.hh new file mode 100644 index 00000000..10f96e14 --- /dev/null +++ b/src/ENGINE/VISU_Engine_i.hh @@ -0,0 +1,143 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org + +#ifndef __VISU_ENGINE_I_H__ +#define __VISU_ENGINE_I_H__ + +// IDL headers +#include "SALOMEconfig.h" +#include CORBA_SERVER_HEADER(VISU_Gen) +#include CORBA_SERVER_HEADER(MED) +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +#include "SALOME_Component_i.hxx" + +namespace VISU{ + class VISU_Gen_i : public virtual POA_VISU::VISU_Gen, + public virtual ::Engines_Component_i + { + VISU_Gen_var myVisuGen; + VISU_Gen_i(); + VISU_Gen_i(const VISU::VISU_Gen_i &); + public: + VISU_Gen_i(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName); + virtual ~VISU_Gen_i(); + + virtual char* GetID(); + virtual VISU::VISUType GetType(); + + virtual void SetCurrentStudy(SALOMEDS::Study_ptr theStudy); + virtual SALOMEDS::Study_ptr GetCurrentStudy(); + + virtual ViewManager_ptr GetViewManager(); + + virtual SALOMEDS::SObject_ptr ImportTables(const char* theFileName); + virtual CORBA::Boolean ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName ); + + //Create Result + virtual Result_ptr ImportFile(const char* theFileName); + virtual Result_ptr CopyAndImportFile(const char* theFileName); + virtual Result_ptr ImportMed(SALOMEDS::SObject_ptr theMedSObject); + virtual Result_ptr ImportMedField(SALOME_MED::FIELD_ptr theField); + + //Create Presentation Of Submeshes + virtual Mesh_ptr MeshOnEntity(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity); + virtual Mesh_ptr FamilyMeshOnEntity(Result_ptr theResult, const char* theMeshName, + VISU::Entity theEntity, const char* theFamilyName); + virtual Mesh_ptr GroupMesh(Result_ptr theResult, const char* theMeshName, const char* theGroupName); + + virtual ScalarMap_ptr ScalarMapOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, + const char* theFieldName, CORBA::Double theIteration); + virtual DeformedShape_ptr DeformedShapeOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, + const char* theFieldName, CORBA::Double theIteration); + virtual Vectors_ptr VectorsOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, + const char* theFieldName, CORBA::Double theIteration); + virtual IsoSurfaces_ptr IsoSurfacesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, + const char* theFieldName, CORBA::Double theIteration); + virtual CutPlanes_ptr CutPlanesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, + const char* theFieldName, CORBA::Double theIteration); + virtual CutLines_ptr CutLinesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, + const char* theFieldName, CORBA::Double theIteration); + virtual StreamLines_ptr StreamLinesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, + const char* theFieldName, CORBA::Double theIteration); + //Create Digital Presentation + virtual Table_ptr CreateTable(const char* theTableEntry); + virtual Curve_ptr CreateCurve(Table_ptr theTable, CORBA::Long theHRow, CORBA::Long theVRow); + virtual Container_ptr CreateContainer(); + virtual Animation_ptr CreateAnimation(View3D_ptr theView3d); + + // inherited methods from SALOMEDS::Driver + virtual SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + bool isMultiFile); + virtual SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + bool isMultiFile); + virtual bool Load(SALOMEDS::SComponent_ptr, + const SALOMEDS::TMPFile &, + const char* theURL, + bool isMultiFile); + virtual bool LoadASCII(SALOMEDS::SComponent_ptr, + const SALOMEDS::TMPFile &, + const char* theURL, + bool isMultiFile); + + virtual void Close(SALOMEDS::SComponent_ptr IORSComponent); + + virtual char* ComponentDataType(); + + virtual char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, + const char* IORString, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII); + virtual char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, + const char* aLocalPersistentID, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII); + + virtual bool CanPublishInStudy(CORBA::Object_ptr theIOR); + virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theSObject, + CORBA::Object_ptr theObject, + const char* theName) throw (SALOME::SALOME_Exception); + + CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject); + SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID); + CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID); + SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream, + CORBA::Long theObjectID, + SALOMEDS::SObject_ptr theObject); + /*! SAN & VSR : Test QT_EVENT + >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + */ + virtual void CreateTestView(); + virtual void ShowTestObject(); + /*! SAN & VSR : Test QT_EVENT + <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + */ + }; +}; + + +#endif diff --git a/src/VISU_SWIG/Makefile.in b/src/VISU_SWIG/Makefile.in index ff40e7bc..d4b0ac36 100644 --- a/src/VISU_SWIG/Makefile.in +++ b/src/VISU_SWIG/Makefile.in @@ -44,7 +44,7 @@ SWIG_DEF = libVISU_Swig.i EXPORT_PYSCRIPTS = libVISU_Swig.py batchmode_visu.py batchmode_visu_table.py batchmode_visu_view3d.py \ visu_med.py visu_view3d.py visu.py visu_gui.py visu_prs_example.py\ visu_table.py visu_big_table.py visu_view.py \ - visu_swig_test.py + visu_swig_test.py test_events.py batch_test_events.py EXPORT_SHAREDPYSCRIPTS = VISU_shared_modules.py LIB_CLIENT_IDL = diff --git a/src/VISU_SWIG/batch_test_events.py b/src/VISU_SWIG/batch_test_events.py new file mode 100644 index 00000000..df7f3c3c --- /dev/null +++ b/src/VISU_SWIG/batch_test_events.py @@ -0,0 +1,14 @@ +############################################################### +# +# File : batch_test_events.py +# Description : Test postEvent() functionality for VISU module +# +############################################################### + +import batchmode_visu + +for i in range ( 10 ): + batchmode_visu.myVisu.CreateTestView() + for j in range ( 10 ): + batchmode_visu.myVisu.ShowTestObject(); + diff --git a/src/VISU_SWIG/batchmode_visu_table.py b/src/VISU_SWIG/batchmode_visu_table.py index fe85ef75..aca745d1 100644 --- a/src/VISU_SWIG/batchmode_visu_table.py +++ b/src/VISU_SWIG/batchmode_visu_table.py @@ -15,6 +15,9 @@ import SALOMEDS import VISU import math +#-------------------------------------------------------------------------- +modulecatalog = naming_service.Resolve("/Kernel/ModulCatalog") + # >>> Getting study builder ================================================== myBuilder = myStudy.NewBuilder() @@ -25,7 +28,14 @@ myVisu.SetCurrentStudy(myStudy) if not myComponent: myComponent = myBuilder.NewComponent("VISU") aName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName") - aName.SetValue("Visu") + #aName.SetValue("Visu") + Comp = modulecatalog.GetComponent( "VISU" ) + aName.SetValue( Comp._get_componentusername() ) + + A2 = myBuilder.FindOrCreateAttribute(myComponent, "AttributePixMap"); + aPixmap = A2._narrow(SALOMEDS.AttributePixMap); + aPixmap.SetPixMap( "ICON_OBJBROWSER_Visu" ); + myBuilder.DefineComponentInstance(myComponent,myVisu) # >>> Creating object with Table of real[ 200 * 20 ] ======================== diff --git a/src/VISU_SWIG/batchmode_visu_view.py b/src/VISU_SWIG/batchmode_visu_view.py new file mode 100644 index 00000000..4bc74a8b --- /dev/null +++ b/src/VISU_SWIG/batchmode_visu_view.py @@ -0,0 +1,57 @@ +# VISU VISU_SWIG : binding of C++ implementation and Python +# +# Copyright (C) 2003 CEA/DEN, EDF R&D +# +# +# +# File : test_table.py +# Author : Alexey Petrov +# Module : VISU +# $Header: + +from VISU import * +from batchmode_visu_table import * + +myViewMan = myVisu.GetViewManager() + +myTable = myViewMan.CreateTableView(myVisuTableReal) +myTitle = myTable.GetTitle() +myTable.SetTitle('Changed Title') + +myPlot = myViewMan.CreateXYPlot() +myTitle = myPlot.GetTitle() +myPlot.SetTitle('Change the title from python') + +mySubTitle = myPlot.GetSubTitle() +myPlot.SetSubTitle(myTitle) + +myXTitle = myPlot.GetXTitle() +myYTitle = myPlot.GetYTitle() +myPlot.SetXTitle(myYTitle) +myPlot.SetYTitle(myXTitle) + +myPlot.GetMarkerSize() +myPlot.SetMarkerSize(20) +myPlot.GetMarkerSize() +myPlot.ShowLegend(0) + +myPlot.SetCurveType(VISU.XYPlot.POINTS) +myPlot.SetCurveType(VISU.XYPlot.MULTYLINE) +myPlot.GetCurveType() +myPlot.SetCurveType(VISU.XYPlot.SPLINE) + +myPlot.SetHorScaling(VISU.LOGARITHMIC) +myPlot.EnableXGrid(1,3,1,4) +myPlot.SetHorScaling(VISU.LINEAR) +myPlot.EnableXGrid(1,10,1,10) +myPlot.GetHorScaling() + +myPlot.SetVerScaling(VISU.LOGARITHMIC) +myPlot.GetVerScaling() +myPlot.EnableYGrid(1,2,1,10) + +myPlot.ShowLegend(1) +myPlot.SetMarkerSize(5) +myPlot.GetMarkerSize() + +myPlot.Display(myContainer) diff --git a/src/VISU_SWIG/batchmode_visu_view3d.py b/src/VISU_SWIG/batchmode_visu_view3d.py index 47396189..0d41aa6d 100644 --- a/src/VISU_SWIG/batchmode_visu_view3d.py +++ b/src/VISU_SWIG/batchmode_visu_view3d.py @@ -8,78 +8,261 @@ # Module : VISU import os -import batchmode_visu +import time +import math import VISU import SALOMEDS +from batchmode_visu import * + +aDelay = 0 #mySession = batchmode_visu.mySession -myVisu = batchmode_visu.myVisu -medFile = "fra.med" -myFieldName = "VITESSE"; +myViewManager = myVisu.GetViewManager(); -#medFile = "minimail.dat" -#myFieldName = "Pressures"; +myView = myViewManager.Create3DView(); +myView.SetTitle("The window will be soon destroyed!") +print "myViewManager.Create3DView()" +time.sleep(aDelay) -#medFile = "brideResultats.dat" -#myFieldName = "VM_Elem."; +myView.Maximize() +print "myView.Maximize()" +time.sleep(aDelay) -medFile = os.getenv('SALOME_ROOT_DIR') + '/data/' + medFile -myResult = myVisu.ImportFile(medFile) +myView.Restore() +print "myView.Restore()" +time.sleep(aDelay) + +myView.Minimize() +print "myView.Minimize()" +time.sleep(aDelay) +myViewManager.Destroy(myView) +print "myViewManager.Destroy(myView)" +time.sleep(aDelay) + + + +medFile = "fra.med" +myFieldName = "VITESSE"; aMeshName ="LE VOLUME" anEntity = VISU.NODE -aMesh = myVisu.MeshOnEntity(myResult, aMeshName, anEntity) - aTimeStampId = 1 -# -aScalarMap = myVisu.ScalarMapOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId) -if aScalarMap is not None: - aScalarMap.SetScaling(VISU.LOGARITHMIC) -else: - print "Null scalar map is created" +medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile +myResult = myVisu.ImportFile(medFile) -# -aCutPlanes = myVisu.CutPlanesOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId) -if aCutPlanes is not None: - aCutPlanes.SetScaling(VISU.LOGARITHMIC) -else: print "Null aCutPlanes is created" -# -aIsoSurfaces = myVisu.IsoSurfacesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId) -if aIsoSurfaces is not None: - aIsoSurfaces.SetScaling(VISU.LINEAR) -else: print "Null aIsoSurfaces is created" -myViewManager = myVisu.GetViewManager(); -#myView = myViewManager.Create3DView(); -myView = myViewManager.GetCurrentView(); +myView = myViewManager.Create3DView(); + +print "myView.SetBackground(...)" +aColor = SALOMEDS.Color(0.0,0.3,1.0) +myView.SetBackground(aColor); + +myView.SetTitle("The viewer will display ScalarMap") +print "myViewManager.Create3DView()" + +aScalarMap = myVisu.ScalarMapOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId) + +myView.Display(aScalarMap); +print "myView.Display(aScalarMap)" myView.SetFocalPoint([0,0,0]); +print "myView.SetFocalPoint(...)" myView.SetParallelScale(2); +print "myView.SetParallelScale(...)" +myView.FitAll(); + +aMax = aScalarMap.GetMax() +aMin = aScalarMap.GetMin() +aDelta = (aMax - aMin)/2.0 +aNbColors = aScalarMap.GetNbColors() +aNbColors = 64 +for i in range(2,aNbColors) : + aScalarMap.SetNbColors(i) + aX = aMin + aDelta*i/aNbColors + aY = aMax - aDelta*i/aNbColors + aScalarMap.SetRange(aX,aY) + myView.Update(); + time.sleep(aDelay) + +aScalarMap.SetRange(aMin,aMax) + +print "myView.Update()" +myView.Update(); +print "myView.FitAll()" +myView.FitAll(); + + + +myView = myViewManager.Create3DView(); +myView.SetTitle("Here we will display CutPlanes") + +print "myView.SetBackground(...)" +aColor = SALOMEDS.Color(0.0,0.7,0.0) +myView.SetBackground(aColor); + +aCutPlanes = myVisu.CutPlanesOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId) +print "myVisu.CutPlanesOnField(...)" + +myView.DisplayOnly(aCutPlanes); +print "myView.DisplayOnly(aCutPlanes)" + aPoint = myView.GetPointOfView(); aPoint[0] = aPoint[0] + 10; myView.SetPointOfView(aPoint); +print "myView.SetPointOfView(...)" myView.ScaleView(VISU.View3D.YAxis,10.0); myView.ScaleView(VISU.View3D.XAxis,3.0); -aColor = SALOMEDS.Color(0.0,0.3,1.0) -myView.SetBackground(aColor); -myView.Update(); -myView.Display(aScalarMap); -#myView.Erase(aScalarMap); -#myView.DisplayOnly(aCutPlanes); +print "myView.ScaleView(...)" +time.sleep(aDelay) + +myView.FitAll(); + +aNbPlanes = aCutPlanes.GetNbPlanes() +aNbPlanes = 30 +aXAngle = aCutPlanes.GetRotateX() +aYAngle = aCutPlanes.GetRotateY() +anOrientation = aCutPlanes.GetOrientationType() +for i in range(aNbPlanes,1,-1) : + aCutPlanes.SetNbPlanes(i) + aX = math.pi/2.0*(aNbPlanes-i)/aNbPlanes + aY = math.pi/2.0*(aNbPlanes-i)/aNbPlanes + aCutPlanes.SetOrientation(anOrientation,aX,aY) + myView.Update(); + time.sleep(aDelay) + +aNbPlanes = 10 +aCutPlanes.SetOrientation(VISU.CutPlanes.ZX,0,0) +for i in range(1,aNbPlanes) : + aCutPlanes.SetNbPlanes(i) + myView.Update(); + time.sleep(aDelay) + myView.SaveViewParams('AAA') +print "myView.SaveViewParams('AAA')" +time.sleep(aDelay) +aCutPlanes.SetOrientation(VISU.CutPlanes.XY,0,0) myView.RemoveScale(); + +print "myView.Update()" +myView.Update(); +print "myView.FitAll()" myView.FitAll(); -aColor = SALOMEDS.Color(0.0,0.0,0.0) + + + +myView = myViewManager.Create3DView(); +print "myViewManager.Create3DView()" + +myView.SetTitle("IsoSurface's viewer") + +print "myView.SetBackground(...)" +aColor = SALOMEDS.Color(1.0,0.7,0.0) myView.SetBackground(aColor); -myView.SaveViewParams('BBB'); +time.sleep(aDelay) + +aIsoSurfaces = myVisu.IsoSurfacesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId) + +myView.DisplayOnly(aIsoSurfaces); +myView.FitAll(); +print "myView.DisplayOnly(aCutPlanes)" +time.sleep(aDelay) + +aNbSurfaces = aIsoSurfaces.GetNbSurfaces() +aNbSurfaces = 32 +for i in range(2,aNbSurfaces) : + aIsoSurfaces.SetNbSurfaces(i) + myView.Update(); + time.sleep(aDelay) + +aIsoSurfaces.SetNbSurfaces(10) + +print "myView.Update()" +myView.Update(); +print "myView.FitAll()" +myView.FitAll(); + -aColor = SALOMEDS.Color(1.0,1.0,1.0) + +myView = myViewManager.Create3DView(); +myView.SetTitle("The viewer for CutLines") +print "myViewManager.Create3DView()" +time.sleep(aDelay) + +print "myView.SetBackground(...)" +aColor = SALOMEDS.Color(0.7,0.7,0.7) myView.SetBackground(aColor); -myView.ScaleView(VISU.View3D.ZAxis,0.5); -myView.SaveViewParams('CCC'); +time.sleep(aDelay) + +aCutLines = myVisu.CutLinesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId) +aCutLines.SetOrientation(VISU.CutPlanes.ZX,0,0) +aCutLines.SetOrientation2(VISU.CutPlanes.YZ,0,0) + +myView.DisplayOnly(aCutLines); +myView.FitAll(); +print "myView.DisplayOnly(aCutLines)" +time.sleep(aDelay) + +aSObj = myStudy.FindObjectIOR(aCutLines.GetID()) +aTable = myVisu.CreateTable( aSObj.GetID() ) +print "myVisu.CreateTable(...)" + +aTableView = myViewManager.CreateTableView(aTable) +aTableView.SetTitle('Changed Title') + +aContainer = myVisu.CreateContainer() +print "myVisu.CreateContainer(...)" + +aNbCurve = aTable.GetNbRows() - 1 +for i in range(2,aNbCurve): + aCurve = myVisu.CreateCurve( aTable, 1, i ) + print i, aCurve + aContainer.AddCurve(aCurve) + + +myView = myViewManager.CreateXYPlot(); +myView.SetTitle("The viewer for Curves from CutLines") +print "myViewManager.CreateXYPlot()" +time.sleep(aDelay) + +myView.Display(aContainer) + + + +myView = myViewManager.Create3DView(); +myView.SetTitle("The viewer for Animation") +print "myViewManager.Create3DView()" +time.sleep(aDelay) + +medFile = "TimeStamps.med" +myFieldName = "vitesse"; + +medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile +myResult = myVisu.ImportFile(medFile) + +anAnim = myVisu.CreateAnimation(myView); +aSObj = myStudy.FindObjectIOR(myResult.GetID()) +aSObj = aSObj.FindSubObject(1)[1] +aSObj = aSObj.FindSubObject(2)[1] +aSObj = aSObj.FindSubObject(2)[1] +anAnim.addField(aSObj) +anAnim.setPresentationType(0,VISU.TISOSURFACE) +print "Generate presentations" +anAnim.generatePresentations(0) +print "Generate frames" +anAnim.generateFrames() +print "Start Animation" +anAnim.setSpeed(99) +#anAnim.setCycling(1) +anAnim.startAnimation() +myView.FitAll() +while 1: + time.sleep(1+aDelay) + if not anAnim.isRunning(): + anAnim.stopAnimation() + break -myView.RestoreViewParams('AAA'); +#anAnim.clearView() diff --git a/src/VISU_SWIG/test_events.py b/src/VISU_SWIG/test_events.py new file mode 100755 index 00000000..df53a3e8 --- /dev/null +++ b/src/VISU_SWIG/test_events.py @@ -0,0 +1,14 @@ +############################################################### +# +# File : test_events.py +# Description : Test postEvent() functionality for VISU module +# This script can be run from GUI Python console only! +############################################################### + +from visu_gui import * + +for i in range ( 10 ): + myVisu.CreateTestView() + for j in range ( 10 ): + myVisu.ShowTestObject(); + diff --git a/src/VISU_SWIG/visu.py b/src/VISU_SWIG/visu.py index 86d8adc8..9306e262 100644 --- a/src/VISU_SWIG/visu.py +++ b/src/VISU_SWIG/visu.py @@ -29,7 +29,18 @@ myLocalStudy = None myLocalVisu = None myDelay = None mySession = None - + +def changeBlankToUnderScore(stringWithBlank): + blank = ' ' + underscore = '_' + decompString = split(stringWithBlank,blank) + length = len(decompString) + stringWithUnderScore = decompString[0] + for i in range(1,length): + stringWithUnderScore += underscore + stringWithUnderScore += decompString[i] + return stringWithUnderScore + def Initialize(theORB, theNamingService, theLifeCycleCORBA, theStudyManager, theStudy, theDelay) : global myORB, myNamingService, myLifeCycleCORBA, myLocalStudyManager, myLocalStudy global mySession, myLocalVisu, myDelay @@ -99,38 +110,104 @@ def CreateStudyForMed(theVisu, theFileName) : return [aStudy, myViewManager, myView] raise RuntimeError, "Error: There is no shuch file." -def getMedObjectFromStudy(theStudy = myLocalStudy): +##def getMedObjectFromStudy(theStudy = myLocalStudy): +## if theStudy is None: +## theStudy = myLocalStudy +## mySO = theStudy.FindObject("Objet MED") +## anAttr = mySO.FindAttribute("AttributeIOR")[1] +## obj = myORB.string_to_object(anAttr.Value()) +## myObj = obj._narrow(SALOME_MED.MED) +## return myObj + +def getMedObjectFromStudy(file, theStudy = myLocalStudy): + objNameInStudy = "MED_OBJECT_FROM_FILE_"+file + compNameInStudy= "MED" + if theStudy is None: theStudy = myLocalStudy - mySO = theStudy.FindObject("Objet MED") - anAttr = mySO.FindAttribute("AttributeIOR")[1] - obj = myORB.string_to_object(anAttr.Value()) - myObj = obj._narrow(SALOME_MED.MED) - return myObj -def getMedSObject(theStudy = myLocalStudy ): - return theStudy.FindObject("Objet MED") + listOfSO = theStudy.FindObjectByName(objNameInStudy,compNameInStudy) + listLength = len(listOfSO) + if (listLength == 0) : + print "PROBLEME ",objNameInStudy," cannot be found in the Study under the component ",compNameInStudy + return None + elif (listLength > 1) : + print "PROBLEME there are more than one instance of ",objNameInStudy," in the Study under the component ",compNameInStudy + return None + mySO = listOfSO[0] + if (mySO == None) : + print "PROBLEM ",objNameInStudy," cannot be found in the Study" + return mySO + else: + anAttr = mySO.FindAttribute("AttributeIOR")[1] + obj = myORB.string_to_object(anAttr.Value()) + myObj = obj._narrow(SALOME_MED.MED) + if (myObj == None) : + print "PROBLEM ",objNameInStudy," has been found in the Study but with the wrong type" + return myObj + +##def getMedSObject(theStudy = myLocalStudy ): +## return theStudy.FindObject("Objet MED") + +def getMedSObject(file, theStudy = myLocalStudy ): + objNameInStudy = "MED_OBJECT_FROM_FILE_"+file + compNameInStudy= "MED" -def getFieldObjectFromStudy(number, subnumber, theStudy = myLocalStudy): if theStudy is None: theStudy = myLocalStudy - mySO = theStudy.FindObject("MEDFIELD") - if mySO is None: - raise Runtime, "getFieldObjectFromStudy mySO is None" - mysub = mySO.FindSubObject(number)[1] - if mysub: - mysubsub = mysub.FindSubObject(subnumber)[1] - if mysubsub: - Builder = theStudy.NewBuilder() - anAttr = Builder.FindOrCreateAttribute(mysubsub, "AttributeIOR") - obj = myORB.string_to_object(anAttr.Value()) - myObj = obj._narrow(SALOME_MED.FIELDINT) - if (myObj == None): - myObj = obj._narrow(SALOME_MED.FIELDDOUBLE) - return myObj - else: - print "ERROR: No Field Object stored in this Study" + + listOfSO = theStudy.FindObjectByName(objNameInStudy,compNameInStudy) + listLength = len(listOfSO) + if (listLength == 0) : + print "PROBLEME ",objNameInStudy," cannot be found in the Study under the component ",compNameInStudy + return None + elif (listLength > 1) : + print "PROBLEME there are more than one instance of ",objNameInStudy," in the Study under the component ",compNameInStudy return None + mySO = listOfSO[0] + return mySO + +##def getFieldObjectFromStudy(number, subnumber, theStudy = myLocalStudy): +## if theStudy is None: +## theStudy = myLocalStudy +## mySO = theStudy.FindObject("MEDFIELD") +## if mySO is None: +## raise Runtime, "getFieldObjectFromStudy mySO is None" +## mysub = mySO.FindSubObject(number)[1] +## if mysub: +## mysubsub = mysub.FindSubObject(subnumber)[1] +## if mysubsub: +## Builder = theStudy.NewBuilder() +## anAttr = Builder.FindOrCreateAttribute(mysubsub, "AttributeIOR") +## obj = myORB.string_to_object(anAttr.Value()) +## myObj = obj._narrow(SALOME_MED.FIELDINT) +## if (myObj == None): +## myObj = obj._narrow(SALOME_MED.FIELDDOUBLE) +## return myObj +## else: +## print "ERROR: No Field Object stored in this Study" +## return None + +def getFieldObjectFromStudy(dt, it, fieldName, supportName, meshName, + theStudy = myLocalStudy): + meshNameStudy = changeBlankToUnderScore(meshName) + if theStudy is None: + theStudy = myLocalStudy + + objNameInStudy = "/Med/MEDFIELD/"+fieldName+"/("+str(dt)+","+str(it)+")_ON_"+supportName+"_OF_"+meshNameStudy + mySO = theStudy.FindObjectByPath(objNameInStudy) + if (mySO == None) : + print "PROBLEM ",objNameInStudy," cannot be found in the Study" + return mySO + else: + anAttr = mySO.FindAttribute("AttributeIOR")[1] + obj = myORB.string_to_object(anAttr.Value()) + myObj = obj._narrow(SALOME_MED.FIELDINT) + if (myObj == None): + myObj = obj._narrow(SALOME_MED.FIELDDOUBLE) + if (myObj == None) : + print "PROBLEM ",objNameInStudy," has been found in the Study but with the wrong type" + return myObj def SObjectToObject(theSObject) : # global myORB @@ -159,7 +236,14 @@ def CreatePrsForMed(theVisu, theFileName, thePrsTypeList, thePictureDir, thePict print "aMedComp.readStructFileWithFieldType...", aMedComp.readStructFileWithFieldType(theFileName,myLocalStudy._get_Name()) - aMedSObj = getMedSObject(myLocalStudy) + print "reading the med file is OK ..." + + # taking the absolute name of theFileName (without the path to it) + decompFileName = split(theFileName,"/") + lenDecomp = len(decompFileName) + absFileName = decompFileName[lenDecomp-1] + + aMedSObj = getMedSObject(absFileName,myLocalStudy) if aMedSObj is None : raise RuntimeError, "Error" else : print "OK" @@ -169,7 +253,7 @@ def CreatePrsForMed(theVisu, theFileName, thePrsTypeList, thePictureDir, thePict else : print "OK" aVISUObjList.append(aResult) aVISUObjList.extend(CreatePrsForResult(theVisu, aResult, myView, thePrsTypeList, thePictureDir, thePictureExt)) - + aFolderIter = myLocalStudy.NewChildIterator(aMedSObj.GetFather()); while aFolderIter.More() : aFolderSObj = aFolderIter.Value() diff --git a/src/VISU_SWIG/visu_big_table.py b/src/VISU_SWIG/visu_big_table.py index 9a3317c4..fb90b2d6 100644 --- a/src/VISU_SWIG/visu_big_table.py +++ b/src/VISU_SWIG/visu_big_table.py @@ -25,7 +25,13 @@ myVisu.SetCurrentStudy(myStudy) if not myComponent: myComponent = myBuilder.NewComponent("VISU") aName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName") - aName.SetValue("Visu") + #aName.SetValue("Visu") + aName.SetValue( salome.sg.getComponentUserName("VISU") ) + + A2 = myBuilder.FindOrCreateAttribute(myComponent, "AttributePixMap"); + aPixmap = A2._narrow(SALOMEDS.AttributePixMap); + aPixmap.SetPixMap( "ICON_OBJBROWSER_Visu" ); + myBuilder.DefineComponentInstance(myComponent,myVisu) # >>> Creating object with Table of real[ 200 * 20 ] ======================== diff --git a/src/VISU_SWIG/visu_med.py b/src/VISU_SWIG/visu_med.py index 46f7bedf..2a5532ae 100644 --- a/src/VISU_SWIG/visu_med.py +++ b/src/VISU_SWIG/visu_med.py @@ -42,7 +42,7 @@ def getFieldObjectFromStudy(number,subnumber): med_comp = salome.lcc.FindOrLoadComponent("FactoryServer", "MED") -medDir = os.getenv('SALOME_ROOT_DIR') + '/data/' +medDir = os.getenv('KERNEL_ROOT_DIR') + '/examples/' def importMedFrom(medDir,medFile): medFile = medDir + medFile diff --git a/src/VISU_SWIG/visu_prs_example.py b/src/VISU_SWIG/visu_prs_example.py index 002ebd10..b23aacb3 100644 --- a/src/VISU_SWIG/visu_prs_example.py +++ b/src/VISU_SWIG/visu_prs_example.py @@ -22,7 +22,8 @@ import visu_gui myVisu = visu_gui.myVisu medFile = "pointe.med" -medFile = os.getenv('SALOME_ROOT_DIR') + '/data/' + medFile +absMedFile = medFile +medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile print medFile studyCurrent = salome.myStudyName @@ -32,34 +33,56 @@ med_comp = salome.lcc.FindOrLoadComponent("FactoryServer", "MED") try: if os.access(medFile, os.R_OK) : - if os.access(medFile, os.W_OK) : - med_comp.readStructFileWithFieldType(medFile,studyCurrent) - med_obj = visu_gui.visu.getMedObjectFromStudy() - print "med_obj - ", med_obj - - myField = visu_gui.visu.getFieldObjectFromStudy(2,1) - aMeshName = "FILED_DOUBLE_MESH" - anEntity = VISU.NODE - aTimeStampId = 0 + print "Reading the .med file ",medFile," and pushing corba objects in the SALOME study" + med_comp.readStructFileWithFieldType(medFile,studyCurrent) + med_obj = visu_gui.visu.getMedObjectFromStudy(absMedFile) + print "med_obj - ", med_obj + + + nbOfMeshes = med_obj.getNumberOfMeshes() + print "in this med file there is(are) ",nbOfMeshes," mesh(es)," + meshNames = med_obj.getMeshNames() + meshName = meshNames[0] + + supportName = "SupportOnAll_MED_NOEUD" + + nbOfFields = med_obj.getNumberOfFields() + print "and ",nbOfFields," field(s)." + fieldNames = med_obj.getFieldNames() + fieldName = fieldNames[1] + nbOfIt = med_obj.getFieldNumberOfIteration(fieldName) + print "the field ",fieldName," has ",nbOfIt," iteration(s)" + dtitsfield = med_obj.getFieldIterations(fieldName) + dtitfield = dtitsfield[0:2] + dt = dtitfield[0] + it = dtitfield[1] + +## myField = visu_gui.visu.getFieldObjectFromStudy(2,1) + # the first iteration of the second field + myField = visu_gui.visu.getFieldObjectFromStudy(dt, it, fieldName, + supportName, + meshName) + aMeshName = "FILED_DOUBLE_MESH" + anEntity = VISU.NODE + aTimeStampId = 0 - myResult1 = myVisu.ImportMedField(myField) - aMesh1 = myVisu.MeshOnEntity(myResult1, aMeshName, anEntity); + myResult1 = myVisu.ImportMedField(myField) + aMesh1 = myVisu.MeshOnEntity(myResult1, aMeshName, anEntity); - aScalarMap1= myVisu.ScalarMapOnField(myResult1, aMeshName, anEntity, myField.getName(), aTimeStampId) - if(myField.getNumberOfComponents() > 1) : - aVectors = myVisu.VectorsOnField(myResult1, aMeshName, anEntity, myField.getName(), aTimeStampId) + aScalarMap1= myVisu.ScalarMapOnField(myResult1, aMeshName, anEntity, myField.getName(), aTimeStampId) + if(myField.getNumberOfComponents() > 1) : + aVectors = myVisu.VectorsOnField(myResult1, aMeshName, anEntity, myField.getName(), aTimeStampId) - myResult2 = myVisu.ImportFile(medFile) - aMeshName = "maa1" - anEntity = VISU.NODE - aMesh2 = myVisu.MeshOnEntity(myResult2, aMeshName, anEntity) + myResult2 = myVisu.ImportFile(medFile) + aMeshName = "maa1" + anEntity = VISU.NODE + aMesh2 = myVisu.MeshOnEntity(myResult2, aMeshName, anEntity) - aScalarMap2 = myVisu.ScalarMapOnField(myResult2, aMeshName, anEntity, myField.getName(), aTimeStampId) - if(myField.getNumberOfComponents() > 1) : - aCutPlanes = myVisu.CutPlanesOnField(myResult2, aMeshName, anEntity, myField.getName(), aTimeStampId) + aScalarMap2 = myVisu.ScalarMapOnField(myResult2, aMeshName, anEntity, myField.getName(), aTimeStampId) + if(myField.getNumberOfComponents() > 1) : + aCutPlanes = myVisu.CutPlanesOnField(myResult2, aMeshName, anEntity, myField.getName(), aTimeStampId) - sg.updateObjBrowser(0) - else : print "We have no permission to rewrite medFile, so readStructFileWithFieldType can't open this file"; + sg.updateObjBrowser(0) else : print "We have no permission to read medFile, it will not be opened"; except: if sys.exc_type == SALOME.SALOME_Exception : diff --git a/src/VISU_SWIG/visu_swig_test.py b/src/VISU_SWIG/visu_swig_test.py index 45a26744..9946faba 100644 --- a/src/VISU_SWIG/visu_swig_test.py +++ b/src/VISU_SWIG/visu_swig_test.py @@ -1,5 +1,5 @@ from libVISU_Swig import * -medFile = os.getenv('SALOME_ROOT_DIR') + '/data/fra.med' +medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/fra.med' myCon=Convertor(medFile) myPrs=ScalarMap(myCon,"LE VOLUME",0,"VITESSE",1) myView=View3D() diff --git a/src/VISU_SWIG/visu_table.py b/src/VISU_SWIG/visu_table.py index 38641bbd..780e698c 100644 --- a/src/VISU_SWIG/visu_table.py +++ b/src/VISU_SWIG/visu_table.py @@ -25,7 +25,13 @@ myVisu.SetCurrentStudy(myStudy) if not myComponent: myComponent = myBuilder.NewComponent("VISU") aName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName") - aName.SetValue("Visu") + #aName.SetValue("Visu") + aName.SetValue( salome.sg.getComponentUserName("VISU") ) + + A2 = myBuilder.FindOrCreateAttribute(myComponent, "AttributePixMap"); + aPixmap = A2._narrow(SALOMEDS.AttributePixMap); + aPixmap.SetPixMap( "ICON_OBJBROWSER_Visu" ); + myBuilder.DefineComponentInstance(myComponent,myVisu) # >>> Creating object with Table of integer ================================== diff --git a/src/VISU_SWIG/visu_view3d.py b/src/VISU_SWIG/visu_view3d.py index 1248289f..8073e354 100644 --- a/src/VISU_SWIG/visu_view3d.py +++ b/src/VISU_SWIG/visu_view3d.py @@ -4,82 +4,265 @@ # # # -# File : visu_view3d.py +# File : batchmode_visu_view3d.py # Module : VISU -import visu_gui import os +import time +import math import VISU import SALOMEDS +from visu_gui import * + +aDelay = 0 + +#mySession = batchmode_visu.mySession + +myViewManager = myVisu.GetViewManager(); + +myView = myViewManager.Create3DView(); +myView.SetTitle("The window will be soon destroyed!") +print "myViewManager.Create3DView()" +time.sleep(aDelay) + +myView.Maximize() +print "myView.Maximize()" +time.sleep(aDelay) + +myView.Restore() +print "myView.Restore()" +time.sleep(aDelay) + +myView.Minimize() +print "myView.Minimize()" +time.sleep(aDelay) + +myViewManager.Destroy(myView) +print "myViewManager.Destroy(myView)" +time.sleep(aDelay) -from libSALOME_Swig import * -sg = SALOMEGUI_Swig() -myVisu = visu_gui.myVisu medFile = "fra.med" myFieldName = "VITESSE"; -medFile = os.getenv('SALOME_ROOT_DIR') + '/data/' + medFile -myResult = myVisu.ImportFile(medFile) - aMeshName ="LE VOLUME" anEntity = VISU.NODE -aMesh = myVisu.MeshOnEntity(myResult, aMeshName, anEntity) - aTimeStampId = 1 -# -aScalarMap = myVisu.ScalarMapOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId) -if aScalarMap is not None: - aScalarMap.SetScaling(VISU.LOGARITHMIC) -else: - print "Null scalar map is created" +medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile +myResult = myVisu.ImportFile(medFile) -# -aCutPlanes = myVisu.CutPlanesOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId) -if aCutPlanes is not None: - aCutPlanes.SetScaling(VISU.LOGARITHMIC) -else: print "Null aCutPlanes is created" -# -aIsoSurfaces = myVisu.IsoSurfacesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId) -if aIsoSurfaces is not None: - aIsoSurfaces.SetScaling(VISU.LINEAR) -else: print "Null aIsoSurfaces is created" -myViewManager = myVisu.GetViewManager(); -#myView = myViewManager.Create3DView(); -myView = myViewManager.GetCurrentView(); +myView = myViewManager.Create3DView(); + +print "myView.SetBackground(...)" +aColor = SALOMEDS.Color(0.0,0.3,1.0) +myView.SetBackground(aColor); + +myView.SetTitle("The viewer will display ScalarMap") +print "myViewManager.Create3DView()" + +aScalarMap = myVisu.ScalarMapOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId) + +myView.Display(aScalarMap); +print "myView.Display(aScalarMap)" myView.SetFocalPoint([0,0,0]); +print "myView.SetFocalPoint(...)" myView.SetParallelScale(2); +print "myView.SetParallelScale(...)" +myView.FitAll(); + +aMax = aScalarMap.GetMax() +aMin = aScalarMap.GetMin() +aDelta = (aMax - aMin)/2.0 +aNbColors = aScalarMap.GetNbColors() +aNbColors = 64 +for i in range(2,aNbColors) : + aScalarMap.SetNbColors(i) + aX = aMin + aDelta*i/aNbColors + aY = aMax - aDelta*i/aNbColors + aScalarMap.SetRange(aX,aY) + myView.Update(); + time.sleep(aDelay) + +aScalarMap.SetRange(aMin,aMax) + +print "myView.Update()" +myView.Update(); +print "myView.FitAll()" +myView.FitAll(); + + + +myView = myViewManager.Create3DView(); +myView.SetTitle("Here we will display CutPlanes") + +print "myView.SetBackground(...)" +aColor = SALOMEDS.Color(0.0,0.7,0.0) +myView.SetBackground(aColor); + +aCutPlanes = myVisu.CutPlanesOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId) +print "myVisu.CutPlanesOnField(...)" + +myView.DisplayOnly(aCutPlanes); +print "myView.DisplayOnly(aCutPlanes)" + aPoint = myView.GetPointOfView(); aPoint[0] = aPoint[0] + 10; myView.SetPointOfView(aPoint); +print "myView.SetPointOfView(...)" myView.ScaleView(VISU.View3D.YAxis,10.0); myView.ScaleView(VISU.View3D.XAxis,3.0); -aColor = SALOMEDS.Color(0.0,0.3,1.0) -myView.SetBackground(aColor); -myView.Update(); -myView.Display(aScalarMap); -#myView.Erase(aScalarMap); -#myView.DisplayOnly(aCutPlanes); +print "myView.ScaleView(...)" +time.sleep(aDelay) + +myView.FitAll(); + +aNbPlanes = aCutPlanes.GetNbPlanes() +aNbPlanes = 30 +aXAngle = aCutPlanes.GetRotateX() +aYAngle = aCutPlanes.GetRotateY() +anOrientation = aCutPlanes.GetOrientationType() +for i in range(aNbPlanes,1,-1) : + aCutPlanes.SetNbPlanes(i) + aX = math.pi/2.0*(aNbPlanes-i)/aNbPlanes + aY = math.pi/2.0*(aNbPlanes-i)/aNbPlanes + aCutPlanes.SetOrientation(anOrientation,aX,aY) + myView.Update(); + time.sleep(aDelay) + +aNbPlanes = 10 +aCutPlanes.SetOrientation(VISU.CutPlanes.ZX,0,0) +for i in range(1,aNbPlanes) : + aCutPlanes.SetNbPlanes(i) + myView.Update(); + time.sleep(aDelay) + myView.SaveViewParams('AAA') +print "myView.SaveViewParams('AAA')" +time.sleep(aDelay) +aCutPlanes.SetOrientation(VISU.CutPlanes.XY,0,0) myView.RemoveScale(); + +print "myView.Update()" +myView.Update(); +print "myView.FitAll()" myView.FitAll(); -aColor = SALOMEDS.Color(0.0,0.0,0.0) + + + +myView = myViewManager.Create3DView(); +print "myViewManager.Create3DView()" + +myView.SetTitle("IsoSurface's viewer") + +print "myView.SetBackground(...)" +aColor = SALOMEDS.Color(1.0,0.7,0.0) myView.SetBackground(aColor); -myView.SaveViewParams('BBB'); +time.sleep(aDelay) + +aIsoSurfaces = myVisu.IsoSurfacesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId) + +myView.DisplayOnly(aIsoSurfaces); +myView.FitAll(); +print "myView.DisplayOnly(aCutPlanes)" +time.sleep(aDelay) -aColor = SALOMEDS.Color(1.0,1.0,1.0) +aNbSurfaces = aIsoSurfaces.GetNbSurfaces() +aNbSurfaces = 32 +for i in range(2,aNbSurfaces) : + aIsoSurfaces.SetNbSurfaces(i) + myView.Update(); + time.sleep(aDelay) + +aIsoSurfaces.SetNbSurfaces(10) + +print "myView.Update()" +myView.Update(); +print "myView.FitAll()" +myView.FitAll(); + + + +myView = myViewManager.Create3DView(); +myView.SetTitle("The viewer for CutLines") +print "myViewManager.Create3DView()" +time.sleep(aDelay) + +print "myView.SetBackground(...)" +aColor = SALOMEDS.Color(0.7,0.7,0.7) myView.SetBackground(aColor); -myView.ScaleView(VISU.View3D.ZAxis,0.5); -myView.SaveViewParams('CCC'); +time.sleep(aDelay) + +aCutLines = myVisu.CutLinesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId) +aCutLines.SetOrientation(VISU.CutPlanes.ZX,0,0) +aCutLines.SetOrientation2(VISU.CutPlanes.YZ,0,0) + +myView.DisplayOnly(aCutLines); +myView.FitAll(); +print "myView.DisplayOnly(aCutLines)" +time.sleep(aDelay) -myView.RestoreViewParams('AAA'); +aSObj = myStudy.FindObjectIOR(aCutLines.GetID()) +aTable = myVisu.CreateTable( aSObj.GetID() ) +print "myVisu.CreateTable(...)" -sg.updateObjBrowser(0) +aTableView = myViewManager.CreateTableView(aTable) +aTableView.SetTitle('Changed Title') +aContainer = myVisu.CreateContainer() +print "myVisu.CreateContainer(...)" + +aNbCurve = aTable.GetNbRows() - 1 +for i in range(2,aNbCurve): + aCurve = myVisu.CreateCurve( aTable, 1, i ) + print i, aCurve + aContainer.AddCurve(aCurve) + + +myView = myViewManager.CreateXYPlot(); +myView.SetTitle("The viewer for Curves from CutLines") +print "myViewManager.CreateXYPlot()" +time.sleep(aDelay) + +myView.Display(aContainer) + + + +myView = myViewManager.Create3DView(); +myView.SetTitle("The viewer for Animation") +print "myViewManager.Create3DView()" +time.sleep(aDelay) + +medFile = "TimeStamps.med" +myFieldName = "vitesse"; + +medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile +myResult = myVisu.ImportFile(medFile) +anAnim = myVisu.CreateAnimation(myView); +aSObj = myStudy.FindObjectIOR(myResult.GetID()) +aSObj = aSObj.FindSubObject(1)[1] +aSObj = aSObj.FindSubObject(2)[1] +aSObj = aSObj.FindSubObject(2)[1] +anAnim.addField(aSObj) +anAnim.setPresentationType(0,VISU.TISOSURFACE) +print "Generate presentations" +anAnim.generatePresentations(0) +print "Generate frames" +anAnim.generateFrames() +print "Start Animation" +anAnim.setSpeed(99) +#anAnim.setCycling(1) +anAnim.startAnimation() +myView.FitAll() +while 1: + time.sleep(1+aDelay) + if not anAnim.isRunning(): + anAnim.stopAnimation() + break +#anAnim.clearView()