1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0028954: Visualization - implement interactive object for camera manipulations

This commit is contained in:
aba
2017-09-08 19:03:18 +03:00
committed by snn
parent d1211c59c5
commit 15e59662ee
7 changed files with 3349 additions and 0 deletions

2076
src/AIS/AIS_ViewCube.cxx Normal file

File diff suppressed because it is too large Load Diff

1044
src/AIS/AIS_ViewCube.hxx Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -181,3 +181,5 @@ AIS_TypeOfAxis.hxx
AIS_TypeOfDist.hxx
AIS_TypeOfIso.hxx
AIS_TypeOfPlane.hxx
AIS_ViewCube.hxx
AIS_ViewCube.cxx

View File

@@ -0,0 +1,64 @@
puts "=================================="
puts "AIS_ViewCube - display and erase with default settings"
puts "=================================="
set anImage1 $imagedir/${casename}_1.png
set anImage2 $imagedir/${casename}_2.png
set anImage3 $imagedir/${casename}_3.png
set anImage4 $imagedir/${casename}_4.png
vclear
vclose ALL
vinit
# -------------------------------------
# create helper object
# -------------------------------------
box aBox1 15 20 70
vdisplay aBox1 -dispMode 1
vaxo
vfit
# -------------------------------------
# display view cube object
# -------------------------------------
vviewcube -enable -size 70 -adaptsize -position 120 250
vmoveto 118 230
if {[vreadpixel 118 230 name] != "DARKTURQUOISE 1"} {
puts "ERROR: Highlighting of view cube side is wrong."
}
vmoveto 0 0
vdump $anImage1
# -------------------------------------
# Check side
# -------------------------------------
vselect 125 200
if {[vreadpixel 115 233 name] != "GRAY95 1"} {
puts "ERROR: Display of view cube is wrong."
}
if {[vreadpixel 190 136 name] != "IVORY 1"} {
puts "ERROR: Position of TOP camera is wrong."
}
vdump $anImage2
# -------------------------------------
# Check edge
# -------------------------------------
vselect 163 242
if {[vreadpixel 141 234 name] != "GRAY76 1"} {
puts "ERROR: Position of TOP-RIGHT camera is wrong."
}
vdump $anImage3
# -------------------------------------
# Check vertex
# -------------------------------------
vselect 121 213
if {[vreadpixel 120 250 name] != "GRAY95 1"} {
puts "ERROR: Position of TOP-RIGHT-BACK camera is wrong."
}
vdump $anImage4
vviewcube -remove
vclear

46
tests/v3d/viewcube/move Normal file
View File

@@ -0,0 +1,46 @@
puts "=================================="
puts "AIS_ViewCube - check positioning of View Cube"
puts "=================================="
set anImage1 $imagedir/${casename}_1.png
set anImage2 $imagedir/${casename}_2.png
set anImage3 $imagedir/${casename}_3.png
set anImage4 $imagedir/${casename}_4.png
vclear
vclose ALL
vinit
# -------------------------------------
# display view cube object
# -------------------------------------
vviewcube -enable -size 70 -adaptsize
# -------------------------------------
# check positioning of view cube object
# -------------------------------------
if {[vreadpixel 96 285 name] != "GRAY68 1"} {
puts "ERROR: Bottom left View Cube fails."
}
vdump $anImage1
vviewcube -position 200 200
if {[vreadpixel 200 176 name] != "GRAY68 1"} {
puts "ERROR: Center View Cube fails."
}
vdump $anImage2
vviewcube -position 310 100
if {[vreadpixel 310 73 name] != "GRAY68 1"} {
puts "ERROR: Top right View Cube fails."
}
vdump $anImage3
vviewcube -position 140 240
if {[vreadpixel 140 217 name] != "GRAY68 1"} {
puts "ERROR: Custom View Cube fails."
}
vdump $anImage4
vviewcube -remove
vclear

33
tests/v3d/viewcube/part Normal file
View File

@@ -0,0 +1,33 @@
puts "====================================="
puts "AIS_ViewCube - test custom appearance"
puts "====================================="
set anImage1 $imagedir/${casename}_1.png
set anImage2 $imagedir/${casename}_2.png
set anImage3 $imagedir/${casename}_3.png
vclear
vclose ALL
vinit
vviewcube -enable -hideedges
if {[vreadpixel 186 236 name] != "BLACK 1"} {
puts "ERROR: Invalid display of View Cube without edges."
}
vdump $anImage1
vviewcube -showedges -hidevertices
if {[vreadpixel 150 258 name] != "BLACK 0"} {
puts "ERROR: Invalid display of View Cube without vertices."
}
vdump $anImage2
vviewcube -hideedges -hidevertices
if {[vreadpixel 186 236 name] != "BLACK 1" || [vreadpixel 150 258 name] != "BLACK 0"} {
puts "ERROR: Invalid display of View Cube without edges & vertices."
}
vdump $anImage3
vviewcube -remove
vclear

84
tests/v3d/viewcube/style Normal file
View File

@@ -0,0 +1,84 @@
puts "=================================="
puts "AIS_ViewCube - display custom styled View Cube"
puts "=================================="
set anImage1 $imagedir/${casename}_1.png
set anImage2 $imagedir/${casename}_2.png
set anImage3 $imagedir/${casename}_3.png
set anImage4 $imagedir/${casename}_4.png
set anImage5 $imagedir/${casename}_5.png
set anImage6 $imagedir/${casename}_6.png
set anImage7 $imagedir/${casename}_7.png
vclear
vclose ALL
vinit
# -------------------------------------
# Color
# -------------------------------------
vviewcube -enable -boxcolor 0.69 0.88 1 -arrowcolor 0 0.4 0.54 -textcolor 0 0.4 0.54
if {[vreadpixel 118 273 name] != "LIGHTSLATEGRAY 1" || [vreadpixel 270 260 name] != "GRAY15 0.24705882352941178"} {
puts "ERROR: Errors in changing View Cube colors."
}
vdump $anImage1
# -------------------------------------
# Transparency
# -------------------------------------
vviewcube -reset
vviewcube -transparency 0.5
if {[vreadpixel 118 273 name] != "GRAY17 0.37254901960784315" || [vreadpixel 270 260 name] != "GRAY48 0.24705882352941178"} {
puts "ERROR: Errors in changing View Cube common transparency."
}
vdump $anImage2
vviewcube -reset
vviewcube -boxtransparency 0.4 -arrowtransparency 0.2
if {[vreadpixel 118 273 name] != "GRAY16 0.50588235294117645" || [vreadpixel 270 260 name] != "GRAY76 0.63921568627450975"} {
puts "ERROR: Errors in changing View Cube separate transparency."
}
vdump $anImage3
# -------------------------------------
# Arrows
# -------------------------------------
vviewcube -reset
vviewcube -arrowangle 30 -arrowlength 30
if {[vreadpixel 270 268 name] != "BLACK 0" || [vreadpixel 291 259 name] != "GRAY48 0.24705882352941178"} {
puts "ERROR: Errors in changing View Cube arrow style."
}
vdump $anImage4
# -------------------------------------
# Font
# -------------------------------------
vviewcube -reset
vviewcube -font "Impact" -fontheight 16
if {[vreadpixel 151 198 name] != "BLACK 1" || [vreadpixel 168 391 name] != "RED 1"} {
puts "ERROR: Errors in changing View Cube font."
}
vdump $anImage5
# -------------------------------------
# Padding
# -------------------------------------
vviewcube -reset
vviewcube -boxpadding 10 -axispadding 20 -arrowpadding 10
if {[vreadpixel 71 263 name] != "BLACK 0" || [vreadpixel 37 266 name] != "BLUE2 1"} {
puts "ERROR: Errors in changing View Cube padding."
}
vdump $anImage6
# -------------------------------------
# Corner radius
# -------------------------------------
vviewcube -reset
vviewcube -cornerradius 0.2
vdump $anImage7
vviewcube -remove
vclear