X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_VTKPrsBathymetry.cxx;h=97d0d6c1237256fa0bffe31157b63819054ada1e;hb=81c9f5cdf82909d0aebd2c491c50fa7516cc80b7;hp=84d5b8e76ace726946fd409da2808b276605a7ca;hpb=a558c58ccc19713db2b13ada4d0f32dff61d0deb;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_VTKPrsBathymetry.cxx b/src/HYDROGUI/HYDROGUI_VTKPrsBathymetry.cxx index 84d5b8e7..97d0d6c1 100644 --- a/src/HYDROGUI/HYDROGUI_VTKPrsBathymetry.cxx +++ b/src/HYDROGUI/HYDROGUI_VTKPrsBathymetry.cxx @@ -34,7 +34,6 @@ #include #include #include -#include #include @@ -68,13 +67,15 @@ HYDROGUI_VTKPrsBathymetry::~HYDROGUI_VTKPrsBathymetry() //================================================================ void HYDROGUI_VTKPrsBathymetry::compute() { + HYDROGUI_VTKPrs::compute(); + if ( !getObject().IsNull() ) { Handle(HYDROData_Bathymetry) aBathymetry = Handle(HYDROData_Bathymetry)::DownCast( getObject() ); if ( !aBathymetry.IsNull() ) { HYDROData_Bathymetry::AltitudePoints anAltPoints = aBathymetry->GetAltitudePoints(); - int aNbPoints = anAltPoints.length(); + int aNbPoints = anAltPoints.Length(); HYDROData_Bathymetry::AltitudePoint anAltPnt; vtkPoints* aPoints = vtkPoints::New(); @@ -88,22 +89,18 @@ void HYDROGUI_VTKPrsBathymetry::compute() vtkVertex* aVertex = vtkVertex::New(); - int aZ; + double aZ; int anInvalidZ = InvalidZValue(); - for (int i = 0; i < aNbPoints; i++ ) + for (int i = 1; i <= aNbPoints; i++ ) { - anAltPnt = anAltPoints.at( i ); + anAltPnt = anAltPoints.Value( i ); aZ = anAltPnt.Z(); if ( ValuesLessEquals( aZ, anInvalidZ ) ) { - aZ = Z_MAX; - } - else - { - aZ = -aZ; + aZ = Z_MAX; // If Z value is invalid then use Z_MAX } - aPoints->InsertPoint( i, anAltPnt.X(), anAltPnt.Y(), aZ ); - aVertex->GetPointIds()->SetId( 0, i ); + aPoints->InsertPoint( i - 1, anAltPnt.X(), anAltPnt.Y(), aZ ); + aVertex->GetPointIds()->SetId( 0, i - 1 ); aVertexGrid->InsertNextCell( aVertex->GetCellType(), aVertex->GetPointIds()); aZValues->InsertNextValue( aZ ); } @@ -116,10 +113,7 @@ void HYDROGUI_VTKPrsBathymetry::compute() // Update the lookup table range if this bathymetry is out of it if ( myLookupTable ) { - double* aRange = aZValues->GetRange(); - myInternalZRange[0] = -aRange[1]; - myInternalZRange[1] = -aRange[0]; - + 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; @@ -141,37 +135,19 @@ void HYDROGUI_VTKPrsBathymetry::compute() myLookupTable->Build(); } - myMapper->SetScalarRange( -aGlobalRange[1], -aGlobalRange[0] ); + myMapper->SetScalarRange( aGlobalRange ); myMapper->ScalarVisibilityOn(); myMapper->SetScalarModeToUsePointData(); - - - vtkLookupTable* aTable = vtkLookupTable::New(); - vtkLookupTable* aGlobalTable = vtkLookupTable::SafeDownCast( myLookupTable ); - double* aHueRange = aGlobalTable->GetHueRange(); - // Revert hue range to keep it the same as for appropriate positive Z values in scalar bar - aTable->SetHueRange( aHueRange[1], aHueRange[0] ); - aTable->SetSaturationRange( aGlobalTable->GetSaturationRange() ); - // Revert the Z values range from positive to negative to show them as depth - aTable->SetTableRange( -aGlobalRange[1], -aGlobalRange[0] ); - aTable->SetValueRange( aGlobalTable->GetValueRange() ); - aTable->SetAlphaRange( aGlobalTable->GetAlphaRange() ); - aTable->SetNumberOfColors( aGlobalTable->GetNumberOfColors() ); - aTable->Build(); - - myMapper->SetLookupTable( aTable ); - aTable->Delete(); -// myMapper->SetLookupTable( myLookupTable ); + myMapper->SetLookupTable( myLookupTable ); } myMapper->SetInputData( aVertexGrid ); - SALOME_Actor* anActor = SALOME_Actor::New(); + SALOME_Actor* anActor = getActor(this); anActor->SetMapper( myMapper.GetPointer() ); anActor->setIO( getIO() ); AddObject( anActor ); - anActor->Delete(); aVertexGrid->Delete(); aZValues->Delete(); }