From: vsr Date: Wed, 2 Jul 2014 07:17:40 +0000 (+0400) Subject: 0022618: [CEA 1062] Define the transparency by default in the preferences X-Git-Tag: V7_5_0a1~48 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a0e22ed86a0df64143edb095e07295a014b32c88;p=modules%2Fgeom.git 0022618: [CEA 1062] Define the transparency by default in the preferences --- diff --git a/doc/salome/gui/GEOM/images/pref15.png b/doc/salome/gui/GEOM/images/pref15.png index 0fec2802a..64aa25d74 100644 Binary files a/doc/salome/gui/GEOM/images/pref15.png and b/doc/salome/gui/GEOM/images/pref15.png differ diff --git a/doc/salome/gui/GEOM/input/geometry_preferences.doc b/doc/salome/gui/GEOM/input/geometry_preferences.doc index 6d322fcb6..6c1f7d03b 100644 --- a/doc/salome/gui/GEOM/input/geometry_preferences.doc +++ b/doc/salome/gui/GEOM/input/geometry_preferences.doc @@ -33,8 +33,7 @@ default color for edges, vectors and wires (isolated lines). vertices.
  • Color of isolines - allows to select default color for isolines.
  • -
  • Step value for spin boxes - allows to define the increment -of values set in spin boxes.
  • +
  • Transparency - allows to define default transparency value.
  • Deflection coefficient - allows to define default deflection coefficient for lines and surfaces. A smaller coefficient provides better quality of a shape in the viewer.
  • @@ -46,6 +45,8 @@ predefined materials.
  • Isolines width - allows to define default width of the isolines.
  • Preview edges width - allows to define width of the edges for preview.
  • Measures line width - allows to define lines width of measurements tools.
  • +
  • Step value for spin boxes - allows to define the increment +of values set in spin boxes.
  • Automatic bring to front - when the option is on, the objects selected by the user automatically become "top-level".
  • diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in index 24a0f148d..47fa423d2 100644 --- a/resources/SalomeApp.xml.in +++ b/resources/SalomeApp.xml.in @@ -44,6 +44,7 @@ + diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 4cd41a6eb..8a8969492 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -507,6 +507,9 @@ GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st ) int aType = resMgr->integerValue("Geometry", "type_of_marker", (int)Aspect_TOM_PLUS); myWidth = resMgr->integerValue("Geometry", "edge_width", -1); myIsosWidth = resMgr->integerValue("Geometry", "isolines_width", -1); + + myTransparency = resMgr->integerValue("Geometry", "transparency", 0) / 100.; + myHasTransparency = false; myTypeOfMarker = (Aspect_TypeOfMarker)(std::min((int)Aspect_TOM_RING3, std::max((int)Aspect_TOM_POINT, aType))); myScaleOfMarker = (resMgr->integerValue("Geometry", "marker_scale", 1)-(int)GEOM::MS_10)*0.5 + 1.0; @@ -519,7 +522,6 @@ GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st ) myWidth = -1; myType = -1; - myTransparency = -1.0; myToActivate = true; // This parameter is used for activisation/deactivisation of objects to be displayed @@ -2057,24 +2059,54 @@ void GEOM_Displayer::UnsetColor() * Set transparency for shape displaying. */ //================================================================= -void GEOM_Displayer::SetTransparency( const double transparency ) +double GEOM_Displayer::SetTransparency( const double transparency ) { - myTransparency = transparency; + double aPrevTransparency = myTransparency; + if ( transparency < 0 ) { + UnsetTransparency(); + } + else { + myTransparency = transparency; + myHasTransparency = true; + } + return aPrevTransparency; } +//================================================================= +/*! + * GEOM_Displayer::GetTransparency + * Get transparency for shape displaying. + */ +//================================================================= double GEOM_Displayer::GetTransparency() const { return myTransparency; } +//================================================================= +/*! + * GEOM_Displayer::HasTransparency + * Check if transparency for shape displaying is set. + */ +//================================================================= bool GEOM_Displayer::HasTransparency() const { - return myTransparency != -1.0; + return myHasTransparency; } -void GEOM_Displayer::UnsetTransparency() +//================================================================= +/*! + * GEOM_Displayer::UnsetTransparency + * Unset transparency for shape displaying. + */ +//================================================================= +double GEOM_Displayer::UnsetTransparency() { - myTransparency = -1.0; + double aPrevTransparency = myTransparency; + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + myTransparency = resMgr->integerValue("Geometry", "transparency", 0) / 100.; + myHasTransparency = false; + return aPrevTransparency; } @@ -2452,7 +2484,8 @@ PropMap GEOM_Displayer::getDefaultPropertyMap() arg( resMgr->integerValue( "Geometry", "iso_number_v", 1 ) ) ); // - transparency (opacity = 1-transparency) - propMap.insert( GEOM::propertyName( GEOM::Transparency ), 0.0 ); + propMap.insert( GEOM::propertyName( GEOM::Transparency ), + resMgr->integerValue( "Geometry", "transparency", 0 ) / 100. ); // - display mode (take default value from preferences) propMap.insert( GEOM::propertyName( GEOM::DisplayMode ), diff --git a/src/GEOMGUI/GEOM_Displayer.h b/src/GEOMGUI/GEOM_Displayer.h index 257b4494e..7061a58cb 100644 --- a/src/GEOMGUI/GEOM_Displayer.h +++ b/src/GEOMGUI/GEOM_Displayer.h @@ -139,8 +139,8 @@ public: int GetColor () const; bool HasColor () const; - void SetTransparency ( const double ); - void UnsetTransparency(); + double SetTransparency ( const double ); + double UnsetTransparency(); double GetTransparency () const; bool HasTransparency () const; @@ -294,6 +294,7 @@ protected: Aspect_TypeOfMarker myTypeOfMarker; double myScaleOfMarker; double myTransparency; + bool myHasTransparency; private: SalomeApp_Application* myApp; diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index e125146d8..04e9f9d6b 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -3148,6 +3148,10 @@ Please, select face, shell or solid and try again PREF_DISPLAY_MODE Default display mode + + PREF_TRANSPARENCY + Transparency + PREF_FREE_BOUND_COLOR Color of free boundaries diff --git a/src/GEOMGUI/GEOM_msg_fr.ts b/src/GEOMGUI/GEOM_msg_fr.ts index 4aa87fa5a..20d5ebe4e 100644 --- a/src/GEOMGUI/GEOM_msg_fr.ts +++ b/src/GEOMGUI/GEOM_msg_fr.ts @@ -3152,6 +3152,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau PREF_DISPLAY_MODE Mode de visualisation + + PREF_TRANSPARENCY + Transparence + PREF_FREE_BOUND_COLOR Couleur des contours libres diff --git a/src/GEOMGUI/GEOM_msg_ja.ts b/src/GEOMGUI/GEOM_msg_ja.ts index e6ff64c64..2d39d9f4d 100644 --- a/src/GEOMGUI/GEOM_msg_ja.ts +++ b/src/GEOMGUI/GEOM_msg_ja.ts @@ -3143,6 +3143,10 @@ PREF_DISPLAY_MODE 表示モード + + PREF_TRANSPARENCY + 透明度 + PREF_FREE_BOUND_COLOR 自由境界の色 diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index e8745c0f2..c3cba1b41 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -2338,8 +2338,8 @@ void GeometryGUI::createPreferences() int top_lev_dm = addPreference( tr( "PREF_TOPLEVEL_DM" ), genGroup, LightApp_Preferences::Selector, "Geometry", "toplevel_dm" ); - int step = addPreference( tr( "PREF_STEP_VALUE" ), genGroup, - LightApp_Preferences::IntSpin, "Geometry", "SettingsGeomStep" ); + int transparency = addPreference( tr( "PREF_TRANSPARENCY" ), genGroup, + LightApp_Preferences::IntSpin, "Geometry", "transparency" ); int defl = addPreference( tr( "PREF_DEFLECTION" ), genGroup, LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" ); @@ -2375,6 +2375,9 @@ void GeometryGUI::createPreferences() setPreferenceProperty( wd[i], "max", 5 ); } + int step = addPreference( tr( "PREF_STEP_VALUE" ), genGroup, + LightApp_Preferences::IntSpin, "Geometry", "SettingsGeomStep" ); + addPreference( tr( "PREF_AUTO_BRING_TO_FRONT" ), genGroup, LightApp_Preferences::Bool, "Geometry", "auto_bring_to_front" ); @@ -2523,6 +2526,10 @@ void GeometryGUI::createPreferences() setPreferenceProperty( step, "max", 10000 ); setPreferenceProperty( step, "precision", 3 ); + // Set property for trandparency value for spinboxes + setPreferenceProperty( transparency, "min", 0 ); + setPreferenceProperty( transparency, "max", 100 ); + // Set property for deflection value for spinboxes setPreferenceProperty( defl, "min", GEOM::minDeflection() ); setPreferenceProperty( defl, "max", 1.0 );