Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Michael Migliore
VTK
Commits
b44f0b7d
Commit
b44f0b7d
authored
Jul 04, 2017
by
Utkarsh Ayachit
⛰
Browse files
Adding test for vtkInteractorStyleRubberBandZoom
Tests various new modes added to vtkInteractorStyleRubberBandZoom.
parent
60fbfb24
Changes
7
Hide whitespace changes
Inline
Side-by-side
Interaction/Style/Testing/Data/Baseline/TestStyleRubberBandZoomPerspective-CenterAtStartPosition.png.md5
0 → 100644
View file @
b44f0b7d
6c5ac5ef623a2c419cc0350c0df1ce46
Interaction/Style/Testing/Data/Baseline/TestStyleRubberBandZoomPerspective-CenterAtStartPositionAndLockAspect.png.md5
0 → 100644
View file @
b44f0b7d
6c5ac5ef623a2c419cc0350c0df1ce46
Interaction/Style/Testing/Data/Baseline/TestStyleRubberBandZoomPerspective-Default.png.md5
0 → 100644
View file @
b44f0b7d
1f82dcbd1215d23f9203a9c0e6e41d6c
Interaction/Style/Testing/Data/Baseline/TestStyleRubberBandZoomPerspective-LockAspect.png.md5
0 → 100644
View file @
b44f0b7d
2f6bf18b92e6f6d213d603a751a971dc
Interaction/Style/Testing/Data/Baseline/TestStyleRubberBandZoomPerspective-ParaViewWay.png.md5
0 → 100644
View file @
b44f0b7d
f67f2f01af729a28f5a7d100e7d86808
Interaction/Style/Testing/Python/CMakeLists.txt
View file @
b44f0b7d
...
...
@@ -2,6 +2,7 @@ if(NOT VTK_OPENGL_HAS_OSMESA AND NOT VTK_USE_OFFSCREEN_EGL)
vtk_add_test_python
(
TestFlyTo.py
TestStyleRubberBandZoom.py
TestStyleRubberBandZoomPerspective.py,NO_RT
TestInteractorStyleTerrain.py
TestStyleBaseSpike.py,NO_RT
TestStyleJoystickActor.py,NO_RT
...
...
Interaction/Style/Testing/Python/TestStyleRubberBandZoomPerspective.py
0 → 100755
View file @
b44f0b7d
#!/usr/bin/env python
from
__future__
import
print_function
import
vtk
import
vtk.test.Testing
class
TestStyleRubberBandZoomPerspective
(
vtk
.
test
.
Testing
.
vtkTest
):
def
initPipeline
(
self
):
try
:
if
self
.
pipelineInitialized
:
# default state
self
.
style
.
LockAspectToViewportOff
()
self
.
style
.
CenterAtStartPositionOff
()
self
.
style
.
UseDollyForPerspectiveProjectionOn
()
# reset camera too
self
.
renderer
.
ResetCamera
()
self
.
renderWindow
.
Render
()
except
AttributeError
:
pass
self
.
pipelineInitialized
=
True
self
.
sphere
=
vtk
.
vtkSphereSource
()
self
.
idFilter
=
vtk
.
vtkIdFilter
()
self
.
mapper
=
vtk
.
vtkPolyDataMapper
()
self
.
actor
=
vtk
.
vtkActor
()
self
.
idFilter
.
PointIdsOff
()
self
.
idFilter
.
CellIdsOn
()
self
.
idFilter
.
SetInputConnection
(
self
.
sphere
.
GetOutputPort
())
self
.
mapper
.
SetInputConnection
(
self
.
idFilter
.
GetOutputPort
())
self
.
mapper
.
SetColorModeToMapScalars
()
self
.
mapper
.
SetScalarModeToUseCellFieldData
()
self
.
mapper
.
SelectColorArray
(
"vtkIdFilter_Ids"
)
self
.
mapper
.
UseLookupTableScalarRangeOff
()
self
.
mapper
.
SetScalarRange
(
0
,
95
)
self
.
actor
.
SetMapper
(
self
.
mapper
)
self
.
renderer
=
vtk
.
vtkRenderer
()
self
.
renderer
.
AddActor
(
self
.
actor
)
self
.
renderWindow
=
vtk
.
vtkRenderWindow
()
self
.
renderWindow
.
AddRenderer
(
self
.
renderer
)
self
.
iren
=
vtk
.
vtkRenderWindowInteractor
()
self
.
iren
.
SetRenderWindow
(
self
.
renderWindow
)
self
.
style
=
vtk
.
vtkInteractorStyleRubberBandZoom
()
self
.
iren
.
SetInteractorStyle
(
self
.
style
)
self
.
renderer
.
GetActiveCamera
().
SetPosition
(
0
,
0
,
-
1
)
self
.
renderer
.
ResetCamera
()
self
.
renderWindow
.
Render
()
def
interact
(
self
):
self
.
iren
.
SetEventInformationFlipY
(
150
,
150
,
0
,
0
,
"0"
,
0
,
"0"
)
self
.
iren
.
InvokeEvent
(
"LeftButtonPressEvent"
)
self
.
iren
.
SetEventInformationFlipY
(
192
,
182
,
0
,
0
,
"0"
,
0
,
"0"
)
self
.
iren
.
InvokeEvent
(
"MouseMoveEvent"
)
self
.
iren
.
InvokeEvent
(
"LeftButtonReleaseEvent"
)
def
compare
(
self
,
suffix
):
img_file
=
"TestStyleRubberBandZoomPerspective-%s.png"
%
suffix
vtk
.
test
.
Testing
.
compareImage
(
self
.
renderWindow
,
vtk
.
test
.
Testing
.
getAbsImagePath
(
img_file
),
threshold
=
25
)
vtk
.
test
.
Testing
.
interact
()
def
testDefault
(
self
):
print
(
"testDefault"
)
self
.
initPipeline
()
self
.
interact
()
self
.
compare
(
"Default"
)
def
testLockAspect
(
self
):
print
(
"testLockAspect"
)
self
.
initPipeline
()
self
.
style
.
LockAspectToViewportOn
()
self
.
interact
()
self
.
compare
(
"LockAspect"
)
def
testCenterAtStartPosition
(
self
):
print
(
"testCenterAtStartPosition"
)
self
.
initPipeline
()
self
.
style
.
CenterAtStartPositionOn
()
self
.
interact
()
self
.
compare
(
"CenterAtStartPosition"
)
def
testCenterAtStartPositionAndLockAspect
(
self
):
print
(
"testCenterAtStartPositionAndLockAspect"
)
self
.
initPipeline
()
self
.
style
.
CenterAtStartPositionOn
()
self
.
style
.
LockAspectToViewportOn
()
self
.
interact
()
self
.
compare
(
"CenterAtStartPositionAndLockAspect"
)
def
testParaViewWay
(
self
):
print
(
"testParaViewWay"
)
self
.
initPipeline
()
self
.
style
.
CenterAtStartPositionOn
()
self
.
style
.
LockAspectToViewportOn
()
self
.
style
.
UseDollyForPerspectiveProjectionOff
()
self
.
interact
()
self
.
compare
(
"ParaViewWay"
)
if
__name__
==
"__main__"
:
vtk
.
test
.
Testing
.
main
([(
TestStyleRubberBandZoomPerspective
,
'test'
)])
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment