0022618: [CEA 1062] Define the transparency by default in the preferences

This commit is contained in:
vsr 2014-07-02 11:17:40 +04:00
parent 3866909ccc
commit a0e22ed86a
9 changed files with 68 additions and 13 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 89 KiB

View File

@ -33,8 +33,7 @@ default color for edges, vectors and wires (isolated lines).</li>
vertices.</li> vertices.</li>
<li><b>Color of isolines</b> - allows to select default color for <li><b>Color of isolines</b> - allows to select default color for
isolines.</li> isolines.</li>
<li><b>Step value for spin boxes</b> - allows to define the increment <li><b>Transparency</b> - allows to define default transparency value.</li>
of values set in spin boxes.</li>
<li><b>Deflection coefficient</b> - allows to define default deflection <li><b>Deflection coefficient</b> - allows to define default deflection
coefficient for lines and surfaces. A smaller coefficient provides coefficient for lines and surfaces. A smaller coefficient provides
better quality of a shape in the viewer.</li> better quality of a shape in the viewer.</li>
@ -46,6 +45,8 @@ predefined materials.</li>
<li><b>Isolines width</b> - allows to define default width of the isolines.</li> <li><b>Isolines width</b> - allows to define default width of the isolines.</li>
<li><b>Preview edges width</b> - allows to define width of the edges for preview.</li> <li><b>Preview edges width</b> - allows to define width of the edges for preview.</li>
<li><b>Measures line width</b> - allows to define lines width of measurements tools.</li> <li><b>Measures line width</b> - allows to define lines width of measurements tools.</li>
<li><b>Step value for spin boxes</b> - allows to define the increment
of values set in spin boxes.</li>
<li><b>Automatic bring to front</b> - when the option is on, the objects selected by the user automatically become "top-level".</li> <li><b>Automatic bring to front</b> - when the option is on, the objects selected by the user automatically become "top-level".</li>
</ul> </ul>

View File

@ -44,6 +44,7 @@
<!-- Other module preferences --> <!-- Other module preferences -->
<parameter name="SettingsGeomStep" value="10" /> <parameter name="SettingsGeomStep" value="10" />
<parameter name="display_mode" value="2" /> <parameter name="display_mode" value="2" />
<parameter name="transparency" value="0" />
<parameter name="shading_color" value="#a7a7a7" /> <parameter name="shading_color" value="#a7a7a7" />
<parameter name="edges_in_shading_color" value="#000000" /> <parameter name="edges_in_shading_color" value="#000000" />
<parameter name="wireframe_color" value="255, 255, 0" /> <parameter name="wireframe_color" value="255, 255, 0" />

View File

@ -507,6 +507,9 @@ GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st )
int aType = resMgr->integerValue("Geometry", "type_of_marker", (int)Aspect_TOM_PLUS); int aType = resMgr->integerValue("Geometry", "type_of_marker", (int)Aspect_TOM_PLUS);
myWidth = resMgr->integerValue("Geometry", "edge_width", -1); myWidth = resMgr->integerValue("Geometry", "edge_width", -1);
myIsosWidth = resMgr->integerValue("Geometry", "isolines_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))); 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; 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; myWidth = -1;
myType = -1; myType = -1;
myTransparency = -1.0;
myToActivate = true; myToActivate = true;
// This parameter is used for activisation/deactivisation of objects to be displayed // 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. * 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 double GEOM_Displayer::GetTransparency() const
{ {
return myTransparency; return myTransparency;
} }
//=================================================================
/*!
* GEOM_Displayer::HasTransparency
* Check if transparency for shape displaying is set.
*/
//=================================================================
bool GEOM_Displayer::HasTransparency() const 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 ) ) ); arg( resMgr->integerValue( "Geometry", "iso_number_v", 1 ) ) );
// - transparency (opacity = 1-transparency) // - 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) // - display mode (take default value from preferences)
propMap.insert( GEOM::propertyName( GEOM::DisplayMode ), propMap.insert( GEOM::propertyName( GEOM::DisplayMode ),

View File

@ -139,8 +139,8 @@ public:
int GetColor () const; int GetColor () const;
bool HasColor () const; bool HasColor () const;
void SetTransparency ( const double ); double SetTransparency ( const double );
void UnsetTransparency(); double UnsetTransparency();
double GetTransparency () const; double GetTransparency () const;
bool HasTransparency () const; bool HasTransparency () const;
@ -294,6 +294,7 @@ protected:
Aspect_TypeOfMarker myTypeOfMarker; Aspect_TypeOfMarker myTypeOfMarker;
double myScaleOfMarker; double myScaleOfMarker;
double myTransparency; double myTransparency;
bool myHasTransparency;
private: private:
SalomeApp_Application* myApp; SalomeApp_Application* myApp;

View File

@ -3148,6 +3148,10 @@ Please, select face, shell or solid and try again</translation>
<source>PREF_DISPLAY_MODE</source> <source>PREF_DISPLAY_MODE</source>
<translation>Default display mode</translation> <translation>Default display mode</translation>
</message> </message>
<message>
<source>PREF_TRANSPARENCY</source>
<translation>Transparency</translation>
</message>
<message> <message>
<source>PREF_FREE_BOUND_COLOR</source> <source>PREF_FREE_BOUND_COLOR</source>
<translation>Color of free boundaries</translation> <translation>Color of free boundaries</translation>

View File

@ -3152,6 +3152,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
<source>PREF_DISPLAY_MODE</source> <source>PREF_DISPLAY_MODE</source>
<translation>Mode de visualisation</translation> <translation>Mode de visualisation</translation>
</message> </message>
<message>
<source>PREF_TRANSPARENCY</source>
<translation>Transparence</translation>
</message>
<message> <message>
<source>PREF_FREE_BOUND_COLOR</source> <source>PREF_FREE_BOUND_COLOR</source>
<translation>Couleur des contours libres</translation> <translation>Couleur des contours libres</translation>

View File

@ -3143,6 +3143,10 @@
<source>PREF_DISPLAY_MODE</source> <source>PREF_DISPLAY_MODE</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>PREF_TRANSPARENCY</source>
<translation></translation>
</message>
<message> <message>
<source>PREF_FREE_BOUND_COLOR</source> <source>PREF_FREE_BOUND_COLOR</source>
<translation></translation> <translation></translation>

View File

@ -2338,8 +2338,8 @@ void GeometryGUI::createPreferences()
int top_lev_dm = addPreference( tr( "PREF_TOPLEVEL_DM" ), genGroup, int top_lev_dm = addPreference( tr( "PREF_TOPLEVEL_DM" ), genGroup,
LightApp_Preferences::Selector, "Geometry", "toplevel_dm" ); LightApp_Preferences::Selector, "Geometry", "toplevel_dm" );
int step = addPreference( tr( "PREF_STEP_VALUE" ), genGroup, int transparency = addPreference( tr( "PREF_TRANSPARENCY" ), genGroup,
LightApp_Preferences::IntSpin, "Geometry", "SettingsGeomStep" ); LightApp_Preferences::IntSpin, "Geometry", "transparency" );
int defl = addPreference( tr( "PREF_DEFLECTION" ), genGroup, int defl = addPreference( tr( "PREF_DEFLECTION" ), genGroup,
LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" ); LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" );
@ -2375,6 +2375,9 @@ void GeometryGUI::createPreferences()
setPreferenceProperty( wd[i], "max", 5 ); 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, addPreference( tr( "PREF_AUTO_BRING_TO_FRONT" ), genGroup,
LightApp_Preferences::Bool, "Geometry", "auto_bring_to_front" ); LightApp_Preferences::Bool, "Geometry", "auto_bring_to_front" );
@ -2523,6 +2526,10 @@ void GeometryGUI::createPreferences()
setPreferenceProperty( step, "max", 10000 ); setPreferenceProperty( step, "max", 10000 );
setPreferenceProperty( step, "precision", 3 ); 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 // Set property for deflection value for spinboxes
setPreferenceProperty( defl, "min", GEOM::minDeflection() ); setPreferenceProperty( defl, "min", GEOM::minDeflection() );
setPreferenceProperty( defl, "max", 1.0 ); setPreferenceProperty( defl, "max", 1.0 );