From: vsr Date: Mon, 8 Oct 2012 13:52:12 +0000 (+0000) Subject: Merge from V6_main (04/10/2012) X-Git-Tag: V7_0_0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=567d1f0ea0003a9b7978447cc619bf1ce8e9f79a;p=modules%2Fparavis.git Merge from V6_main (04/10/2012) --- diff --git a/adm_local/cmake_files/FindPARAVIEW.cmake b/adm_local/cmake_files/FindPARAVIEW.cmake index d0dd6abd..030d81a2 100644 --- a/adm_local/cmake_files/FindPARAVIEW.cmake +++ b/adm_local/cmake_files/FindPARAVIEW.cmake @@ -35,6 +35,9 @@ FIND_LIBRARY(vtkPVCommon vtkPVCommon PATHS ${PARAVIEW_LIBRARY_DIRS} NO_DEFAULT_P FIND_LIBRARY(vtkPVVTKExtensions vtkPVVTKExtensions PATHS ${PARAVIEW_LIBRARY_DIRS} NO_DEFAULT_PATH) FIND_LIBRARY(vtkViews vtkViews PATHS ${PARAVIEW_LIBRARY_DIRS} NO_DEFAULT_PATH) FIND_LIBRARY(pqApplicationComponents pqApplicationComponents PATHS ${PARAVIEW_LIBRARY_DIRS} NO_DEFAULT_PATH) +FIND_LIBRARY(vtkGraphicsCS vtkGraphicsCS PATHS ${PARAVIEW_LIBRARY_DIRS} NO_DEFAULT_PATH) +FIND_LIBRARY(vtkCommonCS vtkCommonCS PATHS ${PARAVIEW_LIBRARY_DIRS} NO_DEFAULT_PATH) + SET(PARAVIEW_LIBS ${QtPython} ${QVTK} @@ -53,4 +56,6 @@ SET(PARAVIEW_LIBS ${vtkPVCommon} ${vtkViews} ${pqApplicationComponents} - ) + ${vtkGraphicsCS} + ${vtkCommonCS} + ) \ No newline at end of file diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in index 498ce10b..3a1f8cd7 100644 --- a/resources/SalomeApp.xml.in +++ b/resources/SalomeApp.xml.in @@ -28,6 +28,7 @@ +
diff --git a/src/PVGUI/CMakeLists.txt b/src/PVGUI/CMakeLists.txt index 4f259991..514e7686 100644 --- a/src/PVGUI/CMakeLists.txt +++ b/src/PVGUI/CMakeLists.txt @@ -47,6 +47,9 @@ SET(vtkWrapIDL_CC_CPPFLAGS INCLUDE(wrap.cmake) +INCLUDE(${ParaView_CMAKE_DIR}/vtkClientServer.cmake) +VTK_WRAP_ClientServer(vtkEDFCutterCS vtkEDFCutter_SRCS ${GUI_ROOT_DIR}/include/salome/vtkEDFCutter.h) + # Library sources SET(dist_libPARAVIS_la_SOURCES PVGUI_Module.h @@ -74,6 +77,7 @@ SET(dist_libPARAVIS_la_SOURCES ${WRAP_IDL_I_HH} ${WRAP_IDL_I_CC} PARAVIS_CreateClass.cxx + ${vtkEDFCutter_SRCS} ) # Check ParaView documentation file existence @@ -160,7 +164,7 @@ TARGET_LINK_LIBRARIES(PARAVIS ${VTK_LIBS} ${PYTHON_LIBS} ${KERNEL_LDFLAGS} ${SalomeDS} ${SALOMELocalTrace} ${SalomeIDLKernel} ${SalomeNS} ${SalomeLifeCycleCORBA} ${SalomeContainer} ${TOOLSDS} - ${GUI_LDFLAGS} ${SalomeApp} ${LightApp} ${CAM} ${qtx} ${suit} ${Event} ${PyInterp} ${SalomeObject} + ${GUI_LDFLAGS} ${SalomeApp} ${LightApp} ${CAM} ${qtx} ${suit} ${Event} ${PyInterp} ${SalomeObject} ${vtkTools} ${MED_LDFLAGS} ${SalomeIDLMED} ${VISU_LDFLAGS} ${VISU_PARAVIS_LIBS} diff --git a/src/PVGUI/PVGUI_Module.cxx b/src/PVGUI/PVGUI_Module.cxx index b4f346df..f4d072bc 100644 --- a/src/PVGUI/PVGUI_Module.cxx +++ b/src/PVGUI/PVGUI_Module.cxx @@ -99,7 +99,7 @@ #include #include #include -//#include +#include #include #include #include @@ -117,11 +117,17 @@ #include #include #include +#include +#include +#include +#include #include #include +#include CORBA_SERVER_HEADER(SALOME_ModuleCatalog) + /* * Make sure all the kits register their classes with vtkInstantiator. * Since ParaView uses Tcl wrapping, all of VTK is already compiled in @@ -163,6 +169,8 @@ #include #include +#include + //---------------------------------------------------------------------------- pqPVApplicationCore* PVGUI_Module::MyCoreApp = 0; @@ -238,6 +246,66 @@ PVGUI_Module* ParavisModule = 0; SALOME module wrapping ParaView GUI. */ + +/* + Fix for the issue 21730: [CEA 596] Slice of polyhedron in PARAVIS returns no cell. + Wrap vtkEDFCutter filter. +*/ + +extern "C" void vtkEDFCutterCS_Initialize(vtkClientServerInterpreter*); +static void vtkEDFHelperInit(); + +void vtkEDFHelperInit(vtkClientServerInterpreter* interp){ + vtkEDFCutterCS_Initialize(interp); +} + +void vtkEDFHelperInit() { + vtkClientServerInterpreterInitializer::GetInitializer()-> + RegisterCallback(&vtkEDFHelperInit); +} + + + _PTR(SComponent) + ClientFindOrCreateParavisComponent(_PTR(Study) theStudyDocument) + { + _PTR(SComponent) aSComponent = theStudyDocument->FindComponent("PARAVIS"); + if (!aSComponent) { + _PTR(StudyBuilder) aStudyBuilder = theStudyDocument->NewBuilder(); + aStudyBuilder->NewCommand(); + int aLocked = theStudyDocument->GetProperties()->IsLocked(); + if (aLocked) theStudyDocument->GetProperties()->SetLocked(false); + aSComponent = aStudyBuilder->NewComponent("PARAVIS"); + _PTR(GenericAttribute) anAttr = + aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributeName"); + _PTR(AttributeName) aName (anAttr); + + CORBA::ORB_var anORB = PARAVIS::PARAVIS_Gen_i::GetORB(); + SALOME_NamingService *NamingService = new SALOME_NamingService( anORB ); + CORBA::Object_var objVarN = NamingService->Resolve("/Kernel/ModulCatalog"); + SALOME_ModuleCatalog::ModuleCatalog_var Catalogue = + SALOME_ModuleCatalog::ModuleCatalog::_narrow(objVarN); + SALOME_ModuleCatalog::Acomponent_var Comp = Catalogue->GetComponent( "PARAVIS" ); + if (!Comp->_is_nil()) { + aName->SetValue(Comp->componentusername()); + } + + anAttr = aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributePixMap"); + _PTR(AttributePixMap) aPixmap (anAttr); + aPixmap->SetPixMap( "pqAppIcon16.png" ); + + // Create Attribute parameters for future using + anAttr = aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributeParameter"); + + + PARAVIS::PARAVIS_Gen_var aPARAVIS = PARAVIS::PARAVIS_Gen_i::GetParavisGenImpl()->_this(); + + aStudyBuilder->DefineComponentInstance(aSComponent, aPARAVIS->GetIOR()); + if (aLocked) theStudyDocument->GetProperties()->SetLocked(true); + aStudyBuilder->CommitCommand(); + } + return aSComponent; + } + /*! \brief Constructor. Sets the default name for the module. */ @@ -404,6 +472,10 @@ void PVGUI_Module::initialize( CAM_Application* app ) connect(pqApplicationCore::instance()->getObjectBuilder(), SIGNAL(finishedAddingServer(pqServer*)), this, SLOT(onFinishedAddingServer(pqServer*))); + connect(pqApplicationCore::instance()->getObjectBuilder(), SIGNAL(dataRepresentationCreated(pqDataRepresentation*)), + this, SLOT(onDataRepresentationCreated(pqDataRepresentation*))); + + SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); bool isStop = aResourceMgr->booleanValue( "PARAVIS", "stop_trace", false ); // start timer to activate trace in a proper moment @@ -417,6 +489,10 @@ void PVGUI_Module::initialize( CAM_Application* app ) this, SLOT(onStartProgress())); this->VTKConnect->Connect(pm, vtkCommand::EndEvent, this, SLOT(onEndProgress())); + + connect(&pqActiveObjects::instance(), + SIGNAL(representationChanged(pqRepresentation*)), + this, SLOT(onRepresentationChanged(pqRepresentation*))); } void PVGUI_Module::onStartProgress() @@ -437,6 +513,58 @@ void PVGUI_Module::onFinishedAddingServer(pqServer* /*server*/) startTimer( 50 ); } +void PVGUI_Module::onDataRepresentationCreated(pqDataRepresentation* data) { + if(!data) + return; + + if(!data->getLookupTable()) + return; + + SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); + if(!aResourceMgr) + return; + + bool visible = aResourceMgr->booleanValue( "PARAVIS", "show_color_legend", false ); + pqLookupTableManager* lut_mgr = pqApplicationCore::instance()->getLookupTableManager(); + + if(lut_mgr) { + lut_mgr->setScalarBarVisibility(data,visible); + } +} + +void PVGUI_Module::onVariableChanged(pqVariableType t, const QString) { + + pqDisplayColorWidget* colorWidget = qobject_cast(sender()); + if( !colorWidget ) + return; + + if( t == VARIABLE_TYPE_NONE ) + return; + + pqDataRepresentation* data = colorWidget->getRepresentation(); + + if( !data->getLookupTable() ) + return; + + SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); + + if(!aResourceMgr) + return; + + bool visible = aResourceMgr->booleanValue( "PARAVIS", "show_color_legend", false ); + + if(!visible) + return; + + pqLookupTableManager* lut_mgr = pqApplicationCore::instance()->getLookupTableManager(); + + if(lut_mgr) { + lut_mgr->setScalarBarVisibility(data,visible); + } + +} + + /*! \brief Launches a tracing of current server */ @@ -684,6 +812,8 @@ bool PVGUI_Module::activateModule( SUIT_Study* study ) if ( myRecentMenuId != -1 ) menuMgr()->show(myRecentMenuId); + ClientFindOrCreateParavisComponent(PARAVIS::GetCStudy(this)); + return isDone; } @@ -1026,6 +1156,10 @@ void PVGUI_Module::createPreferences() aStrings< aWidget = getApp()->desktop()->findChildren(); + + for (int i = 0; i < aWidget.size() ; i++ ) { + if( aWidget[i] ) { + connect( aWidget[i], SIGNAL ( variableChanged ( pqVariableType, const QString ) ), + this, SLOT(onVariableChanged( pqVariableType, const QString) ), Qt::UniqueConnection ); + } + } +} + + /*! \fn CAM_Module* createModule(); \brief Export module instance (factory function). @@ -1384,7 +1536,13 @@ void PVGUI_Module::loadSelectedState(bool toClear) #endif // WNT extern "C" { + + bool flag = false; PVGUI_EXPORT CAM_Module* createModule() { + if(!flag) { + vtkEDFHelperInit(); + flag = true; + } return new PVGUI_Module(); } diff --git a/src/PVGUI/PVGUI_Module.h b/src/PVGUI/PVGUI_Module.h index 4bbcd749..5c0732ee 100644 --- a/src/PVGUI/PVGUI_Module.h +++ b/src/PVGUI/PVGUI_Module.h @@ -31,6 +31,8 @@ #include #include +#include + class QMenu; class QDockWidget; class QToolBar; @@ -42,6 +44,8 @@ class pqMainWindowCore; class vtkEventQtSlotConnect; class pqPythonScriptEditor; class pqPVApplicationCore; +class pqDataRepresentation; +class pqRepresentation; class PVGUI_Module : public SalomeApp_Module @@ -220,6 +224,9 @@ private slots: //void showHelp(const QString& url); void onFinishedAddingServer(pqServer*); + void onDataRepresentationCreated(pqDataRepresentation*); + void onVariableChanged(pqVariableType, const QString); + void onRepresentationChanged(pqRepresentation*); void onStartProgress(); void onEndProgress(); diff --git a/src/PVGUI/PVGUI_Module_widgets.cxx b/src/PVGUI/PVGUI_Module_widgets.cxx index 03849f8e..feba87a6 100644 --- a/src/PVGUI/PVGUI_Module_widgets.cxx +++ b/src/PVGUI/PVGUI_Module_widgets.cxx @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -35,8 +36,10 @@ #include #include #include +#include #include +#include #include #include @@ -73,6 +76,32 @@ #include #include +class ResizeHelper : public pqPVAnimationWidget +{ + // TEMPORARILY WORKAROUND AROUND PARAVIEW 3.14 BUG: + // WHEN ANIMATION VIEW IS RESIZED, ITS CONTENTS IS NOT PREPERLY RE-ARRANGED + // CAUSING SOME CONTROLS TO STAY NON-VISIBLE + // THIS BUG IS NATURALLY FIXED BY ADDING + // this->updateGeometries(); + // TO THE + // void pqAnimationWidget::resizeEvent(QResizeEvent* e); + // BUT THIS CANNOT BE DONE DIRECTLY, SINCE CORRESPONDING API IS NOT PUBLIC + // THE ONLY WAY TO DO THIS BY SENDING SHOW EVENT TO THE WIDGET + +public: + ResizeHelper( QWidget* parent ) : pqPVAnimationWidget( parent ) {} +protected: + void resizeEvent(QResizeEvent* e) + { + pqAnimationWidget* w = findChild( "pqAnimationWidget" ); + if ( w ) { + QShowEvent e; + QApplication::sendEvent( w, &e ); + } + pqPVAnimationWidget::resizeEvent( e ); + } +}; + /*! \brief Create dock widgets for ParaView widgets such as object inspector, pipeline browser, etc. ParaView pqMainWIndowCore class is fully responsible for these dock widgets' contents. @@ -176,7 +205,7 @@ void PVGUI_Module::setupDockWidgets() QDockWidget* animationViewDock = new QDockWidget( tr( "TTL_ANIMATION_VIEW" ), desk ); animationViewDock->setObjectName("animationViewDock"); desk->addDockWidget( Qt::BottomDockWidgetArea, animationViewDock ); - pqPVAnimationWidget* animation_panel = new pqPVAnimationWidget(animationViewDock); + pqPVAnimationWidget* animation_panel = new ResizeHelper(animationViewDock); //pqPVAnimationWidget animationViewDock->setWidget(animation_panel); myDockWidgets[animationViewDock] = false; // hidden by default diff --git a/src/PVGUI/resources/PARAVIS_msg_en.ts b/src/PVGUI/resources/PARAVIS_msg_en.ts index fe8abdbc..9a8bc0d0 100644 --- a/src/PVGUI/resources/PARAVIS_msg_en.ts +++ b/src/PVGUI/resources/PARAVIS_msg_en.ts @@ -1145,6 +1145,10 @@ PREF_STOP_TRACE Deactivate Trace (for next session only) + + PREF_SHOW_COLOR_LEGEND + Show Color Legend + TIT_PVISSETTINGS ParaVis Settings diff --git a/src/Plugins/IntegrationPoints/vtkELNOSurfaceFilter.cxx b/src/Plugins/IntegrationPoints/vtkELNOSurfaceFilter.cxx index 158d8369..1e304e83 100644 --- a/src/Plugins/IntegrationPoints/vtkELNOSurfaceFilter.cxx +++ b/src/Plugins/IntegrationPoints/vtkELNOSurfaceFilter.cxx @@ -84,6 +84,18 @@ int vtkELNOSurfaceFilter::RequestData(vtkInformation *request, vtkIdTypeArray* originalPointIds=vtkIdTypeArray::SafeDownCast( surface->GetPointData()->GetArray("vtkOriginalPointIds")); + if( originalCellIds == NULL ) + { + vtkErrorMacro("vtkPVGeometryFilter return NULL 'vtkOriginalCellIds' array"); + return 0; + } + + if(originalPointIds==NULL) + { + vtkErrorMacro("vtkPVGeometryFilter return NULL 'vtkOriginalPointIds' array"); + return 0; + } + vtkSmartPointer shrink= vtkSmartPointer::New(); shrink->SetInput(surface); diff --git a/src/Plugins/MedReader/IO/vtkMedEntityArray.cxx b/src/Plugins/MedReader/IO/vtkMedEntityArray.cxx index 931c0acf..99ac5070 100644 --- a/src/Plugins/MedReader/IO/vtkMedEntityArray.cxx +++ b/src/Plugins/MedReader/IO/vtkMedEntityArray.cxx @@ -185,9 +185,27 @@ int vtkMedEntityArray::IsConnectivityLoaded() if(this->Connectivity == MED_NODAL && this->Entity.EntityType != MED_STRUCT_ELEMENT) { - vtkIdType connSize = this->NumberOfEntity - * vtkMedUtilities::GetNumberOfPoint(this->Entity.GeometryType); - + vtkIdType connSize = 0; + if(this->Entity.GeometryType == MED_POLYHEDRON || this->Entity.GeometryType == MED_POLYGON) + { + if(!this->NodeIndex || !this->FaceIndex) + return 0; + for(med_int i = 0; i < this->NumberOfEntity; i++ ) + { + med_int start = this->FaceIndex->GetValue(i)-1; + med_int end = this->FaceIndex->GetValue(i+1)-1; + for(med_int fi = start ; fi < end; fi++ ) + { + med_int fstart = this->NodeIndex->GetValue(fi)-1; + med_int fend = this->NodeIndex->GetValue(fi+1)-1; + connSize += (fend-fstart); + } + } + } else + { + connSize = this->NumberOfEntity * + vtkMedUtilities::GetNumberOfPoint(this->Entity.GeometryType); + } return connSize == this->ConnectivityArray->GetNumberOfTuples(); } else if (this->Connectivity == MED_NODAL && this->Entity.EntityType == MED_STRUCT_ELEMENT) diff --git a/src/Plugins/MedReader/IO/vtkMedFamilyOnEntityOnProfile.cxx b/src/Plugins/MedReader/IO/vtkMedFamilyOnEntityOnProfile.cxx index 9666c4a7..e9ac161f 100644 --- a/src/Plugins/MedReader/IO/vtkMedFamilyOnEntityOnProfile.cxx +++ b/src/Plugins/MedReader/IO/vtkMedFamilyOnEntityOnProfile.cxx @@ -269,10 +269,9 @@ void vtkMedFamilyOnEntityOnProfile::ComputeUsedPoints() this->UseAllPoints = true; return; } - // if there is no profile, the grid is structured, the entity is on cell + // if there is no profile, the entity is on cell // and there is at most 1 family on his entity, then all points are used - if(vtkMedUnstructuredGrid::SafeDownCast(grid) == NULL && - this->FamilyOnEntity->GetPointOrCell() == vtkMedUtilities::OnCell && + if(this->FamilyOnEntity->GetPointOrCell() == vtkMedUtilities::OnCell && this->FamilyOnEntity->GetEntityArray()->GetNumberOfFamilyOnEntity() <= 1) { this->UseAllPoints = true; diff --git a/src/Plugins/MedReader/IO/vtkMedField.cxx b/src/Plugins/MedReader/IO/vtkMedField.cxx index 0661aee6..f51a704b 100644 --- a/src/Plugins/MedReader/IO/vtkMedField.cxx +++ b/src/Plugins/MedReader/IO/vtkMedField.cxx @@ -181,6 +181,7 @@ void vtkMedField::ExtractFieldType(vtkMedField* otherfield, int type) vtkMedFieldStep* otherstep = otherfield->GetFieldStep(stepid); vtkMedFieldStep* step = vtkMedFieldStep::New(); step->SetComputeStep(otherstep->GetComputeStep()); + step->SetMedIterator(otherstep->GetMedIterator()); this->AddFieldStep(step); step->Delete(); diff --git a/src/Plugins/MedReader/IO/vtkMedUnstructuredGrid.cxx b/src/Plugins/MedReader/IO/vtkMedUnstructuredGrid.cxx index ad186be2..5a43dc05 100644 --- a/src/Plugins/MedReader/IO/vtkMedUnstructuredGrid.cxx +++ b/src/Plugins/MedReader/IO/vtkMedUnstructuredGrid.cxx @@ -246,6 +246,7 @@ vtkDataSet* vtkMedUnstructuredGrid::CreateVTKDataSet( if (controller->GetNumberOfProcesses() > 1) valid = 1; + array->LoadConnectivity(); for (vtkIdType pindex = 0; pindexKeepCell(realIndex)) continue; - array->GetCellVertices(realIndex, pts); - for(int sid = 0; sid < nsupportcell; sid++) { cellGlobalIds->InsertNextValue(intialGlobalId+pindex); @@ -288,6 +287,7 @@ vtkDataSet* vtkMedUnstructuredGrid::CreateVTKDataSet( } else { + array->GetCellVertices(realIndex, pts); vtkpts->Initialize(); vtkpts->SetNumberOfIds(pts->GetNumberOfIds());