def keyboard( *args ): global gT (key, x, y) = args if key == 27: sys.exit(0) elif key == 'm': VisusXMLInterface().write("restart.xml", gRoot) elif key == 's': camera = VisusCamera() gRoot.getValue(camera) camera.save("camera.txt") elif key == 'l': gT = 0 camera = VisusCamera() camera.load("camera.txt") gRoot.setValue(camera) elif key == 'i': camera1 = VisusCamera() camera1.load("origin.txt") camera2 = VisusCamera() camera2.load("camera.txt") gT += 0.1 camera = VisusCamera.interpolate(camera1,camera2,gT) gRoot.setValue(camera) elif key == 'x': sys.exit(0) glutPostRedisplay() return
def keyboard(*args): global gCurrent, gFocus, gValues import sys (key, x, y) = args if key == 27 or key == 'x': sys.exit(0) elif key == 'm': VisusXMLInterface().write("restart.xml", gRoot) elif key == '+': if gFocus is not None: iso_value = VisusIsoValue() gFocus.getValue(iso_value) iso_value.data(iso_value.data() * 1.1) gFocus.setValue(iso_value) updateIso(iso_value) glutPostRedisplay() elif key == '-': if gFocus is not None: iso_value = VisusIsoValue() gFocus.getValue(iso_value) iso_value.data(iso_value.data() / 1.1) gFocus.setValue(iso_value) updateIso(iso_value) glutPostRedisplay() return
def keyboard( *args ): import sys (key, x, y) = args if key == 27: sys.exit(0) elif key == 'x': sys.exit(0) elif key == 'm': VisusXMLInterface().write("restart.xml", gRoot) return
def keyboard( *args ): global gColorMap,gColorMaps import sys (key, x, y) = args if key == 27: sys.exit(0) elif key == 'x': sys.exit(0) elif key == 'm': VisusXMLInterface().write("restart.xml", gRoot) glutPostRedisplay() return
def keyboard(*args): global gCurrent, gFocus, gValues import sys (key, x, y) = args if key == 27 or key == 'x': sys.exit(0) elif key == 'm': VisusXMLInterface().write("restart.xml", gRoot) elif key == 't': gCurrent += 1 gCurrent %= len(gValues) gFocus = gValues[gCurrent] print "Focusing on ", gFocus return
def keyboard(*args): global gColorMap, gColorMaps import sys (key, x, y) = args if key == 27: sys.exit(0) elif key == 'x': sys.exit(0) elif key == 'm': VisusXMLInterface().write("restart.xml", gRoot) elif key == 'n': name = gColorMaps.keys()[gColorMap] map = gColorMaps[name] print "Change to color map... ", name gFocus.setValue(map) gColorMap += 1 gColorMap %= len(gColorMaps) glutPostRedisplay() return
def keyboard(*args): global gColorMap, gColorMaps, gFocus, gRoot import sys (key, x, y) = args if key == 27: sys.exit(0) elif key == 'x': sys.exit(0) elif key == 'm': VisusXMLInterface().write("restart.xml", gRoot) elif key == 'n': if gFocus.nrOfChildren() > 0: gFocus = gFocus.child(0) print "Switching to first child of focus type(", gFocus.nodeType( ), ")" else: print "Switching to root of scene graph" gFocus = gRoot elif key == '+': value = VisusIsoValue() gFocus.getValue(value) value.data(value.data() * 1.1) gFocus.setValue(value) print "Iso-Value updated to ", value.data( ), " you won't see update in label since generic interface does not know of label" elif key == '-': value = VisusIsoValue() gFocus.getValue(value) value.data(value.data() / 1.1) gFocus.setValue(value) print "Iso-Value updated to ", value.data( ), " you won't see update in label since generic interface does not know of label" glutPostRedisplay() return
if __name__ == "__main__": import sys newArgv = glutInit(sys.argv) glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_MULTISAMPLE) glutInitWindowSize(winWidth, winHeight) glutInitWindowPosition(200, 200) window = glutCreateWindow("ViSUS Load XML Test") glutDisplayFunc(display) glutReshapeFunc(reshape) glutMouseFunc(mouse) glutKeyboardFunc(keyboard) glutMotionFunc(motion) glutIdleFunc(idle) initDisplay() filename = "restart.xml" if len(newArgv) > 1: filename = newArgv[1] # Create the default scene graph gRoot = VisusXMLInterface().read(filename) gFocus = gRoot # Run The Main glutMainLoop()