#include "HYDROGUI_ShapeLandCoverMap.h"
#include "HYDROGUI_OCCDisplayer.h"
#include "HYDROGUI_LandCoverMapPrs.h"
+#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_Module.h"
+
+#include <LightApp_Application.h>
+#include <OCCViewer_ViewManager.h>
+#include <OCCViewer_ViewModel.h>
+#include <OCCViewer_ViewWindow.h>
+#include <OCCViewer_ViewPort3d.h>
#include <HYDROData_LandCoverMap.h>
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()
{
+#ifndef LIGHT_MODE
+ if( myDisplayer )
+ myDisplayer->SetToUpdateColorScale();
+#endif
}
void HYDROGUI_ShapeLandCoverMap::update( bool theIsUpdateViewer, bool isDeactivateSelection )
setShape( aLandCoverMapShape, false, false );
}
- if ( !myIsScalarMapMode ) {
- // TODO
- QColor aFillingColor = Qt::gray;//aLandCoverMapObj->GetFillingColor();
- QColor aBorderColor = Qt::black;//aLandCoverMapObj->GetBorderColor();
-
- setFillingColor( aFillingColor, false, false );
- setBorderColor( aBorderColor, false, false );
- } else {
- updateShape( false, false );
- }
+ Handle(HYDROGUI_LandCoverMapPrs) aLandCoverMapPrs =
+ Handle(HYDROGUI_LandCoverMapPrs)::DownCast( getAISObjects()[0] );
+ if ( !aLandCoverMapPrs.IsNull() )
+ aLandCoverMapPrs->UpdateColors();
HYDROGUI_Shape::update( theIsUpdateViewer, isDeactivateSelection );
}
+bool HYDROGUI_ShapeLandCoverMap::isScalarMapModeEnabled() const
+{
+ return myIsScalarMapMode;
+}
+
void HYDROGUI_ShapeLandCoverMap::setScalarMapModeEnabled( const bool theIsToEnable )
{
myIsScalarMapMode = theIsToEnable;
+ update( false, false );
}
void HYDROGUI_ShapeLandCoverMap::setVisible( const bool theState,
myDisplayer->SetToUpdateColorScale();
}
-Handle_AIS_InteractiveObject HYDROGUI_ShapeLandCoverMap::createShape() const
+QList<Handle(AIS_InteractiveObject)> HYDROGUI_ShapeLandCoverMap::createShape() const
{
+ QList<Handle(AIS_InteractiveObject)> shapes;
+
Handle(HYDROData_LandCoverMap) aLandCoverMap = Handle(HYDROData_LandCoverMap)::DownCast( getObject() );
if ( !aLandCoverMap.IsNull() )
- return new HYDROGUI_LandCoverMapPrs( aLandCoverMap );
- return NULL;
+ {
+ Handle(HYDROGUI_LandCoverMapPrs) aLandCoverMapPrs = new HYDROGUI_LandCoverMapPrs( aLandCoverMap );
+ if ( myIsScalarMapMode )
+ {
+ LightApp_Application* anApp = myDisplayer->module()->getApp();
+ OCCViewer_ViewManager* aViewManager = ::qobject_cast<OCCViewer_ViewManager*>(
+ anApp->getViewManager( OCCViewer_Viewer::Type(), true ) );
+ if ( aViewManager )
+ {
+ if ( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() )
+ {
+ int aViewerId = (size_t)aViewer;
+
+ // Set Strickler table
+ Handle(HYDROData_StricklerTable) aTable =
+ myDisplayer->module()->getLandCoverColoringTable( aViewerId );
+ if( !aTable.IsNull() )
+ aLandCoverMapPrs->SetTable( aTable );
+
+ // Set color scale
+ aLandCoverMapPrs->SetColorScale( myDisplayer->GetColorScale( aViewerId) );
+ }
+ }
+ }
+ shapes.append( aLandCoverMapPrs );
+ }
+ return shapes;
}
void HYDROGUI_ShapeLandCoverMap::display( const bool theIsUpdateViewer )