- GEOM::field_data_type aFieldDataType;
- int aFieldDimension;
- QList<QVariant> aFieldStepData;
- TCollection_AsciiString aFieldStepName;
- double aFieldStepRangeMin, aFieldStepRangeMax;
- aShape->getFieldStepInfo( aFieldDataType,
- aFieldDimension,
- aFieldStepData,
- aFieldStepName,
- aFieldStepRangeMin,
- aFieldStepRangeMax );
- if( !aFieldStepData.isEmpty() && aFieldDataType != GEOM::FDT_String )
- {
- anIsDisplayColorScale = Standard_True;
- aColorScaleTitle = aFieldStepName;
- aColorScaleMin = aFieldStepRangeMin;
- aColorScaleMax = aFieldStepRangeMax;
- anIsBoolean = aFieldDataType == GEOM::FDT_Bool;
- }
- }
+ SUIT_Session* session = SUIT_Session::session();
+ SUIT_ResourceMgr* resMgr = session->resourceMgr();
+
+ Standard_Real xPos = resMgr->doubleValue( "Geometry", "scalar_bar_x_position", 0.05 );
+ Standard_Real yPos = resMgr->doubleValue( "Geometry", "scalar_bar_y_position", 0.1 );
+ Standard_Real width = resMgr->doubleValue( "Geometry", "scalar_bar_width", 0.2 );
+ Standard_Real height = resMgr->doubleValue( "Geometry", "scalar_bar_height", 0.5 );
+ Standard_Integer textHeight = resMgr->integerValue( "Geometry", "scalar_bar_text_height", 14 );
+ Standard_Integer nbIntervals = resMgr->integerValue( "Geometry", "scalar_bar_nb_intervals", 20 );
+
+ Standard_Integer viewWidth = 0, viewHeight = 0;
+ occWindow->getView(0)->getViewPort()->getView()->Window()->Size( viewWidth, viewHeight );
+
+ Handle(AIS_ColorScale) colorScale = view->getColorScale();
+
+ colorScale->SetPosition( viewWidth * xPos, viewHeight * yPos );
+ colorScale->SetBreadth( viewWidth * width );
+ colorScale->SetHeight( viewHeight * height );
+ colorScale->SetRange( fieldStepRangeMin, fieldStepRangeMax );
+ colorScale->SetNumberOfIntervals( fieldDataType == GEOM::FDT_Bool ? 2 : nbIntervals );
+ colorScale->SetTextHeight( textHeight );
+ colorScale->SetTitle( fieldStepName );
+ } // if ( visible )