INT PAL 0054211: SALOME-8.3.0: Geometry fields are displayed incorrectly

This commit is contained in:
jfa 2017-06-02 14:20:15 +03:00
parent 0638e8ec11
commit 61e3f7e90a
2 changed files with 26 additions and 13 deletions

View File

@ -2965,7 +2965,11 @@ QList<QVariant> GEOM_Displayer::groupFieldData( const QList<QVariant>& theFieldS
{ {
QColor aQColor; QColor aQColor;
Quantity_Color aColor; Quantity_Color aColor;
#if OCC_VERSION_MAJOR < 7
if( FindColor( aVariant.toDouble(), theFieldStepRangeMin, theFieldStepRangeMax, anIsBoolean ? 2 : aNbIntervals, aColor ) ) if( FindColor( aVariant.toDouble(), theFieldStepRangeMin, theFieldStepRangeMax, anIsBoolean ? 2 : aNbIntervals, aColor ) )
#else
if( AIS_ColorScale::FindColor( aVariant.toDouble(), theFieldStepRangeMin, theFieldStepRangeMax, anIsBoolean ? 2 : aNbIntervals, aColor ) )
#endif
aQColor = QColor::fromRgbF( aColor.Red(), aColor.Green(), aColor.Blue() ); aQColor = QColor::fromRgbF( aColor.Red(), aColor.Green(), aColor.Blue() );
aResultList << aQColor; aResultList << aQColor;
} }
@ -2973,7 +2977,8 @@ QList<QVariant> GEOM_Displayer::groupFieldData( const QList<QVariant>& theFieldS
return aResultList; return aResultList;
} }
// Note: the method is copied from AIS_ColorScale class #if OCC_VERSION_MAJOR < 7
// Note: the method is copied from Aspect_ColorScale class
Standard_Integer GEOM_Displayer::HueFromValue( const Standard_Integer aValue, Standard_Integer GEOM_Displayer::HueFromValue( const Standard_Integer aValue,
const Standard_Integer aMin, const Standard_Integer aMin,
const Standard_Integer aMax ) const Standard_Integer aMax )
@ -2989,7 +2994,7 @@ Standard_Integer GEOM_Displayer::HueFromValue( const Standard_Integer aValue,
return aHue; return aHue;
} }
// Note: the method is copied from AIS_ColorScale class // Note: the method is copied from Aspect_ColorScale class
Standard_Boolean GEOM_Displayer::FindColor( const Standard_Real aValue, Standard_Boolean GEOM_Displayer::FindColor( const Standard_Real aValue,
const Standard_Real aMin, const Standard_Real aMin,
const Standard_Real aMax, const Standard_Real aMax,
@ -3016,6 +3021,7 @@ Standard_Boolean GEOM_Displayer::FindColor( const Standard_Real aValue,
return Standard_True; return Standard_True;
} }
} }
#endif
void GEOM_Displayer::UpdateColorScale( const bool theIsRedisplayFieldSteps, const bool updateViewer ) void GEOM_Displayer::UpdateColorScale( const bool theIsRedisplayFieldSteps, const bool updateViewer )
{ {
@ -3027,7 +3033,6 @@ void GEOM_Displayer::UpdateColorScale( const bool theIsRedisplayFieldSteps, cons
if( !aViewModel ) if( !aViewModel )
return; return;
#if OCC_VERSION_MAJOR < 7
Handle(V3d_Viewer) aViewer = aViewModel->getViewer3d(); Handle(V3d_Viewer) aViewer = aViewModel->getViewer3d();
if( aViewer.IsNull() ) if( aViewer.IsNull() )
return; return;
@ -3039,7 +3044,6 @@ void GEOM_Displayer::UpdateColorScale( const bool theIsRedisplayFieldSteps, cons
Handle(V3d_View) aView = aViewer->ActiveView(); Handle(V3d_View) aView = aViewer->ActiveView();
if( aView.IsNull() ) if( aView.IsNull() )
return; return;
#endif
Standard_Boolean anIsDisplayColorScale = Standard_False; Standard_Boolean anIsDisplayColorScale = Standard_False;
TCollection_AsciiString aColorScaleTitle; TCollection_AsciiString aColorScaleTitle;
@ -3103,18 +3107,25 @@ void GEOM_Displayer::UpdateColorScale( const bool theIsRedisplayFieldSteps, cons
Handle(Aspect_ColorScale) myColorScale = aView->ColorScale(); Handle(Aspect_ColorScale) myColorScale = aView->ColorScale();
if( !myColorScale.IsNull() ) if( !myColorScale.IsNull() )
{ {
myColorScale->SetXPosition( anXPos );
myColorScale->SetYPosition( anYPos );
myColorScale->SetWidth( aWidth );
myColorScale->SetHeight( aHeight );
#else
Standard_Integer aWinWidth = 0, aWinHeight = 0;
aView->Window()->Size (aWinWidth, aWinHeight);
myColorScale->SetPosition (aWinWidth*anXPos, aWinHeight*anYPos);
//myColorScale->SetBreadth (aWinWidth); // ???
myColorScale->SetBreadth (aWinWidth*aWidth); // ???
myColorScale->SetHeight (aWinHeight*aHeight);
#endif #endif
myColorScale->SetXPosition( anXPos ); myColorScale->SetRange( aColorScaleMin, aColorScaleMax );
myColorScale->SetYPosition( anYPos ); myColorScale->SetNumberOfIntervals( anIsBoolean ? 2 : aNbIntervals );
myColorScale->SetWidth( aWidth );
myColorScale->SetHeight( aHeight );
myColorScale->SetTextHeight( aTextHeight ); myColorScale->SetTextHeight( aTextHeight );
myColorScale->SetNumberOfIntervals( anIsBoolean ? 2 : aNbIntervals ); myColorScale->SetTitle( aColorScaleTitle );
myColorScale->SetTitle( aColorScaleTitle );
myColorScale->SetRange( aColorScaleMin, aColorScaleMax );
#if OCC_VERSION_MAJOR < 7 #if OCC_VERSION_MAJOR < 7
} }

View File

@ -277,6 +277,7 @@ protected:
double& theFieldStepRangeMin, double& theFieldStepRangeMin,
double& theFieldStepRangeMax ); double& theFieldStepRangeMax );
#if OCC_VERSION_MAJOR < 7
// Note: the method is copied from Aspect_ColorScale class // Note: the method is copied from Aspect_ColorScale class
static Standard_Integer HueFromValue( const Standard_Integer aValue, static Standard_Integer HueFromValue( const Standard_Integer aValue,
const Standard_Integer aMin, const Standard_Integer aMin,
@ -288,6 +289,7 @@ protected:
const Standard_Real aMax, const Standard_Real aMax,
const Standard_Integer ColorsCount, const Standard_Integer ColorsCount,
Quantity_Color& aColor ); Quantity_Color& aColor );
#endif
protected: protected:
Handle(SALOME_InteractiveObject) myIO; Handle(SALOME_InteractiveObject) myIO;