From: mzn Date: Thu, 8 Dec 2016 07:54:09 +0000 (+0300) Subject: Porting to OCCT 7.0: fix land cover map amd color scale displaying. X-Git-Tag: Salome_8_3_Hydro_1_1rc1~58^2~12^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1382149dd210706df3a52b380b51af57203326a0;p=modules%2Fhydro.git Porting to OCCT 7.0: fix land cover map amd color scale displaying. --- diff --git a/src/HYDROData/HYDROData_LandCoverMap.cxx b/src/HYDROData/HYDROData_LandCoverMap.cxx index 55e51656..843e35a4 100644 --- a/src/HYDROData/HYDROData_LandCoverMap.cxx +++ b/src/HYDROData/HYDROData_LandCoverMap.cxx @@ -1181,7 +1181,7 @@ void HYDROData_LandCoverMap::SetTransparency( double theTransparency ) double HYDROData_LandCoverMap::GetTransparency() const { - return GetDouble( DataTag_Transparency, 0.5 ); + return GetDouble( DataTag_Transparency, 0.25 ); } bool HYDROData_LandCoverMap::ImportSHP( const QString& theSHPFileName, diff --git a/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx b/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx index 6f508111..f0386a46 100644 --- a/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx +++ b/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx @@ -423,13 +423,6 @@ void HYDROGUI_OCCDisplayer::UpdateColorScale( const OCCViewer_Viewer* theViewer QList 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; @@ -470,15 +463,11 @@ void HYDROGUI_OCCDisplayer::UpdateColorScale( const OCCViewer_Viewer* theViewer { if( !aColorScale.IsNull() ) { - aColorScale->SetXPosition( anXPos ); - aColorScale->SetYPosition( anYPos ); - aColorScale->SetWidth( aWidth ); - aColorScale->SetHeight( aHeight ); - - aColorScale->SetTextHeight( aTextHeight ); - aColorScale->SetNumberOfIntervals( aNbIntervals ); - + // Set color scale title + TCollection_ExtendedString aColorScaleTitle = ""; //TODO aColorScale->SetTitle( aColorScaleTitle ); + + // Set color scale range aColorScale->SetRange( aColorScaleMin, aColorScaleMax ); aColorScale->SetToUpdate(); @@ -493,8 +482,12 @@ void HYDROGUI_OCCDisplayer::UpdateColorScale( const OCCViewer_Viewer* theViewer } } - if ( !aCtx.IsNull() && !aCtx->IsDisplayed( aColorScale ) ) { - aCtx->Display( aColorScale ); + if ( !aCtx.IsNull()/* && !aCtx->IsDisplayed( aColorScale ) */) { + if ( !aCtx->IsDisplayed( aColorScale ) ) { + aCtx->Display( aColorScale, Standard_False ); + } + + aCtx->Update( aColorScale ); } } } @@ -537,7 +530,28 @@ Handle(AIS_ColorScale) HYDROGUI_OCCDisplayer::GetColorScale( const int theViewer aColorScale = myColorScales.value( theViewerId, aColorScale ); if ( aColorScale.IsNull() ) { + // Create color scale aColorScale = new AIS_ColorScale(); + + // Set properties + Standard_Integer anXPos = 50; //TODO + Standard_Integer anYPos = 100; //TODO + Standard_Integer aWidth = 100; //TODO + Standard_Integer aHeight = 350; //TODO + + Standard_Integer aTextHeight = 14; //TODO + Standard_Integer aNbIntervals = 20; //TODO + + aColorScale->SetTransformPersistence( Graphic3d_TMF_2d, gp_Pnt( -1, -1, 0 ) ); + + aColorScale->SetXPosition( anXPos ); + aColorScale->SetYPosition( anYPos ); + aColorScale->SetSize( aWidth, aHeight ); + + aColorScale->SetTextHeight( aTextHeight ); + aColorScale->SetNumberOfIntervals( aNbIntervals ); + + // Put into the map myColorScales.insert( theViewerId, aColorScale ); }