Update documentat if the class.
SetColor() and SetLabel() now work with 0-based index.
SetColor() now checks length of myColors.
Remove methods GetCurrentColor() and GetCurrentLabel().
Methods GetColor() and GetLabel() now can be used to get user-specified and default colors / labels.
Round down IntervNumber in FindColor().
DrawScale() - show labels even for one interval.
Redesign Draw Harness command vcolorscale, provide new options.
Update test cases which use vcolorscale command.
---Category: Public
- FindColor( me; Value : Real from Standard;
- Color : in out Color from Quantity ) returns Boolean from Standard;
+ FindColor( me; theValue : Real from Standard;
+ theColor : in out Color from Quantity ) returns Boolean from Standard;
---Purpose: Calculate color according passed value; returns true if value is in range or false, if isn't
- FindColor( myclass; Value : Real from Standard;
- Min, Max : Real from Standard;
- ColorsCount : Integer from Standard;
- Color : in out Color from Quantity ) returns Boolean from Standard;
+ FindColor( myclass; theValue : Real from Standard;
+ theMin, theMax : Real from Standard;
+ theColorsCount : Integer from Standard;
+ theColor : in out Color from Quantity ) returns Boolean from Standard;
GetMin(me)
returns Real from Standard;
returns Real from Standard;
---Purpose: Returns maximal value of color scale;
- GetRange(me; aMin : in out Real from Standard;
- aMax : in out Real from Standard);
+ GetRange(me; theMin : in out Real from Standard;
+ theMax : in out Real from Standard);
---Purpose: Returns minimal and maximal values of color scale;
GetLabelType(me)
-- The same like format for function printf().
-- Used if GetLabelType() is TOCSD_AUTO;
- GetLabel(me; anIndex : Integer from Standard)
+ GetLabel(me; theIndex : Integer from Standard)
returns ExtendedString from TCollection;
---Purpose: Returns the user specified label with index <anIndex>.
-- Returns empty string if label not defined.
- GetColor(me; anIndex : Integer from Standard)
+ GetColor(me; theIndex : Integer from Standard)
returns Color from Quantity;
---Purpose: Returns the user specified color from color map with index <anIndex>.
-- Returns default color if index out of range in color map.
- GetLabels(me; aLabels : in out SequenceOfExtendedString from TColStd);
+ GetLabels(me; theLabels : in out SequenceOfExtendedString from TColStd);
---Purpose: Returns the user specified labels.
- GetColors(me; aColors : in out SequenceOfColor from Aspect);
+ GetColors(me; theColors : in out SequenceOfColor from Aspect);
---Purpose: Returns the user specified colors.
GetLabelPosition(me)
returns Boolean from Standard;
---Purpose: Returns true if the labels placed at border of color filled rectangles.
- SetMin(me : mutable; aMin : Real from Standard);
+ SetMin(me : mutable; theMin : Real from Standard);
---Purpose: Sets the minimal value of color scale.
- SetMax(me : mutable; aMax : Real from Standard);
+ SetMax(me : mutable; theMax : Real from Standard);
---Purpose: Sets the maximal value of color scale.
- SetRange(me : mutable; aMin : Real from Standard;
- aMax : Real from Standard);
+ SetRange(me : mutable; theMin : Real from Standard;
+ theMax : Real from Standard);
---Purpose: Sets the minimal and maximal value of color scale.
- SetLabelType(me : mutable; aType : TypeOfColorScaleData from Aspect);
+ SetLabelType(me : mutable; theType : TypeOfColorScaleData from Aspect);
---Purpose: Sets the type of labels.
-- Aspect_TOCSD_AUTO - labels as boundary values for intervals
-- Aspect_TOCSD_USER - user specified label is used
- SetColorType(me : mutable; aType : TypeOfColorScaleData from Aspect);
+ SetColorType(me : mutable; theType : TypeOfColorScaleData from Aspect);
---Purpose: Sets the type of colors.
-- Aspect_TOCSD_AUTO - value between Red and Blue
-- Aspect_TOCSD_USER - user specified color from color map
- SetNumberOfIntervals(me : mutable; aNum : Integer from Standard);
+ SetNumberOfIntervals(me : mutable; theNum : Integer from Standard);
---Purpose: Sets the number of color scale intervals.
- SetTitle(me : mutable; aTitle : ExtendedString from TCollection);
+ SetTitle(me : mutable; theTitle : ExtendedString from TCollection);
---Purpose: Sets the color scale title string.
- SetFormat(me : mutable; aFormat : AsciiString from TCollection);
+ SetFormat(me : mutable; theFormat : AsciiString from TCollection);
---Purpose: Sets the color scale auto label format specification.
- SetLabel(me : mutable; aLabel : ExtendedString from TCollection;
+ SetLabel(me : mutable; theLabel : ExtendedString from TCollection;
anIndex : Integer from Standard = -1);
---Purpose: Sets the color scale label at index. Index started from 1.
- SetColor(me : mutable; aColor : Color from Quantity;
- anIndex : Integer from Standard = -1);
+ SetColor(me : mutable; theColor : Color from Quantity;
+ theIndex : Integer from Standard = -1);
---Purpose: Sets the color scale color at index. Index started from 1.
- SetLabels(me : mutable; aSeq : SequenceOfExtendedString from TColStd);
+ SetLabels(me : mutable; theSeq : SequenceOfExtendedString from TColStd);
---Purpose: Sets the color scale labels.
- SetColors(me : mutable; aSeq : SequenceOfColor from Aspect);
+ SetColors(me : mutable; theSeq : SequenceOfColor from Aspect);
---Purpose: Sets the color scale colors.
- SetLabelPosition(me : mutable; aPos : TypeOfColorScalePosition from Aspect);
+ SetLabelPosition(me : mutable; thePos : TypeOfColorScalePosition from Aspect);
---Purpose: Sets the color scale labels position concerning color filled rectangles.
- SetTitlePosition(me : mutable; aPos : TypeOfColorScalePosition from Aspect);
+ SetTitlePosition(me : mutable; thePos : TypeOfColorScalePosition from Aspect);
---Purpose: Sets the color scale title position.
- SetReversed(me : mutable; aReverse : Boolean from Standard);
+ SetReversed(me : mutable; theReverse : Boolean from Standard);
---Purpose: Sets true if the labels and colors used in reversed order.
- SetLabelAtBorder(me : mutable; anOn : Boolean from Standard);
+ SetLabelAtBorder(me : mutable; theOn : Boolean from Standard);
---Purpose: Sets true if the labels placed at border of color filled rectangles.
--- Size and position management
--- Size and position are values relative to view size (between 0 and 1)
- GetSize(me; aWidth : in out Real from Standard;
- aHeight : in out Real from Standard);
+ GetSize(me; theWidth : in out Real from Standard;
+ theHeight : in out Real from Standard);
---Purpose: Returns the size of color scale.
GetWidth(me)
returns Real from Standard;
---Purpose: Returns the height of color scale.
- SetSize(me : mutable; aWidth : Real from Standard;
- aHeight : Real from Standard);
+ SetSize(me : mutable; theWidth : Real from Standard;
+ theHeight : Real from Standard);
---Purpose: Sets the size of color scale.
- SetWidth(me : mutable; aWidth : Real from Standard);
+ SetWidth(me : mutable; theWidth : Real from Standard);
---Purpose: Sets the width of color scale.
- SetHeight(me : mutable; aHeight : Real from Standard);
+ SetHeight(me : mutable; theHeight : Real from Standard);
---Purpose: Sets the height of color scale.
- GetPosition(me; aX : in out Real from Standard;
- aY : in out Real from Standard);
+ GetPosition(me; theX : in out Real from Standard;
+ theY : in out Real from Standard);
---Purpose: Returns the position of color scale.
GetXPosition(me)
returns Real from Standard;
---Purpose: Returns the height of color scale.
- SetPosition(me : mutable; aX : Real from Standard;
- aY : Real from Standard);
+ SetPosition(me : mutable; theX : Real from Standard;
+ theY : Real from Standard);
---Purpose: Sets the position of color scale.
- SetXPosition(me : mutable; aX : Real from Standard);
+ SetXPosition(me : mutable; theX : Real from Standard);
---Purpose: Sets the X position of color scale.
- SetYPosition(me : mutable; aY : Real from Standard);
+ SetYPosition(me : mutable; theY : Real from Standard);
---Purpose: Sets the Y position of color scale.
GetTextHeight(me)
returns Integer from Standard;
-
- SetTextHeight(me: mutable; aHeigh : Integer from Standard);
+ ---Purpose: Returns the height of text of color scale.
+ SetTextHeight(me: mutable; theHeight : Integer from Standard);
+ ---Purpose: Sets the height of text of color scale.
---Category: Protected
Initialize
returns ColorScale from Aspect
is protected;
+ ---Purpose: Default constructor.
- SizeHint(me; aWidth : in out Integer from Standard;
- aHeight : in out Integer from Standard)
+ SizeHint(me; theWidth : in out Integer from Standard;
+ theHeight : in out Integer from Standard)
is protected;
+ ---Purpose: Returns the size of color scale.
+ -- @param theWidth [out] the width of color scale.
+ -- @param theHeight [out] the height of color scale.
+
UpdateColorScale(me : mutable)
is virtual protected;
+ ---Purpose: updates color scale parameters.
- DrawScale(me : mutable; aBgColor : Color from Quantity;
- X, Y, W, H : Integer from Standard)
+ DrawScale(me : mutable; theBgColor : Color from Quantity;
+ theX, theY, theWidth, theHeight : Integer from Standard)
is protected;
+ ---Purpose: Draws color scale.
+ -- @param theBgColor [in] background color
+ -- @param theX [in] the X coordinate of color scale position.
+ -- @param theY [in] the Y coordinate of color scale position.
+ -- @param theWidth [in] the width of color scale.
+ -- @param theHeight [in] the height of color scale.
BeginPaint(me : mutable)
returns Boolean from Standard
returns Boolean from Standard
is virtual protected;
- PaintRect(me : mutable; X, Y, W, H : Integer from Standard;
- aColor : Color from Quantity;
- aFilled : Boolean from Standard = Standard_False)
+ PaintRect(me : mutable; theX, theY, theWidth, theHeight : Integer from Standard;
+ theColor : Color from Quantity;
+ theFilled : Boolean from Standard = Standard_False)
is deferred;
-
- PaintText(me : mutable; aText : ExtendedString from TCollection;
- X, Y : Integer from Standard;
- aColor : Color from Quantity)
+ ---Purpose: Draws a rectangle.
+ -- @param theX [in] the X coordinate of rectangle position.
+ -- @param theY [in] the Y coordinate of rectangle position.
+ -- @param theWidth [in] the width of rectangle.
+ -- @param theHeight [in] the height of rectangle.
+ -- @param theColor [in] the color of rectangle.
+ -- @param theFilled [in] defines if rectangle must be filled.
+
+ PaintText(me : mutable; theText : ExtendedString from TCollection;
+ theX, theY : Integer from Standard;
+ theColor : Color from Quantity)
is deferred;
+ ---Purpose: Draws a text.
+ -- @param theText [in] the text to draw.
+ -- @param theX [in] the X coordinate of text position.
+ -- @param theY [in] the Y coordinate of text position.
+ -- @param theColor [in] the color of text.
- TextWidth(me; aText : ExtendedString from TCollection)
+ TextWidth(me; theText : ExtendedString from TCollection)
returns Integer from Standard
is deferred;
+ ---Purpose: Returns the width of text.
+ -- @param theText [in] the text of which to calculate width.
- TextHeight(me; aText : ExtendedString from TCollection)
+ TextHeight(me; theText : ExtendedString from TCollection)
returns Integer from Standard
is deferred;
+ ---Purpose: Returns the height of text.
+ -- @param theText [in] the text of which to calculate height.
---Category: Private
Format(me)
returns AsciiString from TCollection
is private;
+ ---Purpose: Returns the format of text.
- GetCurrentLabel(me; anIndex : Integer from Standard)
- returns ExtendedString from TCollection
- is private;
-
- GetCurrentColor(me; anIndex : Integer from Standard)
- returns Color from Quantity
- is private;
-
- GetNumber(me; anIndex : Integer from Standard)
+ GetNumber(me; theIndex : Integer from Standard)
returns Real from Standard
is private;
+ ---Purpose: Returns the value of given interval.
- HueFromValue(myclass; aValue : Integer from Standard;
- aMin : Integer from Standard;
- aMax : Integer from Standard)
+ HueFromValue(myclass; theValue : Integer from Standard;
+ theMin : Integer from Standard;
+ theMax : Integer from Standard)
returns Integer from Standard
is private;
+ ---Purpose: Returns the color's hue for the given value in the given interval.
+ -- @param theValue [in] the current value of interval.
+ -- @param theMin [in] the min value of interval.
+ -- @param theMax [in] the max value of interval.
fields
return myMax;
}
-void Aspect_ColorScale::GetRange( Standard_Real& aMin, Standard_Real& aMax ) const
+void Aspect_ColorScale::GetRange (Standard_Real& theMin, Standard_Real& theMax) const
{
- aMin = myMin;
- aMax = myMax;
+ theMin = myMin;
+ theMax = myMax;
}
Aspect_TypeOfColorScaleData Aspect_ColorScale::GetLabelType() const
return myFormat;
}
-TCollection_ExtendedString Aspect_ColorScale::GetLabel( const Standard_Integer anIndex ) const
+TCollection_ExtendedString Aspect_ColorScale::GetLabel (const Standard_Integer theIndex) const
{
- TCollection_ExtendedString aLabel;
- if ( anIndex >= 0 && anIndex < myLabels.Length() )
- aLabel = myLabels.Value( anIndex + 1 );
- return aLabel;
+ if (GetLabelType() == Aspect_TOCSD_USER)
+ {
+ if (theIndex < 0
+ || theIndex >= myLabels.Length())
+ {
+ return "";
+ }
+
+ return myLabels.Value (theIndex + 1);
+ }
+
+ const Standard_Real aVal = GetNumber (theIndex);
+ const TCollection_AsciiString aFormat = Format();
+ Standard_Character aBuf[1024];
+ sprintf (aBuf, aFormat.ToCString(), aVal);
+ return TCollection_ExtendedString (aBuf);
}
-Quantity_Color Aspect_ColorScale::GetColor( const Standard_Integer anIndex ) const
+Quantity_Color Aspect_ColorScale::GetColor (const Standard_Integer theIndex) const
{
- Quantity_Color aColor;
- if ( anIndex >= 0 && anIndex < myColors.Length() )
- aColor = myColors.Value( anIndex + 1 );
- return aColor;
+ if (GetColorType() == Aspect_TOCSD_USER)
+ {
+ if (theIndex < 0
+ || theIndex >= myColors.Length())
+ {
+ return Quantity_Color();
+ }
+
+ return myColors.Value (theIndex + 1);
+ }
+ return Quantity_Color (HueFromValue (theIndex, 0, GetNumberOfIntervals() - 1), 1.0, 1.0, Quantity_TOC_HLS);
}
-void Aspect_ColorScale::GetLabels( TColStd_SequenceOfExtendedString& aLabels ) const
+void Aspect_ColorScale::GetLabels (TColStd_SequenceOfExtendedString& theLabels) const
{
- aLabels.Clear();
- for ( Standard_Integer i = 1; i <= myLabels.Length(); i++ )
- aLabels.Append( myLabels.Value( i ) );
+ theLabels.Clear();
+ for (Standard_Integer i = 1; i <= myLabels.Length(); i++)
+ theLabels.Append (myLabels.Value (i));
}
-void Aspect_ColorScale::GetColors( Aspect_SequenceOfColor& aColors ) const
+void Aspect_ColorScale::GetColors (Aspect_SequenceOfColor& theColors) const
{
- aColors.Clear();
- for ( Standard_Integer i = 1; i <= myColors.Length(); i++ )
- aColors.Append( myColors.Value( i ) );
+ theColors.Clear();
+ for (Standard_Integer i = 1; i <= myColors.Length(); i++)
+ theColors.Append (myColors.Value (i));
}
Aspect_TypeOfColorScalePosition Aspect_ColorScale::GetLabelPosition() const
return myAtBorder;
}
-void Aspect_ColorScale::SetMin( const Standard_Real aMin )
+void Aspect_ColorScale::SetMin (const Standard_Real theMin)
{
- SetRange( aMin, GetMax() );
+ SetRange (theMin, GetMax());
}
-void Aspect_ColorScale::SetMax( const Standard_Real aMax )
+void Aspect_ColorScale::SetMax (const Standard_Real theMax)
{
- SetRange( GetMin(), aMax );
+ SetRange (GetMin(), theMax);
}
-void Aspect_ColorScale::SetRange( const Standard_Real aMin, const Standard_Real aMax )
+void Aspect_ColorScale::SetRange (const Standard_Real theMin, const Standard_Real theMax)
{
- if ( myMin == aMin && myMax == aMax )
+ if (myMin == theMin && myMax == theMax)
return;
- myMin = Min( aMin, aMax );
- myMax = Max( aMin, aMax );
+ myMin = Min( theMin, theMax );
+ myMax = Max( theMin, theMax );
- if ( GetColorType() == Aspect_TOCSD_AUTO )
+ if (GetColorType() == Aspect_TOCSD_AUTO)
UpdateColorScale();
}
-void Aspect_ColorScale::SetLabelType( const Aspect_TypeOfColorScaleData aType )
+void Aspect_ColorScale::SetLabelType (const Aspect_TypeOfColorScaleData theType)
{
- if ( myLabelType == aType )
+ if (myLabelType == theType)
return;
- myLabelType = aType;
+ myLabelType = theType;
UpdateColorScale();
}
-void Aspect_ColorScale::SetColorType( const Aspect_TypeOfColorScaleData aType )
+void Aspect_ColorScale::SetColorType (const Aspect_TypeOfColorScaleData theType)
{
- if ( myColorType == aType )
+ if (myColorType == theType)
return;
- myColorType = aType;
+ myColorType = theType;
UpdateColorScale();
}
-void Aspect_ColorScale::SetNumberOfIntervals( const Standard_Integer aNum )
+void Aspect_ColorScale::SetNumberOfIntervals (const Standard_Integer theNum)
{
- if ( myInterval == aNum || aNum < 1 )
+ if (myInterval == theNum || theNum < 1)
return;
- myInterval = aNum;
+ myInterval = theNum;
UpdateColorScale();
}
-void Aspect_ColorScale::SetTitle( const TCollection_ExtendedString& aTitle )
+void Aspect_ColorScale::SetTitle (const TCollection_ExtendedString& theTitle)
{
- if ( myTitle == aTitle )
+ if (myTitle == theTitle)
return;
- myTitle = aTitle;
+ myTitle = theTitle;
UpdateColorScale();
}
-void Aspect_ColorScale::SetFormat( const TCollection_AsciiString& aFormat )
+void Aspect_ColorScale::SetFormat (const TCollection_AsciiString& theFormat)
{
- if ( myFormat == aFormat )
+ if (myFormat == theFormat)
return;
- myFormat = aFormat;
- if ( GetLabelType() == Aspect_TOCSD_AUTO )
+ myFormat = theFormat;
+ if (GetLabelType() == Aspect_TOCSD_AUTO)
UpdateColorScale();
}
-void Aspect_ColorScale::SetLabel( const TCollection_ExtendedString& aLabel, const Standard_Integer anIndex )
+void Aspect_ColorScale::SetLabel (const TCollection_ExtendedString& theLabel, const Standard_Integer theIndex)
{
Standard_Boolean changed = Standard_False;
- Standard_Integer i = anIndex < 1 ? myLabels.Length() + 1 : anIndex;
- if ( i <= myLabels.Length() ) {
- changed = myLabels.Value( i ) != aLabel;
- myLabels.SetValue( i, aLabel );
+ Standard_Integer i = theIndex < 0 ? myLabels.Length() + 1 : theIndex + 1;
+ if (i <= myLabels.Length()) {
+ changed = myLabels.Value (i) != theLabel;
+ myLabels.SetValue (i, theLabel);
}
else {
changed = Standard_True;
- while ( i > myLabels.Length() )
- myLabels.Append( TCollection_ExtendedString() );
- myLabels.SetValue( i, aLabel );
+ while (i > myLabels.Length())
+ myLabels.Append (TCollection_ExtendedString());
+ myLabels.SetValue (i, theLabel);
}
- if ( changed )
+ if (changed)
UpdateColorScale();
}
-void Aspect_ColorScale::SetColor(const Quantity_Color& aColor, const Standard_Integer anIndex )
+void Aspect_ColorScale::SetColor (const Quantity_Color& theColor, const Standard_Integer theIndex)
{
Standard_Boolean changed = Standard_False;
- Standard_Integer i = anIndex < 1 ? myLabels.Length() + 1 : anIndex;
- if ( i <= myColors.Length() ) {
- changed = myColors.Value( i ) != aColor;
- myColors.SetValue( i, aColor );
+ Standard_Integer i = theIndex < 0 ? myColors.Length() + 1 : theIndex + 1;
+ if (i <= myColors.Length()) {
+ changed = myColors.Value (i) != theColor;
+ myColors.SetValue (i, theColor);
}
else {
changed = Standard_True;
while ( i > myColors.Length() )
- myColors.Append( Quantity_Color() );
- myColors.SetValue( i, aColor );
+ myColors.Append (Quantity_Color());
+ myColors.SetValue (i, theColor);
}
- if ( changed )
+ if (changed)
UpdateColorScale();
}
-void Aspect_ColorScale::SetLabels( const TColStd_SequenceOfExtendedString& aSeq )
+void Aspect_ColorScale::SetLabels (const TColStd_SequenceOfExtendedString& theSeq)
{
myLabels.Clear();
- for ( Standard_Integer i = 1; i <= aSeq.Length(); i++ )
- myLabels.Append( aSeq.Value( i ) );
+ for (Standard_Integer i = 1; i <= theSeq.Length(); i++)
+ myLabels.Append (theSeq.Value (i));
}
-void Aspect_ColorScale::SetColors( const Aspect_SequenceOfColor& aSeq )
+void Aspect_ColorScale::SetColors (const Aspect_SequenceOfColor& theSeq)
{
myColors.Clear();
- for ( Standard_Integer i = 1; i <= aSeq.Length(); i++ )
- myColors.Append( aSeq.Value( i ) );
+ for (Standard_Integer i = 1; i <= theSeq.Length(); i++)
+ myColors.Append (theSeq.Value (i));
}
-void Aspect_ColorScale::SetLabelPosition( const Aspect_TypeOfColorScalePosition aPos )
+void Aspect_ColorScale::SetLabelPosition (const Aspect_TypeOfColorScalePosition thePos)
{
- if ( myLabelPos == aPos )
+ if (myLabelPos == thePos)
return;
- myLabelPos = aPos;
+ myLabelPos = thePos;
UpdateColorScale();
}
-void Aspect_ColorScale::SetTitlePosition( const Aspect_TypeOfColorScalePosition aPos )
+void Aspect_ColorScale::SetTitlePosition (const Aspect_TypeOfColorScalePosition thePos)
{
- if ( myTitlePos == aPos )
+ if (myTitlePos == thePos)
return;
- myTitlePos = aPos;
+ myTitlePos = thePos;
UpdateColorScale();
}
-void Aspect_ColorScale::SetReversed( const Standard_Boolean aReverse )
+void Aspect_ColorScale::SetReversed (const Standard_Boolean theReverse)
{
- if ( myReversed == aReverse )
+ if (myReversed == theReverse)
return;
- myReversed = aReverse;
+ myReversed = theReverse;
UpdateColorScale();
}
-void Aspect_ColorScale::SetLabelAtBorder( const Standard_Boolean anOn )
+void Aspect_ColorScale::SetLabelAtBorder (const Standard_Boolean theOn)
{
- if ( myAtBorder == anOn )
+ if (myAtBorder == theOn)
return;
- myAtBorder = anOn;
+ myAtBorder = theOn;
UpdateColorScale();
}
-void Aspect_ColorScale::GetPosition( Standard_Real& aX, Standard_Real& aY ) const
+void Aspect_ColorScale::GetPosition (Standard_Real& theX, Standard_Real& theY) const
{
- aX = myXPos;
- aY = myYPos;
+ theX = myXPos;
+ theY = myYPos;
}
Standard_Real Aspect_ColorScale::GetXPosition() const
return myYPos;
}
-void Aspect_ColorScale::SetPosition( const Standard_Real aX, const Standard_Real aY )
+void Aspect_ColorScale::SetPosition (const Standard_Real theX, const Standard_Real theY)
{
- if ( myXPos == aX && myYPos == aY )
+ if (myXPos == theX && myYPos == theY)
return;
- myXPos = aX;
- myYPos = aY;
+ myXPos = theX;
+ myYPos = theY;
UpdateColorScale();
}
-void Aspect_ColorScale::SetXPosition( const Standard_Real aX )
+void Aspect_ColorScale::SetXPosition (const Standard_Real theX)
{
- SetPosition( aX, GetYPosition() );
+ SetPosition (theX, GetYPosition());
}
-void Aspect_ColorScale::SetYPosition( const Standard_Real aY )
+void Aspect_ColorScale::SetYPosition (const Standard_Real theY)
{
- SetPosition( GetXPosition(), aY );
+ SetPosition (GetXPosition(), theY);
}
-void Aspect_ColorScale::GetSize( Standard_Real& aWidth, Standard_Real& aHeight ) const
+void Aspect_ColorScale::GetSize (Standard_Real& theWidth, Standard_Real& theHeight) const
{
- aWidth = myWidth;
- aHeight = myHeight;
+ theWidth = myWidth;
+ theHeight = myHeight;
}
Standard_Real Aspect_ColorScale::GetWidth() const
return myHeight;
}
-void Aspect_ColorScale::SetSize( const Standard_Real aWidth, const Standard_Real aHeight )
+void Aspect_ColorScale::SetSize (const Standard_Real theWidth, const Standard_Real theHeight)
{
- if ( myWidth == aWidth && myHeight == aHeight )
+ if (myWidth == theWidth && myHeight == theHeight)
return;
- myWidth = aWidth;
- myHeight = aHeight;
+ myWidth = theWidth;
+ myHeight = theHeight;
UpdateColorScale();
}
-void Aspect_ColorScale::SetWidth( const Standard_Real aWidth )
+void Aspect_ColorScale::SetWidth (const Standard_Real theWidth)
{
- SetSize( aWidth, GetHeight() );
+ SetSize (theWidth, GetHeight());
}
-void Aspect_ColorScale::SetHeight( const Standard_Real aHeight )
+void Aspect_ColorScale::SetHeight (const Standard_Real theHeight)
{
- SetSize( GetWidth(), aHeight );
+ SetSize (GetWidth(), theHeight);
}
-void Aspect_ColorScale::SizeHint( Standard_Integer& aWidth, Standard_Integer& aHeight ) const
+void Aspect_ColorScale::SizeHint (Standard_Integer& theWidth, Standard_Integer& theHeight) const
{
Standard_Integer num = GetNumberOfIntervals();
Standard_Integer spacer = 5;
Standard_Integer textWidth = 0;
- Standard_Integer textHeight = TextHeight( "" );
+ Standard_Integer textHeight = TextHeight ("");
Standard_Integer colorWidth = 20;
- if ( GetLabelPosition() != Aspect_TOCSP_NONE )
- for ( Standard_Integer idx = 0; idx < num; idx++ )
- textWidth = Max( textWidth, TextWidth( GetCurrentLabel( idx + 1 ) ) );
+ if (GetLabelPosition() != Aspect_TOCSP_NONE)
+ for (Standard_Integer idx = 0; idx < num; idx++)
+ textWidth = Max (textWidth, TextWidth (GetLabel (idx + 1)));
Standard_Integer scaleWidth = 0;
Standard_Integer scaleHeight = 0;
Standard_Integer titleWidth = 0;
Standard_Integer titleHeight = 0;
- if ( IsLabelAtBorder() ) {
+ if (IsLabelAtBorder()) {
num++;
- if ( GetTitle().Length() )
+ if (GetTitle().Length())
titleHeight += 10;
}
scaleWidth = colorWidth + textWidth + ( textWidth ? 3 : 2 ) * spacer;
scaleHeight = (Standard_Integer)( 1.5 * ( num + 1 ) * textHeight );
- if ( GetTitle().Length() ) {
- titleHeight = TextHeight( GetTitle() ) + spacer;
- titleWidth = TextWidth( GetTitle() ) + 10;
+ if (GetTitle().Length()) {
+ titleHeight = TextHeight (GetTitle()) + spacer;
+ titleWidth = TextWidth (GetTitle()) + 10;
}
- aWidth = Max( titleWidth, scaleWidth );
- aHeight = scaleHeight + titleHeight;
+ theWidth = Max (titleWidth, scaleWidth);
+ theHeight = scaleHeight + titleHeight;
}
-void Aspect_ColorScale::DrawScale( const Quantity_Color& aBgColor,
- const Standard_Integer X, const Standard_Integer Y,
- const Standard_Integer W, const Standard_Integer H )
+void Aspect_ColorScale::DrawScale ( const Quantity_Color& theBgColor,
+ const Standard_Integer theX, const Standard_Integer theY,
+ const Standard_Integer theWidth, const Standard_Integer theHeight)
{
- if ( !BeginPaint() )
+ if (!BeginPaint())
return;
Standard_Integer num = GetNumberOfIntervals();
Standard_Integer spacer = 5;
Standard_Integer textWidth = 0;
- Standard_Integer textHeight = TextHeight( "" );
+ Standard_Integer textHeight = TextHeight ("");
Standard_Boolean drawLabel = GetLabelPosition() != Aspect_TOCSP_NONE;
Standard_Integer titleHeight = 0;
- Standard_Integer aGray = (Standard_Integer)(255 * ( aBgColor.Red() * 11 + aBgColor.Green() * 16 + aBgColor.Blue() * 5 ) / 32);
- Quantity_Color aFgColor( aGray < 128 ? Quantity_NOC_WHITE : Quantity_NOC_BLACK );
+ Standard_Integer aGray = (Standard_Integer)(255 * ( theBgColor.Red() * 11 + theBgColor.Green() * 16 + theBgColor.Blue() * 5 ) / 32);
+ Quantity_Color aFgColor (aGray < 128 ? Quantity_NOC_WHITE : Quantity_NOC_BLACK);
// Draw title
- if ( aTitle.Length() ) {
- titleHeight = TextHeight( aTitle ) + 2 * spacer;
- PaintText( aTitle, X + spacer, Y + spacer, aFgColor );
+ if (aTitle.Length()) {
+ titleHeight = TextHeight (aTitle) + 2 * spacer;
+ PaintText (aTitle, theX + spacer, theY + spacer, aFgColor);
}
Standard_Boolean reverse = IsReversed();
Aspect_SequenceOfColor colors;
TColStd_SequenceOfExtendedString labels;
- for ( int idx = 0; idx < num; idx++ ) {
- if ( reverse ) {
- colors.Append( GetCurrentColor( idx ) );
- labels.Append( GetCurrentLabel( idx ) );
+ for (int idx = 0; idx < num; idx++) {
+ if (reverse) {
+ colors.Append (GetColor (idx));
+ labels.Append (GetLabel (idx));
}
else {
- colors.Prepend( GetCurrentColor( idx ) );
- labels.Prepend( GetCurrentLabel( idx ) );
+ colors.Prepend (GetColor (idx));
+ labels.Prepend (GetLabel (idx));
}
}
- if ( IsLabelAtBorder() ) {
- if ( reverse )
- labels.Append( GetCurrentLabel( num ) );
+ if (IsLabelAtBorder()) {
+ if (reverse)
+ labels.Append (GetLabel (num));
else
- labels.Prepend( GetCurrentLabel( num ) );
+ labels.Prepend (GetLabel (num));
}
- if ( drawLabel )
- for ( Standard_Integer i = 1; i <= labels.Length(); i++ )
- textWidth = Max( textWidth, TextWidth( labels.Value( i ) ) );
+ if (drawLabel)
+ for (Standard_Integer i = 1; i <= labels.Length(); i++)
+ textWidth = Max (textWidth, TextWidth (labels.Value (i)));
Standard_Integer lab = labels.Length();
- Standard_Real spc = ( H - ( ( Min( lab, 2 ) + Abs( lab - num - 1 ) ) * textHeight ) - titleHeight );
- Standard_Real val = spc != 0 ? 1.0 * ( lab - Min( lab, 2 ) ) * textHeight / spc : 0;
+ Standard_Real spc = ( theHeight - ( ( Min (lab, 2) + Abs (lab - num - 1) ) * textHeight ) - titleHeight );
+ Standard_Real val = spc != 0 ? 1.0 * ( lab - Min (lab, 1) ) * textHeight / spc : 0;
Standard_Real iPart;
- Standard_Real fPart = modf( val, &iPart );
+ Standard_Real fPart = modf (val, &iPart);
Standard_Integer filter = (Standard_Integer)iPart + ( fPart != 0 ? 1 : 0 );
- Standard_Real step = 1.0 * ( H - ( lab - num + Abs( lab - num - 1 ) ) * textHeight - titleHeight ) / num;
+ Standard_Real step = 1.0 * ( theHeight - ( lab - num + Abs (lab - num - 1) ) * textHeight - titleHeight ) / num;
Standard_Integer ascent = 0;
- Standard_Integer colorWidth = Max( 5, Min( 20, W - textWidth - 3 * spacer ) );
- if ( labPos == Aspect_TOCSP_CENTER || !drawLabel )
- colorWidth = W - 2 * spacer;
+ Standard_Integer colorWidth = Max (5, Min (20, theWidth - textWidth - 3 * spacer));
+ if (labPos == Aspect_TOCSP_CENTER || !drawLabel)
+ colorWidth = theWidth - 2 * spacer;
// Draw colors
- Standard_Integer x = X + spacer;
- if ( labPos == Aspect_TOCSP_LEFT )
+ Standard_Integer x = theX + spacer;
+ if (labPos == Aspect_TOCSP_LEFT)
x += textWidth + ( textWidth ? 1 : 0 ) * spacer;
- Standard_Real offset = 1.0 * textHeight / 2 * ( lab - num + Abs( lab - num - 1 ) ) + titleHeight;
- for ( Standard_Integer ci = 1; ci <= colors.Length() && step > 0; ci++ ) {
- Standard_Integer y = (Standard_Integer)( Y + ( ci - 1 )* step + offset );
- Standard_Integer h = (Standard_Integer)( Y + ( ci ) * step + offset ) - y;
- PaintRect( x, y, colorWidth, h, colors.Value( ci ), Standard_True );
+ Standard_Real offset = 1.0 * textHeight / 2 * ( lab - num + Abs (lab - num - 1) ) + titleHeight;
+ for (Standard_Integer ci = 1; ci <= colors.Length() && step > 0; ci++ ) {
+ Standard_Integer y = (Standard_Integer)( theY + ( ci - 1 )* step + offset);
+ Standard_Integer h = (Standard_Integer)( theY + ( ci ) * step + offset ) - y;
+ PaintRect (x, y, colorWidth, h, colors.Value (ci), Standard_True);
}
- if ( step > 0 )
- PaintRect( x - 1, (Standard_Integer)(Y + offset - 1), colorWidth + 2, (Standard_Integer)(colors.Length() * step + 2), aFgColor );
+ if (step > 0)
+ PaintRect (x - 1, (Standard_Integer)(theY + offset - 1), colorWidth + 2, (Standard_Integer)(colors.Length() * step + 2), aFgColor);
// Draw labels
- offset = 1.0 * Abs( lab - num - 1 ) * ( step - textHeight ) / 2 + 1.0 * Abs( lab - num - 1 ) * textHeight / 2;
+ offset = 1.0 * Abs (lab - num - 1) * ( step - textHeight ) / 2 + 1.0 * Abs (lab - num - 1) * textHeight / 2;
offset += titleHeight;
- if ( drawLabel && labels.Length() && filter > 0 ) {
+ if (drawLabel && labels.Length() && filter > 0) {
Standard_Integer i1 = 0;
Standard_Integer i2 = lab - 1;
- Standard_Integer last1( i1 ), last2( i2 );
- x = X + spacer;
+ Standard_Integer last1 (i1), last2 (i2);
+ x = theX + spacer;
switch ( labPos ) {
case Aspect_TOCSP_NONE:
case Aspect_TOCSP_LEFT:
x += colorWidth + spacer;
break;
}
- while ( i2 - i1 >= filter || ( i2 == 0 && i1 == 0 ) ) {
+ while (i2 - i1 >= filter || ( i2 == 0 && i1 == 0 )) {
Standard_Integer pos1 = i1;
Standard_Integer pos2 = lab - 1 - i2;
- if ( filter && !( pos1 % filter ) ) {
- PaintText( labels.Value( i1 + 1 ), x, (Standard_Integer)( Y + i1 * step + ascent + offset ), aFgColor );
- last1 = i1;
+ if (filter && !( pos1 % filter )) {
+ PaintText (labels.Value (i1 + 1), x, (Standard_Integer)( theY + i1 * step + ascent + offset ), aFgColor);
+ last1 = i1;
}
- if ( filter && !( pos2 % filter ) ) {
- PaintText( labels.Value( i2 + 1 ), x, (Standard_Integer)( Y + i2 * step + ascent + offset ), aFgColor );
- last2 = i2;
+ if (filter && !( pos2 % filter )) {
+ PaintText (labels.Value (i2 + 1), x, (Standard_Integer)( theY + i2 * step + ascent + offset ), aFgColor);
+ last2 = i2;
}
i1++;
i2--;
}
Standard_Integer pos = i1;
Standard_Integer i0 = -1;
- while ( pos <= i2 && i0 == -1 ) {
- if ( filter && !( pos % filter ) && Abs( pos - last1 ) >= filter && Abs( pos - last2 ) >= filter )
- i0 = pos;
+ while (pos <= i2 && i0 == -1) {
+ if (filter && !( pos % filter ) && Abs (pos - last1) >= filter && Abs (pos - last2) >= filter)
+ i0 = pos;
pos++;
}
- if ( i0 != -1 )
- PaintText( labels.Value( i0 + 1 ), x, (Standard_Integer)( Y + i0 * step + ascent + offset ), aFgColor );
+ if (i0 != -1)
+ PaintText (labels.Value (i0 + 1), x, (Standard_Integer)( theY + i0 * step + ascent + offset ), aFgColor);
}
EndPaint();
return GetFormat();
}
-TCollection_ExtendedString Aspect_ColorScale::GetCurrentLabel( const Standard_Integer anIndex ) const
-{
- TCollection_ExtendedString aLabel;
- if ( GetLabelType() == Aspect_TOCSD_USER )
- aLabel = GetLabel( anIndex );
- else {
- Standard_Real val = GetNumber( anIndex );
- Standard_Character buf[1024];
- TCollection_AsciiString aFormat = Format();
- sprintf( buf, aFormat.ToCString(), val );
- aLabel = TCollection_ExtendedString( buf );
- }
-
- return aLabel;
-}
-
-Quantity_Color Aspect_ColorScale::GetCurrentColor( const Standard_Integer anIndex ) const
-{
- Quantity_Color aColor;
- if ( GetColorType() == Aspect_TOCSD_USER )
- aColor = GetColor( anIndex );
- else
- aColor = Quantity_Color( HueFromValue( anIndex, 0, GetNumberOfIntervals() - 1 ), 1.0, 1.0, Quantity_TOC_HLS );
- return aColor;
-}
-
-Standard_Real Aspect_ColorScale::GetNumber( const Standard_Integer anIndex ) const
+Standard_Real Aspect_ColorScale::GetNumber (const Standard_Integer theIndex) const
{
Standard_Real aNum = 0;
- if ( GetNumberOfIntervals() > 0 )
- aNum = GetMin() + anIndex * ( Abs( GetMax() - GetMin() ) / GetNumberOfIntervals() );
+ if (GetNumberOfIntervals() > 0)
+ aNum = GetMin() + theIndex * ( Abs (GetMax() - GetMin()) / GetNumberOfIntervals() );
return aNum;
}
-Standard_Integer Aspect_ColorScale::HueFromValue( const Standard_Integer aValue,
- const Standard_Integer aMin, const Standard_Integer aMax )
+Standard_Integer Aspect_ColorScale::HueFromValue (const Standard_Integer theValue,
+ const Standard_Integer theMin, const Standard_Integer theMax)
{
- Standard_Integer minLimit( 0 ), maxLimit( 230 );
+ Standard_Integer minLimit (0), maxLimit (230);
Standard_Integer aHue = maxLimit;
- if ( aMin != aMax )
- aHue = (Standard_Integer)( maxLimit - ( maxLimit - minLimit ) * ( aValue - aMin ) / ( aMax - aMin ) );
+ if (theMin != theMax)
+ aHue = (Standard_Integer)( maxLimit - ( maxLimit - minLimit ) * ( theValue - theMin ) / ( theMax - theMin ) );
- aHue = Min( Max( minLimit, aHue ), maxLimit );
+ aHue = Min (Max (minLimit, aHue), maxLimit);
return aHue;
}
return myTextHeight;
}
-void Aspect_ColorScale::SetTextHeight(const Standard_Integer aHeigh) {
- myTextHeight = aHeigh;
+void Aspect_ColorScale::SetTextHeight (const Standard_Integer theHeight) {
+ myTextHeight = theHeight;
UpdateColorScale ();
}
-Standard_Boolean Aspect_ColorScale::FindColor( const Standard_Real aValue,
- Quantity_Color& aColor ) const
+Standard_Boolean Aspect_ColorScale::FindColor (const Standard_Real theValue,
+ Quantity_Color& theColor) const
{
- return FindColor( aValue, myMin, myMax, myInterval, aColor );
+ return FindColor (theValue, myMin, myMax, myInterval, theColor);
}
-Standard_Boolean Aspect_ColorScale::FindColor( const Standard_Real aValue,
- const Standard_Real aMin,
- const Standard_Real aMax,
- const Standard_Integer ColorsCount,
- Quantity_Color& aColor )
+Standard_Boolean Aspect_ColorScale::FindColor (const Standard_Real theValue,
+ const Standard_Real theMin,
+ const Standard_Real theMax,
+ const Standard_Integer theColorsCount,
+ Quantity_Color& theColor)
{
- if( aValue<aMin || aValue>aMax || aMax<aMin )
+ if(theValue<theMin || theValue>theMax || theMax<theMin)
return Standard_False;
else
{
Standard_Real IntervNumber = 0;
- if( aValue<aMin )
- IntervNumber = 0;
- else if( aValue>aMax )
- IntervNumber = ColorsCount-1;
- else if( Abs( aMax-aMin ) > Precision::Approximation() )
- IntervNumber = Ceiling( Standard_Real( ColorsCount ) * ( aValue - aMin ) / ( aMax - aMin ) );
+ if(Abs (theMax-theMin) > Precision::Approximation())
+ IntervNumber = Floor (Standard_Real( theColorsCount ) * ( theValue - theMin ) / ( theMax - theMin ));
- Standard_Integer Interv = Standard_Integer( IntervNumber );
+ Standard_Integer Interv = Standard_Integer (IntervNumber);
- aColor = Quantity_Color( HueFromValue( Interv, 0, ColorsCount - 1 ), 1.0, 1.0, Quantity_TOC_HLS );
+ theColor = Quantity_Color (HueFromValue (Interv, 0, theColorsCount - 1), 1.0, 1.0, Quantity_TOC_HLS);
return Standard_True;
}
---Category: Public
- Create(aMgr : LayerMgr from V3d)
+ Create(theMgr : LayerMgr from V3d)
returns ColorScale from V3d;
---Purpose: Returns returns ColorScale from V3d.
--returns Boolean from Standard
--is redefined protected;
- PaintRect(me : mutable; X, Y, W, H : Integer from Standard;
- aColor : Color from Quantity;
- aFilled : Boolean from Standard = Standard_False)
+ PaintRect(me : mutable; theX, theY, theWidth, theHeight : Integer from Standard;
+ theColor : Color from Quantity;
+ theFilled : Boolean from Standard = Standard_False)
is redefined;
- PaintText(me : mutable; aText : ExtendedString from TCollection;
- X, Y : Integer from Standard;
- aColor : Color from Quantity)
+ PaintText(me : mutable; theText : ExtendedString from TCollection;
+ theX, theY : Integer from Standard;
+ theColor : Color from Quantity)
is redefined;
- TextWidth(me; aText : ExtendedString from TCollection)
+ TextWidth(me; theText : ExtendedString from TCollection)
returns Integer from Standard
is redefined;
- TextHeight(me; aText : ExtendedString from TCollection)
+ TextHeight(me; theText : ExtendedString from TCollection)
returns Integer from Standard
is redefined;
TextSize( me;
- AText : ExtendedString from TCollection;
- AHeight : Integer from Standard;
- AWidth : in out Integer from Standard;
- AnAscent : in out Integer from Standard;
- ADescent : in out Integer from Standard );
+ theText : ExtendedString from TCollection;
+ theHeight : Integer from Standard;
+ theWidth : in out Integer from Standard;
+ theAscent : in out Integer from Standard;
+ theDescent : in out Integer from Standard );
DrawScale(me : mutable);
#include <TColStd_SequenceOfExtendedString.hxx>
#include <Font_NameOfFont.hxx>
-V3d_ColorScale::V3d_ColorScale( const Handle(V3d_LayerMgr)& aMgr )
+V3d_ColorScale::V3d_ColorScale (const Handle(V3d_LayerMgr)& theMgr)
: Aspect_ColorScale(),
-myLayerMgr( aMgr.operator->() ),
+myLayerMgr( theMgr.operator->() ),
myDisplay( Standard_False )
{
}
myLayerMgr->Compute();
}
-void V3d_ColorScale::PaintRect( const Standard_Integer X, const Standard_Integer Y,
- const Standard_Integer W, const Standard_Integer H,
- const Quantity_Color& aColor, const Standard_Boolean aFilled )
+void V3d_ColorScale::PaintRect (const Standard_Integer theX, const Standard_Integer theY,
+ const Standard_Integer theWidth, const Standard_Integer theHeight,
+ const Quantity_Color& theColor, const Standard_Boolean theFilled)
{
const Handle(Visual3d_Layer) &theLayer = myLayerMgr->Overlay();
- if ( theLayer.IsNull() )
+ if (theLayer.IsNull())
return;
- theLayer->SetColor( aColor );
- if ( aFilled )
- theLayer->DrawRectangle( X, Y, W, H );
+ theLayer->SetColor (theColor);
+ if (theFilled)
+ theLayer->DrawRectangle (theX, theY, theWidth, theHeight);
else {
theLayer->SetLineAttributes( Aspect_TOL_SOLID, 0.5 );
theLayer->BeginPolyline();
- theLayer->AddVertex( X, Y, Standard_False );
- theLayer->AddVertex( X, Y + H, Standard_True );
- theLayer->AddVertex( X + W, Y + H, Standard_True );
- theLayer->AddVertex( X + W, Y, Standard_True );
- theLayer->AddVertex( X, Y, Standard_True );
+ theLayer->AddVertex (theX, theY, Standard_False);
+ theLayer->AddVertex (theX, theY + theHeight, Standard_True);
+ theLayer->AddVertex (theX + theWidth, theY + theHeight, Standard_True);
+ theLayer->AddVertex (theX + theWidth, theY, Standard_True);
+ theLayer->AddVertex (theX, theY, Standard_True);
theLayer->ClosePrimitive();
}
}
-void V3d_ColorScale::PaintText( const TCollection_ExtendedString& aText,
- const Standard_Integer X, const Standard_Integer Y,
- const Quantity_Color& aColor )
+void V3d_ColorScale::PaintText (const TCollection_ExtendedString& theText,
+ const Standard_Integer theX, const Standard_Integer theY,
+ const Quantity_Color& theColor)
{
const Handle(Visual3d_Layer) &theLayer = myLayerMgr->Overlay();
- if ( theLayer.IsNull() )
+ if (theLayer.IsNull())
return;
- theLayer->SetColor( aColor );
- theLayer->SetTextAttributes( Font_NOF_ASCII_MONO, Aspect_TODT_NORMAL, aColor );
- TCollection_AsciiString theText( aText.ToExtString(), '?' );
+ theLayer->SetColor (theColor);
+ theLayer->SetTextAttributes (Font_NOF_ASCII_MONO, Aspect_TODT_NORMAL, theColor);
+ TCollection_AsciiString aText (theText.ToExtString(), '?');
Standard_Integer aTextH = GetTextHeight();
Standard_Integer aWidth, anAscent, aDescent;
- TextSize(aText, aTextH, aWidth, anAscent, aDescent);
- theLayer->DrawText( theText.ToCString(), X, Y + anAscent, aTextH);
+ TextSize (theText, aTextH, aWidth, anAscent, aDescent);
+ theLayer->DrawText (aText.ToCString(), theX, theY + anAscent, aTextH);
}
-Standard_Integer V3d_ColorScale::TextWidth( const TCollection_ExtendedString& aText ) const
+Standard_Integer V3d_ColorScale::TextWidth (const TCollection_ExtendedString& theText) const
{
Standard_Integer aWidth, anAscent, aDescent;
- TextSize(aText, GetTextHeight(), aWidth, anAscent, aDescent);
+ TextSize (theText, GetTextHeight(), aWidth, anAscent, aDescent);
return aWidth;
}
-Standard_Integer V3d_ColorScale::TextHeight( const TCollection_ExtendedString& aText ) const
+Standard_Integer V3d_ColorScale::TextHeight (const TCollection_ExtendedString& theText) const
{
Standard_Integer aWidth, anAscent, aDescent;
- TextSize(aText, GetTextHeight(), aWidth, anAscent, aDescent);
+ TextSize (theText, GetTextHeight(), aWidth, anAscent, aDescent);
return anAscent+aDescent;
}
-void V3d_ColorScale::TextSize (const TCollection_ExtendedString& AText, const Standard_Integer AHeight, Standard_Integer& AWidth, Standard_Integer& AnAscent, Standard_Integer& ADescent) const
+void V3d_ColorScale::TextSize (const TCollection_ExtendedString& theText, const Standard_Integer theHeight, Standard_Integer& theWidth, Standard_Integer& theAscent, Standard_Integer& theDescent) const
{
const Handle(Visual3d_Layer) &theLayer = myLayerMgr->Overlay();
- if ( !theLayer.IsNull() ) {
+ if (!theLayer.IsNull()) {
Standard_Real aWidth, anAscent, aDescent;
- TCollection_AsciiString theText( AText.ToExtString(), '?' );
- theLayer->TextSize(theText.ToCString(),AHeight,aWidth,anAscent,aDescent);
- AWidth = (Standard_Integer)aWidth;
- AnAscent = (Standard_Integer)anAscent;
- ADescent = (Standard_Integer)aDescent;
+ TCollection_AsciiString aText (theText.ToExtString(), '?');
+ theLayer->TextSize (aText.ToCString(),theHeight,aWidth,anAscent,aDescent);
+ theWidth = (Standard_Integer)aWidth;
+ theAscent = (Standard_Integer)anAscent;
+ theDescent = (Standard_Integer)aDescent;
}
else {
- AWidth=AnAscent=ADescent=0;
+ theWidth=theAscent=theDescent=0;
}
}
void V3d_ColorScale::DrawScale ()
{
const Handle(V3d_View) &theView = myLayerMgr->View();
- if ( theView.IsNull() )
+ if (theView.IsNull())
return;
const Handle(Aspect_Window) &theWin = theView->Window();
- if ( theWin.IsNull() )
+ if (theWin.IsNull())
return;
Standard_Integer WinWidth( 0 ), WinHeight( 0 );
- theWin->Size( WinWidth, WinHeight );
+ theWin->Size (WinWidth, WinHeight);
- const Standard_Integer X = RealToInt(GetXPosition() * WinWidth);
- const Standard_Integer Y = RealToInt(GetYPosition() * WinHeight);
+ const Standard_Integer X = RealToInt (GetXPosition() * WinWidth);
+ const Standard_Integer Y = RealToInt (GetYPosition() * WinHeight);
- const Standard_Integer W = RealToInt(GetWidth() * WinWidth);
- const Standard_Integer H = RealToInt(GetHeight() * WinHeight);
+ const Standard_Integer W = RealToInt (GetWidth() * WinWidth);
+ const Standard_Integer H = RealToInt (GetHeight() * WinHeight);
- Aspect_ColorScale::DrawScale( theView->BackgroundColor(), X, Y, W, H );
+ Aspect_ColorScale::DrawScale (theView->BackgroundColor(), X, Y, W, H);
}
void V3d_LayerMgr::ColorScaleDisplay()
{
+ if (ColorScaleIsDisplayed())
+ return;
ColorScale();
myColorScale->Display();
myOverlay->AddLayerItem( myColorScaleLayerItem );
#include <Visual3d_View.hxx>
#include <Visual3d_ViewManager.hxx>
#include <V3d_AmbientLight.hxx>
+#include <V3d_ColorScale.hxx>
#include <V3d_DirectionalLight.hxx>
#include <V3d_LayerMgr.hxx>
#include <V3d_LayerMgrPointer.hxx>
//function : VColorScale
//purpose : representation color scale
//==============================================================================
-#include <V3d_ColorScale.hxx>
-static int VColorScale (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+static Standard_Boolean checkColor (const TCollection_AsciiString& theRed,
+ const TCollection_AsciiString& theGreen,
+ const TCollection_AsciiString& theBlue,
+ Standard_Real& theRedValue,
+ Standard_Real& theGreenValue,
+ Standard_Real& theBlueValue)
{
- if ( argc != 1 && argc != 4 && argc != 5 && argc != 6 && argc != 8 )
+ if (!theRed.IsRealValue()
+ || !theGreen.IsRealValue()
+ || !theBlue.IsRealValue())
{
- di << "Usage : " << argv[0] << " [RangeMin = 0 RangeMax = 100 Intervals = 10 HeightFont = 16 Position = Right X = 0 Y = 0] " << "\n";
- return 1;
+ std::cout << "Error: RGB color values should be real!\n";
+ return Standard_True;
+ }
+ theRedValue = theRed .RealValue();
+ theGreenValue = theGreen.RealValue();
+ theBlueValue = theBlue .RealValue();
+ if (theRedValue < 0.0 || theRedValue > 1.0
+ || theGreenValue < 0.0 || theGreenValue > 1.0
+ || theBlueValue < 0.0 || theBlueValue > 1.0)
+ {
+ std::cout << "Error: RGB color values should be within range 0..1!\n";
+ return Standard_True;
}
+ return Standard_False;
+}
+static int VColorScale (Draw_Interpretor& theDI,
+ Standard_Integer theArgNb,
+ const char** theArgVec)
+{
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
- if(aContext.IsNull()) {
- di << argv[0] << " ERROR : use 'vinit' command before " << "\n";
- return -1;
+ Handle(V3d_View) aView = ViewerTest::CurrentView();
+ if (aContext.IsNull())
+ {
+ std::cout << "Error: no active view!\n";
+ return 1;
}
- Standard_Real minRange = 0. , maxRange = 100. ;
-
- Standard_Integer numIntervals = 10 ;
- Standard_Integer textHeight = 16;
- Aspect_TypeOfColorScalePosition position = Aspect_TOCSP_RIGHT;
- Standard_Real X = 0., Y = 0. ;
-
- if ( argc < 9 )
- {
- if( argc > 3 )
- {
- minRange = Draw::Atof( argv[1] );
- maxRange = Draw::Atof( argv[2] );
- numIntervals = Draw::Atoi( argv[3] );
- }
- if ( argc > 4 )
- textHeight = Draw::Atoi( argv[4] );
- if ( argc > 5 )
- position = (Aspect_TypeOfColorScalePosition)Draw::Atoi( argv[5] );
- if ( argc > 7 )
- {
- X = Draw::Atof( argv[6] );
- Y = Draw::Atof( argv[7] );
- }
- }
- Handle(V3d_View) curView = ViewerTest::CurrentView( );
- if ( curView.IsNull( ) )
+ Handle(V3d_ColorScale) aCS = Handle(V3d_ColorScale)::DownCast (aView->ColorScale());
+ if (aCS.IsNull())
+ {
+ std::cout << "Error: color scale is undefined!\n";
return 1;
- Handle(Aspect_ColorScale) aCSV = curView->ColorScale( );
- Handle(V3d_ColorScale) aCS = ( Handle( V3d_ColorScale )::DownCast( aCSV ) );
- if( ! aCS.IsNull( ) )
- {
- aCS->SetPosition( X , Y );
- aCS->SetHeight( 0.95) ;
- aCS->SetTextHeight( textHeight );
- aCS->SetRange( minRange , maxRange );
- aCS->SetNumberOfIntervals( numIntervals );
- aCS->SetLabelPosition( position );
- if( !curView->ColorScaleIsDisplayed() )
- curView->ColorScaleDisplay( );
}
+
+ Standard_Real aMinRange = aCS->GetMin();
+ Standard_Real aMaxRange = aCS->GetMax();
+ Standard_Integer aNbIntervals = aCS->GetNumberOfIntervals();
+ Standard_Integer aTextHeight = aCS->GetTextHeight();
+ Aspect_TypeOfColorScalePosition aLabPosition = aCS->GetLabelPosition();
+ gp_XY aPos (aCS->GetXPosition(), aCS->GetYPosition());
+
+ ViewerTest_AutoUpdater anUpdateTool (aContext, aView);
+
+ if (theArgNb <= 1)
+ {
+ theDI << "Current color scale parameters:\n"
+ << "Min range: " << aMinRange << "\n"
+ << "Max range: " << aMaxRange << "\n"
+ << "Number of intervals: " << aNbIntervals << "\n"
+ << "Text height: " << aTextHeight << "\n"
+ << "Color scale position: " << aPos.X() <<" "<< aPos.Y()<< "\n"
+ << "Color scale title: " << aCS->GetTitle() << "\n"
+ << "Label position: ";
+ switch (aLabPosition)
+ {
+ case Aspect_TOCSP_NONE:
+ theDI << "None\n";
+ break;
+ case Aspect_TOCSP_LEFT:
+ theDI << "Left\n";
+ break;
+ case Aspect_TOCSP_RIGHT:
+ theDI << "Right\n";
+ break;
+ case Aspect_TOCSP_CENTER:
+ theDI << "Center\n";
+ break;
+ }
+ return 0;
+ }
+ Standard_CString aFirstArg = theArgVec[1];
+ TCollection_AsciiString aFlag (aFirstArg);
+ aFlag.LowerCase();
+ if (aFlag == "-hide" ||
+ aFlag == "-erase")
+ {
+ if (theArgNb > 2)
+ {
+ std::cout << "Error: wrong syntax at argument '" << theArgVec[1] << "'!\n";
+ return 1;
+ }
+ if (!aView->ColorScaleIsDisplayed())
+ {
+ std::cout << "Error: color scale is not displayed!\n";
+ return 1;
+ }
+ else
+ {
+ aView->ColorScaleErase();
+ return 0;
+ }
+ }
+ else if (aFlag == "-show" ||
+ aFlag == "-display")
+ {
+ if (theArgNb > 2)
+ {
+ std::cout << "Error: wrong syntax at argument '" << theArgVec[1] << "'!\n";
+ return 1;
+ }
+ aView->ColorScaleDisplay();
+ return 0;
+ }
+
+ for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
+ {
+ Standard_CString anArg = theArgVec[anArgIter];
+ TCollection_AsciiString aFlag (anArg);
+ aFlag.LowerCase();
+ if (anUpdateTool.parseRedrawMode (aFlag))
+ {
+ continue;
+ }
+ else if (aFlag == "-range")
+ {
+ if (anArgIter + 3 >= theArgNb)
+ {
+ std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ return 1;
+ }
+
+ TCollection_AsciiString anArg1 (theArgVec[++anArgIter]);
+ TCollection_AsciiString anArg2 (theArgVec[++anArgIter]);
+ TCollection_AsciiString anArg3 (theArgVec[++anArgIter]);
+ if (!anArg1.IsRealValue())
+ {
+ std::cout << "Error: the minRange value should be real!\n";
+ return 1;
+ }
+ else if (!anArg2.IsRealValue())
+ {
+ std::cout << "Error: the maxRange value should be real!\n";
+ return 1;
+ }
+ else if (!anArg3.IsIntegerValue())
+ {
+ std::cout << "Error: the number of intervals should be integer!\n";
+ return 1;
+ }
+
+ aMinRange = anArg1.RealValue();
+ aMaxRange = anArg2.RealValue();
+ aNbIntervals = anArg3.IntegerValue();
+ }
+ else if (aFlag == "-font")
+ {
+ if (anArgIter + 1 >= theArgNb)
+ {
+ std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ return 1;
+ }
+ TCollection_AsciiString anArg (theArgVec[anArgIter + 1]);
+ if (!anArg.IsIntegerValue())
+ {
+ std::cout << "Error: HeightFont value should be integer!\n";
+ return 1;
+ }
+
+ aTextHeight = anArg.IntegerValue();
+ anArgIter += 1;
+ }
+ else if (aFlag == "-textpos")
+ {
+ if (anArgIter + 1 >= theArgNb)
+ {
+ std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ return 1;
+ }
+ TCollection_AsciiString anArg (theArgVec[++anArgIter]);
+ anArg.LowerCase();
+ if (anArg == "none")
+ {
+ aLabPosition = Aspect_TOCSP_NONE;
+ }
+ else if (anArg == "left")
+ {
+ aLabPosition = Aspect_TOCSP_LEFT;
+ }
+ else if (anArg == "right")
+ {
+ aLabPosition = Aspect_TOCSP_RIGHT;
+ }
+ else if (anArg == "center")
+ {
+ aLabPosition = Aspect_TOCSP_CENTER;
+ }
+ else
+ {
+ std::cout << "Error: unknown position '" << anArg << "'!\n";
+ return 1;
+ }
+ }
+ else if (aFlag == "-xy")
+ {
+ if (anArgIter + 2 >= theArgNb)
+ {
+ std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ return 1;
+ }
+
+ TCollection_AsciiString aX (theArgVec[++anArgIter]);
+ TCollection_AsciiString aY (theArgVec[++anArgIter]);
+ if (!aX.IsRealValue()
+ || !aY.IsRealValue())
+ {
+ std::cout << "Error: coordinates should be real values!\n";
+ return 1;
+ }
+
+ aPos.SetCoord (aX.RealValue(), aY.RealValue());
+ }
+ else if (aFlag == "-color")
+ {
+ if (aCS->GetColorType() != Aspect_TOCSD_USER)
+ {
+ std::cout << "Error: wrong color type! Call -colors before to set user-specified colors!\n";
+ return 1;
+ }
+
+ Quantity_NameOfColor aColorName;
+ if (anArgIter + 4 >= theArgNb)
+ {
+ if (anArgIter + 2 >= theArgNb)
+ {
+ std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ return 1;
+ }
+ else if (!Quantity_Color::ColorFromName (theArgVec[anArgIter + 2], aColorName))
+ {
+ std::cout << "Error: wrong color name: '" << theArgVec[anArgIter + 2] << "' !\n";
+ return 1;
+ }
+ }
+
+ TCollection_AsciiString anInd (theArgVec[anArgIter + 1]);
+ if (!anInd.IsIntegerValue())
+ {
+ std::cout << "Error: Index value should be integer!\n";
+ return 1;
+ }
+
+ Standard_Integer anIndex = anInd.IntegerValue();
+ if (anIndex < 0
+ || anIndex > aNbIntervals - 1)
+ {
+ std::cout << "Error: Index value should be within range 0..." << (aNbIntervals - 1) <<"!\n";
+ return 1;
+ }
+
+ if (Quantity_Color::ColorFromName (theArgVec[anArgIter + 2], aColorName))
+ {
+ aCS->SetColor (Quantity_Color (aColorName), anIndex);
+ aCS->SetColorType(Aspect_TOCSD_USER);
+ anArgIter += 2;
+ continue;
+ }
+
+ TCollection_AsciiString aRed (theArgVec[anArgIter + 2]);
+ TCollection_AsciiString aGreen (theArgVec[anArgIter + 3]);
+ TCollection_AsciiString aBlue (theArgVec[anArgIter + 4]);
+ Standard_Real aRedValue,aGreenValue, aBlueValue;
+ if(checkColor (aRed, aGreen, aBlue, aRedValue, aGreenValue, aBlueValue))
+ {
+ return 1;
+ }
+ aCS->SetColor (Quantity_Color (aRedValue, aGreenValue, aBlueValue, Quantity_TOC_RGB), anIndex);
+ aCS->SetColorType (Aspect_TOCSD_USER);
+ anArgIter += 4;
+ }
+ else if (aFlag == "-label")
+ {
+ if (aCS->GetColorType() != Aspect_TOCSD_USER)
+ {
+ std::cout << "Error: wrong label type! Call -labels before to set user-specified labels!\n";
+ return 1;
+ }
+ else if (anArgIter + 2 >= theArgNb)
+ {
+ std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ return 1;
+ }
+
+ Standard_Integer anIndex = Draw::Atoi (theArgVec[anArgIter + 1]);
+ if (anIndex < 0
+ || anIndex > aNbIntervals)
+ {
+ std::cout << "Error: Index value should be within range 0..." << aNbIntervals <<"!\n";
+ return 1;
+ }
+
+ TCollection_ExtendedString aText (theArgVec[anArgIter + 2]);
+ aCS->SetLabel (aText, anIndex);
+ aCS->SetLabelType (Aspect_TOCSD_USER);
+ anArgIter += 2;
+ }
+ else if (aFlag == "-colors")
+ {
+ Aspect_SequenceOfColor aSeq;
+ if (anArgIter + aNbIntervals + 1 > theArgNb)
+ {
+ std::cout << "Error: not enough arguments! You should provide color names or RGB color values for every interval of the "
+ << aNbIntervals << " intervals\n";
+ return 1;
+ }
+
+ Standard_Integer aColorIter = anArgIter + 1;
+ while (aColorIter < theArgNb)
+ {
+ if (theArgVec[aColorIter][0] == '-')
+ {
+ break;
+ }
+
+ else if (theArgVec[aColorIter][0] >= 97
+ && theArgVec[aColorIter][0] <= 122)
+ {
+ Quantity_NameOfColor aColorName;
+ if (!Quantity_Color::ColorFromName (theArgVec[aColorIter], aColorName))
+ {
+ std::cout << "Error: wrong color name: " << theArgVec[aColorIter] << " !\n";
+ return 1;
+ }
+ aSeq.Append (Quantity_Color (aColorName));
+ aColorIter++;
+ anArgIter++;
+ }
+ else
+ {
+ TCollection_AsciiString aRed (theArgVec[aColorIter]);
+ TCollection_AsciiString aGreen (theArgVec[aColorIter + 1]);
+ TCollection_AsciiString aBlue (theArgVec[aColorIter + 2]);
+ Standard_Real aRedValue,aGreenValue, aBlueValue;
+ if (checkColor (aRed, aGreen, aBlue, aRedValue, aGreenValue, aBlueValue))
+ {
+ return 1;
+ }
+ aSeq.Append (Quantity_Color (aRedValue, aGreenValue, aBlueValue, Quantity_TOC_RGB));
+ aColorIter += 3;
+ anArgIter += 3;
+ }
+ }
+ if (aSeq.Length() < aNbIntervals)
+ {
+ std::cout << "Error: not enough arguments! You should provide color names or RGB color values for every interval of the "
+ << aNbIntervals << " intervals\n";
+ return 1;
+ }
+
+ aCS->SetColors (aSeq);
+ aCS->SetColorType (Aspect_TOCSD_USER);
+ }
+ else if (aFlag == "-labels")
+ {
+ if (anArgIter + aNbIntervals + 1 >= theArgNb)
+ {
+ std::cout << "Error: not enough arguments! You should provide " << (aNbIntervals + 1)
+ << " text labels for " << aNbIntervals << " intervals.\n";
+ return 1;
+ }
+
+ TColStd_SequenceOfExtendedString aSeq;
+ for (int aLabelIter = anArgIter + 1; aLabelIter <= anArgIter + aNbIntervals + 1; aLabelIter += 1)
+ {
+ aSeq.Append (TCollection_ExtendedString (theArgVec[aLabelIter]));
+ }
+ aCS->SetLabels (aSeq);
+ aCS->SetLabelType (Aspect_TOCSD_USER);
+ anArgIter += aSeq.Length();
+ }
+ else if (aFlag == "-title")
+ {
+ if (anArgIter + 1 >= theArgNb)
+ {
+ std::cout << "Error: wrong syntax at argument '" << anArg << "'!\n";
+ return 1;
+ }
+
+ Standard_Boolean isTwoArgs = Standard_False;
+ if (anArgIter + 2 < theArgNb)
+ {
+ TCollection_AsciiString aSecondArg (theArgVec[anArgIter + 2]);
+ aSecondArg.LowerCase();
+ if (aSecondArg == "none")
+ {
+ aCS->SetTitlePosition (Aspect_TOCSP_NONE);
+ isTwoArgs = Standard_True;
+ }
+ else if (aSecondArg == "left")
+ {
+ aCS->SetTitlePosition (Aspect_TOCSP_LEFT);
+ isTwoArgs = Standard_True;
+ }
+ else if (aSecondArg == "right")
+ {
+ aCS->SetTitlePosition (Aspect_TOCSP_RIGHT);
+ isTwoArgs = Standard_True;
+ }
+ else if (aSecondArg == "center")
+ {
+ aCS->SetTitlePosition (Aspect_TOCSP_CENTER);
+ isTwoArgs = Standard_True;
+ }
+ }
+
+ aCS->SetTitle (theArgVec[anArgIter + 1]);
+ if (isTwoArgs)
+ {
+ anArgIter += 1;
+ }
+ anArgIter += 1;
+ }
+ else if (aFlag == "-demoversion"
+ || aFlag == "-demo")
+ {
+ aPos.SetCoord (0.0, 0.0);
+ aTextHeight = 16;
+ aMinRange = 0.0;
+ aMaxRange = 100;
+ aNbIntervals = 10;
+ aLabPosition = Aspect_TOCSP_RIGHT;
+ aCS->SetColorType(Aspect_TOCSD_AUTO);
+ aCS->SetLabelType(Aspect_TOCSD_AUTO);
+ }
+ else
+ {
+ std::cout << "Error: wrong syntax at " << anArg << " - unknown argument!\n";
+ return 1;
+ }
+ }
+
+ aCS->SetPosition (aPos.X(), aPos.Y());
+ aCS->SetHeight (0.95);
+ aCS->SetTextHeight (aTextHeight);
+ aCS->SetRange (aMinRange, aMaxRange);
+ aCS->SetNumberOfIntervals (aNbIntervals);
+ aCS->SetLabelPosition (aLabPosition);
+
+ if (!aView->ColorScaleIsDisplayed())
+ {
+ aView->ColorScaleDisplay();
+ }
+
return 0;
}
" : notice that EMF format requires patched gl2ps",
__FILE__,VExport,group);
theCommands.Add("vcolorscale",
- "vcolorscale : vcolorscale [RangeMin = 0 RangeMax = 100 Intervals = 10 HeightFont = 16 Position = 2 X = 0 Y = 0]: draw color scale",
+ "vcolorscale : vcolorscale [-range RangeMin = 0 RangeMax = 100 Intervals = 10 -font HeightFont = 16 -textpos "
+ "Position = left -xy X = 0 Y = 0] [-noupdate|-update]: draw color scale\n"
+ "-demo/-demoversion draw a demoversion of color scale.\n"
+ "-show/display display color scale.\n"
+ "-hide/erase erase color scale.\n"
+ "Please note that -show/-hide option must be the first argument!\n"
+ "-color Index R G B: set color for indexed interval\n"
+ "-color Index ColorName: set color for indexed interval\n"
+ "-colors R G B R G B ...: set colors for all intervals\n"
+ "-colors ColorName1 ColorName2 ...: set colors for all intervals\n"
+ "-colors supports both color names and rgb values in one call\n"
+ "-label Index Text: set label for indexed interval\n"
+ "-labels Text Text Text ...: set labels for all intervals\n"
+ "-title Title [Position]: set the title for color scale with certain position. Default position = center;\n"
+ "Available text positions: left, right, center, none;\n",
__FILE__,VColorScale,group);
theCommands.Add("vgraduatedtrihedron",
"vgraduatedtrihedron : 1/0 (display/erase) [Xname Yname Zname [Font [isMultibyte]]]",
puts "OCC21450"
puts "============"
puts ""
-###### vcolorscale: vcolorscale [RangeMin RangeMax Intervals HeightFont Position X Y]: draw color scale
-###### RangeMin - min of color scale number range
-###### RangeMax - max of color scale number range
-###### Intervals - number of color scale segments
-###### HeightFont - height of font
-###### Position - Defines position for color scale labels
-############### 0 - NONE
-############### 1 - LEFT
-############### 2 - RIGHT
-############### 3 - CENTER
-###### X,Y - coordinates of color scale
-vcolorscale 10 20 100 16 2 0 0
+vcolorscale -range 10 20 100 -font 16 -textpos right -xy 0 0
puts "OCC21450"
puts "============"
puts ""
-###### vcolorscale: vcolorscale [RangeMin RangeMax Intervals HeightFont Position X Y]: draw color scale
-###### RangeMin - min of color scale number range
-###### RangeMax - max of color scale number range
-###### Intervals - number of color scale segments
-###### HeightFont - height of font
-###### Position - Defines position for color scale labels
-############### 0 - NONE
-############### 1 - LEFT
-############### 2 - RIGHT
-############### 3 - CENTER
-###### X,Y - coordinates of color scale
-vinit
-vcolorscale 10 20 100 16 2 0 0
+vinit View1
+vcolorscale -range 10 20 100 -font 16 -textpos right -xy 0 0
set only_screen 0
-
-
puts "============"
puts "OCC22819"
+puts "Redesign of OpenGl driver(Tests ColorScale)"
puts "============"
puts ""
-##################################################################
-# Redesign of OpenGl driver(Tests ColorScale)
-##################################################################
set BugNumber OCC22819
plane p 100 100 100 0 0 1 1 0 0
psphere result p 30
-vinit
+vinit View1
vdisplay result
vsetmaterial result SILVER
vsettransparency result 0.6
-vcolorscale
+vcolorscale -demo
vsetdispmode result 1
set square 11309.6
set only_screen 1
-
#######################################################################
box b 1 2 3
-vinit w=1024 h=512
+vinit View1 w=1024 h=512
vsetdispmode 1
vdisplay b
vfit
-vcolorscale 10 20 100 16 2 0 0
+vcolorscale -range 10 20 100 -font 16 -textpos right -xy 0 0
vmoveto 512 250
set only_screen 1
--- /dev/null
+puts "============"
+puts "OCC25136"
+puts "Display customized colorscale."
+puts "============"
+puts ""
+
+vinit View1
+vclear
+vaxo
+
+# create default color scale
+vcolorscale -demo
+vdump ${imagedir}/${casename}_1.png
+
+# reduce color scale range and number of intervals
+vcolorscale -range 0 20 5
+vdump ${imagedir}/${casename}_2.png
+
+# set user-defined colors and labels for color scale
+vcolorscale -colors white 0 0 1 green 1 0 0 1 1 1 -labels start 1 2 3 4 end
+vdump ${imagedir}/${casename}_3.png
+
+# change colors of first and last intervals
+vcolorscale -color 0 0.42 0.35 0.8
+vcolorscale -color 4 pink
+
+# change last label
+vcolorscale -label 5 "last"
+
+# set a title for color scale
+vcolorscale -title "My color scale"
+vdump ${imagedir}/${casename}_4.png