ShapeViewer client commands
The ShapeViewer may be controlled by text commands (entered into it's BeanShell terminal window).
The set of defined commands, and their arguments, are defined in the table, below.
Thsese commands apply to ShapeViewer version: 1.1.0
| Command | Arguments | Description | Example | Notes |
| addShape | url [,"true"/"false"] | Url of a shape file, Whether it is grid ucf | addShape("http://loni.ucla.edu/~qma/shapeviewer/FFFclrd.obj") | You may have to type command "clearViewer()" first to remove all loaded shapes, and you may have to type "fitViewer()" to make it visible thereafter |
| addScene | url | Url of a scene file | addScene( "http://loni.ucla.edu/~qma/shapeviewer/sceneshapes/colormap.xml") | To first clear the display enter the command: "clearViewer()" |
| clearViewer | | | clearViewer() | to remove all loaded shapes |
| fitViewer | | | fitViewer() | Adjust the zoom to fit all currently displayed shapes into the view display. |
| rotX | a double value of angle in radians | | rotX(1.234) | Rotate view around X axis 1.234 Radians |
| rotY | a double value of angle in radians | | rotY(1.234) | Rotate view around Y axis 1.234 Radians |
| rotZ | a double value of angle in radians | | rotZ(1.234) | Rotate view around Z axis 1.234 Radians |
| transformChanged | an 16 elments float array or a String which has 16 elements of float delimited by space | | transformChanged(newval) | to set current view transformation as newval |
| transformChangeBy | an 16 elments float array or a String which has 16 elements of float delimited by space | | transformChangeBy(val) | Multiply current transform matrix (M) by a new matrix (N). The resulting current transform matrix will be NM. |
| setViewerProperty | String attribute , String value | see table of arguments below | setViewerProperty("background_color", "-1") | Sets display bacground to new color whose RGBA as int is -1, (Bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are blue). |
| setShapeProperty | String shapeId, String attribute, String value | see table of arguments below | setShapeProperty("1","visible", "true" | to make the shape whose id is "1" visible |
| escapeString | a text String | | str = escapeString(str) | name="shape viewer" => name=\"shape viewer\" |
Viewer Properties and Property Values
(set by command
setViewerProperty)
| String Property Name | String Property Values | Java Property name | Java Property value(s) | Note |
| "background_color", | "-12345" | ATTNAME.BACKGROUND_COLOR | Color.getRGB() | an int whose bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are blue. |
| "show_msg_pane", | "true" or "false" | ATTNAME.SHOW_MSG_PANEL | true or false | |
| "draw_mode" | 0 (lines) 1 (surface) 2 (shaded, filled surface) 3 (points) | ATTNAME.DRAW_MODE | Viewer.POINTS Viewer.LINESTRIP Viewer.SURFACE Viewer.SURFACE_FILL | |
| "transform" | "1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0" | ATTNAME.TRANSFORM | A 16 element space delimited transform column major array | Uses homogenous coordinates. Example string encodes the identity transform: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 |
| "rotation_transform" | "1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0" | ATTNAME.ROTATION_TRANSFORM | A 16 element space delimited transform column major array | Uses homogenous coordinates. Example string encodes the identity transform: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0. Only rotation components are changed. The scale and translation of client views are unaltered. |
| "draw_start_point" | "true" or "false" | ATTNAME.DRAW_START_POINT | true or false | |
| "draw_end_point" | "true" or "false" | ATTNAME.DRAW_END_POINT`` | true or false | |
| "light_direction" | "0.0 1.0 2.5" | ATTNAME_LIGHT_DIRECTION | 3 element space delimited vector | currently supporting 6 axis directions |
| "view_direction" | "0 0 1" | ATTNAME.VIEW_DIRECTION | 3 element space delimited vector | currently supporting 6 axis directions |
| "perspective_projection" | "true" or "false" | ATTNAME.PERSPECTIVE | true or false | |
| "standard_orientations" | "0 0 1" | ATTNAME.STD_ORIENTATIONS | 3 element space delimited vector | currently supporting 6 axis directions |
Shape Properties
(set by command
setShapeProperty)
*shapeId* is a String which identifies the shape whose properties will be set.
Shape properties and their allowed values are:
| String Property Name | String Property Values | Java Property name | Java Property value(s) | Note |
| "color", | "-12345" | ATTNAME.COLOR | Color.getRGB() | an int whose bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are blue. |
| "transform" | (see above table) | ATTNAME.TRANSFORM | A 16 element space delimited column major transform matrix | If the matrix does not contain 16 elements the local transformation will be reset. |
| "selected" | "" | ATTNAME.SELECTED | Empty or null String | property value parmeter is unused. |
| "visible" | "true" or "false" | ATTNAME.VISIBLE | true or false | |
| "normal_mode" | "0" (normals off ) "1" (Normals on) "2" (Normals reversed) | ATTNAME.NORMAL_MODE | IShape.NORMAL_OFF IShape.NORMAL.ON IShape.NORMAL_FLIP | |
| Others: literal value of attribute name, .eg. "ucfData0" | an XML format of color map | | colormap.toXML("") | You must escape double quotes (str = escapeString(str) or str = GUIUTIL.escapeString(str)) |
Updated: 15 January 2007