From ed191931f2fdad3eec02fdd6cb9967c1d2158fcc Mon Sep 17 00:00:00 2001 From: rnv Date: Tue, 14 Feb 2012 12:08:05 +0000 Subject: [PATCH] Implementation of the "21046: EDF 1610 GUI: To be able to change the width of the lines" issue. --- resources/SalomeApp.xml.in | 2 -- src/OBJECT/SMESH_Actor.cxx | 12 +++++++++--- src/SMESHGUI/SMESHGUI.cxx | 10 +--------- src/SMESHGUI/SMESHGUI_VTKUtils.cxx | 11 ++--------- 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in index cbeffbd36..ed12aa583 100644 --- a/resources/SalomeApp.xml.in +++ b/resources/SalomeApp.xml.in @@ -48,8 +48,6 @@ - - diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index b0af3e9e3..7d1ab09d1 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -376,7 +376,7 @@ SMESH_ActorDef::SMESH_ActorDef() myBaseActor->SetStoreGemetryMapping(true); myBaseActor->GetProperty()->SetOpacity(0.0); myPickableActor = myBaseActor; - + myHighlightProp = vtkProperty::New(); myHighlightProp->SetAmbient(1.0); myHighlightProp->SetDiffuse(0.0); @@ -384,6 +384,7 @@ SMESH_ActorDef::SMESH_ActorDef() SMESH::GetColor( "SMESH", "selection_object_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) ); myHighlightProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); myHighlightProp->SetPointSize(aElem0DSize); // ?? + myHighlightProp->SetLineWidth(aLineWidth); myHighlightProp->SetRepresentation(1); myOutLineProp = vtkProperty::New(); @@ -393,6 +394,7 @@ SMESH_ActorDef::SMESH_ActorDef() SMESH::GetColor( "SMESH", "outline_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 70, 0 ) ); myOutLineProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); myOutLineProp->SetPointSize(aElem0DSize); // ?? + myOutLineProp->SetLineWidth(aLineWidth); myOutLineProp->SetRepresentation(1); myPreselectProp = vtkProperty::New(); @@ -402,6 +404,7 @@ SMESH_ActorDef::SMESH_ActorDef() SMESH::GetColor( "SMESH", "highlight_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 255 ) ); myPreselectProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); myPreselectProp->SetPointSize(aElem0DSize); // ?? + myPreselectProp->SetLineWidth(aLineWidth); myPreselectProp->SetRepresentation(1); myHighlitableActor = SMESH_DeviceActor::New(); @@ -1812,8 +1815,11 @@ void SMESH_ActorDef::SetLineWidth(vtkFloatingPointType theVal){ myEdgeProp->SetLineWidth(theVal); my1DProp->SetLineWidth(theVal + aLineWidthInc); - my1DExtProp->SetLineWidth(theVal + aLineWidthInc); - + my1DExtProp->SetLineWidth(theVal + aLineWidthInc); + my2DExtProp->SetLineWidth(theVal + aLineWidthInc); + myOutLineProp->SetLineWidth(theVal); + myHighlightProp->SetLineWidth(theVal); + myPreselectProp->SetLineWidth(theVal); Modified(); } diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index e76fb8564..5cf671294 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -4699,19 +4699,11 @@ void SMESHGUI::createPreferences() addPreference( tr( "PREF_OBJECT_COLOR" ), selGroup, LightApp_Preferences::Color, "SMESH", "selection_object_color" ); addPreference( tr( "PREF_ELEMENT_COLOR" ), selGroup, LightApp_Preferences::Color, "SMESH", "selection_element_color" ); - int selW = addPreference( tr( "PREF_WIDTH" ), selGroup, LightApp_Preferences::IntSpin, "SMESH", "selection_width" ); - - setPreferenceProperty( selW, "min", 1 ); - setPreferenceProperty( selW, "max", 5 ); int preGroup = addPreference( tr( "PREF_GROUP_PRESELECTION" ), selTab ); setPreferenceProperty( preGroup, "columns", 2 ); addPreference( tr( "PREF_HIGHLIGHT_COLOR" ), preGroup, LightApp_Preferences::Color, "SMESH", "highlight_color" ); - int preW = addPreference( tr( "PREF_WIDTH" ), preGroup, LightApp_Preferences::IntSpin, "SMESH", "highlight_width" ); - - setPreferenceProperty( preW, "min", 1 ); - setPreferenceProperty( preW, "max", 5 ); int precSelGroup = addPreference( tr( "PREF_GROUP_PRECISION" ), selTab ); setPreferenceProperty( precSelGroup, "columns", 2 ); @@ -4814,7 +4806,7 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name ) std::string aWarning; SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this); if( name=="selection_object_color" || name=="selection_element_color" || - name=="selection_width" || name=="highlight_color" || name=="highlight_width" || + name=="highlight_color" || name=="selection_precision_node" || name=="selection_precision_element" || name=="selection_precision_object") SMESH::UpdateSelectionProp( this ); diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx index 46e7e5c96..4c9ac89fe 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx @@ -896,16 +896,11 @@ namespace SMESH aSelColor = mgr->colorValue( "SMESH", "selection_element_color", Qt::yellow ), aPreColor = mgr->colorValue( "SMESH", "highlight_color", Qt::cyan ); - int SW = mgr->integerValue( "SMESH", "selection_width", 5 ), - PW = mgr->integerValue( "SMESH", "highlight_width", 5 ); - - // adjust highlight_width to the width of mesh entities int aElem0DSize = mgr->integerValue("SMESH", "elem0d_size", 5); int aLineWidth = mgr->integerValue("SMESH", "element_width", 1); int maxSize = aElem0DSize; if (aElem0DSize > maxSize) maxSize = aElem0DSize; if (aLineWidth > maxSize) maxSize = aLineWidth; - if (PW < maxSize + 2) PW = maxSize + 2; double SP1 = mgr->doubleValue( "SMESH", "selection_precision_node", 0.025 ), SP2 = mgr->doubleValue( "SMESH", "selection_precision_element", 0.001 ), @@ -917,16 +912,14 @@ namespace SMESH // mesh element selection aVtkView->SetSelectionProp(aSelColor.red()/255., aSelColor.green()/255., - aSelColor.blue()/255., - SW ); + aSelColor.blue()/255.); // tolerances aVtkView->SetSelectionTolerance(SP1, SP2, SP3); // pre-selection aVtkView->SetPreselectionProp(aPreColor.red()/255., aPreColor.green()/255., - aPreColor.blue()/255., - PW); + aPreColor.blue()/255.); // update actors vtkRenderer* aRenderer = aVtkView->getRenderer(); VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); -- 2.30.2