Salome HOME
refs #1327: debug of scaling operations
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ShapeLandCoverMap.cxx
index 450a195e7525a4e0e580cdede2acfca2d3d4757f..3446545e3db4973a5ed49219077f8079eaa82aa3 100644 (file)
 
 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 ),
   myDisplayer( theDisplayer ),
   myIsScalarMapMode( theIsScalarMode )
 {
+  setFillingColor( QColor(), false, false );
 }
 
 HYDROGUI_ShapeLandCoverMap::~HYDROGUI_ShapeLandCoverMap()
@@ -66,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;
@@ -85,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() )
@@ -109,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) );
         }
       }
     }