]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To publish the new kind of presentations in the 'Points View' on creation
authorapo <apo@opencascade.com>
Fri, 3 Nov 2006 11:49:39 +0000 (11:49 +0000)
committerapo <apo@opencascade.com>
Fri, 3 Nov 2006 11:49:39 +0000 (11:49 +0000)
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI_Module.cxx
src/VISUGUI/VisuGUI_Prs3dTools.h

index 1dae21e50607b47791a261fda015fcc5fdab8522..7805e73f4e5b172b247d73cf78a9649b381d8934 100644 (file)
@@ -3286,13 +3286,14 @@ void VisuGUI::OnPlot3dFromCutPlane()
      }
      GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
      
-     VISU::Plot3D_i* aPrs3d = CreatePrs3d<VISU::Plot3D_i>(this, 
-                                                         aTimeStampSObj, 
-                                                         aMeshName.latin1(), 
-                                                         (Entity)anEntity.toInt(),
-                                                         aFieldName.latin1(), 
-                                                         aTimeStampId.toInt(),
-                                                         ColoredPrs3d_i::EPublishUnderTimeStamp);
+     VISU::Plot3D_i* aPrs3d = 
+       CreatePrs3dFromFactory<VISU::Plot3D_i>(this, 
+                                             aTimeStampSObj, 
+                                             aMeshName.latin1(), 
+                                             (Entity)anEntity.toInt(),
+                                             aFieldName.latin1(), 
+                                             aTimeStampId.toInt(),
+                                             ColoredPrs3d_i::EPublishUnderTimeStamp);
      if (aPrs3d) {
        SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
        int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
index 338267c07ce6134178646b0488a62c21c7773965..4dbc5fd78b26e2b48bc4c803820e54e89427212b 100644 (file)
@@ -934,7 +934,7 @@ VisuGUI_Module::
 OnCreateGaussPoints()
 {
   double initialTime = vtkTimerLog::GetCPUTime();
-  CreatePrs3d<VISU::GaussPoints_i, VVTK_Viewer, VisuGUI_GaussPointsDlg, 1>(this);
+  CreatePrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, VVTK_Viewer::Type());
   INFOS( "VisuGUI_Module::OnCreateGaussPoints() : Gauss Points created in " <<
         vtkTimerLog::GetCPUTime() - initialTime << " seconds" );
 }
index 3e245ca909f5580c4907b1a8b7b160bc6a3f025f..dc4161d5707cb947d32391e3952c2164333de677 100644 (file)
@@ -111,13 +111,13 @@ namespace VISU
   template<class TPrs3d_i>
   inline
   TPrs3d_i*
-  CreatePrs3d(VisuGUI* theModule,
-             _PTR(SObject) theTimeStamp,
-             const char* theMeshName,
-             VISU::Entity theEntity,
-             const char* theFieldName,
-             int theTimeId,
-             ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode)
+  CreatePrs3dFromFactory(VisuGUI* theModule,
+                        _PTR(SObject) theTimeStamp,
+                        const char* theMeshName,
+                        VISU::Entity theEntity,
+                        const char* theFieldName,
+                        int theTimeId,
+                        ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode)
   {
     VISU::Result_var aResult;
     if (CheckResult(theModule,theTimeStamp,aResult)){
@@ -141,10 +141,10 @@ namespace VISU
   template<class TPrs3d_i, class TViewer, class TDlg, int IsDlgModal>
   inline
   bool
-  CreatePrs3d(VisuGUI* theModule,
-             _PTR(SObject) theTimeStamp,
-             const Handle(SALOME_InteractiveObject)& theIO,
-             ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode)
+  CreateAndEditPrs3d(VisuGUI* theModule,
+                    _PTR(SObject) theTimeStamp,
+                    const Handle(SALOME_InteractiveObject)& theIO,
+                    ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode)
   {
     Storable::TRestoringMap aMap = getMapOfValue(theTimeStamp);
 
@@ -169,14 +169,14 @@ namespace VISU
     QApplication::setOverrideCursor(Qt::waitCursor);
 
     TPrs3d_i* aPrs3d =
-      CreatePrs3d<TPrs3d_i>(theModule,
-                           theTimeStamp,
-                           aMeshName.latin1(),
-                           (Entity)anEntity.toInt(),
-                           aFieldName.latin1(),
-                           aTimeStampId.toInt(),
-                           thePublishInStudyMode);
-
+      CreatePrs3dFromFactory<TPrs3d_i>(theModule,
+                                      theTimeStamp,
+                                      aMeshName.latin1(),
+                                      (Entity)anEntity.toInt(),
+                                      aFieldName.latin1(),
+                                      aTimeStampId.toInt(),
+                                      thePublishInStudyMode);
+    
     QApplication::restoreOverrideCursor();
     if (aPrs3d) {
       SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
@@ -223,23 +223,17 @@ namespace VISU
   template<class TPrs3d_i, class TViewer, class TDlg, int IsDlgModal>
   inline
   void
-  CreatePrs3d(VisuGUI* theModule)
+  CreatePrs3dInViewer(VisuGUI* theModule,
+                     _PTR(SObject) theTimeStampSObj,
+                     const Handle(SALOME_InteractiveObject)& theIO,
+                     ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode)
   {
-    if (CheckLock(GetCStudy(GetAppStudy(theModule)),GetDesktop(theModule)))
-      return;
-
-    _PTR(SObject) aTimeStampSObj;
-    Handle(SALOME_InteractiveObject) anIO;
-    ColoredPrs3d_i::EPublishInStudyMode aPublishInStudyMode;
-    if (!CheckTimeStamp(theModule,aTimeStampSObj,anIO,aPublishInStudyMode))
-      return;
-
     // Create new TViewWindow instance, if it does not exist.
     typedef typename TViewer::TViewWindow TViewWindow;
     if (!GetViewWindow<TViewer>(theModule))
       return;
 
-    if (!CreatePrs3d<TPrs3d_i,TViewer,TDlg,IsDlgModal>(theModule,aTimeStampSObj,anIO,aPublishInStudyMode))
+    if (!CreateAndEditPrs3d<TPrs3d_i,TViewer,TDlg,IsDlgModal>(theModule,theTimeStampSObj,theIO,thePublishInStudyMode))
       return;
 
     theModule->application()->putInfo(QObject::tr("INF_DONE"));
@@ -248,13 +242,41 @@ namespace VISU
   template<class TPrs3d_i, class TDlg, int IsDlgModal>
   inline
   void
-  CreatePrs3d(VisuGUI* theModule)
+  CreatePrs3d(VisuGUI* theModule,
+             const QString& theDesiredViewerType = QString())
   {
-    if (SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager())
-      if (aViewManager->getType() == VVTK_Viewer::Type()) 
-       return CreatePrs3d<TPrs3d_i,VVTK_Viewer,TDlg,IsDlgModal>(theModule);
+    if (CheckLock(GetCStudy(GetAppStudy(theModule)),GetDesktop(theModule)))
+      return;
+
+    _PTR(SObject) aTimeStampSObj;
+    Handle(SALOME_InteractiveObject) anIO;
+    ColoredPrs3d_i::EPublishInStudyMode aPublishInStudyMode;
+    if (!CheckTimeStamp(theModule,aTimeStampSObj,anIO,aPublishInStudyMode))
+      return;
 
-    CreatePrs3d<TPrs3d_i,SVTK_Viewer,TDlg,IsDlgModal>(theModule);
+    if(aPublishInStudyMode == VISU::ColoredPrs3d_i::EPublishIndependently){
+      CreatePrs3dInViewer<TPrs3d_i,VVTK_Viewer,TDlg,IsDlgModal>
+       (theModule,aTimeStampSObj,anIO,aPublishInStudyMode);
+      return;
+    }else{
+      if(theDesiredViewerType.isNull()){
+       if (SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager())
+         if (aViewManager->getType() == VVTK_Viewer::Type()){ 
+           CreatePrs3dInViewer<TPrs3d_i,VVTK_Viewer,TDlg,IsDlgModal>
+             (theModule,aTimeStampSObj,anIO,aPublishInStudyMode);
+           return;
+         }
+       CreatePrs3dInViewer<TPrs3d_i,SVTK_Viewer,TDlg,IsDlgModal>
+         (theModule,aTimeStampSObj,anIO,aPublishInStudyMode);
+      }else{
+       if(theDesiredViewerType == VVTK_Viewer::Type())
+         CreatePrs3dInViewer<TPrs3d_i,VVTK_Viewer,TDlg,IsDlgModal>
+           (theModule,aTimeStampSObj,anIO,aPublishInStudyMode);
+       else
+         CreatePrs3dInViewer<TPrs3d_i,VVTK_Viewer,TDlg,IsDlgModal>
+           (theModule,aTimeStampSObj,anIO,aPublishInStudyMode);
+      }
+    }
   }
 }