- // Get or create the appropriate layer
- Standard_Integer aLayerId = -1;
- if ( theZLayerIndex <= aNbLayers ) {
- aLayerId = anExistingZLayers.Value( theZLayerIndex );
- } else {
- Standard_Integer aNewId = -1;
- if ( aViewer3d->AddZLayer( aNewId ) ) {
- aLayerId = aNewId;
- }
- }
+ int aViewerId = (size_t)theViewer;//TODO: check if viewer id is correct
+ bool isLandCoverColoringOn = module()->isLandCoversScalarMapModeOn( aViewerId );
+
+ QList<HYDROGUI_Shape*> aLandCoverMapShapes = module()->getObjectShapes( aViewerId, KIND_LAND_COVER_MAP );
+ QList<HYDROGUI_Shape*> aBathShapes = module()->getObjectShapes( aViewerId, KIND_BATHYMETRY );
+
+ bool isDisplayColorScale = !aBathShapes.empty() || isLandCoverColoringOn;
+ Standard_Real anXPos = 0.05; //TODO
+ Standard_Real anYPos = 0.1; //TODO
+ Standard_Real aWidth = 0.2; //TODO
+ Standard_Real aHeight = 0.5; //TODO
+ Standard_Integer aTextHeight = 14; //TODO
+ Standard_Integer aNbIntervals = 20; //TODO
+ TCollection_ExtendedString aColorScaleTitle = "";//TODO
+
+ Standard_Real aColorScaleMin = 0, aColorScaleMax = 1;
+
+ // Get range
+ Handle(HYDROData_StricklerTable) aTable;
+ QStringList aTableTypes;
+ if ( isLandCoverColoringOn ) {
+ aTable = module()->getLandCoverColoringTable( aViewerId );
+ if ( !aTable.IsNull() ) {
+ // TODO: non-empty title leads to buggy behaviour
+ // aColorScaleTitle = TCollection_ExtendedString( aTable->GetName().toLatin1().constData() );
+ aTable->GetCoefficientRange( aColorScaleMin, aColorScaleMax );
+ aTableTypes = aTable->GetTypes();
+ }
+ } else {
+ Standard_Real aMin, aMax;
+ bool isFirst = true;
+ foreach( HYDROGUI_Shape* aShape, aBathShapes )
+ {
+ HYDROGUI_ShapeBathymetry* aBathShape = dynamic_cast<HYDROGUI_ShapeBathymetry*>( aShape );
+ if( !aBathShape || !aBathShape->isVisible() )
+ continue;