From: rnv Date: Wed, 27 May 2009 11:23:48 +0000 (+0000) Subject: Implementation of the issue 20115: [CEA 308] Quadratic elements visualization. X-Git-Tag: V5_1_main_20090528~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4056171343730e83feeac85d0caeb45fcf2bd0c9;p=modules%2Fvisu.git Implementation of the issue 20115: [CEA 308] Quadratic elements visualization. --- diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index f2bd29f8..7ff5beb8 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -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 + * Quadratic2DPresentationType 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 Quadratic2DPresentationType 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. diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml index d3036faa..a764ac0c 100644 --- a/resources/SalomeApp.xml +++ b/resources/SalomeApp.xml @@ -50,6 +50,8 @@ + + diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index c9b52260..8a5ca950 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -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 ) +{ + +} diff --git a/src/OBJECT/VISU_Actor.h b/src/OBJECT/VISU_Actor.h index 65920a78..76cc277e 100644 --- a/src/OBJECT/VISU_Actor.h +++ b/src/OBJECT/VISU_Actor.h @@ -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(); diff --git a/src/OBJECT/VISU_MeshAct.cxx b/src/OBJECT/VISU_MeshAct.cxx index 2c3050dd..c5c87fe5 100644 --- a/src/OBJECT/VISU_MeshAct.cxx +++ b/src/OBJECT/VISU_MeshAct.cxx @@ -27,6 +27,9 @@ // #include "VISU_MeshAct.h" +#include +#include + #include #include #include @@ -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; + } +} diff --git a/src/OBJECT/VISU_MeshAct.h b/src/OBJECT/VISU_MeshAct.h index 3c72e69e..f888b5da 100644 --- a/src/OBJECT/VISU_MeshAct.h +++ b/src/OBJECT/VISU_MeshAct.h @@ -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(); diff --git a/src/OBJECT/VISU_ScalarMapAct.cxx b/src/OBJECT/VISU_ScalarMapAct.cxx index a1ce8e71..e68b8375 100644 --- a/src/OBJECT/VISU_ScalarMapAct.cxx +++ b/src/OBJECT/VISU_ScalarMapAct.cxx @@ -35,6 +35,10 @@ #include "VISU_DeformedShapePL.hxx" #include "VISU_PipeLineUtils.hxx" + +#include +#include + #include #include @@ -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; + } +} diff --git a/src/OBJECT/VISU_ScalarMapAct.h b/src/OBJECT/VISU_ScalarMapAct.h index 63b10ce0..b399f21d 100644 --- a/src/OBJECT/VISU_ScalarMapAct.h +++ b/src/OBJECT/VISU_ScalarMapAct.h @@ -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 diff --git a/src/VISUGUI/VISU_msg_en.ts b/src/VISUGUI/VISU_msg_en.ts index fb62750e..e7539f3d 100644 --- a/src/VISUGUI/VISU_msg_en.ts +++ b/src/VISUGUI/VISU_msg_en.ts @@ -369,6 +369,14 @@ number of time stamps or number of components is not the same! VISU_TITLE Title + + QUADRATIC_REPRESENT_MODE + Representation of the 2D quadratic elements + + + MAX_ARC_ANGLE + Maximum angle + VISU_USE_SHADING Use Shading @@ -1297,6 +1305,19 @@ Please, refer to the documentation. VISU_VALUES_LABELING_PARAMS Labeling parameters + + + MEN_2D_QUADRATIC_MODE + 2D Quadratic + + + MEN_VISU_ARCQUAD_MODE + Arcs + + + MEN_VISU_LINEQUAD_MODE + Lines + TOOL_IMPORTImport TOOL_REPRESENTATIONRepresentation TOOL_SELECTIONSelection diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 03cff4e0..5c51442e 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -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); +} + diff --git a/src/VISUGUI/VisuGUI.h b/src/VISUGUI/VisuGUI.h index 5461c134..3a955a50 100644 --- a/src/VISUGUI/VisuGUI.h +++ b/src/VISUGUI/VisuGUI.h @@ -189,6 +189,9 @@ protected slots: void OnValuesLabeling(); void OnValuesLabelingParams(); + void OnArcQuadMode(); + void OnLineQuadMode(); + // MULTIPR void OnMultiprViewFullRes(); void OnMultiprViewMediumRes(); diff --git a/src/VISUGUI/VisuGUI_ActionsDef.h b/src/VISUGUI/VisuGUI_ActionsDef.h index e772b39f..184aee88 100644 --- a/src/VISUGUI/VisuGUI_ActionsDef.h +++ b/src/VISUGUI/VisuGUI_ActionsDef.h @@ -149,5 +149,7 @@ #define VISU_VALUES_LABELING 4302 #define VISU_VALUES_LABELING_PARAMS 4303 +#define VISU_ARCQUAD_MODE 4401 +#define VISU_LINEQUAD_MODE 4402 #endif diff --git a/src/VISUGUI/VisuGUI_Module.cxx b/src/VISUGUI/VisuGUI_Module.cxx index 09012bcb..7a4d2a61 100644 --- a/src/VISUGUI/VisuGUI_Module.cxx +++ b/src/VISUGUI/VisuGUI_Module.cxx @@ -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() ); diff --git a/src/VISUGUI/VisuGUI_Selection.cxx b/src/VISUGUI/VisuGUI_Selection.cxx index 38b56d3b..3828a0ca 100644 --- a/src/VISUGUI/VisuGUI_Selection.cxx +++ b/src/VISUGUI/VisuGUI_Selection.cxx @@ -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()(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()(myModule, entry(ind)); +} diff --git a/src/VISUGUI/VisuGUI_Selection.h b/src/VISUGUI/VisuGUI_Selection.h index 5026d72b..e1bf9155 100644 --- a/src/VISUGUI/VisuGUI_Selection.h +++ b/src/VISUGUI/VisuGUI_Selection.h @@ -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; diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 97eabc84..9d150f1b 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -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(theModule); + + if(!aPrs3d || !aViewWindow) + return; + + VISU_Actor *anActor = FindActor(aViewWindow, aPrs3d); + if(!anActor) + return; + + if (VISU::Mesh_i* aMesh = dynamic_cast(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, diff --git a/src/VISUGUI/VisuGUI_Tools.h b/src/VISUGUI/VisuGUI_Tools.h index 4ad92fab..8a41bf8c 100644 --- a/src/VISUGUI/VisuGUI_Tools.h +++ b/src/VISUGUI/VisuGUI_Tools.h @@ -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 diff --git a/src/VISU_I/VISU_DumpPython.cc b/src/VISU_I/VISU_DumpPython.cc index 04ff5006..d782714e 100644 --- a/src/VISU_I/VISU_DumpPython.cc +++ b/src/VISU_I/VISU_DumpPython.cc @@ -1263,6 +1263,18 @@ namespace VISU theStr<IsShrank()? "True" : "False")<<")"<GetQuadratic2DPresentationType()){ + case LINES: + aQuad2DPresent = "VISU.LINES"; + break; + case ARCS: + aQuad2DPresent = "VISU.ARCS"; + break; + } + + theStr<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); diff --git a/src/VISU_I/VISU_Mesh_i.hh b/src/VISU_I/VISU_Mesh_i.hh index de7e3142..9115438b 100644 --- a/src/VISU_I/VISU_Mesh_i.hh +++ b/src/VISU_I/VISU_Mesh_i.hh @@ -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; diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index 87a4760b..c3b8bdd0 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -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(); diff --git a/src/VISU_I/VISU_View_i.cc b/src/VISU_I/VISU_View_i.cc index 945e3ff5..92e8d75a 100644 --- a/src/VISU_I/VISU_View_i.cc +++ b/src/VISU_I/VISU_View_i.cc @@ -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(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()); + } } + + diff --git a/src/VISU_I/VISU_View_i.hh b/src/VISU_I/VISU_View_i.hh index f1e8ca33..7b1e8672 100644 --- a/src/VISU_I/VISU_View_i.hh +++ b/src/VISU_I/VISU_View_i.hh @@ -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;