Salome HOME
refs #1327: debug of scaling operations
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ShapeLandCoverMap.cxx
index de07a5b555496cf2dde81591a3fec57647b5b384..3446545e3db4973a5ed49219077f8079eaa82aa3 100644 (file)
@@ -34,7 +34,7 @@
 
 HYDROGUI_ShapeLandCoverMap::HYDROGUI_ShapeLandCoverMap( HYDROGUI_OCCDisplayer* theDisplayer,
                                                         const Handle(AIS_InteractiveContext)& theContext,
-                                                        const Handle_HYDROData_LandCoverMap&  theLandCoverMap,
+                                                        const Handle(HYDROData_LandCoverMap)& theLandCoverMap,
                                                         const int                             theZLayer,
                                                         const bool                            theIsScalarMode )
 : HYDROGUI_Shape( theContext, theLandCoverMap, theZLayer ),
@@ -67,6 +67,11 @@ void HYDROGUI_ShapeLandCoverMap::update( bool theIsUpdateViewer, bool isDeactiva
   HYDROGUI_Shape::update( theIsUpdateViewer, isDeactivateSelection );
 }
 
+bool HYDROGUI_ShapeLandCoverMap::isScalarMapModeEnabled() const
+{
+  return myIsScalarMapMode;
+}
+
 void HYDROGUI_ShapeLandCoverMap::setScalarMapModeEnabled( const bool theIsToEnable )
 {
   myIsScalarMapMode = theIsToEnable;
@@ -86,7 +91,7 @@ void HYDROGUI_ShapeLandCoverMap::displayShape( const bool theIsUpdateViewer )
   myDisplayer->SetToUpdateColorScale();
 }
 
-Handle_AIS_InteractiveObject HYDROGUI_ShapeLandCoverMap::createShape() const
+Handle(AIS_InteractiveObject) HYDROGUI_ShapeLandCoverMap::createShape() const
 {
   Handle(HYDROData_LandCoverMap) aLandCoverMap = Handle(HYDROData_LandCoverMap)::DownCast( getObject() );
   if ( !aLandCoverMap.IsNull() )
@@ -110,13 +115,7 @@ Handle_AIS_InteractiveObject HYDROGUI_ShapeLandCoverMap::createShape() const
             aLandCoverMapPrs->SetTable( aTable );
 
           // Set color scale
-          OCCViewer_ViewWindow* aWnd = dynamic_cast<OCCViewer_ViewWindow*>( aViewer->getViewManager()->getActiveView() );
-          Handle(V3d_View) aView = aWnd->getViewPort()->getView();
-          if( !aView.IsNull() )
-          {
-            Handle(Aspect_ColorScale) aColorScale = aView->ColorScale();
-            aLandCoverMapPrs->SetColorScale( aColorScale );
-          }
+          aLandCoverMapPrs->SetColorScale( myDisplayer->GetColorScale( aViewerId) );
         }
       }
     }