DATASOURCE attribute
The DATASOURCE attribute allows the WebXpresso plugin to request a textual
data stream that will be interpreted by the plugin instance as graphical
animation commands. These commands are primarily used to modify attributes
of the graphical object hierarchy.
The value of the DATASOURCE attribute is a URL. This allows animation data
to be acquired from any internet resource, whether it be a file, a remote
server, or a program. It is possible to embed the animation data in an
html document; the WebXpesso parser will ignore the html tags.
A typical DATASOURCE stream is shown below. This is a segment from the
file that updates the graphs demo on the samples page.
set_value $1/DataGroup/EntryPoint d 0.2
set_value $1/DataGroup/EntryPoint d 0.2
set_value $1/DataGroup/EntryPoint d 1.0
set_value $1/DataGroup/EntryPoint d 0.5
set_value $1/DataGroup/EntryPoint d 0.8
set_value $1/DataGroup/EntryPoint d 0.4
update
end
Standard commands
The set_value command is used to set the value of
a graphical objects resources or attributes. This command takes
three parameters:
- The resource to modify
- The type of the resource
- The new value for the resource
In this example, the object being updated is the graph named $1.
This being a typical
DV-Xpresso graph, it has an EntryPoint resource that is used
to add the next data iteration to the graph. The "d" indicates
the type of this resource. Allowed types are:
- d: single float
- g: triple float (used for points in 3D space and for RGB colors)
- s: to set a string resource
The update command tells the plugin instance that the user
wants to drawing to be redrawn with the new resources that
have previously been set using set_value.
The end command just marks the end of the animation commands.
Alias commands
In addition, there are commands to
numeric aliases for the resource strings. Resource strings can be
quite long for a deep object hierarchy. The aliases help conserve
network bandwith by allowing numbers to be substituted for these
strings in commands. This is demonstrated below in a sample form
the cgi program that updates the satellite drawing demo.
alias viewport/satellite/MoveCenter g 0
alias viewport/satellite/RotateAngle d 1
d 0 g 0.000000 700.000000 0.000000
set viewport/satellite/SideAngle d -21.250506
d 1 d 0.000000
u
d 0 g 0.000000 698.618710 43.953364
d 1 d 3.600000
u
d 0 g 0.000000 694.480291 87.733263
d 1 d 7.200000
u
d 0 g 0.000000 687.601076 131.166920
d 1 d 10.800000
u
The alias command takes three resouces. The first and second are
the resource name and type. The third is an integer value that will
be used to represent the resource string in the "direct" command.
The direct command takes the same parameters as the set_value
command except that the integer alias replaces the resource string.
Notice also from this example that commands can be abbreviated
to further compact the animation streams from the server.
Remote commands
Plugin instances can communicate update commands between themselves
using the "remote" version of the normal commands. This was introduced
to work in conjunction with the DATASINK command. The remote versions of the
commands are the same as those described above, except that the command
name begins with an "r" (ex: rset_value, rupdate). A plugin instance
may send user input data back to the server (using the DATASINK attribute).
A cgi on the server may interpret this user input and wish to update
a different plugin instance on the client. For instance, consider the
following cgi output from the UNIX procdemo sample.
rset_value proc:v13 d 55.0
rupdate proc
The user had clicked on an analog input object in one plugin
that has been set up to cause the update of a tank named "v13"
in the plugin instance named "proc".