From fd4c6604cefb559d3cc1000e324a7107a15280a0 Mon Sep 17 00:00:00 2001 From: abd Date: Thu, 19 Oct 2006 06:53:29 +0000 Subject: [PATCH] First stable version after merging with V3_2_2 --- Makefile.in | 10 +- adm_local/unix/make_commence.in | 2 + configure.in.base | 10 +- doc/salome/gui/VISU/files/creating_curves.htm | 78 +++-- .../files/setting_properties_of_xy_plots.htm | 7 +- doc/salome/gui/VISU/pics/createcurves.png | Bin 0 -> 15112 bytes doc/salome/gui/VISU/visu.log | 2 +- doc/salome/gui/VISU/whcsh_home.htm | 2 +- doc/salome/gui/VISU/whdata/whfts.htm | 2 +- doc/salome/gui/VISU/whdata/whtdata0.htm | 3 +- doc/salome/gui/VISU/whfform.htm | 2 +- doc/salome/gui/VISU/whiform.htm | 2 +- doc/salome/gui/VISU/whnjs.htm | 2 +- doc/salome/gui/VISU/whres.xml | 2 +- doc/salome/gui/VISU/whskin_info.htm | 2 +- doc/salome/gui/VISU/whskin_pickup.htm | 2 +- doc/salome/gui/VISU/whstart.js | 2 +- doc/salome/gui/VISU/whtdhtml.htm | 2 +- doc/salome/gui/VISU/whtopic.js | 2 +- doc/salome/gui/VISU/whxdata/whtdata0.xml | 3 +- doc/salome/tui/Makefile.in | 2 +- idl/VISU_Gen.idl | 10 + resources/SalomeApp.xml | 14 +- src/CONVERTOR/VISU_Convertor_impl.cxx | 29 +- src/CONVERTOR/VISU_Convertor_impl.hxx | 3 +- src/CONVERTOR/VISU_MedConvertor.cxx | 264 +++++++++++---- src/ENGINE/VISU_Engine_i.cc | 8 + src/ENGINE/VISU_Engine_i.hh | 1 + src/GUITOOLS/VisuGUI_TableDlg.cxx | 16 + src/GUITOOLS/VisuGUI_TableDlg.h | 3 + src/PIPELINE/Makefile.in | 2 +- src/PIPELINE/VISUPipeLine.cxx | 126 ++++--- src/PIPELINE/VISU_CutLinesPL.cxx | 6 +- src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx | 113 +++++-- .../VISU_ScalarMapOnDeformedShapePL.cxx | 24 +- src/VISUGUI/VISU_msg_en.po | 3 + src/VISUGUI/VisuGUI.cxx | 16 +- src/VISUGUI/VisuGUI_BuildProgressDlg.cxx | 13 + src/VISUGUI/VisuGUI_BuildProgressDlg.h | 3 + src/VISUGUI/VisuGUI_ClippingDlg.cxx | 23 +- src/VISUGUI/VisuGUI_ClippingDlg.h | 3 + src/VISUGUI/VisuGUI_CursorDlg.cxx | 17 + src/VISUGUI/VisuGUI_CursorDlg.h | 3 + src/VISUGUI/VisuGUI_CutLinesDlg.cxx | 13 + src/VISUGUI/VisuGUI_CutLinesDlg.h | 3 + src/VISUGUI/VisuGUI_CutPlanesDlg.cxx | 17 +- src/VISUGUI/VisuGUI_CutPlanesDlg.h | 3 + src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx | 13 + src/VISUGUI/VisuGUI_DeformedShapeDlg.h | 3 + src/VISUGUI/VisuGUI_EditContainerDlg.cxx | 13 + src/VISUGUI/VisuGUI_EditContainerDlg.h | 3 + src/VISUGUI/VisuGUI_GaussPointsDlg.cxx | 13 + src/VISUGUI/VisuGUI_GaussPointsDlg.h | 3 + src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx | 13 + src/VISUGUI/VisuGUI_IsoSurfacesDlg.h | 3 + src/VISUGUI/VisuGUI_NameDlg.cxx | 13 + src/VISUGUI/VisuGUI_NameDlg.h | 3 + src/VISUGUI/VisuGUI_OffsetDlg.cxx | 13 + src/VISUGUI/VisuGUI_OffsetDlg.h | 3 + src/VISUGUI/VisuGUI_Plot3DDlg.cxx | 34 +- src/VISUGUI/VisuGUI_Plot3DDlg.h | 3 + src/VISUGUI/VisuGUI_Prs3dTools.h | 3 +- src/VISUGUI/VisuGUI_ScalarBarDlg.cxx | 34 +- src/VISUGUI/VisuGUI_ScalarBarDlg.h | 6 + .../VisuGUI_ScalarMapOnDeformedShapeDlg.cxx | 31 +- .../VisuGUI_ScalarMapOnDeformedShapeDlg.h | 7 +- src/VISUGUI/VisuGUI_Selection.cxx | 22 +- src/VISUGUI/VisuGUI_Selection.h | 3 + src/VISUGUI/VisuGUI_SetupPlot2dDlg.cxx | 119 +++++-- src/VISUGUI/VisuGUI_SetupPlot2dDlg.h | 10 +- src/VISUGUI/VisuGUI_StreamLinesDlg.cxx | 13 + src/VISUGUI/VisuGUI_StreamLinesDlg.h | 3 + src/VISUGUI/VisuGUI_TimeAnimation.cxx | 40 ++- src/VISUGUI/VisuGUI_TimeAnimation.h | 1 + src/VISUGUI/VisuGUI_Tools.cxx | 5 +- src/VISUGUI/VisuGUI_TransparencyDlg.cxx | 17 + src/VISUGUI/VisuGUI_TransparencyDlg.h | 3 + src/VISUGUI/VisuGUI_VectorsDlg.cxx | 13 + src/VISUGUI/VisuGUI_VectorsDlg.h | 4 + src/VISU_I/VISU_DeformedShape_i.cc | 12 +- src/VISU_I/VISU_DeformedShape_i.hh | 4 + src/VISU_I/VISU_DumpPython.cc | 22 +- src/VISU_I/VISU_GaussPoints_i.cc | 4 +- src/VISU_I/VISU_Gen_i.cc | 132 ++++++-- src/VISU_I/VISU_Gen_i.hh | 6 + src/VISU_I/VISU_Mesh_i.cc | 22 +- src/VISU_I/VISU_Prs3d_i.cc | 101 ++++-- src/VISU_I/VISU_Result_i.cc | 101 +++--- src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc | 2 +- src/VISU_I/VISU_ScalarMap_i.cc | 11 +- src/VISU_I/VISU_ScalarMap_i.hh | 4 + src/VISU_I/VISU_StreamLines_i.cc | 2 +- src/VISU_I/VISU_Table_i.cc | 56 +++- src/VISU_I/VISU_Table_i.hh | 7 +- src/VISU_I/VISU_TimeAnimation.cxx | 315 ++++++------------ src/VISU_I/VISU_Vectors_i.cc | 2 + src/VISU_I/VISU_ViewManager_i.cc | 10 +- src/VISU_I/VISU_View_i.cc | 11 +- src/VISU_I/VISU_View_i.hh | 2 +- src/VISU_SWIG/Makefile.in | 2 +- src/VISU_SWIG/libVISU_Swig.i | 24 +- src/VISU_SWIG/visu.py | 2 +- src/VVTK/VVTK_MainWindow.cxx | 10 +- src/VVTK/VVTK_PickingDlg.cxx | 13 + src/VVTK/VVTK_PickingDlg.h | 1 + src/VVTK/VVTK_PrimitiveBox.cxx | 6 +- src/VVTK/VVTK_RecorderDlg.cxx | 13 + src/VVTK/VVTK_RecorderDlg.h | 3 + src/VVTK/VVTK_SegmentationCursorDlg.cxx | 21 +- src/VVTK/VVTK_SegmentationCursorDlg.h | 2 + src/VVTK/VVTK_ViewWindow.cxx | 28 +- src/VVTK/VVTK_ViewWindow.h | 10 + 112 files changed, 1607 insertions(+), 696 deletions(-) create mode 100755 doc/salome/gui/VISU/pics/createcurves.png diff --git a/Makefile.in b/Makefile.in index 4331fa8b..ac80cb95 100644 --- a/Makefile.in +++ b/Makefile.in @@ -81,9 +81,9 @@ depend: depend_idl depend_idl: (cd idl ; $(MAKE) $@) || exit 1 -resources: share/salome/resources/VISUCatalog.xml +resources: share/salome/resources/visu/VISUCatalog.xml -share/salome/resources/VISUCatalog.xml: VISUCatalog.xml +share/salome/resources/visu/VISUCatalog.xml: VISUCatalog.xml cp $< $@ # doc is already build : if you want to had documents, go manually to doc and run 'make doc' @@ -128,6 +128,6 @@ install: install-bin install-include install-end install-resources: install-catalog -install-catalog: share/salome/resources/VISUCatalog.xml - $(INSTALL) -d $(datadir)/resources - $(INSTALL_DATA) $< $(datadir)/resources/. +install-catalog: share/salome/resources/visu/VISUCatalog.xml + $(INSTALL) -d $(datadir)/resources/visu + $(INSTALL_DATA) $< $(datadir)/resources/visu/. diff --git a/adm_local/unix/make_commence.in b/adm_local/unix/make_commence.in index ed0e9c45..bba7766f 100644 --- a/adm_local/unix/make_commence.in +++ b/adm_local/unix/make_commence.in @@ -1,6 +1,8 @@ # common directories to put headerfiles inc_builddir=$(top_builddir)/include/salome +MODULE_NAME=@MODULE_NAME@ + @SET_MAKE@ SHELL=/bin/sh diff --git a/configure.in.base b/configure.in.base index a0717524..b96d47bb 100644 --- a/configure.in.base +++ b/configure.in.base @@ -22,11 +22,15 @@ AC_CANONICAL_HOST PACKAGE=salome AC_SUBST(PACKAGE) -VERSION=3.2.0 -XVERSION=0x030200 +VERSION=3.2.2 +XVERSION=0x030202 AC_SUBST(VERSION) AC_SUBST(XVERSION) +# set up MODULE_NAME variable for dynamic construction of directories (resources, etc.) +MODULE_NAME=visu +AC_SUBST(MODULE_NAME) + dnl dnl Initialize source and build root directories dnl @@ -343,7 +347,7 @@ else fi # make other build directories -for rep in salome_adm adm_local doc bin/salome include/salome lib${LIB_LOCATION_SUFFIX}/salome share/salome/resources idl +for rep in salome_adm adm_local doc bin/salome include/salome lib${LIB_LOCATION_SUFFIX}/salome share/salome/resources/${MODULE_NAME} idl do # if test ! -d $rep ; then # eval mkdir $rep diff --git a/doc/salome/gui/VISU/files/creating_curves.htm b/doc/salome/gui/VISU/files/creating_curves.htm index f77c33b1..b75af456 100755 --- a/doc/salome/gui/VISU/files/creating_curves.htm +++ b/doc/salome/gui/VISU/files/creating_curves.htm @@ -19,26 +19,27 @@ p.whs2 { font-family:'Times New Roman' , serif; } img_whs3 { border:none; width:30px; height:30px; float:none; border-style:none; } p.whs4 { font-family:'Times New Roman' , serif; margin-left:40px; color:#000000; font-style:normal; } p.whs5 { font-family:'Times New Roman' , serif; font-style:italic; color:#ff0000; margin-left:40px; } -img_whs6 { border:none; width:585px; height:241px; float:none; border-style:none; } -p.whs7 { font-family:'Times New Roman' , serif; margin-left:40px; } +img_whs6 { border:none; width:705px; height:209px; float:none; } +p.whs7 { margin-left:36px; } ul.whs8 { list-style:disc; } -p.whs9 { font-family:'Times New Roman' , serif; margin-left:0px; font-weight:normal; } +p.whs9 { font-family:'Times New Roman' , serif; margin-left:40px; } p.whs10 { font-weight:bold; margin-left:40px; } p.whs11 { font-weight:bold; margin-left:38px; } p.whs12 { font-family:'Times New Roman' , serif; margin-left:0px; background-image:url('../texture_horiz_ltbluebubbles.jpg'); } img_whs13 { border:none; float:none; width:36px; height:38px; border-style:none; } -p.whs14 { margin-left:80px; } -p.whs15 { font-family:'Times New Roman' , serif; margin-left:40px; font-weight:bold; } -p.whs16 { font-family:'Times New Roman' , serif; margin-left:0px; } +p.whs14 { font-family:'Times New Roman' , serif; margin-left:0px; font-weight:normal; } +p.whs15 { margin-left:80px; } +p.whs16 { font-family:'Times New Roman' , serif; margin-left:40px; font-weight:bold; } +p.whs17 { font-family:'Times New Roman' , serif; margin-left:0px; } --> - \ No newline at end of file + diff --git a/doc/salome/gui/VISU/whdata/whfts.htm b/doc/salome/gui/VISU/whdata/whfts.htm index 78cf6e3e..15fe687b 100755 --- a/doc/salome/gui/VISU/whdata/whfts.htm +++ b/doc/salome/gui/VISU/whdata/whfts.htm @@ -15,4 +15,4 @@ iTM(0,40,"whftdata0.htm"); //--> - \ No newline at end of file + diff --git a/doc/salome/gui/VISU/whdata/whtdata0.htm b/doc/salome/gui/VISU/whdata/whtdata0.htm index 827fe63c..03b69286 100755 --- a/doc/salome/gui/VISU/whdata/whtdata0.htm +++ b/doc/salome/gui/VISU/whdata/whtdata0.htm @@ -54,8 +54,7 @@ aTE(2,0,"Creating XY plots","files/creating_xy_plot.htm"); aTE(2,0,"Plot2D Viewer","plot2d_viewer.htm"); aTE(2,0,"Setting properties of XY plots","files/setting_properties_of_xy_plots.htm"); - aTE(2,0,"Access to Post-Pro module functionality from Python (using VISU_Gen.idl)","visugenidl_doc/VISU__Gen_8idl.html"); - +aTE(2,0,"Access to Post-Pro module functionality from Python (using VISU_Gen.idl)","visugenidl_doc/VISU__Gen_8idl.html"); //--> diff --git a/doc/salome/gui/VISU/whfform.htm b/doc/salome/gui/VISU/whfform.htm index e01bedde..0f8f90ab 100755 --- a/doc/salome/gui/VISU/whfform.htm +++ b/doc/salome/gui/VISU/whfform.htm @@ -133,4 +133,4 @@ else //--> - \ No newline at end of file + diff --git a/doc/salome/gui/VISU/whiform.htm b/doc/salome/gui/VISU/whiform.htm index ad886218..d412744b 100755 --- a/doc/salome/gui/VISU/whiform.htm +++ b/doc/salome/gui/VISU/whiform.htm @@ -88,4 +88,4 @@ else //--> - \ No newline at end of file + diff --git a/doc/salome/gui/VISU/whnjs.htm b/doc/salome/gui/VISU/whnjs.htm index bb3ef3ef..41c48172 100755 --- a/doc/salome/gui/VISU/whnjs.htm +++ b/doc/salome/gui/VISU/whnjs.htm @@ -22,4 +22,4 @@ window.onload=window_Onload; <p>Your browser does not support frames. We recommend that you update your browser to a version that supports frames.</p><p>To view the Help system without frames click on this<a href="whgdata/whnvp30.htm">hyperlink.</a></p> - \ No newline at end of file + diff --git a/doc/salome/gui/VISU/whres.xml b/doc/salome/gui/VISU/whres.xml index b79fae01..1d279bbc 100755 --- a/doc/salome/gui/VISU/whres.xml +++ b/doc/salome/gui/VISU/whres.xml @@ -253,4 +253,4 @@ - \ No newline at end of file + diff --git a/doc/salome/gui/VISU/whskin_info.htm b/doc/salome/gui/VISU/whskin_info.htm index 11f124b8..ac47c252 100755 --- a/doc/salome/gui/VISU/whskin_info.htm +++ b/doc/salome/gui/VISU/whskin_info.htm @@ -17,4 +17,4 @@ Authoring Tool Name RoboHelp X5 - \ No newline at end of file + diff --git a/doc/salome/gui/VISU/whskin_pickup.htm b/doc/salome/gui/VISU/whskin_pickup.htm index d06481fc..c3469d79 100755 --- a/doc/salome/gui/VISU/whskin_pickup.htm +++ b/doc/salome/gui/VISU/whskin_pickup.htm @@ -226,4 +226,4 @@ writeStyle(); - \ No newline at end of file + diff --git a/doc/salome/gui/VISU/whstart.js b/doc/salome/gui/VISU/whstart.js index 6fa36cda..08b4b82b 100755 --- a/doc/salome/gui/VISU/whstart.js +++ b/doc/salome/gui/VISU/whstart.js @@ -429,4 +429,4 @@ function isAPane(sPaneName) return true; else return false; -} \ No newline at end of file +} diff --git a/doc/salome/gui/VISU/whtdhtml.htm b/doc/salome/gui/VISU/whtdhtml.htm index 5c1b6d72..e94f97f2 100755 --- a/doc/salome/gui/VISU/whtdhtml.htm +++ b/doc/salome/gui/VISU/whtdhtml.htm @@ -46,4 +46,4 @@ TocInitPage(); //--> - \ No newline at end of file + diff --git a/doc/salome/gui/VISU/whtopic.js b/doc/salome/gui/VISU/whtopic.js index e9d9cd19..52198a57 100755 --- a/doc/salome/gui/VISU/whtopic.js +++ b/doc/salome/gui/VISU/whtopic.js @@ -722,4 +722,4 @@ setButtonFont("hide","","","","","",""); gbWhTopic=true; } else - document.location.reload(); \ No newline at end of file + document.location.reload(); diff --git a/doc/salome/gui/VISU/whxdata/whtdata0.xml b/doc/salome/gui/VISU/whxdata/whtdata0.xml index 5af34615..4e9b495d 100755 --- a/doc/salome/gui/VISU/whxdata/whtdata0.xml +++ b/doc/salome/gui/VISU/whxdata/whtdata0.xml @@ -52,7 +52,8 @@ - + + diff --git a/doc/salome/tui/Makefile.in b/doc/salome/tui/Makefile.in index 286f83a6..712af448 100644 --- a/doc/salome/tui/Makefile.in +++ b/doc/salome/tui/Makefile.in @@ -31,7 +31,7 @@ doxygen=@DOXYGEN@ @COMMENCE@ -usr_docs: +dev_docs: cp -fr $(srcdir)/VISU ./INPUT; \ cp -fr ./VISU/doxyfile ./INPUT; \ cp -fr ./VISU/sources/static/tree.js ./INPUT/sources/static; \ diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index 4bb0aece..2f1d27f9 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -1594,6 +1594,16 @@ module VISU { * \param VRow Index of the row in the table: ordinate of the point. */ Curve CreateCurve(in Table theTable, in long theHRow, in long theVRow); + + /*! + * Creates a curve on the basis of points, whose values are taken from the table. + * Each point has also assigned value, that will be shown as tooltip in Plot2d + * \param theTable Table containing the data for construction of curves. + * \param HRow Index of the row in the table: abscissa of the point. + * \param VRow Index of the row in the table: ordinate of the point. + * \param ZRow Index of the row in the table: assigned value (so-called as Z). + */ + Curve CreateCurveWithZ( in Table theTable, in long theHRow, in long theVRow, in long theZRow ); /*! * Creates a presentation form containing an array of references to the curves. diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml index adf42a07..ca9b14e8 100644 --- a/resources/SalomeApp.xml +++ b/resources/SalomeApp.xml @@ -59,8 +59,8 @@ - - + + @@ -72,8 +72,8 @@ - - + + @@ -83,8 +83,8 @@ - - + + @@ -112,6 +112,6 @@
- +
diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index da1bdf3a..88d0bd9f 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -399,7 +399,7 @@ namespace VISU ::GetVTKOutput() { if(!myFilter.GetPointer()){ - const TVTKAppendFilter& anAppendFilter = myIDMapper.GetFilter(); + const TVTKAppendFilter& anAppendFilter = myIDMapper->GetFilter(); TVTKOutput* aGeometry = anAppendFilter->GetOutput(); const TVTKSource& aSource = mySource.GetSource(); @@ -419,42 +419,42 @@ namespace VISU TIDMapperFilter ::GetNodeObjID(vtkIdType theID) const { - return myIDMapper.GetNodeObjID(theID); + return myIDMapper->GetNodeObjID(theID); } vtkIdType TIDMapperFilter ::GetNodeVTKID(vtkIdType theID) const { - return myIDMapper.GetNodeVTKID(theID); + return myIDMapper->GetNodeVTKID(theID); } vtkFloatingPointType* TIDMapperFilter ::GetNodeCoord(vtkIdType theObjID) { - return myIDMapper.GetNodeCoord(theObjID); + return myIDMapper->GetNodeCoord(theObjID); } vtkIdType TIDMapperFilter ::GetElemObjID(vtkIdType theID) const { - return myIDMapper.GetElemObjID(theID); + return myIDMapper->GetElemObjID(theID); } vtkIdType TIDMapperFilter ::GetElemVTKID(vtkIdType theID) const { - return myIDMapper.GetElemVTKID(theID); + return myIDMapper->GetElemVTKID(theID); } vtkCell* TIDMapperFilter ::GetElemCell(vtkIdType theObjID) { - return myIDMapper.GetElemCell(theObjID); + return myIDMapper->GetElemCell(theObjID); } @@ -1108,7 +1108,9 @@ namespace int aMeshDimension = theMesh->myDim; bool anIsDimPresent[3] = {false, false, false}; for(int iDim = 0; iDim < aMeshDimension; iDim++){ - const std::string& aName = aCoords.GetName(iDim); + std::string aName = aCoords.GetName(iDim); + if ( aName.size() > 1 ) // PAL13021 (PAL12148), aName has size 8 or 16 + aName = aName.substr(0,1); if(aName == "x" || aName == "X") anIsDimPresent[eX] = true; else if(aName == "y" || aName == "Y") @@ -1276,9 +1278,9 @@ namespace vtkIdType anID = *aSubMeshIDIter; PrintCells(i,aConnectivity,anArray[anID]); aCellTypesArray->SetValue(j++,(unsigned char)aVGeom); - - anElemObj2VTKID[anID] = i; - aMeshID[i] = anID; + vtkIdType anObjID = aSubMesh.GetElemObjID(anID); + anElemObj2VTKID[anObjID] = i; + aMeshID[i] = anObjID; } } vtkIdType *pts = 0, npts = 0; @@ -2024,7 +2026,7 @@ VISU_Convertor_impl TFamilyArr& aFamilyArr = aGroup->myFamilyArr; aFamilyArr.resize(aFamilySet.size()); - for(vtkIdType anID = 0; anIter != aFamilySet.end(); anIter++){ + for(vtkIdType anID = 0; anIter != aFamilySet.end(); anIter++, anID++){ PFamilyImpl aFamily = *anIter; const std::string& aFamilyName = aFamily->myName; const VISU::TEntity& anEntity = aFamily->myEntity; @@ -2033,9 +2035,10 @@ VISU_Convertor_impl VISU::TVTKOutput* anOutput = anIDMapper->GetVTKOutput(); anAppendFilter->AddInput(anOutput); + vtkIdType aStartID = anElemObj2VTKID.size(); vtkIdType aNbCells = anOutput->GetNumberOfCells(); for(vtkIdType aCellID = 0; aCellID < aNbCells; aCellID++){ - anElemObj2VTKID[aFamily->GetElemObjID(aCellID)] = aCellID; + anElemObj2VTKID[aFamily->GetElemObjID(aCellID)] = aStartID + aCellID; } aFamilyArr[anID] = aFamily; } diff --git a/src/CONVERTOR/VISU_Convertor_impl.hxx b/src/CONVERTOR/VISU_Convertor_impl.hxx index ee102713..578f4a36 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.hxx +++ b/src/CONVERTOR/VISU_Convertor_impl.hxx @@ -165,6 +165,7 @@ namespace VISU TVTKOutput* GetVTKOutput(); }; + typedef SharedPtr PAppendFilter; //--------------------------------------------------------------- @@ -387,7 +388,7 @@ namespace VISU //! Specialize TIDMapper to provide VTK mapping for MED TIMESTAMP mesh struct VISU_CONVERTOR_EXPORT TIDMapperFilter: virtual TMergeFilter { - TAppendFilter myIDMapper; //!< Responsible for numbering + PAppendFilter myIDMapper; //!< Responsible for numbering TSource mySource; //!< Keeps assigned data //! Reimplement the TIDMapper::GetNodeObjID diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index f8321d71..d1658e32 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -17,7 +17,7 @@ // 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_MedConvertor.cxx @@ -34,7 +34,17 @@ #include "MED_GaussUtils.hxx" #include "MED_Utilities.hxx" +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#define NO_CAS_CATCH +#endif + +#include + +#ifdef NO_CAS_CATCH +#include +#else #include "CASCatch.hxx" +#endif #include @@ -61,8 +71,8 @@ static int MY_GROUP_DEBUG = 0; #define _LOAD_FAMILIES_ #define _EDF_NODE_IDS_ -namespace VISU -{ +//namespace +//{ //--------------------------------------------------------------- vtkIdType MEDGeom2NbNodes(MED::EGeometrieElement theMEDGeomType) @@ -410,6 +420,8 @@ namespace VISU "; aNbCells = "<myNbCells<< "; aCellsSize = "<myCellsSize<< endl); + + //break; } } @@ -645,7 +657,7 @@ namespace VISU aMeshOnEntity->myEntity = aVEntity; aMeshOnEntity->myMeshName = aMeshName; aMeshOnEntity->myGeom2Size = aGeom2Size; -// TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize; + TFamilyID2CellsSize& aFamilyID2CellsSize = aMeshOnEntity->myFamilyID2CellsSize; INITMSG(MYDEBUG, "- aMEntity = "<myNbCells = theGrilleInfo->GetNbNodes(); aMeshOnEntity->myCellsSize = 2*theGrilleInfo->GetNbNodes(); - // must be implemented (shadow point for GRILLE STANDARD,CARTESIAN,...) -// for(TInt iElem = 0; iElem < theMesh->myNbPoints; iElem++){ -// TInt aFamId = theNodeInfo->GetFamNum(iElem); -// if(aFamId != 0) -// aFamilyID2CellsSize[aFamId] += 2; -// } + if((theGrilleInfo->myFamNumNode).size() > 0) + for(TInt iElem = 0; iElem < theGrilleInfo->GetNbNodes(); iElem++){ + TInt aFamId = theGrilleInfo->GetFamNumNode(iElem); + if(aFamId != 0) + aFamilyID2CellsSize[aFamId] += 2; + } INITMSG(MYDEBUG, "- myNbCells = "<myNbCells<< @@ -687,11 +699,12 @@ namespace VISU "; myCellsSize = "<myCellsSize<< endl); -// for(TInt iElem = 0; iElem < aNbElem; iElem++){ -// TInt aFamId = aCellInfo->GetFamNum(iElem); -// if(aFamId != 0) -// aFamilyID2CellsSize[aFamId] += aVNbNodes + 1; -// } + if((theGrilleInfo->myFamNum).size() > 0) + for(TInt iElem = 0; iElem < aNbElem; iElem++){ + TInt aFamId = theGrilleInfo->GetFamNum(iElem); + if(aFamId != 0) + aFamilyID2CellsSize[aFamId] += aVNbNodes + 1; + } } } @@ -856,6 +869,74 @@ namespace VISU } } + + /*! + * Build grille family map + */ + void + BuildGrilleFamilyMap(PMEDMesh theMesh, + const MED::TEntityInfo& theEntityInfo, + const MED::TFamilyInfoSet& theFamilyInfoSet, + MED::PWrapper theMEDWrapper) + { + TTimerLog aTimerLog(MYDEBUG,"BuildGrilleFamilyMap"); + INITMSG(MYDEBUG,"BuildGrilleFamilyMap\n"); + + TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap; + + MED::TEntityInfo::const_iterator aEntityIter = theEntityInfo.begin(); + + const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo; + MED::PGrilleInfo aGrilleInfo = theMEDWrapper->GetPGrilleInfo(aMeshInfo); + + const MED::TFamilyID2NbCells& aFam2NbCells = MED::GetFamilyID2NbCells(aGrilleInfo); + + MED::TFamilyInfoSet::const_iterator aFamInter = theFamilyInfoSet.begin(); + for(;aFamInter != theFamilyInfoSet.end();aFamInter++){ + TInt anId = (*aFamInter)->GetId(); + + if(anId == 0) + continue; + + std::string aFamilyName = (*aFamInter)->GetName(); + const MED::EEntiteMaillage& aMEntity = MED::GetEntityByFamilyId(aGrilleInfo, + anId); + TEntity aVEntity = MEDEntityToVTK(aMEntity); + + PMEDMeshOnEntity aMeshOnEntity; + TMeshOnEntityMap::iterator aMeshOnEntityIter = aMeshOnEntityMap.find(aVEntity); + if(aMeshOnEntityIter != aMeshOnEntityMap.end()) + aMeshOnEntity = aMeshOnEntityIter->second; + + TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap; + + PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily()); + aFamily->myId = anId; + aFamily->myEntity = aVEntity; + aFamily->myName = aFamilyName; + aFamily->myNbCells = 0; + aFamily->myCellsSize = 0; + + TFamilyID2CellsSize::iterator aFamilyid2CellsSizeIter = (aMeshOnEntity->myFamilyID2CellsSize).find(anId); + if(aFamilyid2CellsSizeIter != (aMeshOnEntity->myFamilyID2CellsSize).end()) + aFamily->myCellsSize = aFamilyid2CellsSizeIter->second; + MED::TFamilyID2NbCells::const_iterator aFam2NbCellsIter = aFam2NbCells.find(anId); + if(aFam2NbCellsIter != aFam2NbCells.end()) + aFamily->myNbCells = aFam2NbCellsIter->second; + + INITMSG(MY_FAMILY_DEBUG, + "- aFamilyName =|"<myName<<"|" + << "; myId = "<myId + << "; aNbAttr = "<<(*aFamInter)->GetNbAttr() + << "; aNbGroup = "<<(*aFamInter)->GetNbGroup() + << "; aVEntity = "<GetMessageString()); }catch(std::exception& exc){ MSG(MYDEBUG,"Follow exception was occured in:\n"<GetMessageString()); - } +#else + }catch(std::exception& exc){ + MSG(MYDEBUG,"Follow exception was occured in:\n"<GetMessageString()); + } +#endif #endif } for(TInt iComp = 0; iComp <= aNbComp; iComp++){ @@ -1469,6 +1566,8 @@ VISU_MedConvertor INITMSG(MYDEBUG,"aMeshName = '"<GetType(); + MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo); MED::TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo = @@ -1479,11 +1578,17 @@ VISU_MedConvertor #endif MED::TFamilyInfoSet aFamilyInfoSet = MED::GetFamilyInfoSet(aMed,aMeshInfo); - BuildFamilyMap(aMesh, - anEntityInfo, - anEntity2TGeom2ElemInfo, - aFamilyInfoSet, - aMed); + if(aType == MED::eNON_STRUCTURE) + BuildFamilyMap(aMesh, + anEntityInfo, + anEntity2TGeom2ElemInfo, + aFamilyInfoSet, + aMed); + else + BuildGrilleFamilyMap(aMesh, + anEntityInfo, + aFamilyInfoSet, + aMed); BuildGroupMap(aMesh, aFamilyInfoSet); @@ -1491,7 +1596,7 @@ VISU_MedConvertor }catch(std::exception& exc){ MSG(MYDEBUG,"Follow exception was occured in:\n"<myIsDone = true; @@ -1745,16 +1851,33 @@ VISU_MedConvertor if(theFamily->myIsDone) return 0; + const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo; + MED::EMaillage aType = aMeshInfo->GetType(); + //Main part of code - MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo); - TInt aNbElem = aNodeInfo->GetNbElem(); - - if(aNbElem > 0){ - TInt anId = theFamily->myId; - TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1]; - for(TInt iElem = 0; iElem < aNbElem; iElem++) - if(aNodeInfo->GetFamNum(iElem) == anId) - aSubMeshID.push_back(iElem); + if(aType==MED::eNON_STRUCTURE){ + MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo); + TInt aNbElem = aNodeInfo->GetNbElem(); + + if(aNbElem > 0){ + TInt anId = theFamily->myId; + TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1]; + for(TInt iElem = 0; iElem < aNbElem; iElem++) + if(aNodeInfo->GetFamNum(iElem) == anId) + aSubMeshID.push_back(iElem); + } + } + else { + MED::PGrilleInfo aGrilleInfo = theMed->GetPGrilleInfo(aMeshInfo); + TInt aNbElem = aGrilleInfo->GetNbNodes(); + + if(aNbElem > 0){ + TInt anId = theFamily->myId; + TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1]; + for(TInt iElem = 0; iElem < aNbElem; iElem++) + if(aGrilleInfo->GetFamNumNode(iElem) == anId) + aSubMeshID.push_back(iElem); + } } theFamily->myIsDone = true; @@ -2146,35 +2269,54 @@ VISU_MedConvertor const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo; TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID; + MED::EMaillage aType = aMeshInfo->GetType(); const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size; MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin(); for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){ const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first; - MED::PElemInfo anElemInfo; - switch(aMGeom){ - case MED::ePOLYGONE: { - anElemInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom); - break; - } - case MED::ePOLYEDRE: { - anElemInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom); - break; - } - default: { - anElemInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom); - break; - }} - if(anElemInfo){ - if(TInt aNbElem = anElemInfo->GetNbElem()){ - TSubMeshID aSubMeshID; - for(TInt iElem = 0; iElem < aNbElem; iElem++) - if(anElemInfo->GetFamNum(iElem) == anId) - aSubMeshID.push_back(iElem); - if(!aSubMeshID.empty()){ - VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom); - INITMSG(MYDEBUG,"aMGeom = "<GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom); + break; + } + case MED::ePOLYEDRE: { + anElemInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom); + break; + } + default: { + anElemInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom); + break; + }} + if(anElemInfo){ + if(TInt aNbElem = anElemInfo->GetNbElem()){ + TSubMeshID aSubMeshID; + for(TInt iElem = 0; iElem < aNbElem; iElem++) + if(anElemInfo->GetFamNum(iElem) == anId) + aSubMeshID.push_back(iElem); + if(!aSubMeshID.empty()){ + VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom); + INITMSG(MYDEBUG,"aMGeom = "<GetPGrilleInfo(aMeshInfo); + if(anElemInfo){ + TInt aNbElem = anElemInfo->GetNbCells(); + if(aNbElem>0 && (aMGeom == anElemInfo->GetGeom()) ){ + TSubMeshID aSubMeshID; + for(TInt iElem = 0; iElem < aNbElem; iElem++) + if(anElemInfo->GetFamNum(iElem) == anId) + aSubMeshID.push_back(iElem); + if(!aSubMeshID.empty()){ + VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom); + INITMSG(MYDEBUG,"aMGeom = "<CreateCurve(theTable,theHRow,theVRow); } + Curve_ptr VISU_Gen_i::CreateCurveWithZ(Table_ptr theTable, + CORBA::Long theHRow, + CORBA::Long theVRow, + CORBA::Long theZRow) + { + return myVisuGen->CreateCurveWithZ(theTable,theHRow,theVRow,theZRow); + } + Container_ptr VISU_Gen_i::CreateContainer(){ return myVisuGen->CreateContainer(); diff --git a/src/ENGINE/VISU_Engine_i.hh b/src/ENGINE/VISU_Engine_i.hh index 223a5996..3f605b43 100644 --- a/src/ENGINE/VISU_Engine_i.hh +++ b/src/ENGINE/VISU_Engine_i.hh @@ -108,6 +108,7 @@ namespace VISU{ //Create Digital Presentation virtual Table_ptr CreateTable(const char* theTableEntry); virtual Curve_ptr CreateCurve(Table_ptr theTable, CORBA::Long theHRow, CORBA::Long theVRow); + virtual Curve_ptr CreateCurveWithZ(Table_ptr theTable, CORBA::Long theHRow, CORBA::Long theVRow, CORBA::Long theZRow); virtual Container_ptr CreateContainer(); virtual Animation_ptr CreateAnimation(View3D_ptr theView3d); diff --git a/src/GUITOOLS/VisuGUI_TableDlg.cxx b/src/GUITOOLS/VisuGUI_TableDlg.cxx index b43f8d69..5dc1a547 100644 --- a/src/GUITOOLS/VisuGUI_TableDlg.cxx +++ b/src/GUITOOLS/VisuGUI_TableDlg.cxx @@ -455,6 +455,22 @@ void VisuGUI_TableDlg::initDlg() } } +/*! + Provides help on F1 button click +*/ +void VisuGUI_TableDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} + /*! Constructor */ diff --git a/src/GUITOOLS/VisuGUI_TableDlg.h b/src/GUITOOLS/VisuGUI_TableDlg.h index ea076771..44621d27 100644 --- a/src/GUITOOLS/VisuGUI_TableDlg.h +++ b/src/GUITOOLS/VisuGUI_TableDlg.h @@ -51,6 +51,9 @@ public: bool showColumnTitles = true ); ~VisuGUI_TableDlg(); +private: + void keyPressEvent( QKeyEvent* e ); + public slots: void onOK(); void onHelp(); diff --git a/src/PIPELINE/Makefile.in b/src/PIPELINE/Makefile.in index 1ea484f8..0d0f95a0 100644 --- a/src/PIPELINE/Makefile.in +++ b/src/PIPELINE/Makefile.in @@ -103,7 +103,7 @@ CPPFLAGS+= \ $(HDF5_INCLUDES) $(BOOST_CPPFLAGS) LDFLAGS+= \ - $(VTK_LIBS) -lVTKViewer -lSVTK -lVisuConvertor \ + $(VTK_LIBS) -lVTKViewer -lVisuConvertor \ $(KERNEL_LDFLAGS) -lSALOMELocalTrace \ $(GUI_LDFLAGS) \ $(MED_LDFLAGS) diff --git a/src/PIPELINE/VISUPipeLine.cxx b/src/PIPELINE/VISUPipeLine.cxx index ecfda1eb..6bf73009 100644 --- a/src/PIPELINE/VISUPipeLine.cxx +++ b/src/PIPELINE/VISUPipeLine.cxx @@ -104,71 +104,67 @@ int main(int argc, char** argv) } //Import fields aMeshOnEntityMapIter = aMeshOnEntityMap.begin(); - for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++) - { - const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first; - const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second; - const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; - VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin(); - - for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++) - { - const VISU::PField aField = aFieldMapIter->second; - //if(aField->myNbComp == 1) - // continue; - const string& aFieldName = aFieldMapIter->first; - const VISU::TValField& aValField = aField->myValField; - VISU::TValField::const_iterator aValFieldIter = aValField.begin(); - if(aValFieldIter == aValField.end()) return 0; - int aTimeStamp = aValFieldIter->first; - - TPresent* aPresent = TPresent::New(); - VISU::PIDMapper anIDMapper; - if(anEntity != VISU::NODE_ENTITY) - { - VISU::PGaussPtsIDMapper aGaussPtsIDMapper = aConvertor->GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp); - aPresent->SetGaussPtsIDMapper(aGaussPtsIDMapper); - } - else - { - continue; - VISU::PIDMapper anIDMapper = aConvertor->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp); - aPresent->SetIDMapper(anIDMapper); - } - - aPresent->Build(); - aPresent->Init(); - - char aMainTexture[80]; - strcpy( aMainTexture, getenv( "VISU_ROOT_DIR" ) ); - strcat( aMainTexture, "/share/salome/resources/sprite_texture.vti" ); - //cout << aMainTexture << endl; - - char anAlphaTexture[80]; - strcpy( anAlphaTexture, getenv( "VISU_ROOT_DIR" ) ); - strcat( anAlphaTexture, "/share/salome/resources/sprite_alpha.vti" ); - //cout << anAlphaTexture << endl; - - vtkSmartPointer aTextureValue = VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture ); - aPresent->SetImageData( aTextureValue.GetPointer() ); - - aPresent->Update(); - - vtkActor* anActor = vtkActor::New(); - anActor->SetMapper(aPresent->GetMapper()); - - VISU_ScalarBarActor * aScalarBar = VISU_ScalarBarActor::New(); - aScalarBar->SetLookupTable(aPresent->GetBarTable()); - - ren->AddActor(anActor); - ren->AddActor2D(aScalarBar); - - renWin->Render(); - ren->ResetCamera(); - - iren->Start(); - return 0; - } + for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++) { + const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first; + const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second; + const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; + VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin(); + for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){ + const VISU::PField aField = aFieldMapIter->second; + /* + if(aField->myNbComp == 1) + continue; + */ + const string& aFieldName = aFieldMapIter->first; + const VISU::TValField& aValField = aField->myValField; + VISU::TValField::const_iterator aValFieldIter = aValField.begin(); + if(aValFieldIter == aValField.end()) return 0; + int aTimeStamp = aValFieldIter->first; + + TPresent* aPresent = TPresent::New(); + VISU::PIDMapper anIDMapper; + if(anEntity != VISU::NODE_ENTITY){ + VISU::PGaussPtsIDMapper aGaussPtsIDMapper = aConvertor->GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp); + aPresent->SetGaussPtsIDMapper(aGaussPtsIDMapper); + }else{ + continue; + VISU::PIDMapper anIDMapper = aConvertor->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp); + aPresent->SetIDMapper(anIDMapper); + } + + aPresent->Build(); + aPresent->Init(); + + char aMainTexture[80]; + strcpy( aMainTexture, getenv( "VISU_ROOT_DIR" ) ); + strcat( aMainTexture, "/share/salome/resources/visu/sprite_texture.vti" ); + //cout << aMainTexture << endl; + + char anAlphaTexture[80]; + strcpy( anAlphaTexture, getenv( "VISU_ROOT_DIR" ) ); + strcat( anAlphaTexture, "/share/salome/resources/visu/sprite_alpha.vti" ); + //cout << anAlphaTexture << endl; + + vtkSmartPointer aTextureValue = VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture ); + aPresent->SetImageData( aTextureValue.GetPointer() ); + + aPresent->Update(); + + vtkActor* anActor = vtkActor::New(); + anActor->SetMapper(aPresent->GetMapper()); + + VISU_ScalarBarActor * aScalarBar = VISU_ScalarBarActor::New(); + aScalarBar->SetLookupTable(aPresent->GetBarTable()); + + ren->AddActor(anActor); + ren->AddActor2D(aScalarBar); + + renWin->Render(); + ren->ResetCamera(); + + iren->Start(); + return 0; + } } } } diff --git a/src/PIPELINE/VISU_CutLinesPL.cxx b/src/PIPELINE/VISU_CutLinesPL.cxx index 322e69ee..8749ff80 100644 --- a/src/PIPELINE/VISU_CutLinesPL.cxx +++ b/src/PIPELINE/VISU_CutLinesPL.cxx @@ -49,8 +49,10 @@ VISU_CutLinesPL SetOrientation(aPipeLine->GetPlaneOrientation(1), aPipeLine->GetRotateX(1),aPipeLine->GetRotateY(1),1); SetDisplacement(aPipeLine->GetDisplacement(1),1); - SetDefault(); - if (!aPipeLine->IsDefault()) SetPosition(aPipeLine->GetPosition()); + if (aPipeLine->IsDefault()) + SetDefault(); + else + SetPosition(aPipeLine->GetPosition()); } VISU_CutPlanesPL::ShallowCopy(thePipeLine); } diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx index 4bdf8611..6f0edac8 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx @@ -47,14 +47,20 @@ #include #include -#ifndef WIN32 -#include -#endif - #include #include #include +#ifndef WNT +# ifndef GLX_GLXEXT_LEGACY +# define GLX_GLXEXT_LEGACY +# endif +# include +# include +#else +# include +#endif + #ifndef VTK_IMPLEMENT_MESA_CXX vtkCxxRevisionMacro(VISU_OpenGLPointSpriteMapper, "Revision$"); vtkStandardNewMacro(VISU_OpenGLPointSpriteMapper); @@ -138,26 +144,78 @@ static PFNGLBINDBUFFERARBPROC vglBindBufferARB = NULL static PFNGLBUFFERDATAARBPROC vglBufferDataARB = NULL; static PFNGLDELETEBUFFERSARBPROC vglDeleteBuffersARB = NULL; -void InitializeARB() +#ifndef WNT +#define GL_GetProcAddress( x ) glXGetProcAddressARB( (const GLubyte*)x ) +#else +#define GL_GetProcAddress( x ) wglGetProcAddress( (const LPCSTR)x ) +#endif + +bool InitializeARB() { - vglShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)SVTK::getOpenGLExtension( "glShaderSourceARB" ); - vglCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)SVTK::getOpenGLExtension( "glCreateShaderObjectARB" ); - vglCompileShaderARB = (PFNGLCOMPILESHADERARBPROC)SVTK::getOpenGLExtension( "glCompileShaderARB" ); - vglCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)SVTK::getOpenGLExtension( "glCreateProgramObjectARB" ); - vglAttachObjectARB = (PFNGLATTACHOBJECTARBPROC)SVTK::getOpenGLExtension( "glAttachObjectARB" ); - vglLinkProgramARB = (PFNGLLINKPROGRAMARBPROC)SVTK::getOpenGLExtension( "glLinkProgramARB" ); - vglUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)SVTK::getOpenGLExtension( "glUseProgramObjectARB" ); - vglGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC)SVTK::getOpenGLExtension( "glGetObjectParameterivARB" ); - vglGetInfoLogARB = (PFNGLGETINFOLOGARBPROC)SVTK::getOpenGLExtension( "glGetInfoLogARB" ); - vglGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC)SVTK::getOpenGLExtension( "glGetAttribLocationARB" ); - vglVertexAttrib1fARB = (PFNGLVERTEXATTRIB1FARBPROC)SVTK::getOpenGLExtension( "glVertexAttrib1fARB" ); - - vglGenBuffersARB = (PFNGLGENBUFFERSARBPROC)SVTK::getOpenGLExtension( "glGenBuffersARB" ); - vglBindBufferARB = (PFNGLBINDBUFFERARBPROC)SVTK::getOpenGLExtension( "glBindBufferARB" ); - vglBufferDataARB = (PFNGLBUFFERDATAARBPROC)SVTK::getOpenGLExtension( "glBufferDataARB" ); - vglDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC)SVTK::getOpenGLExtension( "glDeleteBuffersARB" ); + vglShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)GL_GetProcAddress( "glShaderSourceARB" ); + if( !vglShaderSourceARB ) + return false; + + vglCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)GL_GetProcAddress( "glCreateShaderObjectARB" ); + if( !vglCreateShaderObjectARB ) + return false; + + vglCompileShaderARB = (PFNGLCOMPILESHADERARBPROC)GL_GetProcAddress( "glCompileShaderARB" ); + if( !vglCompileShaderARB ) + return false; + + vglCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)GL_GetProcAddress( "glCreateProgramObjectARB" ); + if( !vglCreateProgramObjectARB ) + return false; + + vglAttachObjectARB = (PFNGLATTACHOBJECTARBPROC)GL_GetProcAddress( "glAttachObjectARB" ); + if( !vglAttachObjectARB ) + return false; + + vglLinkProgramARB = (PFNGLLINKPROGRAMARBPROC)GL_GetProcAddress( "glLinkProgramARB" ); + if( !vglLinkProgramARB ) + return false; + + vglUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)GL_GetProcAddress( "glUseProgramObjectARB" ); + if( !vglUseProgramObjectARB ) + return false; + + vglGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC)GL_GetProcAddress( "glGetObjectParameterivARB" ); + if( !vglGetObjectParameterivARB ) + return false; + + vglGetInfoLogARB = (PFNGLGETINFOLOGARBPROC)GL_GetProcAddress( "glGetInfoLogARB" ); + if( !vglGetInfoLogARB ) + return false; + + vglGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC)GL_GetProcAddress( "glGetAttribLocationARB" ); + if( !vglGetAttribLocationARB ) + return false; + + vglVertexAttrib1fARB = (PFNGLVERTEXATTRIB1FARBPROC)GL_GetProcAddress( "glVertexAttrib1fARB" ); + if( !vglVertexAttrib1fARB ) + return false; + + vglGenBuffersARB = (PFNGLGENBUFFERSARBPROC)GL_GetProcAddress( "glGenBuffersARB" ); + if( !vglGenBuffersARB ) + return false; + + vglBindBufferARB = (PFNGLBINDBUFFERARBPROC)GL_GetProcAddress( "glBindBufferARB" ); + if( !vglBindBufferARB ) + return false; + + vglBufferDataARB = (PFNGLBUFFERDATAARBPROC)GL_GetProcAddress( "glBufferDataARB" ); + if( !vglBufferDataARB ) + return false; + + vglDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC)GL_GetProcAddress( "glDeleteBuffersARB" ); + if( !vglDeleteBuffersARB ) + return false; + + return true; }; +static bool IsARBInitialized = InitializeARB(); static float Tolerance = 1.0 / VTK_LARGE_FLOAT; //----------------------------------------------------------------------------- @@ -196,7 +254,8 @@ VISU_OpenGLPointSpriteMapper::VISU_OpenGLPointSpriteMapper() //----------------------------------------------------------------------------- VISU_OpenGLPointSpriteMapper::~VISU_OpenGLPointSpriteMapper() { - glDeleteTextures( 1, &PointSpriteTexture ); + if( PointSpriteTexture>0 ) + glDeleteTextures( 1, &PointSpriteTexture ); if( this->LastWindow ) this->ReleaseGraphicsResources(this->LastWindow); @@ -277,7 +336,7 @@ void VISU_OpenGLPointSpriteMapper::InitShader() //cout << "Initializing vertex program" << endl; std::string fileName = std::string( getenv( "VISU_ROOT_DIR") ) + - "/share/salome/resources/Vertex_Program_ARB.txt"; + "/share/salome/resources/visu/Vertex_Program_ARB.txt"; char* shader = readFromFile( fileName ); @@ -389,7 +448,8 @@ bool VISU_OpenGLPointSpriteMapper::InitExtensions() char* ext = (char*)glGetString( GL_EXTENSIONS ); //cout << "OpenGL extensions : " << ext << endl; - if( strstr( ext, "GL_ARB_point_sprite" ) == NULL || + if( !IsARBInitialized || + strstr( ext, "GL_ARB_point_sprite" ) == NULL || strstr( ext, "GL_ARB_shader_objects" ) == NULL || strstr( ext, "GL_ARB_vertex_buffer_object" ) == NULL ) { @@ -419,7 +479,10 @@ float ViewToDisplay( vtkRenderer* theRenderer ) theRenderer->ViewToDisplay(); theRenderer->GetDisplayPoint( p2 ); - vtkFloatingPointType coefficient = sqrt( (double)pow( p2[0] - p1[0], 2 ) + pow( p2[1] - p1[1], 2 ) ) / sqrt( (double)2 ); + vtkFloatingPointType coefficient = sqrt( pow( p2[0] - p1[0], 2 ) + pow( p2[1] - p1[1], 2 ) ) / sqrt( 2. ); + //cout << p1[0] << " " << p1[1] << " " << p1[2] << endl; + //cout << p2[0] << " " << p2[1] << " " << p2[2] << endl; + //cout << "ZOOM : " << coefficient << endl; return coefficient; } diff --git a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx index 14412af8..16759ec6 100644 --- a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx +++ b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx @@ -120,6 +120,7 @@ VISU_ScalarMapOnDeformedShapePL // Sets geometry for merge filter myMergeFilter->SetGeometry(myDeformVectors->GetOutput()); + myMergeFilter->SetScalars(myExtractorScalars->GetOutput()); // Sets data to mapper myMapper->SetInput(myMergeFilter->GetOutput()); } @@ -158,11 +159,7 @@ void VISU_ScalarMapOnDeformedShapePL ::UpdateScalars() { - if(myScalars->GetCellData()->GetVectors() != NULL || - myScalars->GetPointData()->GetVectors() != NULL) - myMergeFilter->SetScalars(myExtractorScalars->GetOutput()); - else - myMergeFilter->SetScalars(GetScalars()); + myExtractorScalars->Update(); } /*! @@ -194,7 +191,22 @@ VISU_ScalarMapOnDeformedShapePL { myScalars = theScalars; vtkUnstructuredGrid* aScalars = GetScalars(); - myExtractorScalars->SetInput(aScalars); + vtkCellData *aInCellData = GetInput()->GetCellData(); + + if(aScalars->GetPointData()->GetScalars()) + myExtractorScalars->SetInput(aScalars); + else if(aScalars->GetCellData()->GetScalars() && + !aInCellData->GetAttribute(vtkDataSetAttributes::VECTORS)){ + //Approximate cell data values to point data by vtkCellDataToPointData filter. + vtkCellDataToPointData* aCellDataToPointData = vtkCellDataToPointData::New(); + aCellDataToPointData->SetInput(aScalars); + aCellDataToPointData->Update(); + myExtractorScalars->SetInput(aCellDataToPointData->GetUnstructuredGridOutput()); + aCellDataToPointData->Delete(); + } else { + myExtractorScalars->SetInput(aScalars); + } + Update(); Modified(); } diff --git a/src/VISUGUI/VISU_msg_en.po b/src/VISUGUI/VISU_msg_en.po index c5683bd1..eebc49c8 100644 --- a/src/VISUGUI/VISU_msg_en.po +++ b/src/VISUGUI/VISU_msg_en.po @@ -1194,6 +1194,9 @@ msgstr "Attributes" msgid "AXIS_LBL" msgstr "Axis" +msgid "ASSIGNED" +msgstr "Assigned" + #: VisuGUI_SetupPlot2dDlg.cxx:69 msgid "DATA_LBL" msgstr "Data" diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 9ef0a4ab..fe81ee2c 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -1220,8 +1220,8 @@ OnPlotData() // if study is not locked - create new container, create curves and insert them // into container, then plot container if current viewer is of VIEW_PLOT2D type int horIndex; - QValueList verIndices; - dlg->getCurvesSource( horIndex, verIndices ); + QValueList verIndices, zIndices; + dlg->getCurvesSource( horIndex, verIndices, zIndices ); if ( horIndex >= 0 && verIndices.count() > 0 ) { CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer(); if( !CORBA::is_nil( aContainer ) ) { @@ -1230,7 +1230,7 @@ OnPlotData() if ( pContainer ) { for ( int i = 0; i < verIndices.count(); i++ ) { CORBA::Object_var aNewCurve = - GetVisuGen(this)->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 ); + GetVisuGen(this)->CreateCurveWithZ( table->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 ); if( !CORBA::is_nil( aNewCurve ) ) { VISU::Curve_i* pCrv = dynamic_cast(VISU::GetServant(aNewCurve).in()); @@ -1290,8 +1290,8 @@ OnPlotData() // if study is not locked - create new table and container objects, create curves // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type int horIndex; - QValueList verIndices; - dlg->getCurvesSource( horIndex, verIndices ); + QValueList verIndices, zIndices; + dlg->getCurvesSource( horIndex, verIndices, zIndices ); if ( horIndex >= 0 && verIndices.count() > 0 ) { CORBA::Object_var aTable = GetVisuGen(this)->CreateTable( SO->GetID().c_str() ); CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer(); @@ -1301,8 +1301,8 @@ OnPlotData() if ( pContainer && pTable ) { for ( int i = 0; i < verIndices.count(); i++ ) { - CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve - ( pTable->_this(), horIndex+1, verIndices[i]+1 ); + CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurveWithZ + ( pTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 ); if( !CORBA::is_nil( aNewCurve ) ) { VISU::Curve_i* pCrv = dynamic_cast(VISU::GetServant(aNewCurve).in()); if ( pCrv ) { @@ -1612,7 +1612,7 @@ OnSweep() int aTemp = int(1.E6 * aTempoDbl); int aCycles = aResourceMgr->integerValue("VISU", "sweeping_number_cycles", 1); - int aSteps = aResourceMgr->integerValue("VISU", "sweeping_time_step", 40); + int aSteps = aResourceMgr->integerValue("VISU", "sweeping_number_steps", 40); // Sweep QApplication::setOverrideCursor(Qt::waitCursor); diff --git a/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx b/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx index ad40b34c..e1dace81 100644 --- a/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx +++ b/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx @@ -428,3 +428,16 @@ void VisuGUI_BuildProgressDlg::setFileName( const QString& theFileName ) myFileNameLineEdit->setText( myFileName.section( '/', -1 ) ); } } + +void VisuGUI_BuildProgressDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} diff --git a/src/VISUGUI/VisuGUI_BuildProgressDlg.h b/src/VISUGUI/VisuGUI_BuildProgressDlg.h index 0d56a0dc..8284c52d 100644 --- a/src/VISUGUI/VisuGUI_BuildProgressDlg.h +++ b/src/VISUGUI/VisuGUI_BuildProgressDlg.h @@ -56,6 +56,9 @@ public: QString fileName() const { return myFileName; } void setFileName( const QString& theFileName ); +private: + void keyPressEvent( QKeyEvent* e ); + protected slots: void done( int ); diff --git a/src/VISUGUI/VisuGUI_ClippingDlg.cxx b/src/VISUGUI/VisuGUI_ClippingDlg.cxx index 0be9f3ef..87195d31 100644 --- a/src/VISUGUI/VisuGUI_ClippingDlg.cxx +++ b/src/VISUGUI/VisuGUI_ClippingDlg.cxx @@ -599,8 +599,11 @@ void VisuGUI_ClippingDlg::onSelectionChanged() if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(myVisuGUI)) { Handle(SALOME_InteractiveObject) anIO; CORBA::Object_var anObject = VISU::GetSelectedObj(myVisuGUI, &anIO); - myIO = anIO; if (CORBA::is_nil(anObject)) return; + + if (!anIO.IsNull()) + myIO = anIO; + PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); if (!aServant.in()) return; @@ -1131,3 +1134,21 @@ void VisuGUI_ClippingDlg::OnPreviewToggle (bool theIsToggled) if (SVTK_ViewWindow* vw = VISU::GetActiveViewWindow(myVisuGUI)) VISU::RenderViewWindow(vw); } + + +//================================================================================= +// function : keyPressEvent() +// purpose : +//================================================================================= +void VisuGUI_ClippingDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + ClickOnHelp(); + } +} diff --git a/src/VISUGUI/VisuGUI_ClippingDlg.h b/src/VISUGUI/VisuGUI_ClippingDlg.h index dcc56423..be9dcb20 100644 --- a/src/VISUGUI/VisuGUI_ClippingDlg.h +++ b/src/VISUGUI/VisuGUI_ClippingDlg.h @@ -134,6 +134,9 @@ public: ~VisuGUI_ClippingDlg(); +private: + void keyPressEvent( QKeyEvent* e ); + private: LightApp_SelectionMgr* mySelectionMgr; diff --git a/src/VISUGUI/VisuGUI_CursorDlg.cxx b/src/VISUGUI/VisuGUI_CursorDlg.cxx index f193d0cc..45de30f6 100644 --- a/src/VISUGUI/VisuGUI_CursorDlg.cxx +++ b/src/VISUGUI/VisuGUI_CursorDlg.cxx @@ -148,3 +148,20 @@ void VisuGUI_CursorDlg::onHelp() QObject::tr("BUT_OK")); } } + +/*! + function : keyPressEvent() + purpose : +*/ +void VisuGUI_CursorDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} diff --git a/src/VISUGUI/VisuGUI_CursorDlg.h b/src/VISUGUI/VisuGUI_CursorDlg.h index 82a910d8..cebb7b6e 100644 --- a/src/VISUGUI/VisuGUI_CursorDlg.h +++ b/src/VISUGUI/VisuGUI_CursorDlg.h @@ -52,6 +52,9 @@ public: QPushButton* buttonCancel; QPushButton* buttonHelp; +private: + void keyPressEvent( QKeyEvent* e ); + private slots: void onHelp(); diff --git a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx index 3b7284da..4b68c799 100644 --- a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx @@ -944,3 +944,16 @@ void VisuGUI_CutLinesDlg::onHelp() //jfa tmp: if (theWnd != myStudyWnd) //jfa tmp: reject(); //jfa tmp:} + +void VisuGUI_CutLinesDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} diff --git a/src/VISUGUI/VisuGUI_CutLinesDlg.h b/src/VISUGUI/VisuGUI_CutLinesDlg.h index 596798bd..8b0e1da4 100644 --- a/src/VISUGUI/VisuGUI_CutLinesDlg.h +++ b/src/VISUGUI/VisuGUI_CutLinesDlg.h @@ -50,6 +50,9 @@ public: bool isGenerateTable() { return myCreateTable->isChecked(); } bool isGenerateCurves() { return myCreateTable->isChecked() && myCurvesCheck->isChecked(); } +private: + void keyPressEvent( QKeyEvent* e ); + protected slots: void accept(); void reject(); diff --git a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx index 212f569f..dab4e24b 100644 --- a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx @@ -421,7 +421,9 @@ void VisuGUI_CutPlanesPane::deletePlanes() { if (myPreviewActor == 0) return; vtkRenderer* aRend = myPreviewActor->GetRenderer(); - if(aRend) + vtkRenderWindow* aWnd = aRend->GetRenderWindow(); + + if(aRend && aWnd) myPreviewActor->RemoveFromRender(aRend); // Bug IPAL11962: preview is still in the viewer, if viewer not active. // if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) @@ -591,3 +593,16 @@ QWidget* VisuGUI_NumEditItem::createEditor() const editline->setValidator(dvalidator); return editline; } + +void VisuGUI_CutPlanesDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} diff --git a/src/VISUGUI/VisuGUI_CutPlanesDlg.h b/src/VISUGUI/VisuGUI_CutPlanesDlg.h index e1726ecc..b7f9e4cf 100644 --- a/src/VISUGUI/VisuGUI_CutPlanesDlg.h +++ b/src/VISUGUI/VisuGUI_CutPlanesDlg.h @@ -111,6 +111,9 @@ public: void initFromPrsObject (VISU::CutPlanes_i* thePrs); int storeToPrsObject (VISU::CutPlanes_i* thePrs); +private: + void keyPressEvent( QKeyEvent* e ); + protected slots: void accept(); void reject(); diff --git a/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx index fc28efe2..5bbe4c89 100644 --- a/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx +++ b/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx @@ -181,3 +181,16 @@ void VisuGUI_DeformedShapeDlg::onHelp() QObject::tr("BUT_OK")); } } + +void VisuGUI_DeformedShapeDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} diff --git a/src/VISUGUI/VisuGUI_DeformedShapeDlg.h b/src/VISUGUI/VisuGUI_DeformedShapeDlg.h index a5e870b1..32c10f4c 100644 --- a/src/VISUGUI/VisuGUI_DeformedShapeDlg.h +++ b/src/VISUGUI/VisuGUI_DeformedShapeDlg.h @@ -64,6 +64,9 @@ public: void initFromPrsObject(VISU::DeformedShape_i* thePrs); int storeToPrsObject(VISU::DeformedShape_i* thePrs); +private: + void keyPressEvent( QKeyEvent* e ); + protected slots: void accept(); void reject(); diff --git a/src/VISUGUI/VisuGUI_EditContainerDlg.cxx b/src/VISUGUI/VisuGUI_EditContainerDlg.cxx index 5e203796..9850d1f4 100644 --- a/src/VISUGUI/VisuGUI_EditContainerDlg.cxx +++ b/src/VISUGUI/VisuGUI_EditContainerDlg.cxx @@ -468,3 +468,16 @@ void VisuGUI_EditContainerDlg::onHelp() QObject::tr("BUT_OK")); } } + +void VisuGUI_EditContainerDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} diff --git a/src/VISUGUI/VisuGUI_EditContainerDlg.h b/src/VISUGUI/VisuGUI_EditContainerDlg.h index ced26561..0ff26c94 100644 --- a/src/VISUGUI/VisuGUI_EditContainerDlg.h +++ b/src/VISUGUI/VisuGUI_EditContainerDlg.h @@ -55,6 +55,9 @@ class VisuGUI_EditContainerDlg: public QDialog void initFromPrsObject (VISU::Container_i* theContainer); void storeToPrsObject (VISU::Container_i* theContainer); + + private: + void keyPressEvent( QKeyEvent* e ); private slots: void onLeftClicked(); diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx index b7a7571c..8531c225 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx @@ -756,3 +756,16 @@ void VisuGUI_GaussPointsDlg::onHelp() QObject::tr("BUT_OK")); } } + +void VisuGUI_GaussPointsDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.h b/src/VISUGUI/VisuGUI_GaussPointsDlg.h index 9617d640..1ce86e43 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.h +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.h @@ -139,6 +139,9 @@ public: //! Update Gauss Points presentation using parameters from the dialog. int storeToPrsObject(VISU::GaussPoints_i* thePrs); +private: + void keyPressEvent( QKeyEvent* e ); + protected slots: void onToggleDefShape( bool ); void onHelp(); diff --git a/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx b/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx index f57ac26a..7c4d3e8d 100644 --- a/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx +++ b/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx @@ -251,3 +251,16 @@ void VisuGUI_IsoSurfacesDlg::onHelp() QObject::tr("BUT_OK")); } } + +void VisuGUI_IsoSurfacesDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} diff --git a/src/VISUGUI/VisuGUI_IsoSurfacesDlg.h b/src/VISUGUI/VisuGUI_IsoSurfacesDlg.h index 5e3b1c51..385fa646 100644 --- a/src/VISUGUI/VisuGUI_IsoSurfacesDlg.h +++ b/src/VISUGUI/VisuGUI_IsoSurfacesDlg.h @@ -83,6 +83,9 @@ class VisuGUI_IsoSurfacesDlg : public QDialog int storeToPrsObject(VISU::IsoSurfaces_i* thePrs) {return myScalarPane->storeToPrsObject(thePrs) && myIsoPane->storeToPrsObject(thePrs);} + private: + void keyPressEvent( QKeyEvent* e ); + protected slots: void accept(); void reject(); diff --git a/src/VISUGUI/VisuGUI_NameDlg.cxx b/src/VISUGUI/VisuGUI_NameDlg.cxx index 6b3ce013..60b252af 100644 --- a/src/VISUGUI/VisuGUI_NameDlg.cxx +++ b/src/VISUGUI/VisuGUI_NameDlg.cxx @@ -178,3 +178,16 @@ QString VisuGUI_NameDlg::getName( QWidget* parent, const QString& oldName ) delete dlg; return n; } + +void VisuGUI_NameDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} diff --git a/src/VISUGUI/VisuGUI_NameDlg.h b/src/VISUGUI/VisuGUI_NameDlg.h index c9505799..5198a631 100644 --- a/src/VISUGUI/VisuGUI_NameDlg.h +++ b/src/VISUGUI/VisuGUI_NameDlg.h @@ -45,6 +45,9 @@ public: QString name(); static QString getName( QWidget* parent = 0, const QString& oldName = QString::null ); + +private: + void keyPressEvent( QKeyEvent* e ); protected slots: void accept(); diff --git a/src/VISUGUI/VisuGUI_OffsetDlg.cxx b/src/VISUGUI/VisuGUI_OffsetDlg.cxx index 94d6fe26..33ba4ba2 100644 --- a/src/VISUGUI/VisuGUI_OffsetDlg.cxx +++ b/src/VISUGUI/VisuGUI_OffsetDlg.cxx @@ -257,3 +257,16 @@ void VisuGUI_OffsetDlg::onHelp() QObject::tr("BUT_OK")); } } + +void VisuGUI_OffsetDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} diff --git a/src/VISUGUI/VisuGUI_OffsetDlg.h b/src/VISUGUI/VisuGUI_OffsetDlg.h index 80a3f114..a1d67a51 100644 --- a/src/VISUGUI/VisuGUI_OffsetDlg.h +++ b/src/VISUGUI/VisuGUI_OffsetDlg.h @@ -65,6 +65,9 @@ class VisuGUI_OffsetDlg: public QDialog void getOffset (vtkFloatingPointType* theOffset) const; bool isToSave() const; + private: + void keyPressEvent( QKeyEvent* e ); + public slots: void onReset(); diff --git a/src/VISUGUI/VisuGUI_Plot3DDlg.cxx b/src/VISUGUI/VisuGUI_Plot3DDlg.cxx index 1ea50f4c..abbdd3f6 100644 --- a/src/VISUGUI/VisuGUI_Plot3DDlg.cxx +++ b/src/VISUGUI/VisuGUI_Plot3DDlg.cxx @@ -362,7 +362,12 @@ void VisuGUI_Plot3DPane::onPrsType(int id) //======================================================================= void VisuGUI_Plot3DPane::updatePreview() { - if (myInitFromPrs || !myPrs || !myViewWindow) + if(myPreviewActor){ + vtkRenderer* aRend = myPreviewActor->GetRenderer(); + vtkRenderWindow* aWnd = aRend->GetRenderWindow(); + if (!aWnd) return; + } + if (myInitFromPrs || !myPrs || !myViewWindow) return; bool fitall = false; if (PreviewChkB->isChecked()) // place preview plane @@ -489,14 +494,18 @@ int VisuGUI_Plot3DPane::storeToPrsObject(VISU::Plot3D_i* thePrs) //======================================================================= bool VisuGUI_Plot3DPane::check() { - if (myPreviewActor && myViewWindow) // erase preview - { + if(!myPreviewActor) return true; + + SVTK_ViewWindow* aView; + vtkRenderer* aRend = myPreviewActor->GetRenderer(); + vtkRenderWindow* aWnd = aRend->GetRenderWindow(); + if(aRend && aWnd){ myPreviewActor->SetVisibility(false); myViewWindow->RemoveActor(myPreviewActor); myPreviewActor->Delete(); myPreviewActor = 0; } - + return true; } @@ -643,3 +652,20 @@ void VisuGUI_Plot3DDlg::setPlane(int theOrientation, double theXRotation, double { myIsoPane->setPlane(theOrientation, theXRotation, theYRotation, thePlanePos); } + +//================================================================================= +// function : keyPressEvent() +// purpose : +//================================================================================= +void VisuGUI_Plot3DDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} diff --git a/src/VISUGUI/VisuGUI_Plot3DDlg.h b/src/VISUGUI/VisuGUI_Plot3DDlg.h index e6e22751..230df000 100644 --- a/src/VISUGUI/VisuGUI_Plot3DDlg.h +++ b/src/VISUGUI/VisuGUI_Plot3DDlg.h @@ -111,6 +111,9 @@ class VisuGUI_Plot3DDlg : public QDialog void setPlane(int theOrientation, double theXRotation, double theYRotation, double thePlanePos); + private: + void keyPressEvent( QKeyEvent* e ); + protected slots: void accept(); void reject(); diff --git a/src/VISUGUI/VisuGUI_Prs3dTools.h b/src/VISUGUI/VisuGUI_Prs3dTools.h index 9050d5fd..62b46d51 100644 --- a/src/VISUGUI/VisuGUI_Prs3dTools.h +++ b/src/VISUGUI/VisuGUI_Prs3dTools.h @@ -194,12 +194,13 @@ namespace VISU delete aDlg; } else { DeletePrs3d(theModule,aPrs3d,theIO); + QApplication::restoreOverrideCursor(); delete aDlg; return false; } } } - + aViewWindow = GetViewWindow(theModule); // Display created presentation. if (aViewWindow) { PublishInView(theModule, aPrs3d, aViewWindow, /*highlight = */true); diff --git a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx index 768a0c49..cc032130 100644 --- a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx @@ -746,7 +746,8 @@ void VisuGUI_ScalarBarPane::deleteScalarBar() if (myPreviewActor == 0) return; vtkRenderer* aRend = myPreviewActor->GetRenderer(); - if(aRend) + vtkRenderWindow* aWnd = aRend->GetRenderWindow(); + if(aRend && aWnd) myPreviewActor->RemoveFromRender(aRend); myPreviewActor->GetScalarBar()->VisibilityOff(); myPreviewActor->Delete(); @@ -1155,6 +1156,21 @@ void VisuGUI_ScalarBarDlg::onHelp() } } +/*! + Provides help on F1 button click +*/ +void VisuGUI_ScalarBarDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} //####################################################################################### VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent) @@ -1271,3 +1287,19 @@ void VisuGUI_TextPrefDlg::accept() QDialog::accept(); } + +/*! + Provides help on F1 button click +*/ +void VisuGUI_TextPrefDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} diff --git a/src/VISUGUI/VisuGUI_ScalarBarDlg.h b/src/VISUGUI/VisuGUI_ScalarBarDlg.h index 5ef53b8d..d9d0f6f2 100644 --- a/src/VISUGUI/VisuGUI_ScalarBarDlg.h +++ b/src/VISUGUI/VisuGUI_ScalarBarDlg.h @@ -79,6 +79,9 @@ class VisuGUI_TextPrefDlg: public QDialog void storeBeginValues(); + private: + void keyPressEvent( QKeyEvent* e ); + public: SVTK_FontWidget* myTitleFont; SVTK_FontWidget* myLabelFont; @@ -203,6 +206,9 @@ class VisuGUI_ScalarBarDlg : public QDialog void initFromPrsObject(VISU::ScalarMap_i* thePrs) {myScalarPane->initFromPrsObject(thePrs);} int storeToPrsObject(VISU::ScalarMap_i* thePrs) {return myScalarPane->storeToPrsObject(thePrs);} + private: + void keyPressEvent( QKeyEvent* e ); + protected slots: void accept(); void reject(); diff --git a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx index 721448f0..f0d9f960 100644 --- a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx @@ -293,7 +293,7 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject myFieldsCombo->setCurrentText(aFieldName); AddAllTimes(myFieldsCombo->currentText()); myTimeStampsCombo->setCurrentText(aIteration); - SetScalarField(); + SetScalarField( false ); myScalarPane->initFromPrsObject(myPrs); } @@ -314,7 +314,7 @@ int VisuGUI_ScalarMapOnDeformedShapeDlg::storeToPrsObject myTimeStampsCombo->currentItem() + 1, myPrs->GetScalarEntity()); - if (theUpdateScalars) SetScalarField(); + if (theUpdateScalars) SetScalarField( false ); thePrs->ShowColored(true); @@ -349,11 +349,11 @@ VISU::TEntity VisuGUI_ScalarMapOnDeformedShapeDlg::getCurrentScalarEntity(){ return anEntity; } -void VisuGUI_ScalarMapOnDeformedShapeDlg::SetScalarField(){ - SetScalarField(myTimeStampsCombo->currentItem()+1); +void VisuGUI_ScalarMapOnDeformedShapeDlg::SetScalarField( const bool save_scalar_pane ){ + SetScalarField( myTimeStampsCombo->currentItem()+1, "", save_scalar_pane ); } -void VisuGUI_ScalarMapOnDeformedShapeDlg::SetScalarField(int theIter,QString theFieldName){ +void VisuGUI_ScalarMapOnDeformedShapeDlg::SetScalarField(int theIter,QString theFieldName, const bool save_scalar_pane ){ QString aFieldName; @@ -369,9 +369,11 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::SetScalarField(int theIter,QString the theIter, anEntity); - myScalarPane->storeToPrsObject(myPrs); - - UpdateScalarField(); + if( save_scalar_pane ) + { + myScalarPane->storeToPrsObject(myPrs); + UpdateScalarField(); + } } void VisuGUI_ScalarMapOnDeformedShapeDlg::accept() @@ -486,3 +488,16 @@ float VisuGUI_ScalarMapOnDeformedShapeDlg::GetFloatValueOfTimeStamp(const char* } return ret; } + +void VisuGUI_ScalarMapOnDeformedShapeDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} diff --git a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h index 7fb24fac..3151bd93 100644 --- a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h +++ b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h @@ -69,7 +69,10 @@ public: QString getCurrentScalarFieldName(); int getCurrentScalarNbIterations(); VISU::TEntity getCurrentScalarEntity(); - void SetScalarField(int theIter,QString theFieldName=QString("")); + void SetScalarField(int theIter,QString theFieldName=QString(""), const bool = true ); + +private: + void keyPressEvent( QKeyEvent* e ); protected slots: void accept(); @@ -102,7 +105,7 @@ private: protected: void UpdateScalarField(); - void SetScalarField(); + void SetScalarField( const bool = true ); void AddAllFieldNames(); void AddAllTimes(const QString& theFieldName); float GetFloatValueOfTimeStamp(const char* theMeshName, diff --git a/src/VISUGUI/VisuGUI_Selection.cxx b/src/VISUGUI/VisuGUI_Selection.cxx index 86329bed..10a7c45d 100644 --- a/src/VISUGUI/VisuGUI_Selection.cxx +++ b/src/VISUGUI/VisuGUI_Selection.cxx @@ -466,13 +466,12 @@ void VisuGUI_SelectionDlg::onSelectionEvent() { myCellScalarValLbl->setText(getValue(aCellData, aVTKID)); myCellVectorValLbl->setText(getVector(aCellData, aVTKID)); - vtkFloatingPointType* aCoord; vtkIdList *aPointList = aCell->GetPointIds(); - for (int i = 0; i < aNbOfPoints; i++) { - int idCurrent = aPointList->GetId(i); - aCoord = aDataSet->GetPoint(idCurrent); - aPointsMap.insert(PointsMap::value_type(idCurrent,aCoord)); + int aNodeVTKId = aPointList->GetId(i); + vtkFloatingPointType* aCoord = aDataSet->GetPoint(aNodeVTKId); + vtkIdType aNodeObjId = anVISUActor->GetNodeObjId(aNodeVTKId); + aPointsMap.insert(PointsMap::value_type(aNodeObjId,aCoord)); } } } @@ -642,3 +641,16 @@ void VisuGUI_SelectionDlg::onHelp() QObject::tr("BUT_OK")); } } + +void VisuGUI_SelectionDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} diff --git a/src/VISUGUI/VisuGUI_Selection.h b/src/VISUGUI/VisuGUI_Selection.h index 40da2d6c..a6517bc1 100644 --- a/src/VISUGUI/VisuGUI_Selection.h +++ b/src/VISUGUI/VisuGUI_Selection.h @@ -47,6 +47,9 @@ public: VisuGUI_SelectionDlg (const SalomeApp_Module* theModule); virtual ~VisuGUI_SelectionDlg (); +private: + void keyPressEvent( QKeyEvent* e ); + protected: void closeEvent (QCloseEvent* theEvent); diff --git a/src/VISUGUI/VisuGUI_SetupPlot2dDlg.cxx b/src/VISUGUI/VisuGUI_SetupPlot2dDlg.cxx index a5eda1ca..5c46ede4 100644 --- a/src/VISUGUI/VisuGUI_SetupPlot2dDlg.cxx +++ b/src/VISUGUI/VisuGUI_SetupPlot2dDlg.cxx @@ -88,15 +88,18 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p QFrame* lin; QLabel* labAxis = new QLabel( tr( "AXIS_LBL" ), frame ); + QLabel* labAssigned = new QLabel( tr( "ASSIGNED" ), frame ); QLabel* labData = new QLabel( tr( "DATA_LBL" ), frame ); QLabel* labUnit = new QLabel( tr( "UNITS_LBL" ), frame ); QLabel* labAttr = new QLabel( tr( "ATTRIBUTES_LBL" ), frame ); labAxis->setAlignment( AlignCenter ); + labAssigned->setAlignment( AlignCenter ); labData->setAlignment( AlignCenter ); labUnit->setAlignment( AlignCenter ); labAttr->setAlignment( AlignCenter ); QFont font = labAxis->font(); font.setBold( true ); labAxis->setFont( font ); + labAssigned->setFont( font ); labData->setFont( font ); labUnit->setFont( font ); labAttr->setFont( font ); @@ -104,16 +107,21 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p frameLayout->addMultiCellWidget( labAxis, 0, 0, 0, 1 ); lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken ); frameLayout->addWidget( lin, 0, 2 ); - frameLayout->addWidget( labData, 0, 3 ); + + frameLayout->addWidget( labAssigned, 0, 3 ); lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken ); frameLayout->addWidget( lin, 0, 4 ); - frameLayout->addWidget( labUnit, 0, 5 ); + + frameLayout->addWidget( labData, 0, 5 ); lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken ); frameLayout->addWidget( lin, 0, 6 ); - frameLayout->addMultiCellWidget( labAttr, 0, 0, 7, 11 ); - frameLayout->setColStretch( 12, 5 ); + frameLayout->addWidget( labUnit, 0, 7 ); + lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken ); + frameLayout->addWidget( lin, 0, 8 ); + frameLayout->addMultiCellWidget( labAttr, 0, 0, 9, 13 ); + frameLayout->setColStretch( 14, 5 ); lin = new QFrame( frame ); lin->setFrameStyle( QFrame::HLine | QFrame::Sunken ); - frameLayout->addMultiCellWidget( lin, 1, 1, 0, 12 ); + frameLayout->addMultiCellWidget( lin, 1, 1, 0, 14 ); int row = 2; _PTR(GenericAttribute) anAttr; @@ -128,22 +136,28 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p int nbRows = tblIntAttr->GetNbRows() ; vector rowTitles = tblIntAttr->GetRowTitles(); vector rowUnits = tblIntAttr->GetRowUnits(); + QStringList rows; + for ( int i = 0; i < nbRows; i++ ) + rows.append( rowTitles[i] ); + for ( int i = 0; i < nbRows; i++ ) { VisuGUI_ItemContainer* item = new VisuGUI_ItemContainer( this ); - item->createWidgets( frame ); + item->createWidgets( frame, rows ); frameLayout->addWidget( item->myHBtn, row, 0 ); frameLayout->addWidget( item->myVBtn, row, 1 ); - frameLayout->addWidget( item->myTitleLab, row, 3 ); + frameLayout->addWidget( item->myAssigned, row, 3 ); + + frameLayout->addWidget( item->myTitleLab, row, 5 ); if ( rowTitles.size() > 0 ) item->myTitleLab->setText( QString( rowTitles[ i ].c_str() ) ); - frameLayout->addWidget( item->myUnitLab, row, 5 ); + frameLayout->addWidget( item->myUnitLab, row, 7 ); if ( rowUnits.size() > 0 ) item->myUnitLab->setText( QString( rowUnits[ i ].c_str() ) ); - frameLayout->addWidget( item->myAutoCheck, row, 7 ); - frameLayout->addWidget( item->myLineCombo, row, 8 ); - frameLayout->addWidget( item->myLineSpin, row, 9 ); - frameLayout->addWidget( item->myMarkerCombo, row, 10 ); - frameLayout->addWidget( item->myColorBtn, row, 11 ); + frameLayout->addWidget( item->myAutoCheck, row, 9 ); + frameLayout->addWidget( item->myLineCombo, row, 10 ); + frameLayout->addWidget( item->myLineSpin, row, 11 ); + frameLayout->addWidget( item->myMarkerCombo, row, 12 ); + frameLayout->addWidget( item->myColorBtn, row, 13 ); connect( item, SIGNAL( horToggled( bool ) ), this, SLOT( onHBtnToggled( bool ) ) ); connect( item, SIGNAL( verToggled( bool ) ), this, SLOT( onVBtnToggled( bool ) ) ); myItems.append( item ); @@ -163,22 +177,28 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p int nbRows = tblRealAttr->GetNbRows() ; vector rowTitles = tblRealAttr->GetRowTitles(); vector rowUnits = tblRealAttr->GetRowUnits(); + QStringList rows; + for ( int i = 0; i < nbRows; i++ ) + rows.append( rowTitles[i] ); + for ( int i = 0; i < nbRows; i++ ) { VisuGUI_ItemContainer* item = new VisuGUI_ItemContainer( this ); - item->createWidgets( frame ); + item->createWidgets( frame, rows ); frameLayout->addWidget( item->myHBtn, row, 0 ); frameLayout->addWidget( item->myVBtn, row, 1 ); - frameLayout->addWidget( item->myTitleLab, row, 3 ); + frameLayout->addWidget( item->myAssigned, row, 3 ); + + frameLayout->addWidget( item->myTitleLab, row, 5 ); if ( rowTitles.size() > 0 ) item->myTitleLab->setText( QString( rowTitles[ i ].c_str() ) ); - frameLayout->addWidget( item->myUnitLab, row, 5 ); + frameLayout->addWidget( item->myUnitLab, row, 7 ); if ( rowUnits.size() > 0 ) item->myUnitLab->setText( QString( rowUnits[ i ].c_str() ) ); - frameLayout->addWidget( item->myAutoCheck, row, 7 ); - frameLayout->addWidget( item->myLineCombo, row, 8 ); - frameLayout->addWidget( item->myLineSpin, row, 9 ); - frameLayout->addWidget( item->myMarkerCombo, row, 10 ); - frameLayout->addWidget( item->myColorBtn, row, 11 ); + frameLayout->addWidget( item->myAutoCheck, row, 9 ); + frameLayout->addWidget( item->myLineCombo, row, 10 ); + frameLayout->addWidget( item->myLineSpin, row, 11 ); + frameLayout->addWidget( item->myMarkerCombo, row, 12 ); + frameLayout->addWidget( item->myColorBtn, row, 13 ); connect( item, SIGNAL( horToggled( bool ) ), this, SLOT( onHBtnToggled( bool ) ) ); connect( item, SIGNAL( verToggled( bool ) ), this, SLOT( onVBtnToggled( bool ) ) ); myItems.append( item ); @@ -237,7 +257,8 @@ VisuGUI_SetupPlot2dDlg::~VisuGUI_SetupPlot2dDlg() /*! Gets curves info ( indexes of row data in the table for horizontal and verical axes ) */ -void VisuGUI_SetupPlot2dDlg::getCurvesSource( int& horIndex, QValueList& verIndexes ) +void VisuGUI_SetupPlot2dDlg::getCurvesSource( int& horIndex, QValueList& verIndexes, + QValueList& zIndices ) { /* collecting horizontal and vertical axis items */ horIndex = -1; @@ -248,7 +269,9 @@ void VisuGUI_SetupPlot2dDlg::getCurvesSource( int& horIndex, QValueList& ve } else if ( myItems.at( i )->isVerticalOn() ) { verIndexes.append( i ); + zIndices.append( myItems.at( i )->assigned() ); } + } } /*! @@ -286,8 +309,8 @@ void VisuGUI_SetupPlot2dDlg::getCurves( QPtrList& container ) /* collecting horizontal and vertical axis items */ int horIndex; int i, j; - QValueList verIndex; - getCurvesSource( horIndex, verIndex ); + QValueList verIndex, zIndices; + getCurvesSource( horIndex, verIndex, zIndices ); if ( horIndex < 0 || verIndex.isEmpty() ) /* no curves can be created */ return; @@ -321,13 +344,15 @@ void VisuGUI_SetupPlot2dDlg::getCurves( QPtrList& container ) if ( nbPoints > 0 ) { double* xList = new double[ nbPoints ]; double* yList = new double[ nbPoints ]; + QStringList zList; for ( j = 1; j <= nbCols; j++ ) { if ( tblIntAttr->HasValue( horIndex+1, j ) && tblIntAttr->HasValue( verIndex[i]+1, j ) ) { xList[j-1] = tblIntAttr->GetValue( horIndex +1, j ); yList[j-1] = tblIntAttr->GetValue( verIndex[i]+1, j ); + zList.append( QString( "%1" ).arg( tblIntAttr->GetValue( zIndices[i]+1, j ) ) ); } } - curve->setData( xList, yList, nbPoints ); + curve->setData( xList, yList, nbPoints, zList ); } // curve attributes curve->setLine( (Plot2d_Curve::LineType)myItems.at( verIndex[i] )->getLine(), myItems.at( verIndex[i] )->getLineWidth() ); @@ -373,13 +398,15 @@ void VisuGUI_SetupPlot2dDlg::getCurves( QPtrList& container ) if ( nbPoints > 0 ) { double* xList = new double[ nbPoints ]; double* yList = new double[ nbPoints ]; + QStringList zList; for ( j = 1; j <= nbCols; j++ ) { if ( tblRealAttr->HasValue( horIndex+1, j ) && tblRealAttr->HasValue( verIndex[i]+1, j ) ) { xList[j-1] = tblRealAttr->GetValue( horIndex +1, j ); yList[j-1] = tblRealAttr->GetValue( verIndex[i]+1, j ); + zList.append( QString( "%1" ).arg( tblIntAttr->GetValue( zIndices[i]+1, j ) ) ); } } - curve->setData( xList, yList, nbPoints ); + curve->setData( xList, yList, nbPoints, zList ); } // curve attributes curve->setLine( (Plot2d_Curve::LineType)myItems.at( verIndex[i] )->getLine(), myItems.at( verIndex[i] )->getLineWidth() ); @@ -418,6 +445,7 @@ void VisuGUI_SetupPlot2dDlg::onVBtnToggled( bool on ) VisuGUI_ItemContainer* item = ( VisuGUI_ItemContainer* )sender(); QPtrList itemList; itemList.setAutoDelete( false ); + item->myAssigned->setEnabled( on ); int i; if ( on ) { int totalOn = 0; @@ -499,6 +527,22 @@ void VisuGUI_SetupPlot2dDlg::enableControls() myOkBtn->setEnabled( bHSet && bVSet ); } +/*! + Provides help on F1 button click +*/ +void VisuGUI_SetupPlot2dDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} + // ==================================================================================== /*! Constructor @@ -511,7 +555,7 @@ VisuGUI_ItemContainer::VisuGUI_ItemContainer( QObject* parent, const char* name /*! Creates widgets */ -void VisuGUI_ItemContainer::createWidgets( QWidget* parentWidget ) +void VisuGUI_ItemContainer::createWidgets( QWidget* parentWidget, const QStringList& lst ) { myHBtn = new QToolButton( parentWidget ); myHBtn->setText( tr( "H" ) ); @@ -557,6 +601,13 @@ void VisuGUI_ItemContainer::createWidgets( QWidget* parentWidget ) myColorBtn = new QToolButton( parentWidget ); myColorBtn->setMinimumWidth( 20 ); + + myAssigned = new QComboBox( false, parentWidget ); + myAssigned->insertItem( "" ); + QStringList::const_iterator anIt = lst.begin(), aLast = lst.end(); + for( ; anIt!=aLast; anIt++ ) + myAssigned->insertItem( *anIt ); + myAssigned->setEnabled( false ); connect( myAutoCheck, SIGNAL( clicked() ), this, SLOT( onAutoChanged() ) ); connect( myColorBtn, SIGNAL( clicked() ), this, SLOT( onColorChanged() ) ); @@ -729,7 +780,13 @@ void VisuGUI_ItemContainer::onHVToggled( bool on ) } } - - - - +/*! + \return index of assigned row (0, if there is no assigned row) +*/ +int VisuGUI_ItemContainer::assigned() const +{ + if( isVerticalOn() ) + return myAssigned->currentItem()-1; + else + return -1; +} diff --git a/src/VISUGUI/VisuGUI_SetupPlot2dDlg.h b/src/VISUGUI/VisuGUI_SetupPlot2dDlg.h index 4332f048..234a2870 100644 --- a/src/VISUGUI/VisuGUI_SetupPlot2dDlg.h +++ b/src/VISUGUI/VisuGUI_SetupPlot2dDlg.h @@ -54,9 +54,12 @@ public: ~VisuGUI_SetupPlot2dDlg(); void getCurves( QPtrList& container ); - void getCurvesSource( int& horIndex, QValueList& verIndexes ); + void getCurvesSource( int& horIndex, QValueList& verIndexes, QValueList& zIndexes ); bool getCurveAttributes( const int vIndex, bool& isAuto, int& marker, int& line, int& lineWidth, QColor& color); +private: + void keyPressEvent( QKeyEvent* e ); + private slots: void onHBtnToggled( bool ); void onVBtnToggled( bool ); @@ -80,7 +83,7 @@ class VisuGUI_ItemContainer : public QObject public: VisuGUI_ItemContainer( QObject* parent = 0, const char* name = 0 ); - void createWidgets( QWidget* parentWidget ); + void createWidgets( QWidget* parentWidget, const QStringList& ); void enableWidgets( bool enable ); void setHorizontalOn( bool on ); @@ -96,6 +99,7 @@ public: int getMarker() const; void setColor( const QColor& color ); QColor getColor() const; + int assigned() const; protected: void updateState(); @@ -119,7 +123,7 @@ public: QCheckBox* myAutoCheck; QComboBox* myLineCombo; QSpinBox* myLineSpin; - QComboBox* myMarkerCombo; + QComboBox* myMarkerCombo, *myAssigned; QToolButton* myColorBtn; }; diff --git a/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx b/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx index e3668af8..e4c82e8e 100644 --- a/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx @@ -634,3 +634,16 @@ void VisuGUI_StreamLinesDlg::onHelp() QObject::tr("BUT_OK")); } } + +void VisuGUI_StreamLinesDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} diff --git a/src/VISUGUI/VisuGUI_StreamLinesDlg.h b/src/VISUGUI/VisuGUI_StreamLinesDlg.h index b1e33ac3..263ef4be 100644 --- a/src/VISUGUI/VisuGUI_StreamLinesDlg.h +++ b/src/VISUGUI/VisuGUI_StreamLinesDlg.h @@ -50,6 +50,9 @@ public: void setColor( QColor color ); void enableMagnColor( bool enable ); +private: + void keyPressEvent( QKeyEvent* e ); + protected slots: void accept(); void reject(); diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index fe7c72ff..5b7a2ccb 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -834,8 +834,8 @@ void SetupDlg::onArrangeDlg() //------------------------------------------------------------------------ void SetupDlg::onRangeCheck (bool theCheck) { - for (int i = 0; i < myAnimator->getNbFields(); i++) - myAnimator->clearData(myAnimator->getFieldData(i)); +// for (int i = 0; i < myAnimator->getNbFields(); i++) +// myAnimator->clearData(myAnimator->getFieldData(i)); myMinVal->setEnabled(theCheck); myMaxVal->setEnabled(theCheck); @@ -1354,18 +1354,9 @@ void VisuGUI_TimeAnimationDlg::reject() //------------------------------------------------------------------------ void VisuGUI_TimeAnimationDlg::closeEvent (QCloseEvent* theEvent) { - if (isClosing) { - if(theEvent->type() == QEvent::Close){ - for (int i = 0; i < myAnimator->getNbFields(); i++) - myAnimator->clearData(myAnimator->getFieldData(i)); - myAnimator->clearFieldData(); - } - QDialog::closeEvent(theEvent); - return; - } - if(myAnimator != NULL){ + if(myAnimator != NULL){ myAnimator->stopAnimation(); - myAnimator->wait(); + myAnimator->wait(500); if (myAnimator->running() && (! myAnimator->finished())) { isClosing = true; myEvent = theEvent; @@ -1373,12 +1364,12 @@ void VisuGUI_TimeAnimationDlg::closeEvent (QCloseEvent* theEvent) // * It needed for correcting destroing of myAnimator, which // * depend from SVTK_RenderWindowInteractor() e.t.c. if(theEvent->type() == QEvent::Close){ - for (int i = 0; i < myAnimator->getNbFields(); i++) - myAnimator->clearData(myAnimator->getFieldData(i)); - myAnimator->clearFieldData(); + for (int i = 0; i < myAnimator->getNbFields(); i++) + myAnimator->clearData(myAnimator->getFieldData(i)); + myAnimator->clearFieldData(); } } else { - QDialog::closeEvent(theEvent); + QDialog::closeEvent(theEvent); } } else { QDialog::closeEvent(theEvent); @@ -1550,3 +1541,18 @@ void VisuGUI_TimeAnimationDlg::onPathChanged() { myAnimator->dumpTo(myPathEdit->text()); } + +//------------------------------------------------------------------------ +void VisuGUI_TimeAnimationDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} + diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.h b/src/VISUGUI/VisuGUI_TimeAnimation.h index 3d592826..604cd24b 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.h +++ b/src/VISUGUI/VisuGUI_TimeAnimation.h @@ -154,6 +154,7 @@ class VisuGUI_TimeAnimationDlg: public QDialog protected: virtual void closeEvent(QCloseEvent* theEvent); virtual void showEvent(QShowEvent* theEvent); + virtual void keyPressEvent(QKeyEvent* theEvent); virtual void reject(); void stopAnimation(); diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index ffefafb9..1bc379bb 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -825,9 +825,10 @@ namespace VISU plotCurve->setVerUnits( theCurve->GetVerUnits().c_str() ); double* xList = 0; double* yList = 0; - int nbPoints = theCurve->GetData( xList, yList ); + QStringList zList; + int nbPoints = theCurve->GetData( xList, yList, zList ); if ( nbPoints > 0 && xList && yList ) { - plotCurve->setData( xList, yList, nbPoints ); + plotCurve->setData( xList, yList, nbPoints, zList ); } if ( !theCurve->IsAuto() ) { plotCurve->setLine( (Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth() ); diff --git a/src/VISUGUI/VisuGUI_TransparencyDlg.cxx b/src/VISUGUI/VisuGUI_TransparencyDlg.cxx index 70109fdb..2904e209 100644 --- a/src/VISUGUI/VisuGUI_TransparencyDlg.cxx +++ b/src/VISUGUI/VisuGUI_TransparencyDlg.cxx @@ -279,3 +279,20 @@ void VisuGUI_TransparencyDlg::onSelectionChanged() } ValueHasChanged(); } + +//================================================================================= +// function : keyPressEvent() +// purpose : +//================================================================================= +void VisuGUI_TransparencyDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + ClickOnHelp(); + } +} diff --git a/src/VISUGUI/VisuGUI_TransparencyDlg.h b/src/VISUGUI/VisuGUI_TransparencyDlg.h index 9a67b25b..2809a460 100644 --- a/src/VISUGUI/VisuGUI_TransparencyDlg.h +++ b/src/VISUGUI/VisuGUI_TransparencyDlg.h @@ -56,6 +56,9 @@ public: ~VisuGUI_TransparencyDlg(); +private: + void keyPressEvent( QKeyEvent* e ); + private : LightApp_SelectionMgr* mySelectionMgr; SVTK_ViewWindow* myViewWindow; diff --git a/src/VISUGUI/VisuGUI_VectorsDlg.cxx b/src/VISUGUI/VisuGUI_VectorsDlg.cxx index 04f3cdef..53961573 100644 --- a/src/VISUGUI/VisuGUI_VectorsDlg.cxx +++ b/src/VISUGUI/VisuGUI_VectorsDlg.cxx @@ -450,3 +450,16 @@ void VisuGUI_VectorsDlg::onHelp() QObject::tr("BUT_OK")); } } + +void VisuGUI_VectorsDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} diff --git a/src/VISUGUI/VisuGUI_VectorsDlg.h b/src/VISUGUI/VisuGUI_VectorsDlg.h index 857887ce..091fec4d 100644 --- a/src/VISUGUI/VisuGUI_VectorsDlg.h +++ b/src/VISUGUI/VisuGUI_VectorsDlg.h @@ -79,6 +79,10 @@ public: void initFromPrsObject(VISU::Vectors_i* thePrs); int storeToPrsObject(VISU::Vectors_i* thePrs); +private: + void keyPressEvent( QKeyEvent* e ); + + protected slots: void accept(); void reject(); diff --git a/src/VISU_I/VISU_DeformedShape_i.cc b/src/VISU_I/VISU_DeformedShape_i.cc index 7f9b4b7f..8c2920dc 100644 --- a/src/VISU_I/VISU_DeformedShape_i.cc +++ b/src/VISU_I/VISU_DeformedShape_i.cc @@ -169,19 +169,25 @@ void VISU::DeformedShape_i::SetMapScale(double theMapScale){ VISU_Actor* VISU::DeformedShape_i -::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +::CreateActor(const Handle(SALOME_InteractiveObject)& theIO, bool toSupressShrinking) { - VISU_Actor* anActor = VISU::ScalarMap_i::CreateActor(theIO); + VISU_Actor* anActor = VISU::ScalarMap_i::CreateActor(theIO, true); anActor->SetVTKMapping(false); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU", "deformed_shape_represent", 1); bool toShrink = aResourceMgr->booleanValue("VISU", "deformed_shape_shrink", false); anActor->SetRepresentation(aDispMode); - if (toShrink) anActor->SetShrink(); + if (toShrink && !toSupressShrinking) anActor->SetShrink(); anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B); return anActor; } +VISU_Actor* +VISU::DeformedShape_i +::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +{ + return CreateActor(theIO, false); +} void VISU::DeformedShape_i::UpdateActor(VISU_Actor* theActor) { if(VISU_ScalarMapAct* anActor = dynamic_cast(theActor)){ diff --git a/src/VISU_I/VISU_DeformedShape_i.hh b/src/VISU_I/VISU_DeformedShape_i.hh index c2e6777f..a19e9c85 100644 --- a/src/VISU_I/VISU_DeformedShape_i.hh +++ b/src/VISU_I/VISU_DeformedShape_i.hh @@ -91,6 +91,10 @@ namespace VISU{ VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + virtual + VISU_Actor* + CreateActor(const Handle(SALOME_InteractiveObject)& theIO, bool toSupressShrinking); + virtual void UpdateActor(VISU_Actor* theActor) ; }; } diff --git a/src/VISU_I/VISU_DumpPython.cc b/src/VISU_I/VISU_DumpPython.cc index dec25f6a..a5378c0a 100644 --- a/src/VISU_I/VISU_DumpPython.cc +++ b/src/VISU_I/VISU_DumpPython.cc @@ -967,11 +967,19 @@ namespace VISU case VISU::TCURVE: if(Curve_i* aServant = dynamic_cast(GetServant(anObj).in())) { - theStr << thePrefix << "aName2ObjectMap['" << aName << "'] = visu.CreateCurve(" << + bool withZ = aServant->GetZRow()>0; + + theStr << thePrefix << "aName2ObjectMap['" << aName << "'] = visu.CreateCurve"; + if( withZ ) + theStr << "WithZ"; + theStr << "(" << theArgumentName<< // table ","<GetHRow()<< // H row - ","<GetVRow()<< // V row - ",'"<GetTitle()<<"'"; // title + ","<GetVRow(); // V row + if( withZ ) + theStr << "," << aServant->GetZRow(); // Z row + + theStr << ",'"<GetTitle()<<"'"; // title SALOMEDS::Color aColor = aServant->GetColor(); theStr << ",SALOMEDS.Color("<< aColor.R<<","<integerValue( "VISU", "geom_sphere_face_limit", GetFaceLimit() ); SetFaceLimit( aFaceLimit ); - QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp"; + QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/visu/sprite_texture.bmp"; aMainTexture = aResourceMgr->stringValue( "VISU", "point_sprite_main_texture", aMainTexture ); - QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_alpha.bmp"; + QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/visu/sprite_alpha.bmp"; anAlphaTexture = aResourceMgr->stringValue( "VISU", "point_sprite_alpha_texture", anAlphaTexture ); SetTextures( aMainTexture, anAlphaTexture ); diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc index 172cb49b..a278a3a1 100644 --- a/src/VISU_I/VISU_Gen_i.cc +++ b/src/VISU_I/VISU_Gen_i.cc @@ -17,7 +17,7 @@ // 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_Gen_i.cc @@ -70,9 +70,9 @@ #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog) // QT Includes -#include +#include #include -#include +#include // VTK Includes #include @@ -88,6 +88,18 @@ #include "Utils_ExceptHandlers.hxx" #include "CASCatch.hxx" +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#define NO_CAS_CATCH +#endif + +#include + +#ifdef NO_CAS_CATCH +#include +#else +#include "CASCatch.hxx" +#endif + using namespace std; static QFileInfo aFileInfo; @@ -244,25 +256,85 @@ namespace VISU #ifndef _DEXCEPT_ try{ #endif - if(theColoredPrs3d->Create(theMeshName,theEntity,theFieldName,int(theIteration))) - return true; + if(theColoredPrs3d->Create(theMeshName,theEntity,theFieldName,int(theIteration))) + return true; #ifndef _DEXCEPT_ - }catch(std::exception& exc){ - INFOS("Follow exception was occured :\n"<GetMessageString()); - } + }CASCatch_CATCH(Standard_Failure){ + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + INFOS("Follow signal was occured :\n"<GetMessageString()); + } return false; - } + } VISU_Gen_i::~VISU_Gen_i(){ if(MYDEBUG) MESSAGE("VISU_Gen_i::~VISU_Gen_i"); } + + void CorrectSObjectType(SALOMEDS::SObject_ptr theSObject) + { + SALOMEDS::GenericAttribute_var anAttr; + if ( theSObject->FindAttribute(anAttr, "AttributeComment") ) { + SALOMEDS::AttributeComment_var aAttComment = SALOMEDS::AttributeComment::_narrow(anAttr); + if ( aAttComment ) { + string aValue = aAttComment->Value(); + if ( aValue.compare("") ) { + const QString aStr = QString( aValue.c_str() ); + VISU::Storable::TRestoringMap aMap; + Storable::StrToMap( aStr, aMap ); + + bool isFind = false; + QString aType = Storable::FindValue( aMap, "myType", &isFind ); + if ( isFind ) { + VISU::VISUType aVISUType = (VISU::VISUType)( aType.toInt() ); + QString aComment = Storable::FindValue( aMap, "myComment", &isFind ); + if ( isFind ) { + if ( !aComment.compare(QString("NONE")) ) aVISUType = VISU::TNONE; + else if ( !aComment.compare(QString("CURVE")) ) aVISUType = VISU::TCURVE; + else if ( !aComment.compare(QString("TABLE")) ) aVISUType = VISU::TTABLE; + else if ( !aComment.compare(QString("CONTAINER")) ) aVISUType = VISU::TCONTAINER; + else if ( !aComment.compare(QString("MESH")) ) aVISUType = VISU::TMESH; + else if ( !aComment.compare(QString("SCALARMAP")) ) aVISUType = VISU::TSCALARMAP; + else if ( !aComment.compare(QString("ISOSURFACE")) ) aVISUType = VISU::TISOSURFACE; + else if ( !aComment.compare(QString("DEFORMEDSHAPE")) ) aVISUType = VISU::TDEFORMEDSHAPE; + else if ( !aComment.compare(QString("SCALARMAPONDEFORMEDSHAPE")) ) aVISUType = VISU::TSCALARMAPONDEFORMEDSHAPE; + else if ( !aComment.compare(QString("GAUSSPOINTS")) ) aVISUType = VISU::TGAUSSPOINTS; + else if ( !aComment.compare(QString("PLOT3D")) ) aVISUType = VISU::TPLOT3D; + else if ( !aComment.compare(QString("CUTPLANES")) ) aVISUType = VISU::TCUTPLANES; + else if ( !aComment.compare(QString("CUTLINES")) ) aVISUType = VISU::TCUTLINES; + else if ( !aComment.compare(QString("VECTORS")) ) aVISUType = VISU::TVECTORS; + else if ( !aComment.compare(QString("STREAMLINES")) ) aVISUType = VISU::TSTREAMLINES; + else if ( !aComment.compare(QString("VISUGEN")) ) aVISUType = VISU::TVISUGEN; + else if ( !aComment.compare(QString("VIEWMANAGER")) ) aVISUType = VISU::TVIEWMANAGER; + else if ( !aComment.compare(QString("RESULT")) ) aVISUType = VISU::TRESULT; + else if ( !aComment.compare(QString("XYPLOT")) ) aVISUType = VISU::TXYPLOT; + else if ( !aComment.compare(QString("TABLEVIEW,")) ) aVISUType = VISU::TTABLEVIEW; + else if ( !aComment.compare(QString("VIEW3D")) ) aVISUType = VISU::TVIEW3D; + else if ( !aComment.compare(QString("GAUSSVIEW")) ) aVISUType = VISU::TGAUSSVIEW; + else if ( !aComment.compare(QString("ENTITY")) ) aVISUType = VISU::TENTITY; + else if ( !aComment.compare(QString("FAMILY")) ) aVISUType = VISU::TFAMILY; + else if ( !aComment.compare(QString("GROUP")) ) aVISUType = VISU::TGROUP; + else if ( !aComment.compare(QString("FIELD")) ) aVISUType = VISU::TFIELD; + else if ( !aComment.compare(QString("TIMESTAMP")) ) aVISUType = VISU::TTIMESTAMP; + else if ( !aComment.compare(QString("ANIMATION")) ) aVISUType = VISU::TANIMATION; + else if ( !aComment.compare(QString("ALL")) ) aVISUType = VISU::TALL; + else + if (MYDEBUG) MESSAGE("Error : Unknown type of VISU object!"); + } + QString aNewStr = aStr; + aAttComment->SetValue( aNewStr.replace( QRegExp( QString("myType=") + aType ) , + QString("myType=") + QString::number(aVISUType) ).latin1() ); + } + } + } + } + } + //=========================================================================== CORBA::Boolean VISU_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, const SALOMEDS::TMPFile & theStream, @@ -271,6 +343,13 @@ namespace VISU { Mutex mt(myMutex); SALOMEDS::Study_var aStudy = theComponent->GetStudy(); + + SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(theComponent); + for (anIter->InitEx(true); anIter->More(); anIter->Next()) { + SALOMEDS::SObject_var aSObject = anIter->Value(); + CorrectSObjectType(aSObject); + } + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); string aDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir(); TCollection_AsciiString aTmpDir (const_cast(aDir.c_str())); @@ -303,6 +382,7 @@ namespace VISU } return aString._retn(); } + //=========================================================================== SALOMEDS::TMPFile* VISU_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent, const char* theURL, @@ -332,13 +412,11 @@ namespace VISU std::string aFile = aFileInfo.filePath().latin1(); if(theIsMultiFile){ aFileName = SALOMEDS_Tool::GetNameFromPath(aStudy->URL()) + aFileName; - //std::ostringstream aStream; - QString aCommand; - aCommand.sprintf( " %s %s%s", aFile.c_str(), aTmpDir.c_str(), aFileName.c_str() ); - aCommand = QDir::convertSeparators( aCommand ); - aCommand.prepend( COPY_COMMAND ); - - if(system(aCommand.latin1())){ + + std::ostringstream aStream; + aStream<<"cp "<GetProperties()->IsLocked()) return Curve::_nil(); Mutex mt(myMutex); PortableServer::POA_ptr aPOA = GetPOA(); Table_i* pTable = dynamic_cast(aPOA->reference_to_servant(theTable)); - Curve_i* pPresent = new Curve_i(myStudyDocument,pTable,theHRow,theVRow); + Curve_i* pPresent = new Curve_i(myStudyDocument,pTable,theHRow,theVRow,theZRow); if(pPresent->Create() != NULL) return pPresent->_this(); else{ diff --git a/src/VISU_I/VISU_Gen_i.hh b/src/VISU_I/VISU_Gen_i.hh index 04870fc5..e2da330a 100644 --- a/src/VISU_I/VISU_Gen_i.hh +++ b/src/VISU_I/VISU_Gen_i.hh @@ -284,6 +284,12 @@ namespace VISU CreateCurve(Table_ptr theTable, CORBA::Long theHRow, CORBA::Long theVRow); + virtual + Curve_ptr + CreateCurveWithZ(Table_ptr theTable, + CORBA::Long theHRow, + CORBA::Long theVRow, + CORBA::Long theZRow); virtual Container_ptr diff --git a/src/VISU_I/VISU_Mesh_i.cc b/src/VISU_I/VISU_Mesh_i.cc index cdd8dc00..ababd507 100644 --- a/src/VISU_I/VISU_Mesh_i.cc +++ b/src/VISU_I/VISU_Mesh_i.cc @@ -247,24 +247,32 @@ VISU::Storable* VISU::Mesh_i::Build (int theRestoring) myType = VISU::TGROUP; if(MYDEBUG) MESSAGE("Mesh_i::Build - myType = "<GetInput()->GetMeshOnEntity(myMeshName,(VISU::TEntity)myEntity);//jfa IPAL9284 - aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d", - VISU::TENTITY,myMeshName.c_str(),myEntity); + aComment = ""; + aComment.append(aTmp.sprintf("myComment=ENTITY;myType=%d;",VISU::TENTITY)); + aComment.append("myMeshName=");aComment.append(myMeshName);aComment.append(";"); + aComment.append(aTmp.sprintf("myId=%d",myEntity)); break; case VISU::TFAMILY : anIDMapper = myResult->GetInput()->GetFamilyOnEntity(myMeshName,(VISU::TEntity)myEntity,mySubMeshName); - aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s", - VISU::TFAMILY,myMeshName.c_str(),myEntity,mySubMeshName.c_str()); + aComment = ""; + aComment.append(aTmp.sprintf("myComment=FAMILY;myType=%d;",VISU::TFAMILY)); + aComment.append("myMeshName=");aComment.append(myMeshName);aComment.append(";"); + aComment.append(aTmp.sprintf("myEntityId=%d;",myEntity)); + aComment.append("myName=");aComment.append(mySubMeshName); break; case VISU::TGROUP : anIDMapper = myResult->GetInput()->GetMeshOnGroup(myMeshName,mySubMeshName); - aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s", - VISU::TGROUP,myMeshName.c_str(),mySubMeshName.c_str()); + aComment = ""; + aComment.append(aTmp.sprintf("myComment=GROUP;myType=%d;",VISU::TGROUP)); + aComment.append("myMeshName=");aComment.append(myMeshName);aComment.append(";"); + aComment.append("myName=");aComment.append(mySubMeshName); + break; } if(!anIDMapper) diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 70d0e429..461b04f4 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -91,18 +91,36 @@ VISU::Prs3d_i } } +struct TRemoveActorsFromRendererEvent: public SALOME_Event +{ + typedef boost::signal0 TRemoveActorsFromRendererSignalType; + const TRemoveActorsFromRendererSignalType& myRemoveActorsFromRendererSignalVar; + + TRemoveActorsFromRendererEvent + (const TRemoveActorsFromRendererSignalType& theRemoveActorsFromRendererSignalVar): + myRemoveActorsFromRendererSignalVar(theRemoveActorsFromRendererSignalVar) + {} + + virtual + void + Execute() + { + myRemoveActorsFromRendererSignalVar(); + } +}; + VISU::Prs3d_i -::~Prs3d_i() +::~Prs3d_i() { if(MYDEBUG) MESSAGE("Prs3d_i::~Prs3d_i - this = "<Delete(); myResult->Destroy(); } //---------------------------------------------------------------------------- -VISU::Storable* +VISU::Storable* VISU::Prs3d_i ::Restore(const Storable::TRestoringMap& theMap) { @@ -125,7 +143,7 @@ VISU::Prs3d_i //---------------------------------------------------------------------------- -SALOMEDS::SObject_var +SALOMEDS::SObject_var VISU::Prs3d_i ::GetSObject() { @@ -137,25 +155,25 @@ VISU::Prs3d_i return mySObject; } -Result_i* +Result_i* VISU::Prs3d_i -::GetResult() const -{ +::GetResult() const +{ return myResult; } -const std::string& +const std::string& VISU::Prs3d_i -::GetMeshName() const -{ - return myMeshName; +::GetMeshName() const +{ + return myMeshName; } //---------------------------------------------------------------------------- void VISU::Prs3d_i -::Update() +::Update() { if(MYDEBUG) MESSAGE("Prs3d_i::Update - this = "<GetMapper(); vtkDataSet *aDataSet = aMapper->GetInput(); @@ -185,7 +203,7 @@ VISU::Prs3d_i void VISU::Prs3d_i -::RemoveFromStudy() +::RemoveFromStudy() { struct TRemoveFromStudy: public SALOME_Event { @@ -198,7 +216,7 @@ VISU::Prs3d_i myRemovable(theRemovable), myRemoveFromStudySignal(theRemoveFromStudySignal) {} - + virtual void Execute() @@ -213,21 +231,21 @@ VISU::Prs3d_i //---------------------------------------------------------------------------- -VISU_PipeLine* +VISU_PipeLine* VISU::Prs3d_i ::GetPipeLine() { return GetPL(); } -VISU_PipeLine* +VISU_PipeLine* VISU::Prs3d_i ::GetPL() { return myPipeLine; } -vtkUnstructuredGrid* +vtkUnstructuredGrid* VISU::Prs3d_i:: GetInput() { @@ -274,7 +292,7 @@ VISU::Prs3d_i void VISU::Prs3d_i -::RemoveActor(VISU_Actor* theActor) +::RemoveActor(VISU_Actor* theActor) { if(MYDEBUG) MESSAGE("Prs3d_i::RemoveActor - this = "<myDim); + aComment = ""; + aComment.append("myComment=MESH;"); + aComment.append("myName=");aComment.append(aMeshName);aComment.append(";"); + aComment.append(aTmp.sprintf("myDim=%d",aMesh->myDim)); aMesh->myEntry = CreateAttributes(theStudy, theResultEntry, @@ -423,8 +423,9 @@ namespace VISU aComment.latin1(), true); - aComment.sprintf("myComment=FAMILIES;myMeshName=%s", - aMeshName.c_str()); + aComment = ""; + aComment.append("myComment=FAMILIES;"); + aComment.append("myMeshName=");aComment.append(aMeshName); string aSubMeshesEntry = CreateAttributes(theStudy, aMesh->myEntry, @@ -477,10 +478,11 @@ namespace VISU continue; } - aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d", - VISU::TENTITY, - aMeshName.c_str(), - anEntity); + aComment = ""; + aComment.append(aTmp.sprintf("myComment=ENTITY;myType=%d;",VISU::TENTITY)); + aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";"); + aComment.append(aTmp.sprintf("myId=%d",anEntity)); + aMeshOnEntity->myEntry = CreateAttributes(theStudy, @@ -516,7 +518,7 @@ namespace VISU theInput->BuildGroups(); } - QString aComment; + QString aComment,aTmp; const TMeshMap& aMeshMap = theInput->GetMeshMap(); TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin(); for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){ @@ -537,11 +539,12 @@ namespace VISU for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){ const string& aFamilyName = aFamilyMapIter->first; const PFamily& aFamily = aFamilyMapIter->second; - aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s", - TFAMILY, - aMeshName.c_str(), - anEntity, - aFamilyName.c_str()); + aComment = ""; + aComment.append(aTmp.sprintf("myComment=FAMILY;myType=%d;",TFAMILY)); + aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";"); + aComment.append(aTmp.sprintf("myEntityId=%d;",anEntity)); + aComment.append("myName=");aComment.append(aFamilyName); + aFamily->myEntry = CreateAttributes(theStudy, aMeshOnEntity->myEntry, @@ -554,8 +557,9 @@ namespace VISU //Importing groups const TGroupMap& aGroupMap = aMesh->myGroupMap; if(!aGroupMap.empty()){ - aComment.sprintf("myComment=GROUPS;myMeshName=%s", - aMeshName.c_str()); + aComment = ""; + aComment.append("myComment=GROUPS;"); + aComment.append("myMeshName=");aComment.append(aMeshName); UpdateAttributes(theStudy, aMesh->myGroupsEntry, @@ -567,8 +571,11 @@ namespace VISU for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){ const string& aGroupName = aGroupMapIter->first; const PGroup& aGroup = aGroupMapIter->second; - aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s", - TGROUP,aMeshName.c_str(),aGroupName.c_str()); + aComment = ""; + aComment.sprintf("myComment=GROUP;myType=%d;", + TGROUP); + aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";"); + aComment.append("myName=");aComment.append(aGroupName); aGroup->myEntry = CreateAttributes(theStudy, aMesh->myGroupsEntry, @@ -615,7 +622,7 @@ namespace VISU theInput->BuildFields(); } - QString aComment; + QString aComment,aTmp; const TMeshMap& aMeshMap = theInput->GetMeshMap(); TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin(); for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){ @@ -636,9 +643,10 @@ namespace VISU TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin(); for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){ if(!anIsFieldsEntryUpdated){ - aComment.sprintf("myComment=FIELDS;myMeshName=%s", - aMeshName.c_str()); - + aComment = ""; + aComment.append("myComment=FIELDS;"); + aComment.append("myMeshName=");aComment.append(aMeshName); + UpdateAttributes(theStudy, aMesh->myFieldsEntry, "", @@ -651,13 +659,13 @@ namespace VISU const PField& aField = aFieldMapIter->second; const TValField& aValField = aField->myValField; QString aFieldNameWithUnit = GenerateFieldName(aFieldName,aField->myUnitNames[0]); - aComment.sprintf("myComment=FIELD;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s;myNbTimeStamps=%d;myNumComponent=%d", - TFIELD, - aMeshName.c_str(), - anEntity, - aFieldName.c_str(), - aValField.size(), - aField->myNbComp); + aComment = ""; + aComment.sprintf("myComment=FIELD;myType=%d;",TFIELD); + aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";"); + aComment.append(aTmp.sprintf("myEntityId=%d;",anEntity)); + aComment.append("myName=");aComment.append(aFieldName);aComment.append(";"); + aComment.append(aTmp.sprintf("myNbTimeStamps=%d;",aValField.size())); + aComment.append(aTmp.sprintf("myNumComponent=%d",aField->myNbComp)); aField->myEntry = CreateAttributes(theStudy, aMesh->myFieldsEntry, @@ -672,13 +680,13 @@ namespace VISU for(; aValFieldIter != aValField.end(); aValFieldIter++){ int aTimeStamp = aValFieldIter->first; const PValForTime& aValForTime = aValFieldIter->second; - aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d", - TTIMESTAMP, - aMeshName.c_str(), - anEntity, - aFieldName.c_str(), - aTimeStamp, - aField->myNbComp); + aComment = ""; + aComment.sprintf("myComment=TIMESTAMP;myType=%d;",TTIMESTAMP); + aComment.append("myMeshName=");aComment.append(aMeshName);aComment.append(";"); + aComment.append(aTmp.sprintf("myEntityId=%d;",anEntity)); + aComment.append("myFieldName=");aComment.append(aFieldName);aComment.append(";"); + aComment.append(aTmp.sprintf("myTimeStampId=%d;myNumComponent=%d",aTimeStamp,aField->myNbComp)); + string aTimeStampId = VISU_Convertor::GenerateName(aValForTime->myTime); aValForTime->myEntry = CreateAttributes(theStudy, @@ -1480,9 +1488,9 @@ VISU::Result_i if(aCreationId == eImportMed || aCreationId == eImportMedField) aSourceId = eRestoredComponent; - CORBA::Boolean anIsBuildFields = Storable::FindValue(theMap,"myIsBuildFields","0").toInt(); - CORBA::Boolean anIsBuildMinMax = Storable::FindValue(theMap,"myIsBuildMinMax","0").toInt(); - CORBA::Boolean anIsBuildGroups = Storable::FindValue(theMap,"myIsBuildGroups","0").toInt(); + CORBA::Boolean anIsBuildFields = Storable::FindValue(theMap,"myIsBuildFields","1").toInt(); + CORBA::Boolean anIsBuildMinMax = Storable::FindValue(theMap,"myIsBuildMinMax","1").toInt(); + CORBA::Boolean anIsBuildGroups = Storable::FindValue(theMap,"myIsBuildGroups","1").toInt(); VISU::Result_i* aResult = new VISU::Result_i(aStudy, aSourceId, @@ -1541,7 +1549,7 @@ VISU::Result_i return FindEntryWithComment(myStudyDocument,GetEntry().c_str(),theComment.c_str()); } - +#include //--------------------------------------------------------------- VISU::Result_i ::~Result_i() @@ -1554,14 +1562,17 @@ VISU::Result_i #else aCommand.sprintf("del /F %s",myFileInfo.filePath().latin1()); #endif - MESSAGE("Result_i::~Result_i - system("<integerValue("VISU", "scalar_def_represent", 2); bool toShrink = aResourceMgr->booleanValue("VISU", "scalar_def_shrink", false); diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index 2a26f380..e56862cf 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -304,7 +304,7 @@ VISU::ScalarMap_i //---------------------------------------------------------------------------- VISU_Actor* VISU::ScalarMap_i -::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +::CreateActor(const Handle(SALOME_InteractiveObject)& theIO, bool toSupressShrinking) { VISU_ScalarMapAct* anActor = VISU_ScalarMapAct::New(); try{ @@ -315,7 +315,7 @@ VISU::ScalarMap_i bool toShrink = aResourceMgr->booleanValue("VISU", "scalar_map_shrink", false); bool toUseShading = aResourceMgr->booleanValue("VISU", "represent_shading", false); anActor->SetRepresentation(aDispMode); - if (toShrink) anActor->SetShrink(); + if (toShrink && !toSupressShrinking) anActor->SetShrink(); anActor->SetShading(toUseShading); UpdateActor(anActor); }catch(...){ @@ -325,6 +325,13 @@ VISU::ScalarMap_i return anActor; } +VISU_Actor* +VISU::ScalarMap_i +::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +{ + return CreateActor(theIO, false); +} + void VISU::ScalarMap_i ::UpdateActor(VISU_Actor* theActor) diff --git a/src/VISU_I/VISU_ScalarMap_i.hh b/src/VISU_I/VISU_ScalarMap_i.hh index c3999cca..a6652fa5 100644 --- a/src/VISU_I/VISU_ScalarMap_i.hh +++ b/src/VISU_I/VISU_ScalarMap_i.hh @@ -150,6 +150,10 @@ namespace VISU virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + + virtual + VISU_Actor* + CreateActor(const Handle(SALOME_InteractiveObject)& theIO, bool toSupressShrinking); virtual void diff --git a/src/VISU_I/VISU_StreamLines_i.cc b/src/VISU_I/VISU_StreamLines_i.cc index 8bf6fa27..7aa8273b 100644 --- a/src/VISU_I/VISU_StreamLines_i.cc +++ b/src/VISU_I/VISU_StreamLines_i.cc @@ -271,7 +271,7 @@ VISU_Actor* VISU::StreamLines_i ::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) { - if(VISU_Actor* anActor = VISU::DeformedShape_i::CreateActor(theIO)){ + if(VISU_Actor* anActor = VISU::DeformedShape_i::CreateActor(theIO, true)){ anActor->SetVTKMapping(true); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU", "stream_lines_represent", 1); diff --git a/src/VISU_I/VISU_Table_i.cc b/src/VISU_I/VISU_Table_i.cc index 4713feda..cb642126 100644 --- a/src/VISU_I/VISU_Table_i.cc +++ b/src/VISU_I/VISU_Table_i.cc @@ -329,8 +329,11 @@ const char* VISU::Curve_i::GetComment() const Constructor NB : theHRow, theVRow are the indexes of rows in the Table object and numbered from the 1 to GetNbRows() */ -VISU::Curve_i::Curve_i(SALOMEDS::Study_ptr theStudy, Table_i* theTable, CORBA::Long theHRow, CORBA::Long theVRow ) - : PrsObject_i(theStudy), myTable( theTable ), myHRow( theHRow ), myVRow( theVRow ) +VISU::Curve_i::Curve_i( SALOMEDS::Study_ptr theStudy, Table_i* theTable, + CORBA::Long theHRow, CORBA::Long theVRow, + CORBA::Long theZRow ) +: PrsObject_i(theStudy), myTable( theTable ), myHRow( theHRow ), + myVRow( theVRow ), myZRow( theZRow ) { myAuto = true; myLine = VISU::Curve::SOLIDLINE; @@ -533,7 +536,7 @@ string VISU::Curve_i::GetVerUnits() /*! Gets curve data */ -int VISU::Curve_i::GetData( double*& theHorList, double*& theVerList ) +int VISU::Curve_i::GetData( double*& theHorList, double*& theVerList, QStringList& zList ) { theHorList = 0; theVerList = 0; // getting table SObject by it's entry @@ -542,10 +545,13 @@ int VISU::Curve_i::GetData( double*& theHorList, double*& theVerList ) SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeTableOfInteger_var anInt; SALOMEDS::AttributeTableOfReal_var aReal; + + QString tip = "%1: %2", z_data; + if ( !SO->_is_nil() ) { if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) { anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr ); - int nbCols = anInt->GetNbColumns() ; + int nbCols = anInt->GetNbColumns(), nbRows = anInt->GetNbRows(); if ( nbCols > 0 && myHRow > 0 && myHRow <= anInt->GetNbRows() && myVRow > 0 && myVRow <= anInt->GetNbRows() ) { int nbPoints = 0; for ( int j = 1; j <= nbCols; j++ ) { @@ -556,10 +562,24 @@ int VISU::Curve_i::GetData( double*& theHorList, double*& theVerList ) theHorList = new double[ nbPoints ]; theVerList = new double[ nbPoints ]; int k = 0; + + SALOMEDS::StringSeq_var rowTitles = anInt->GetRowTitles(); + for ( int j = 1; j <= nbCols; j++ ) { if ( anInt->HasValue( myHRow, j ) && anInt->HasValue( myVRow, j ) ) { theHorList[k] = anInt->GetValue( myHRow, j ); theVerList[k] = anInt->GetValue( myVRow, j ); + + z_data = tip.arg( GetHorTitle().c_str() ).arg( theHorList[k] ) + "\n"; + z_data += tip.arg( GetVerTitle().c_str() ).arg( theVerList[k] ); + + if( myZRow>0 && myZRow<=nbRows && anInt->HasValue( myZRow, j ) ) + { + string title; + title = rowTitles[ myZRow-1 ]; + z_data += "\n" + tip.arg( title.c_str() ).arg( anInt->GetValue( myZRow, j ) ); + } + zList.append( z_data ); k++; } } @@ -569,7 +589,7 @@ int VISU::Curve_i::GetData( double*& theHorList, double*& theVerList ) } else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) { aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr ); - int nbCols = aReal->GetNbColumns() ; + int nbCols = aReal->GetNbColumns(), nbRows = aReal->GetNbRows(); if ( nbCols > 0 && myHRow > 0 && myHRow <= aReal->GetNbRows() && myVRow > 0 && myVRow <= aReal->GetNbRows() ) { int nbPoints = 0; for ( int j = 1; j <= nbCols; j++ ) { @@ -580,10 +600,24 @@ int VISU::Curve_i::GetData( double*& theHorList, double*& theVerList ) theHorList = new double[ nbPoints ]; theVerList = new double[ nbPoints ]; int k = 0; + + SALOMEDS::StringSeq_var rowTitles = aReal->GetRowTitles(); + for ( int j = 1; j <= nbCols; j++ ) { if ( aReal->HasValue( myHRow, j ) && aReal->HasValue( myVRow, j ) ) { theHorList[k] = aReal->GetValue( myHRow, j ); theVerList[k] = aReal->GetValue( myVRow, j ); + + z_data = tip.arg( GetHorTitle().c_str() ).arg( theHorList[k] ) + "\n"; + z_data += tip.arg( GetVerTitle().c_str() ).arg( theVerList[k] ); + + if( myZRow>0 && myZRow<=nbRows && aReal->HasValue( myZRow, j ) ) + { + string title; + title = rowTitles[ myZRow-1 ]; + z_data += "\n" + tip.arg( title.c_str() ).arg( aReal->GetValue( myZRow, j ) ); + } + zList.append( z_data ); k++; } } @@ -611,9 +645,10 @@ SPlot2d_Curve* VISU::Curve_i::CreatePresentation() crv->setVerUnits( GetVerUnits().c_str() ); double* xList = 0; double* yList = 0; - int nbPoints = GetData( xList, yList ); + QStringList zList; + int nbPoints = GetData( xList, yList, zList ); if ( nbPoints > 0 && xList && yList ) { - crv->setData( xList, yList, nbPoints ); + crv->setData( xList, yList, nbPoints, zList ); } //cout << "********** Number of points: " << nbPoints <GetStudy(); VISU::Table_i* pTable = GetTable(aStudy, theSObject->GetFather()); if( pTable != NULL ) { - VISU::Curve_i* pResent = new VISU::Curve_i( aStudy, pTable, 0, 0 ); + VISU::Curve_i* pResent = new VISU::Curve_i( aStudy, pTable, 0, 0, 0 ); return pResent->Restore( theMap, theSObject); } return NULL; diff --git a/src/VISU_I/VISU_Table_i.hh b/src/VISU_I/VISU_Table_i.hh index 5ba1efc3..fa899f04 100644 --- a/src/VISU_I/VISU_Table_i.hh +++ b/src/VISU_I/VISU_Table_i.hh @@ -90,7 +90,8 @@ namespace VISU{ Curve_i(); Curve_i( const Curve_i& ); public: - Curve_i( SALOMEDS::Study_ptr theStudy, Table_i* theTable, CORBA::Long theHRow, CORBA::Long theVRow ); + Curve_i( SALOMEDS::Study_ptr theStudy, Table_i* theTable, + CORBA::Long theHRow, CORBA::Long theVRow, CORBA::Long theZRow ); virtual ~Curve_i(); virtual VISU::VISUType GetType() { return VISU::TCURVE;}; @@ -119,6 +120,7 @@ namespace VISU{ Table_i* myTable; int myHRow; int myVRow; + int myZRow; struct SALOMEDS::Color myColor; VISU::Curve::MarkerType myMarker; VISU::Curve::LineType myLine; @@ -132,6 +134,7 @@ namespace VISU{ int GetHRow() const { return myHRow;} int GetVRow() const { return myVRow;} + int GetZRow() const { return myZRow;} virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr theSO); @@ -151,7 +154,7 @@ namespace VISU{ virtual std::string GetVerTitle(); virtual std::string GetHorUnits(); virtual std::string GetVerUnits(); - virtual int GetData( double*& theHorList, double*& theVerList ); + virtual int GetData( double*& theHorList, double*& theVerList, QStringList& ); virtual SPlot2d_Curve* CreatePresentation(); }; diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index ad6239f3..82d68a19 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -70,6 +70,18 @@ #include #include +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#define NO_CAS_CATCH +#endif + +#include + +#ifdef NO_CAS_CATCH +#include +#else +#include "CASCatch.hxx" +#endif + using namespace std; @@ -116,7 +128,7 @@ VISU_TimeAnimation::~VISU_TimeAnimation() for (int i = 0; i < getNbFields(); i++) { clearData(myFieldsLst[i]); } - clearFieldData(); + /* Terminates the execution of the thread. * The thread may or may not be terminated immediately, * depending on the operating system's scheduling policies. @@ -241,23 +253,39 @@ namespace bool anIsCreated = false; TPrs3d* aPresent = new TPrs3d(theResult, false); - CASCatch_TRY{ - try{ - if(aPresent->Create(aMeshName.latin1(),anEntity,aFieldName.latin1(),aTimeStampId)){ - anIsCreated = true; - theData.myPrs[aFrameId++] = aPresent; - aMin = std::min(aPresent->GetMin(), aMin); - aMax = std::max(aPresent->GetMax(), aMax); - } - }catch(std::exception& exc){ - INFOS("Follow exception was occured :\n"<GetMessageString()); +#ifdef NO_CAS_CATCH + try{ + OCC_CATCH_SIGNALS; +#else + CASCatch_TRY{ + try{ +#endif + if(aPresent->Create(aMeshName.latin1(),anEntity,aFieldName.latin1(),aTimeStampId)){ + anIsCreated = true; + theData.myPrs[aFrameId++] = aPresent; + aMin = std::min(aPresent->GetMin(), aMin); + aMax = std::max(aPresent->GetMax(), aMax); + } +#ifdef NO_CAS_CATCH + }catch(Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + INFOS("Follow signal was occured :\n"<GetMessageString()); + }catch(std::exception& exc){ + INFOS("Follow exception was occured :\n"<GetMessageString()); } +#endif if(!anIsCreated) aPresent->_remove_ref(); } @@ -665,73 +693,59 @@ void VISU_TimeAnimation::run() // We must unlock mutex for some time before grabbing to allow view updating qApp->unlock(); msleep(delay); - if (!myIsActive) { - emit stopped(); - return; - } qApp->lock(); if(!(myFieldsLst[0].myField)) // break, if field was deleted. - break; + break; if (myDumpFormat.compare("AVI") != 0) { - QString aFile(myDumpPath); - QString aName = QString("%1").arg(myFieldsLst[0].myTiming[myFrame]); - int aPos = -1; - while ((aPos = aName.find(".")) > -1 ) - aName.replace(aPos, 1, "_"); - aFile += aName; - aFile += "."; - aFile += myDumpFormat.lower(); - myView->dumpViewToFormat(aFile,myDumpFormat); - } - else - { - QFileInfo aFileInfo(myDumpPath); - QString aDirPath = aFileInfo.dirPath(true); - QString aBaseName = aFileInfo.fileName(); - - switch (myFrame) { - case 0: - break; - case 1: - myFileIndex += 5; - break; - default: - if (myProportional) { - double p = (myFieldsLst[0].myTiming[myFrame] - - myFieldsLst[0].myTiming[myFrame-1]) / aOneVal; - myFileIndex += (long) (5*p); - } else { - myFileIndex += 5; - } - } - - QString aFile = aDirPath + QDir::separator() + aBaseName; - aFile += "_"; - aFile += QString("%1").arg(myFileIndex).rightJustify(8, '0'); -#ifndef WNT - aFile += ".jpeg"; -#else - aFile += ".bmp"; -#endif + QString aFile(myDumpPath); + QString aName = QString("%1").arg(myFieldsLst[0].myTiming[myFrame]); + int aPos = -1; + while ((aPos = aName.find(".")) > -1 ) + aName.replace(aPos, 1, "_"); + aFile += aName; + aFile += "."; + aFile += myDumpFormat.lower(); + myView->dumpViewToFormat(aFile,myDumpFormat); + } else { + QFileInfo aFileInfo(myDumpPath); + QString aDirPath = aFileInfo.dirPath(true); + QString aBaseName = aFileInfo.fileName(); - /* check image size is divisable 16 - myView->dumpViewToFormat(aFile,"JPEG"); - */ - SUIT_ViewWindow* aView = myView; - QImage img = aView->dumpView(); - if (!img.isNull()) { - int width = img.width(); width = (width/16)*16; - int height = img.height(); height = (height/16)*16; - QImage copy = img.copy(0, 0, width, height); -#ifndef WNT - if (copy.save(aFile, "JPEG")) { -#else - if (copy.save(aFile, "BMP")) { -#endif - anIndexList.append(myFileIndex); - aNbFiles++; - } - } + switch (myFrame) { + case 0: + break; + case 1: + myFileIndex += 5; + break; + default: + if (myProportional) { + double p = (myFieldsLst[0].myTiming[myFrame] - + myFieldsLst[0].myTiming[myFrame-1]) / aOneVal; + myFileIndex += (long) (5*p); + } else { + myFileIndex += 5; + } + } + + QString aFile = aDirPath + QDir::separator() + aBaseName; + aFile += "_"; + aFile += QString("%1").arg(myFileIndex).rightJustify(8, '0'); + aFile += ".jpeg"; + + /* check image size is divisable 16 + myView->dumpViewToFormat(aFile,"JPEG"); + */ + SUIT_ViewWindow* aView = myView; + QImage img = aView->dumpView(); + if (!img.isNull()) { + int width = img.width(); width = (width/16)*16; + int height = img.height(); height = (height/16)*16; + QImage copy = img.copy(0, 0, width, height); + if (copy.save(aFile, "JPEG")) { + anIndexList.append(myFileIndex); + aNbFiles++; + } + } } } @@ -750,33 +764,28 @@ void VISU_TimeAnimation::run() } // make AVI file if need - if (isDumping && myDumpFormat.compare("AVI") == 0) - { + if (isDumping && myDumpFormat.compare("AVI") == 0) { double aFPS = 17.3 * mySpeed; QFileInfo aFileInfo(myDumpPath); QString aDirPath = aFileInfo.dirPath(true); QString aBaseName = aFileInfo.fileName(); -#ifndef WNT // add missing files - if (anIndexList.count() > 1) - { + if (anIndexList.count() > 1) { QString aFFile = aDirPath + QDir::separator() + aBaseName; aFFile += QString("_%1.jpeg"); int aStartIndex = anIndexList[0], anEndIndex; - for (int i = 1; i < anIndexList.count(); i++) - { - anEndIndex = anIndexList[i]; - QString aCurFile = aFFile.arg(QString::number(aStartIndex).rightJustify(8, '0')); - QStringList aCommands; - for (int j = aStartIndex+1; j < anEndIndex; j++) - { - QString aFile = aFFile.arg(QString::number(j).rightJustify(8, '0')); - aCommands.append(QString("ln -s %1 %2").arg(aCurFile).arg(aFile)); - } - system(aCommands.join(" ; \\\n").latin1()); - aStartIndex = anEndIndex; + for (int i = 1; i < anIndexList.count(); i++) { + anEndIndex = anIndexList[i]; + QString aCurFile = aFFile.arg(QString::number(aStartIndex).rightJustify(8, '0')); + QStringList aCommands; + for (int j = aStartIndex+1; j < anEndIndex; j++) { + QString aFile = aFFile.arg(QString::number(j).rightJustify(8, '0')); + aCommands.append(QString("ln -s %1 %2").arg(aCurFile).arg(aFile)); + } + system(aCommands.join(" ; \\\n").latin1()); + aStartIndex = anEndIndex; } } @@ -803,114 +812,6 @@ void VISU_TimeAnimation::run() aCmd += " | xargs rm"; aCmd += " )"; system(aCmd.latin1()); -#else - - //create avi file - IAVIFile *pfile; - AVIFileInit(); - HRESULT hr = AVIFileOpen( &pfile, myDumpPath.latin1(), OF_WRITE|OF_CREATE, NULL ); - if ( hr!=AVIERR_OK ) - { - AVIFileExit(); - QMessageBox::information( NULL, "INFO", "Can't Open Avi file", 1 ); - } - - if (anIndexList.count() > 1) - { - QString aFFile = aDirPath + QDir::separator() + aBaseName; - aFFile += QString("_%1.bmp"); - int aStartIndex = anIndexList[0], anEndIndex; - - QImage anImage; - - IAVIStream *ps = 0; - IAVIStream *psCompressed = 0; - int index = 0; - - QStringList FileToDelete; - - for (int i = 1; i < anIndexList.count(); i++) - { - anEndIndex = anIndexList[i]; - QString aCurFile = aFFile.arg(QString::number(aStartIndex).rightJustify(8, '0')); - - //load current image - HBITMAP hbm=(HBITMAP)LoadImage(NULL,aCurFile.latin1(),IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION ); - - DIBSECTION dibs; int sbm = GetObject(hbm,sizeof(dibs),&dibs); - if ( sbm == 0 ) - { - AVIFileExit(); - QMessageBox::information( NULL, "INFO", "BAD Param DIB", 1 ); - } - - for (int j = aStartIndex+1; j < anEndIndex; j++) - { - // if no avi stream - create it - if ( !ps ) - { - AVISTREAMINFO strhdr; ZeroMemory( &strhdr, sizeof( strhdr ) ); - strhdr.fccType = streamtypeVIDEO;// stream type - strhdr.fccHandler = 0; - strhdr.dwScale = 10; - strhdr.dwRate = 173 * mySpeed; - strhdr.dwSuggestedBufferSize = dibs.dsBmih.biSizeImage; - SetRect(&strhdr.rcFrame, 0, 0, dibs.dsBmih.biWidth, dibs.dsBmih.biHeight); - hr=AVIFileCreateStream( pfile, &ps, &strhdr ); - if ( hr!=AVIERR_OK ) - { - AVIFileExit(); - QMessageBox::information( NULL, "INFO", "Can't create video stream", 1 ); - break; - } - } - // if no avi compressed stream - create it - if ( !psCompressed ) - { - AVICOMPRESSOPTIONS opts; ZeroMemory( &opts, sizeof( opts ) ); - opts.fccHandler=mmioFOURCC('C','V','I','D'); - //opts.fccHandler=mmioFOURCC('M','P','4','2'); - //opts.dwQuality = -1; - hr = AVIMakeCompressedStream( &psCompressed, ps, &opts, NULL ); - if ( hr != AVIERR_OK ) - { - AVIFileExit(); - QMessageBox::information( NULL, "INFO", "Can't create video compressed stream", 1 ); - break; - } - hr = AVIStreamSetFormat( psCompressed, 0, &dibs.dsBmih, dibs.dsBmih.biSize+dibs.dsBmih.biClrUsed*sizeof(RGBQUAD)); - if ( hr != AVIERR_OK ) - { - AVIFileExit(); - QMessageBox::information( NULL, "INFO", "Can't set format to compressed stream", 1 ); - break; - } - } - // add image to avi stream - hr = AVIStreamWrite( psCompressed, index, 1, dibs.dsBm.bmBits, dibs.dsBmih.biSizeImage, AVIIF_KEYFRAME, NULL, NULL); - if ( hr!=AVIERR_OK ) - { - AVIFileExit(); - QMessageBox::information( NULL, "INFO", "Can't add frame to stream ", 1 ); - break; - } - index++; - - } - aStartIndex = anEndIndex; - FileToDelete.append( aCurFile ); - } - - // close all streams and avi file - AVIStreamRelease( psCompressed ); - AVIStreamRelease( ps ); - AVIFileRelease( pfile ); - AVIFileExit(); - - //delete temporary pictures (bmp) - system( QDir::convertSeparators(QString( "del %1_* /f /q" ).arg( myDumpPath )).latin1() ); - } -#endif } emit stopped(); @@ -984,7 +885,6 @@ std::string VISU_TimeAnimation::setDumpFormat(const char* theFormat) //------------------------------------------------------------------------ bool VISU_TimeAnimation::checkAVIMaker() const { -#ifndef WNT QStrList aDumpFormats = QImageIO::outputFormats(); if (aDumpFormats.find("JPEG") < 0) return false; @@ -993,9 +893,6 @@ bool VISU_TimeAnimation::checkAVIMaker() const aCmd += " >& /dev/null"; int iErr = system(aCmd.latin1()); return (iErr == 0); -#else - return true; -#endif } //************************************************************************ diff --git a/src/VISU_I/VISU_Vectors_i.cc b/src/VISU_I/VISU_Vectors_i.cc index 1ab9c254..c8bd8a59 100644 --- a/src/VISU_I/VISU_Vectors_i.cc +++ b/src/VISU_I/VISU_Vectors_i.cc @@ -198,7 +198,9 @@ VISU_Actor* VISU::Vectors_i::CreateActor(const Handle(SALOME_InteractiveObject)& anActor->GetProperty()->SetLineWidth(GetLineWidth()); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU", "vectors_represent", 1); + bool toUseShading = aResourceMgr->booleanValue("VISU", "represent_shading", false); anActor->SetRepresentation(aDispMode); + anActor->SetShading(toUseShading); UpdateActor(anActor); }catch(...){ anActor->Delete(); diff --git a/src/VISU_I/VISU_ViewManager_i.cc b/src/VISU_I/VISU_ViewManager_i.cc index 29c69d21..cb6425f4 100644 --- a/src/VISU_I/VISU_ViewManager_i.cc +++ b/src/VISU_I/VISU_ViewManager_i.cc @@ -360,9 +360,10 @@ namespace VISU { aSPlot2dC->setVerUnits( theCurve->GetVerUnits().c_str() ); double* xList = 0; double* yList = 0; - int nbPoints = theCurve->GetData( xList, yList ); + QStringList zList; + int nbPoints = theCurve->GetData( xList, yList, zList ); if (nbPoints > 0 && xList && yList) { - aSPlot2dC->setData( xList, yList, nbPoints ); + aSPlot2dC->setData( xList, yList, nbPoints, zList ); } if (!theCurve->IsAuto()) { aSPlot2dC->setLine((Plot2d_Curve::LineType)theCurve->GetLine(), @@ -408,9 +409,10 @@ namespace VISU { aSPlot2dC->setVerUnits( theCurve->GetVerUnits().c_str() ); double* xList = 0; double* yList = 0; - int nbPoints = theCurve->GetData( xList, yList ); + QStringList zList; + int nbPoints = theCurve->GetData( xList, yList, zList ); if ( nbPoints > 0 && xList && yList ) { - aSPlot2dC->setData( xList, yList, nbPoints ); + aSPlot2dC->setData( xList, yList, nbPoints, zList ); } if ( !theCurve->IsAuto() ) { aSPlot2dC->setLine((Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth()); diff --git a/src/VISU_I/VISU_View_i.cc b/src/VISU_I/VISU_View_i.cc index 22adc03a..894b76fc 100644 --- a/src/VISU_I/VISU_View_i.cc +++ b/src/VISU_I/VISU_View_i.cc @@ -156,9 +156,14 @@ namespace VISU { myApplication->setWindowShown(SalomeApp_Application::WT_LogWindow,myState); break; case VISU::View::VIEWER:{ - ViewManagerList aViewManagerList = myApplication->viewManagers(); - // to do something - // ... + ViewManagerList mgrs = myApplication->viewManagers(); + ViewManagerList::const_iterator anIt = mgrs.begin(), aLast = mgrs.end(); + for( ; anIt!=aLast; anIt++ ) + { + const QPtrVector& views = (*anIt)->getViews(); + for( int i=0; isetShown( myState ); + } break; }} } diff --git a/src/VISU_I/VISU_View_i.hh b/src/VISU_I/VISU_View_i.hh index c0c4e505..d57c2965 100644 --- a/src/VISU_I/VISU_View_i.hh +++ b/src/VISU_I/VISU_View_i.hh @@ -259,7 +259,7 @@ namespace VISU static void SetFocalPoint (SUIT_ViewWindow* theViewWindow, const CORBA::Double theFocalPnt[3]); virtual void SetFocalPoint (const VISU::View3D::XYZ theCoord); - static void View3D_i::GetFocalPoint (SUIT_ViewWindow* theViewWindow, CORBA::Double theFocalPnt[3]); + static void GetFocalPoint (SUIT_ViewWindow* theViewWindow, CORBA::Double theFocalPnt[3]); virtual VISU::View3D::XYZ_slice* GetFocalPoint(); static void SetParallelScale (SUIT_ViewWindow* theViewWindow, CORBA::Double theScale); diff --git a/src/VISU_SWIG/Makefile.in b/src/VISU_SWIG/Makefile.in index 384afc38..98950247 100644 --- a/src/VISU_SWIG/Makefile.in +++ b/src/VISU_SWIG/Makefile.in @@ -42,7 +42,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_delete.py \ - visu_swig_test.py test_events.py batch_test_events.py visu_split_views.py \ + visu_swig_test.py visu_split_views.py \ VISU_Example_01.py VISU_Example_02.py VISU_Example_03.py VISU_Example_04.py \ VISU_Example_05.py VISU_Example_06.py VISU_Example_07.py EXPORT_SHAREDPYSCRIPTS = VISU_shared_modules.py diff --git a/src/VISU_SWIG/libVISU_Swig.i b/src/VISU_SWIG/libVISU_Swig.i index 280bb30d..21bf5475 100644 --- a/src/VISU_SWIG/libVISU_Swig.i +++ b/src/VISU_SWIG/libVISU_Swig.i @@ -17,7 +17,7 @@ // 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -32,6 +32,26 @@ %} +/* + managing C++ exception in the Python API +*/ +%exception +{ + class PyAllowThreadsGuard { + public: + // Py_BEGIN_ALLOW_THREADS + PyAllowThreadsGuard() { _save = PyEval_SaveThread(); } + // Py_END_ALLOW_THREADS + ~PyAllowThreadsGuard() { PyEval_RestoreThread(_save); } + private: + PyThreadState *_save; + }; + + PyAllowThreadsGuard guard; + + $action +} + class Convertor{ public: Convertor(){}; @@ -51,4 +71,4 @@ public: View3D(); void Display(ScalarMap* theScalarMap); void SetPosition(int theX, int theY); -}; \ No newline at end of file +}; diff --git a/src/VISU_SWIG/visu.py b/src/VISU_SWIG/visu.py index 2d8b23bb..15d5b7fe 100644 --- a/src/VISU_SWIG/visu.py +++ b/src/VISU_SWIG/visu.py @@ -152,7 +152,7 @@ def CreateStudyForMed(theVisu, theFileName) : print "OK" return [aStudy, myViewManager, myView] - raise RuntimeError, "Error: There is no shuch file." + raise RuntimeError, "Error: There is no such file." def getMedSObject(theStudy = myLocalStudy ): if theStudy is None: diff --git a/src/VVTK/VVTK_MainWindow.cxx b/src/VVTK/VVTK_MainWindow.cxx index 18f4ef48..63cf2bc0 100644 --- a/src/VVTK/VVTK_MainWindow.cxx +++ b/src/VVTK/VVTK_MainWindow.cxx @@ -155,6 +155,10 @@ VVTK_MainWindow::~VVTK_MainWindow() //---------------------------------------------------------------------------- void VVTK_MainWindow::onDumpView() { + QImage img = dumpView(); + if( img.isNull() ) + return; + SUIT_Application* app = SUIT_Session::session()->activeApplication(); QString fileName = app->getFileName( false, QString::null, tr( "TLT_IMAGE_FILES" ), @@ -162,10 +166,6 @@ void VVTK_MainWindow::onDumpView() if( fileName.isEmpty() ) return; - QImage img = dumpView(); - if( img.isNull() ) - return; - QString fmt = SUIT_Tools::extension( fileName ).upper(); if( fmt.isEmpty() ) fmt = QString( "BMP" ); // default format @@ -245,7 +245,7 @@ VVTK_MainWindow if ( accelAction == SUIT_Accel::ZoomFit ) onFitAll(); else { - int anEvent = convertAction( accelAction ); + int anEvent = SVTK::convertAction( accelAction ); InvokeEvent( anEvent, 0 ); } } diff --git a/src/VVTK/VVTK_PickingDlg.cxx b/src/VVTK/VVTK_PickingDlg.cxx index 602d19ba..e59a57e9 100644 --- a/src/VVTK/VVTK_PickingDlg.cxx +++ b/src/VVTK/VVTK_PickingDlg.cxx @@ -413,3 +413,16 @@ void VVTK_PickingDlg::onColorButtonPressed() if( aColor.isValid() ) mySelectionColorButton->setPaletteBackgroundColor( aColor ); } + +void VVTK_PickingDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onClickHelp(); + } +} diff --git a/src/VVTK/VVTK_PickingDlg.h b/src/VVTK/VVTK_PickingDlg.h index 9cd68798..81b2576c 100644 --- a/src/VVTK/VVTK_PickingDlg.h +++ b/src/VVTK/VVTK_PickingDlg.h @@ -89,6 +89,7 @@ private: void* theCallData); void KeyPressed(); + void keyPressEvent( QKeyEvent* e ); private: QtxDblSpinBox* myCursorSizeSpinBox; diff --git a/src/VVTK/VVTK_PrimitiveBox.cxx b/src/VVTK/VVTK_PrimitiveBox.cxx index 58c8bc36..908d825b 100644 --- a/src/VVTK/VVTK_PrimitiveBox.cxx +++ b/src/VVTK/VVTK_PrimitiveBox.cxx @@ -64,7 +64,7 @@ VVTK_PrimitiveBox::VVTK_PrimitiveBox( QWidget* parent ) : myPrimitiveType = VISU_OpenGLPointSpriteMapper::PointSprite; - QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/"; + QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/visu/"; myMainTexture = aRootDir + "sprite_texture.bmp"; myAlphaTexture = aRootDir + "sprite_alpha.bmp"; @@ -335,7 +335,7 @@ void VVTK_PrimitiveBox::setFaceLimit( int theFaceLimit ) void VVTK_PrimitiveBox::onBrowseMainTexture() { - QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/"; + QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/visu/"; QString aFileName = QFileDialog::getOpenFileName( aRootDir, "Bitmap (*.bmp *.jpg *.png)", this ); if( aFileName.isNull() ) @@ -347,7 +347,7 @@ void VVTK_PrimitiveBox::onBrowseMainTexture() void VVTK_PrimitiveBox::onBrowseAlphaTexture() { - QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/"; + QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/visu/"; QString aFileName = QFileDialog::getOpenFileName( aRootDir, "Bitmap (*.bmp *.jpg *.png)", this ); if( aFileName.isNull() ) diff --git a/src/VVTK/VVTK_RecorderDlg.cxx b/src/VVTK/VVTK_RecorderDlg.cxx index 35ec9c9d..3d287ec4 100644 --- a/src/VVTK/VVTK_RecorderDlg.cxx +++ b/src/VVTK/VVTK_RecorderDlg.cxx @@ -209,3 +209,16 @@ bool VVTK_RecorderDlg::onBrowseFile() return true; } + +void VVTK_RecorderDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onHelp(); + } +} diff --git a/src/VVTK/VVTK_RecorderDlg.h b/src/VVTK/VVTK_RecorderDlg.h index 5c2ead33..23b5a1df 100644 --- a/src/VVTK/VVTK_RecorderDlg.h +++ b/src/VVTK/VVTK_RecorderDlg.h @@ -58,6 +58,9 @@ public: QString fileName() const { return myFileName; } +private: + void keyPressEvent( QKeyEvent* e ); + protected slots: void onStart(); void onClose(); diff --git a/src/VVTK/VVTK_SegmentationCursorDlg.cxx b/src/VVTK/VVTK_SegmentationCursorDlg.cxx index 6191e727..55b1fb7a 100644 --- a/src/VVTK/VVTK_SegmentationCursorDlg.cxx +++ b/src/VVTK/VVTK_SegmentationCursorDlg.cxx @@ -528,8 +528,8 @@ void VVTK_SegmentationCursorDlg::UpdateInsideGaussPoints() { int aPrimitiveType = VISU_OpenGLPointSpriteMapper::PointSprite; vtkFloatingPointType aClamp = 200.0; - QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp"; - QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_alpha.bmp"; + QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/visu/sprite_texture.bmp"; + QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/visu/sprite_alpha.bmp"; vtkFloatingPointType anAlphaThreshold = 0.1; int aResolution = 8; int aMinSize = 3; @@ -596,8 +596,8 @@ void VVTK_SegmentationCursorDlg::UpdateOutsideGaussPoints() { vtkFloatingPointType aClamp = 256.0; int aPrimitiveType = VISU_OpenGLPointSpriteMapper::PointSprite; - QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp"; - QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_alpha.bmp"; + QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/visu/sprite_texture.bmp"; + QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/visu/sprite_alpha.bmp"; vtkFloatingPointType anAlphaThreshold = 0.1; int aResolution = 8; int aSize = 25; @@ -899,3 +899,16 @@ bool VVTK_SegmentationCursorDlg::CheckNumberOfFaces() myOutsidePrimitiveBox->getPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere && aNumberOfPoints * myOutsidePrimitiveBox->getFaceNumber() > myOutsidePrimitiveBox->getFaceLimit() ); } + +void VVTK_SegmentationCursorDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + onClickHelp(); + } +} diff --git a/src/VVTK/VVTK_SegmentationCursorDlg.h b/src/VVTK/VVTK_SegmentationCursorDlg.h index 8f1e462a..50d17609 100644 --- a/src/VVTK/VVTK_SegmentationCursorDlg.h +++ b/src/VVTK/VVTK_SegmentationCursorDlg.h @@ -125,6 +125,8 @@ private: unsigned long theEvent, void* theClientData, void* theCallData); + + void keyPressEvent( QKeyEvent* e ); protected slots: virtual void done( int ); diff --git a/src/VVTK/VVTK_ViewWindow.cxx b/src/VVTK/VVTK_ViewWindow.cxx index cbd0d46a..b0d70802 100755 --- a/src/VVTK/VVTK_ViewWindow.cxx +++ b/src/VVTK/VVTK_ViewWindow.cxx @@ -49,7 +49,8 @@ VVTK_ViewWindow SVTK_ViewWindow(theDesktop), myMainWindow1(NULL), myMainWindow2(NULL), - myView2(NULL) + myView2(NULL), + myDumpImage(QImage()) {} //---------------------------------------------------------------------------- @@ -277,10 +278,20 @@ VVTK_ViewWindow ::dumpView() { if( myMainWindow1->GetInteractor()->hasFocus() ) - return myMainWindow1->dumpView(); + { + if ( myMainWindow1->getToolBar()->hasMouse() || myDumpImage.isNull() ) + return myMainWindow1->dumpView(); + else + return myDumpImage; + } if( myMainWindow2->GetInteractor()->hasFocus() ) - return myMainWindow2->dumpView(); + { + if ( myMainWindow1->getToolBar()->hasMouse() || myDumpImage.isNull() ) + return myMainWindow2->dumpView(); + else + return myDumpImage; + } return QImage(); } @@ -294,3 +305,14 @@ VVTK_ViewWindow myMainWindow2->SetBackgroundColor( theColor ); } + +//---------------------------------------------------------------------------- +void +VVTK_ViewWindow +::RefreshDumpImage() +{ + if( myMainWindow1->GetInteractor()->hasFocus() ) + myDumpImage = myMainWindow1->dumpView(); + else if ( myMainWindow2->GetInteractor()->hasFocus() ) + myDumpImage = myMainWindow2->dumpView(); +} diff --git a/src/VVTK/VVTK_ViewWindow.h b/src/VVTK/VVTK_ViewWindow.h index ca0ab04c..7e2dbf05 100755 --- a/src/VVTK/VVTK_ViewWindow.h +++ b/src/VVTK/VVTK_ViewWindow.h @@ -27,6 +27,8 @@ #include "VVTK.h" #include "SVTK_ViewWindow.h" +#include + #include class VVTK_MainWindow1; @@ -105,6 +107,11 @@ public: setBackgroundColor( const QColor& ); //---------------------------------------------------------------------------- + + //! Refresh dump images of the viewers + virtual + void RefreshDumpImage(); + public slots: //! Redefine SVTK_ViewWindow::onSelectionChanged method virtual @@ -134,6 +141,9 @@ protected: VVTK_MainWindow2* myMainWindow2; //!< The manage segmented view SVTK_View* myView2; //!< The manage segmented view + +private: + QImage myDumpImage; }; #ifdef WIN32 -- 2.39.2