int vtkTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), vtkGroup,
LightApp_Preferences::IntSpin, "VTKViewer", "trihedron_size" );
+ pref->addPreference( tr( "PREF_RELATIVE_SIZE" ), vtkGroup, LightApp_Preferences::Bool, "VTKViewer", "relative_size" );
pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), vtkGroup,
LightApp_Preferences::Color, "VTKViewer", "background" );
}
}
- if ( sec == QString( "VTKViewer" ) && param == QString( "trihedron_size" ) )
+ if ( sec == QString( "VTKViewer" ) && (param == QString( "trihedron_size" ) || param == QString( "relative_size" )) )
{
- int sz = resMgr->integerValue( sec, param, -1 );
+ int sz = resMgr->integerValue( "VTKViewer", "trihedron_size", -1 );
QPtrList<SUIT_ViewManager> lst;
viewManagers( SVTK_Viewer::Type(), lst );
for ( QPtrListIterator<SUIT_ViewManager> it( lst ); it.current() && sz >= 0; ++it )
void SVTK_ViewWindow::SetTrihedronSize( const int sz )
{
- if ( myTrihedronSize == sz )
- return;
-
myTrihedronSize = sz;
AdjustTrihedrons( true );
}
myCubeAxes->GetBounds(bnd);
int aVisibleNum = myTrihedron->GetVisibleActorCount( myRenderer );
+
+ SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ bool isRelativeSize = aResMgr->booleanValue( "VTKViewer", "relative_size", true );
+
//if (aVisibleNum || theIsForcedUpdate) {
- if (aVisibleNum) {
+ if (aVisibleNum || !isRelativeSize) {
// if the new trihedron size have sufficient difference, then apply the value
double aNewSize = 100, anOldSize=myTrihedron->GetSize();
bool aTDisplayed = isTrihedronDisplayed();
if(aTDisplayed) myTrihedron->VisibilityOff();
if(aCDisplayed) myCubeAxes->VisibilityOff();
- SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
- QString aSetting = aResMgr->stringValue("Viewer", "TrihedronSize", "105");
- static float aSizeInPercents = aSetting.toFloat();
-
+ int aDefaultSize = 100;
+ if (isRelativeSize) aDefaultSize = 105;
+ int aSizeFromPreferences = aResMgr->integerValue( "VTKViewer", "trihedron_size", aDefaultSize );
+
//bool isComputeTrihedronSize =
- ::ComputeTrihedronSize(myRenderer, aNewSize, anOldSize, aSizeInPercents);
-
+ if (isRelativeSize)
+ ::ComputeTrihedronSize(myRenderer, aNewSize, anOldSize, (float)aSizeFromPreferences);
+ else
+ aNewSize = (double)aSizeFromPreferences;
+
myTrihedron->SetSize( aNewSize );
// iterate through displayed objects and set size if necessary
</section>
<section name="VTKViewer" >
<parameter value="0, 0, 0" name="background" />
- <parameter value="100" name="trihedron_size" />
+ <parameter value="105" name="trihedron_size" />
+ <parameter value="true" name="relative_size" />
</section>
<section name="Plot2d" >
<parameter value="255, 255, 255" name="Background" />