]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Implementation of the issue 20115: [CEA 308] Quadratic elements visualization.
authorrnv <rnv@opencascade.com>
Wed, 27 May 2009 11:23:48 +0000 (11:23 +0000)
committerrnv <rnv@opencascade.com>
Wed, 27 May 2009 11:23:48 +0000 (11:23 +0000)
23 files changed:
idl/VISU_Gen.idl
resources/SalomeApp.xml
src/OBJECT/VISU_Actor.cxx
src/OBJECT/VISU_Actor.h
src/OBJECT/VISU_MeshAct.cxx
src/OBJECT/VISU_MeshAct.h
src/OBJECT/VISU_ScalarMapAct.cxx
src/OBJECT/VISU_ScalarMapAct.h
src/VISUGUI/VISU_msg_en.ts
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI.h
src/VISUGUI/VisuGUI_ActionsDef.h
src/VISUGUI/VisuGUI_Module.cxx
src/VISUGUI/VisuGUI_Selection.cxx
src/VISUGUI/VisuGUI_Selection.h
src/VISUGUI/VisuGUI_Tools.cxx
src/VISUGUI/VisuGUI_Tools.h
src/VISU_I/VISU_DumpPython.cc
src/VISU_I/VISU_Mesh_i.cc
src/VISU_I/VISU_Mesh_i.hh
src/VISU_I/VISU_ScalarMap_i.cc
src/VISU_I/VISU_View_i.cc
src/VISU_I/VISU_View_i.hh

index f2bd29f83f4fa3e1cebe14725d8ad5fef7ab2448..7ff5beb88abcb401b88dd34a08c5797abebede0b 100644 (file)
@@ -314,6 +314,15 @@ module VISU {
                         SHRINK
   };
 
+  /*!
+   * This enumeration contains a set of elements defining the
+   * type of presentation of the 2D quadratic mesh elements.
+   */
+  enum Quadratic2DPresentationType{
+    LINES,
+    ARCS
+  };
+
   /*! \brief Interface of the mesh.
    *
    * Manages presentation parameters of a 3D presentation of a mesh.
@@ -366,6 +375,21 @@ module VISU {
      */
     PresentationType GetPresentationType();
 
+
+    /*!
+     * Sets the type of representation of a 2D quadratic mesh elements.
+     * \param theType The type of representation of 2D quadratic mesh elements.
+     *                This parameter is taken from 
+     *               <VAR>Quadratic2DPresentationType</VAR> enumeration.
+     */
+    void SetQuadratic2DPresentationType(in Quadratic2DPresentationType theType);
+
+    /*!
+     * Gets the type of representation of the 2D quadratic mesh elements.
+     * \return The type of representation of the 2D quadratic mesh elements.
+     */
+    Quadratic2DPresentationType GetQuadratic2DPresentationType();
+    
     /*!
      * Switches shrink mode of presentation
      * Note: SetPresentationType(SHRINK) is same as SetShrink(True)
@@ -2652,6 +2676,24 @@ module VISU {
      */
     string SetPresentationType(in ScalarMap thePrs, in PresentationType thePrsType);
 
+
+    /*! Set representation type of 2D quadratic elements 
+     *  of the given presentation in this view.
+     *  \param thePrs Object to set a representation type of 2D quadratic elements.
+     *  \param theType Representation type of 2D quadratic elements to be set to the given object.
+     *  \return Empty string in case of success, error description in case of failure.
+     */
+    string SetQuadratic2DPresentationType(in ScalarMap thePrs,in Quadratic2DPresentationType theType);
+
+
+    /*! Get representation type of the 2D quadratic mesh elements of given presentation in this view.
+     *  \param thePrs Object to get a representation type of 2D quadratic mesh elements.
+     *  \return <VAR>Quadratic2DPresentationType</VAR> Representation type of 2D quadratic mesh elements 
+     *          in this view.
+     */    
+    Quadratic2DPresentationType GetQuadratic2DPresentationType(in ScalarMap thePrs);
+    
+
     /*! Get shrink state of the given presentation in this view.
      *  \param thePrs Object to get a shrink state of.
      *  \return TRUE if \a thePrs is shrinked in this view, FALSE overwise.
index d3036faaccae08ba54fc5f9155822a344831caaf..a764ac0c2bda3ad1d3a93aeeaa1498ff7e2f8ec3 100644 (file)
@@ -50,6 +50,8 @@
     <parameter name="scalar_def_represent"     value="2"/>
     <parameter name="scalar_def_shrink"        value="false"/>
     <parameter name="floating_point_precision" value="6"/>
+    <parameter name="quadratic_mode"           value="0"  />
+    <parameter name="max_angle"                value="2"  />
     <parameter name="represent_shading"        value="false"/>
     <parameter name="feature_edges_angle"      value="30.0"/>
     <parameter name="show_feature_edges"       value="true"/>
index c9b52260e6386427e306bef171247a52b0262521..8a5ca9506adbd08391b74db8201bf4bebdb20f3e 100644 (file)
@@ -1256,3 +1256,19 @@ vtkDataSet* VISU_Actor::GetValLabelsInput()
   return aDataSet;
 }
 
+
+
+VISU_Actor::EQuadratic2DRepresentation 
+VISU_Actor::GetQuadratic2DRepresentation() const
+{
+  if(Superclass::GetQuadraticArcMode()){
+    return VISU_Actor::eArcs;
+  }
+  else
+    return VISU_Actor::eLines;
+}
+
+void VISU_Actor::SetQuadratic2DRepresentation( EQuadratic2DRepresentation theMode )
+{
+  
+}
index 65920a789d582a5938b2e0641075dcf5078af2aa..76cc277e55e4614bcb5d66cea1291297f96acc8a 100644 (file)
@@ -326,6 +326,15 @@ class VISU_OBJECT_EXPORT VISU_Actor : public VISU_ActorBase
 
   vtkTextProperty* 
   GetsValLabelsProps() const;
+
+  enum EQuadratic2DRepresentation { eLines = 0, eArcs };
+
+  virtual
+    EQuadratic2DRepresentation GetQuadratic2DRepresentation() const;
+  
+  virtual void 
+    SetQuadratic2DRepresentation( EQuadratic2DRepresentation theMode );
+  
   
  protected:
   VISU_Actor();
index 2c3050dd51f23160010c3669db1371e10dace150..c5c87fe57f90f12874ac89acae5e00b15f8890df 100644 (file)
@@ -27,6 +27,9 @@
 //
 #include "VISU_MeshAct.h"
 
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+
 #include <vtkObjectFactory.h>
 #include <vtkRenderer.h>
 #include <vtkTexture.h>
@@ -63,6 +66,15 @@ VISU_MeshAct
 
   m->Delete();
   SetRepresentation(SVTK::Representation::Surface);
+
+  SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+  //Quadratic 2D elements representation
+  if(aResourceMgr) {
+    //----------------------------------------------------------------------------
+    int aQuadraticAngle = aResourceMgr->integerValue( "VISU", "max_angle", 2);
+    mySurfaceActor->SetQuadraticArcAngle(aQuadraticAngle);
+    myEdgeActor->SetQuadraticArcAngle(aQuadraticAngle);
+  }  
 }
 
 VISU_MeshAct
@@ -390,3 +402,30 @@ VISU_MeshAct
   }
   return 1;
 }
+
+VISU_Actor::EQuadratic2DRepresentation 
+VISU_MeshAct::GetQuadratic2DRepresentation() const
+{
+  bool mode = (mySurfaceActor->GetQuadraticArcMode() && myEdgeActor->GetQuadraticArcMode());
+  if(mode){
+    return VISU_Actor::eArcs;
+  }
+  else
+    return VISU_Actor::eLines;
+}
+
+void VISU_MeshAct::SetQuadratic2DRepresentation( EQuadratic2DRepresentation theMode )
+{
+  switch(theMode) {
+  case VISU_Actor::eArcs:
+    mySurfaceActor->SetQuadraticArcMode(true);
+    myEdgeActor->SetQuadraticArcMode(true);
+    break;
+  case VISU_Actor::eLines:
+    mySurfaceActor->SetQuadraticArcMode(false);
+    myEdgeActor->SetQuadraticArcMode(false);
+    break;
+  default:
+    break;
+  }    
+}
index 3c72e69e85a8fc8d1678f121523978852953279e..f888b5dab66ffc1056586592db24712f81154c44 100644 (file)
@@ -135,6 +135,13 @@ class VISU_OBJECT_EXPORT VISU_MeshAct : public VISU_DataSetActor
   int
   RenderTranslucentGeometry(vtkViewport *ren);
 
+  virtual
+  EQuadratic2DRepresentation GetQuadratic2DRepresentation() const;
+  
+  virtual void 
+  SetQuadratic2DRepresentation( EQuadratic2DRepresentation theMode );
+
+
  protected:
   VISU_MeshAct();
   ~VISU_MeshAct();
index a1ce8e7142b1e514289edf23cc81d361b8bf23dd..e68b837576224b43f4e38347de10603098e52131 100644 (file)
 #include "VISU_DeformedShapePL.hxx"
 #include "VISU_PipeLineUtils.hxx"
 
+
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+
 #include <SALOME_ExtractGeometry.h>
 #include <SALOME_ExtractPolyDataGeometry.h>
 
@@ -242,6 +246,15 @@ VISU_ScalarMapAct
   myPointsActor->SetUserMatrix(aMatrix);
 
   aMatrix->Delete();
+
+  SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+  //Quadratic 2D elements representation
+  if(aResourceMgr) {
+    //----------------------------------------------------------------------------
+    int aQuadraticAngle = aResourceMgr->integerValue( "VISU", "max_angle", 2);
+    mySurfaceActor->SetQuadraticArcAngle(aQuadraticAngle);
+    myEdgeActor->SetQuadraticArcAngle(aQuadraticAngle);
+  }
 }
 
 //----------------------------------------------------------------------------
@@ -639,3 +652,31 @@ VISU_ScalarMapAct
 }
 
 //----------------------------------------------------------------------------
+
+VISU_Actor::EQuadratic2DRepresentation 
+VISU_ScalarMapAct
+::GetQuadratic2DRepresentation() const
+{
+  bool mode = (mySurfaceActor->GetQuadraticArcMode() && myEdgeActor->GetQuadraticArcMode());
+  if(mode){
+    return VISU_Actor::eArcs;
+  }
+  else
+    return VISU_Actor::eLines;
+}
+  
+void VISU_ScalarMapAct::SetQuadratic2DRepresentation( VISU_Actor::EQuadratic2DRepresentation theMode )
+{
+  switch(theMode) {
+  case VISU_Actor::eArcs:
+    mySurfaceActor->SetQuadraticArcMode(true);
+    myEdgeActor->SetQuadraticArcMode(true);
+    break;
+  case VISU_Actor::eLines:
+    mySurfaceActor->SetQuadraticArcMode(false);
+    myEdgeActor->SetQuadraticArcMode(false);
+    break;
+  default:
+    break;
+  }
+}
index 63b10ce0abbf367c7ed0b57b12d7cd4a691c64e1..b399f21d6effc96d82d9fea996fe2f7bc8674a9e 100644 (file)
@@ -76,6 +76,13 @@ class VISU_OBJECT_EXPORT VISU_ScalarMapAct : public VISU_DataSetActor
   virtual
   void
   UnShrink(); 
+
+  virtual
+    EQuadratic2DRepresentation GetQuadratic2DRepresentation() const;
+  
+  virtual void 
+    SetQuadratic2DRepresentation( EQuadratic2DRepresentation theMode );
+
   
   virtual
   void
index fb62750ef2932276bd0de1f561c2f44215628aab..e7539f3dba4d7d3dd8167db52bd0ef3272590fbf 100644 (file)
@@ -369,6 +369,14 @@ number of time stamps or number of components is not the same!</translation>
             <source>VISU_TITLE</source>
             <translation>Title</translation>
         </message>
+        <message>
+            <source>QUADRATIC_REPRESENT_MODE</source>
+            <translation>Representation of the 2D quadratic elements</translation>
+        </message>
+        <message>
+            <source>MAX_ARC_ANGLE</source>
+            <translation>Maximum angle</translation>
+        </message>
         <message>
             <source>VISU_USE_SHADING</source>
             <translation>Use Shading</translation>
@@ -1297,6 +1305,19 @@ Please, refer to the documentation.</translation>
             <source>VISU_VALUES_LABELING_PARAMS</source>
             <translation>Labeling parameters</translation>
         </message>
+
+        <message>
+            <source>MEN_2D_QUADRATIC_MODE</source>
+            <translation>2D Quadratic</translation>
+        </message>
+        <message>
+            <source>MEN_VISU_ARCQUAD_MODE</source>
+            <translation>Arcs</translation>
+        </message>
+        <message>
+            <source>MEN_VISU_LINEQUAD_MODE</source>
+            <translation>Lines</translation>
+        </message>
         <message><source>TOOL_IMPORT</source><translation>Import</translation></message>
         <message><source>TOOL_REPRESENTATION</source><translation>Representation</translation></message>
         <message><source>TOOL_SELECTION</source><translation>Selection</translation></message>
index 03cff4e0e1263c2a58f816fddb9b0589908a40b3..5c51442e103d3bd86bb59b2efea12842f670ade1 100644 (file)
@@ -2712,6 +2712,14 @@ VisuGUI
                 tr("VISU_VALUES_LABELING_PARAMS"), "", 0, aParent, false,
                 this, SLOT(OnValuesLabelingParams())); 
 
+  createAction(VISU_ARCQUAD_MODE, tr("MEN_VISU_ARCQUAD_MODE"), QIcon(), 
+               tr("MEN_VISU_ARCQUAD_MODE"), "",0, aParent, true,
+               this, SLOT(OnArcQuadMode()));
+  
+  createAction(VISU_LINEQUAD_MODE, tr("MEN_VISU_LINEQUAD_MODE"),QIcon(),
+               tr("MEN_VISU_LINEQUAD_MODE"), "",0, aParent, true,
+               this, SLOT(OnLineQuadMode()));
+
 }
 
 void
@@ -2745,6 +2753,11 @@ VisuGUI
   createMenu( VISU_WIREFRAME, parentId, 10 ); //   wireframe
   createMenu( VISU_SURFACE, parentId, 10 ); //   surface
   createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
+
+  parentId = createMenu( tr( "MEN_2D_QUADRATIC_MODE" ), aMenuId, 10 ); // 2D quadratic mode
+  createMenu( VISU_LINEQUAD_MODE, parentId, 10 ); //   lines
+  createMenu( VISU_ARCQUAD_MODE, parentId, 10 ); //   arcs
+  
 }
 
 void
@@ -2873,6 +2886,11 @@ VisuGUI
   mgr->insert( action( VISU_SHADING )     , parentId, -1, -1 ); // shading
   mgr->insert( action( VISU_NOSHADING )   , parentId, -1, -1 ); // noshading
 
+  //"2D Quadratic" submenu
+  parentId = mgr->insert( tr( "MEN_2D_QUADRATIC_MODE" ), -1, -1 );
+  mgr->insert( action( VISU_LINEQUAD_MODE ), parentId, -1, -1 ); // line representation
+  mgr->insert( action( VISU_ARCQUAD_MODE ), parentId, -1, -1 ); // arc representation
+
   // "Properties" submenu
   parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
   mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
@@ -2989,6 +3007,15 @@ VisuGUI
   mgr->setRule( action( VISU_VALUES_LABELING ), "{true} in $isValuesLabeled", QtxPopupMgr::ToggleRule );
   mgr->setRule( action( VISU_VALUES_LABELING_PARAMS ), aRule, QtxPopupMgr::VisibleRule );
 
+  //2D quadratic
+  aRule = "isVisible and hasActor=1 and selcount=1 and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
+  mgr->setRule (action(VISU_ARCQUAD_MODE), aRule , QtxPopupMgr::VisibleRule);
+  mgr->setRule (action(VISU_LINEQUAD_MODE),aRule , QtxPopupMgr::VisibleRule);
+
+  mgr->setRule (action(VISU_ARCQUAD_MODE), aRule + " and quadratic2DMode='VISU::ARCS'", QtxPopupMgr::ToggleRule);
+  mgr->setRule (action(VISU_LINEQUAD_MODE),aRule + " and quadratic2DMode='VISU::LINES'", QtxPopupMgr::ToggleRule);
+
+
   // view parameters
   aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
   mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule );
@@ -3858,6 +3885,24 @@ void VisuGUI::createPreferences()
   setPreferenceProperty( point_precision, "step", 1 );
   addPreference( "", representGr, LightApp_Preferences::Space );
 
+
+  int quadraticmode = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), representGr, LightApp_Preferences::Selector, "VISU", "quadratic_mode" );
+  QStringList quadraticModes;
+  quadraticModes.append("Lines");
+  quadraticModes.append("Arcs");
+  indices.clear();
+  indices.append( 0 );
+  indices.append( 1 );
+  setPreferenceProperty( quadraticmode, "strings", quadraticModes );
+  setPreferenceProperty( quadraticmode, "indexes", indices );
+
+  int maxAngle = addPreference( tr( "MAX_ARC_ANGLE" ), representGr, LightApp_Preferences::IntSpin,
+                              "VISU", "max_angle" );
+  setPreferenceProperty( maxAngle, "min", 1 );
+  setPreferenceProperty( maxAngle, "max", 90 );
+
+
+
   addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" );
   sp = addPreference( "", representGr, LightApp_Preferences::Space );
   setPreferenceProperty( sp, "hstretch", 0 );
@@ -4329,3 +4374,20 @@ int VisuGUI::addVtkFontPref(
 
   return tfont;
 }
+
+/*!
+  \brief SLOT called when "2D Quadratic -> Arcs" popup menu item 
+  \      of presentation is cliked
+ */
+void VisuGUI::OnArcQuadMode(){
+  ChangeQuadratic2DRepresentation(this,VISU::ARCS);
+}
+
+/*!
+  \brief SLOT called when "2D Quadratic -> Lines" popup menu item 
+  \      of presentation is cliked
+ */
+void VisuGUI::OnLineQuadMode(){
+  ChangeQuadratic2DRepresentation(this,VISU::LINES);
+}
+
index 5461c134951c2edff85a5dac68775618f9a925be..3a955a50128d8dd7e8340c2ae8643d56305f9b51 100644 (file)
@@ -189,6 +189,9 @@ protected slots:
   void OnValuesLabeling();
   void OnValuesLabelingParams();
 
+  void OnArcQuadMode();
+  void OnLineQuadMode();
+
   // MULTIPR
   void OnMultiprViewFullRes();
   void OnMultiprViewMediumRes();
index e772b39f32578e7a735e551d17873a7a12536f7f..184aee88e77953e19a7603ea472b2fcc0fac0142 100644 (file)
 #define VISU_VALUES_LABELING        4302
 #define VISU_VALUES_LABELING_PARAMS 4303
 
+#define VISU_ARCQUAD_MODE           4401
+#define VISU_LINEQUAD_MODE          4402
 
 #endif
index 09012bcbc884110543e34118de794dfd9b9e4f0a..7a4d2a61b2c50eaa0d59d5d5e65d6ea6870bd10c 100644 (file)
@@ -1716,6 +1716,8 @@ void VisuGUI_Module::storeVisualParameters(int savePoint)
                  ip->setParameter( entry, param, vActor->getName() );
                  param = vtkParam + "RepresentationMode";
                  ip->setParameter( entry, param, QString::number( vActor->GetRepresentation() ).toLatin1().data() );
+                  param = vtkParam + "Quadratic2DRepresentation";
+                  ip->setParameter( entry, param, QString::number( vActor->GetQuadratic2DRepresentation() ).toLatin1().data() );
                  param = vtkParam + "Opacity";
                  ip->setParameter( entry, param, QString::number( vActor->GetOpacity() ).toLatin1().data() );
                  vtkFloatingPointType r, g, b;
@@ -1964,6 +1966,9 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint)
          else if ( paramName == "RepresentationMode" )
            vActor->SetRepresentation( val.toInt() );
 
+          else if (paramName == "Quadratic2DRepresentation")
+            vActor->SetQuadratic2DRepresentation(VISU_Actor::EQuadratic2DRepresentation(val.toInt()));
+
          else if ( paramName == "Opacity" )
            vActor->SetOpacity( val.toFloat() );
 
index 38b56d3bfe7e04e3cc4ecd7989300dfa83dc1327..3828a0ca0dceb862bf6b56ac4f53d7b457c2f3b1 100644 (file)
@@ -77,6 +77,7 @@ QVariant VisuGUI_Selection::parameter( const int ind, const QString& p ) const
     else if ( p == "isPlot2dViewer"      ) val = QVariant( Plot2dViewerType( ind ) );
     else if ( p == "isValuesLabeled"  ) val = QVariant( isValuesLabeled( ind ) );
     else if ( p == "isScalarBarVisible" ) val = QVariant( isScalarBarVisible( ind ) );
+    else if ( p == "quadratic2DMode" ) val = QVariant( quadratic2DMode(ind) );
   }
 
   return val;
@@ -765,3 +766,24 @@ bool VisuGUI_Selection::isScalarBarVisible( const int ind ) const
 {
   return TPopupDispatcher<TIsScalarBarVisibleFunctor>()(myModule, entry(ind)) == "true";
 }
+
+struct TGetQuadratic2DRepresentation: TViewFunctor
+{
+  QString virtual get (VISU::Prs3d_i* thePrs3d,
+                       SVTK_ViewWindow* theViewWindow,
+                       VISU_Actor* theActor)
+  {
+    if(theActor->GetQuadratic2DRepresentation() == VISU_Actor::eLines)
+      return "VISU::LINES";
+    else if (theActor->GetQuadratic2DRepresentation() == VISU_Actor::eArcs)
+      return "VISU::ARCS";
+    
+    return QString();
+  }
+};
+
+
+QString VisuGUI_Selection::quadratic2DMode( const int ind) const
+{
+  return TPopupDispatcher<TGetQuadratic2DRepresentation>()(myModule, entry(ind));
+}
index 5026d72b9f5ab6f8721fa5e1fd1150f7b30eda5b..e1bf9155aca4d62ad234b09d5248838e4f72f9bc 100644 (file)
@@ -69,6 +69,8 @@ private:
   QString          lowResolution( const int ) const;
   QString          resolutionState( const int ) const;
 
+  QString          quadratic2DMode( const int ) const;
+
 private:
   bool             findDisplayedCurves( const int, bool ) const;
   bool             hasCurves( const int ) const;
index 97eabc841d6caba6627a3fedb002e857f86f4143..9d150f1b38bf0f51a6c6cd4f8841bfcc55b54314 100644 (file)
@@ -630,6 +630,44 @@ namespace VISU
     aViewWindow->Repaint();
   }
 
+
+  void ChangeQuadratic2DRepresentation (const SalomeApp_Module* theModule,
+                                        VISU::Quadratic2DPresentationType  theType)
+  {
+    TSelectionInfo aSelectionInfo = GetSelectedObjects(theModule);
+    if(aSelectionInfo.empty())
+      return;
+    
+    TSelectionItem aSelectionItem = aSelectionInfo.front();
+
+    VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
+
+    SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+    
+    if(!aPrs3d || !aViewWindow)
+      return;
+    
+    VISU_Actor *anActor = FindActor(aViewWindow, aPrs3d);
+    if(!anActor)
+      return;
+    
+    if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
+      aMesh->SetQuadratic2DPresentationType(theType);
+      RecreateActor(theModule, aMesh);
+    } else {
+      switch(theType){
+      case VISU::LINES:
+        anActor->SetQuadratic2DRepresentation(VISU_Actor::eLines);
+        break;
+      case VISU::ARCS:
+        anActor->SetQuadratic2DRepresentation(VISU_Actor::eArcs);
+        break;
+      default:
+        break;
+      }
+    }
+  }
+  
   //------------------------------------------------------------
   void
   SetShading ( const SalomeApp_Module* theModule,
index 4ad92fabe2626e93970861018bd354d5ed368a32..8a41bf8c103e9502af744289bd7e37e13ecea2ec 100644 (file)
@@ -146,6 +146,12 @@ namespace VISU
   void ChangeRepresentation (const SalomeApp_Module* theModule,
                             VISU::PresentationType  theType);
 
+
+  void ChangeQuadratic2DRepresentation (const SalomeApp_Module* theModule,
+                                       VISU::Quadratic2DPresentationType  theType);
+  
+
+
   void SetShading ( const SalomeApp_Module* theModule, bool theOn = true );
 
   // SObject type
index 04ff5006ac49b58ad4f33dc9a623eeffdc7b82bf..d782714ea228e6c4f880baed244ad8bad13c0b83 100644 (file)
@@ -1263,6 +1263,18 @@ namespace VISU
            theStr<<thePrefix<<aName<<".SetShrink("<<(aServant->IsShrank()? "True" : "False")<<")"<<endl;
            theStr<<thePrefix<<endl;
 
+           std::string aQuad2DPresent;
+           switch(aServant->GetQuadratic2DPresentationType()){
+           case LINES:
+             aQuad2DPresent = "VISU.LINES";
+             break;
+           case ARCS:
+             aQuad2DPresent = "VISU.ARCS";
+             break;
+           }
+
+           theStr<<thePrefix<<aName<<".SetQuadratic2DPresentationType("<<aQuad2DPresent<<")"<<endl;
+           
            DumpChildrenToPython(theStudy,
                                 theIsPublished,
                                 theIsValidScript,
index f07f2208a85416d2134916e2db0afcb203ac3917..368d9a6814d517ec7d47b3f1dc715c6d16a972cc 100644 (file)
@@ -201,6 +201,8 @@ VISU::Mesh_i
       myCellColor.R = 0.0;  myCellColor.G = myCellColor.B = 1.0;
       myNodeColor.R = myNodeColor.G = 1.0;  myNodeColor.B = 1.0;
       myLinkColor.R = myLinkColor.G = myLinkColor.B = 83/255.;
+
+      my2DQuadPrsType = VISU::Quadratic2DPresentationType(VISU::GetResourceMgr()->integerValue( "VISU", "quadratic_mode", 0));
     }
 
     if(myEntity >= 0)
@@ -411,6 +413,19 @@ VISU::Mesh_i
 }
 
 
+void
+VISU::Mesh_i
+::SetQuadratic2DPresentationType(VISU::Quadratic2DPresentationType theType)
+{
+  if(my2DQuadPrsType == theType)
+    return;
+  
+  VISU::TSetModified aModified(this);
+  my2DQuadPrsType = theType;
+  myParamsTime.Modified();
+}
+
+
 //----------------------------------------------------------------------------
 VISU::PresentationType 
 VISU::Mesh_i
@@ -420,6 +435,17 @@ VISU::Mesh_i
 }
 
 
+//----------------------------------------------------------------------------
+VISU::Quadratic2DPresentationType
+VISU::Mesh_i
+::GetQuadratic2DPresentationType()
+{
+  return my2DQuadPrsType;
+}
+
+
+
+
 //----------------------------------------------------------------------------
 VISU::Entity 
 VISU::Mesh_i
@@ -452,6 +478,8 @@ VISU::Mesh_i
 
   myPresentType = VISU::PresentationType(VISU::Storable::FindValue(theMap,"myPresentType").toInt());
 
+  my2DQuadPrsType = VISU::Quadratic2DPresentationType(VISU::Storable::FindValue(theMap,"my2DQuadPrsType").toInt());
+
   myIsShrank = (VISU::Storable::FindValue(theMap,"myIsShrank", "0").toInt() == 1)? true: false;
 
   myCellColor.R = VISU::Storable::FindValue(theMap,"myCellColor.R").toDouble();
@@ -495,6 +523,8 @@ VISU::Mesh_i
 
   Storable::DataToStream( theStr, "myPresentType", int(myPresentType) );
 
+  Storable::DataToStream( theStr, "my2DQuadPrsType", int(my2DQuadPrsType) );
+
   Storable::DataToStream( theStr, "myIsShrank",  (myIsShrank? "1":"0"));
 
   Storable::DataToStream( theStr, "myCellColor.R", myCellColor.R );
@@ -565,6 +595,11 @@ VISU::Mesh_i
       else
        anActor->UnShrink();
     }
+    if(my2DQuadPrsType == VISU::LINES)
+      anActor->SetQuadratic2DRepresentation(VISU_Actor::eLines);
+    else{
+      anActor->SetQuadratic2DRepresentation(VISU_Actor::eArcs);
+    }
     anActor->GetSurfaceProperty()->SetColor(myCellColor.R, myCellColor.G, myCellColor.B);
     anActor->GetEdgeProperty()->SetColor(myLinkColor.R, myLinkColor.G, myLinkColor.B);
     anActor->GetNodeProperty()->SetColor(myNodeColor.R, myNodeColor.G, myNodeColor.B);
index de7e3142660d62f0fd47ed31a684b73826208a87..9115438bcfc251c51356f3d50d0c6686eb9f6087 100644 (file)
@@ -91,6 +91,14 @@ namespace VISU
     void
     SetPresentationType(VISU::PresentationType theType);
 
+    virtual 
+    void
+    SetQuadratic2DPresentationType(VISU::Quadratic2DPresentationType theType);
+
+    virtual 
+    VISU::Quadratic2DPresentationType
+    GetQuadratic2DPresentationType();
+
     virtual
     VISU::PresentationType 
     GetPresentationType();
@@ -115,7 +123,8 @@ namespace VISU
     std::string mySubMeshName;
     VISU::VISUType myType;
 
-    VISU::PresentationType myPresentType;
+    VISU::PresentationType              myPresentType;
+    VISU::Quadratic2DPresentationType   my2DQuadPrsType;
     SALOMEDS::Color myCellColor;
     SALOMEDS::Color myNodeColor;
     SALOMEDS::Color myLinkColor;
index 87a4760bd1f0be3a50c27c79633be3ee73403f64..c3b8bdd07b69e9a228a613402af89e24a4be504d 100644 (file)
@@ -424,6 +424,10 @@ VISU::ScalarMap_i
                                   aResourceMgr->booleanValue("VISU", "show_non_manifold_edges", false) );
     anActor->SetFeatureEdgesColoring( aResourceMgr->booleanValue("VISU", "feature_edges_coloring", false) );
 
+    anActor->SetQuadratic2DRepresentation(VISU_Actor::EQuadratic2DRepresentation(aResourceMgr->integerValue( "VISU", 
+                                                                                                            "quadratic_mode", 
+                                                                                                            0)));
+
     UpdateActor(anActor);
   }catch(...){
     anActor->Delete();
index 945e3ff502e9d4b036068654e958ae781bb40f17..92e8d75a16c3eeae38bfbe6c4ee957984b0314fa 100644 (file)
@@ -2521,6 +2521,59 @@ namespace VISU {
     }
   };
 
+  class TSetQuadratic2DPresentationTypeEvent: public TPrsManageEvent {
+  private:
+    Quadratic2DPresentationType myPrsType;
+  public:
+    typedef string TResult;
+    TResult myResult;
+    TSetQuadratic2DPresentationTypeEvent(View3D_i* theView3D,
+                                        ScalarMap_ptr thePrs,
+                                        Quadratic2DPresentationType theType):
+      TPrsManageEvent(theView3D, thePrs), myPrsType(theType),
+      myResult("Unknown error occured")
+    {}
+    virtual void Execute() 
+    {
+      VISU::VISUType aType = myPrs->GetType();
+      if (aType != VISU::TSCALARMAP &&
+         aType != VISU::TDEFORMEDSHAPE &&
+         aType != VISU::TSCALARMAPONDEFORMEDSHAPE &&
+         aType != VISU::TDEFORMEDSHAPEANDSCALARMAP) {
+       myResult = "2D Quadratic element representation is not available for this type of presentations.";
+       return;
+      }
+      if (VISU_Actor* anActor = GetMyActor()) {
+       if(myPrsType == VISU::LINES)
+         anActor->SetQuadratic2DRepresentation(VISU_Actor::eLines);
+       else if(myPrsType == VISU::ARCS)
+         anActor->SetQuadratic2DRepresentation(VISU_Actor::eArcs);
+       
+       SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(myView3D->GetViewWindow());
+       vw->Repaint();
+       myResult = "";
+      } else {
+       myResult = myError;
+      }
+    }
+  };
+
+  class TGetQuadratic2DPresentationTypeEvent: public TPrsManageEvent {
+  public:
+    typedef VISU::Quadratic2DPresentationType TResult;
+    TResult myResult;
+    TGetQuadratic2DPresentationTypeEvent(View3D_i* theView3D, ScalarMap_ptr thePrs):
+      TPrsManageEvent(theView3D, thePrs), myResult(VISU::LINES) {}
+    virtual void Execute() {
+      if (VISU_Actor* anActor = GetMyActor()) {
+       if(anActor->GetQuadratic2DRepresentation() == VISU_Actor::eLines)
+         myResult = VISU::LINES;
+       else if(anActor->GetQuadratic2DRepresentation() == VISU_Actor::eArcs)
+         myResult = VISU::ARCS;
+      }
+    }
+  };
+
   PresentationType View3D_i::GetPresentationType(ScalarMap_ptr thePrs)
   {
     return ProcessEvent(new TGetPrsTypeEvent(this,thePrs));
@@ -2542,6 +2595,11 @@ namespace VISU {
     return ProcessEvent(new TGetLineWidthEvent(this,thePrs));
   }
 
+  Quadratic2DPresentationType View3D_i::GetQuadratic2DPresentationType(ScalarMap_ptr thePrs)
+  {
+    return ProcessEvent(new TGetQuadratic2DPresentationTypeEvent(this,thePrs));
+  }
+  
   char* View3D_i::SetPresentationType(ScalarMap_ptr thePrs, PresentationType thePrsType)
   {
     string aRet = ProcessEvent(new TSetPrsTypeEvent(this,thePrs,thePrsType));
@@ -2567,4 +2625,12 @@ namespace VISU {
     string aRet = ProcessEvent(new TSetLineWidthEvent(this,thePrs,theLineWidth));
     return CORBA::string_dup(aRet.c_str());
   }
+  
+  char* View3D_i::SetQuadratic2DPresentationType(ScalarMap_ptr thePrs, Quadratic2DPresentationType theType)
+  {
+    string aRet = ProcessEvent(new TSetQuadratic2DPresentationTypeEvent(this,thePrs,theType));
+    return CORBA::string_dup(aRet.c_str());
+  }
 }
+
+
index f1e8ca334ca860707875d5bc05dbb8e4faa7881f..7b1e8672fe14e3af885a07ceaa8f45be20441f30 100644 (file)
@@ -305,12 +305,14 @@ namespace VISU
     virtual CORBA::Boolean   IsShaded           (ScalarMap_ptr thePrs);
     virtual CORBA::Double    GetOpacity         (ScalarMap_ptr thePrs);
     virtual CORBA::Double    GetLineWidth       (ScalarMap_ptr thePrs);
+    virtual Quadratic2DPresentationType GetQuadratic2DPresentationType(ScalarMap_ptr thePrs);
 
     virtual char* SetPresentationType(ScalarMap_ptr thePrs, PresentationType thePrsType);
     virtual char* SetShrinked        (ScalarMap_ptr thePrs, CORBA::Boolean   isShrinked);
     virtual char* SetShaded          (ScalarMap_ptr thePrs, CORBA::Boolean   isShaded);
     virtual char* SetOpacity         (ScalarMap_ptr thePrs, CORBA::Double    theOpacity);
     virtual char* SetLineWidth       (ScalarMap_ptr thePrs, CORBA::Double    theLineWidth);
+    virtual char* SetQuadratic2DPresentationType(ScalarMap_ptr thePrs, Quadratic2DPresentationType theType);
 
   protected:
     static int myNbViewParams;