1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00
occt/tests/bugs/vis/bug25136
kgv 4b3d6eb1d2 0028004: Visualization, AIS_ColorScale - allow defining labels list not equal to intervals list
Cosmetics, code clean up.

AIS_ColorScale now draw labels using Graphic3d_VTA_CENTER
vertical alignment flag, instead of incorrect own alignment logic.
The color bar now adds margin on the top simmetrical to the bottom.

AIS_ColorScale::SetSmoothTransition() - added new property
for displaying colorscale with smooth transition between color intervals.

AIS_ColorScale::SetHueRange() - added new property defining the hue angles
corresponding to minimal and maximum values on the color scale.

AIS_ColorScale::SetLabels() now allows setting the sequence of free labels,
which number does not match the number of intervals.
In this case the labels will be displayed at positions of virtual
intervals corresponding to the number of labels.
2016-12-22 12:39:35 +03:00

31 lines
1.4 KiB
Plaintext

puts "============"
puts "OCC25136"
puts "Display customized colorscale."
puts "============"
puts ""
vclear
vinit View1
vaxo
# create default color scale
vcolorscale cs1 -demo -xy 0 0
foreach {y aColor} {20 RED 60 DARKORANGE1 100 GOLD 140 GREENYELLOW 180 CHARTREUSE2 220 GREEN 250 MEDIUMSPRINGGREEN 290 CYAN1 330 DODGERBLUE1 370 BLUE1} { if { [vreadpixel 15 $y rgb name] != "$aColor" } { puts "Error: wrong color at $y" } }
# reduce color scale range and number of intervals
vcolorscale cs2 -range 0 20 5 -xy 60 0
foreach {y aColor} {40 RED 120 YELLOW 200 GREEN 280 CYAN2 350 BLUE1} { if { [vreadpixel 75 $y rgb name] != "$aColor" } { puts "Error: wrong color at $y" } }
# set user-defined colors and labels for color scale
vcolorscale cs3 -range 0 20 5 -colors white 0 0 1 green 1 0 0 1 1 1 -labels start 1 2 3 4 end -xy 120 0
foreach {y aColor} {40 WHITE 120 RED 200 GREEN 280 BLUE1 350 WHITE} { if { [vreadpixel 135 $y rgb name] != "$aColor" } { puts "Error: wrong color at $y" } }
# change colors of first and last intervals
vcolorscale cs4 -range 0 20 5 -colors white 0 0 1 green 1 0 0 1 1 1 -labels start 1 2 3 4 end -xy 200 0
vcolorscale cs4 -color 1 0.42 0.35 0.8
vcolorscale cs4 -color 5 pink
vcolorscale cs4 -label 6 "last"
vcolorscale cs4 -title "My color scale"
foreach {y aColor} {60 PINK 120 RED 200 GREEN 280 BLUE1 350 SLATEBLUE} { if { [vreadpixel 215 $y rgb name] != "$aColor" } { puts "Error: wrong color at $y" } }
vdump ${imagedir}/${casename}.png