- vtkPolyDataMapper* aMapper = vtkPolyDataMapper::New();
- aMapper->SetInputData( aVertexGrid );
- SALOME_Actor* anActor = SALOME_Actor::New();
- anActor->SetMapper( aMapper );
+ aVertexGrid->GetPointData()->SetScalars( aZValues );
+
+ // Update the lookup table range if this bathymetry is out of it
+ if ( myLookupTable )
+ {
+ aZValues->GetRange( myInternalZRange );
+ double* aGlobalRange = myLookupTable->GetRange();
+ // If the global range is not yet initialized or the current one is out of scope then update the global
+ bool anIsUpdated = false;
+ if ( ValuesEquals( aGlobalRange[0], anInvalidZ ) || ( aGlobalRange[0] > myInternalZRange[0] ) )
+ {
+ aGlobalRange[0] = myInternalZRange[0];
+ anIsUpdated = true;
+ }
+
+ if ( ValuesEquals( aGlobalRange[1], anInvalidZ ) || ( aGlobalRange[1] < myInternalZRange[1] ) )
+ {
+ aGlobalRange[1] = myInternalZRange[1];
+ anIsUpdated = true;
+ }
+
+ if ( anIsUpdated )
+ {
+ myLookupTable->SetRange( aGlobalRange );
+ myLookupTable->Build();
+ }
+
+ myMapper->SetScalarRange( aGlobalRange );
+ myMapper->ScalarVisibilityOn();
+ myMapper->SetScalarModeToUsePointData();
+ myMapper->SetLookupTable( myLookupTable );
+ }
+
+ myMapper->SetInputData( aVertexGrid );
+
+ SALOME_Actor* anActor = getActor<SALOME_Actor>(this);
+ anActor->SetMapper( myMapper.GetPointer() );