Hi
I have a requirement to produce hardcopy charts from a visad
application.
Due to the complexity of the data, the charts will likely be on A1 paper at
a resolution way beyond what is possible using a simple raster based screen
dump of a visad display. The only solution is to plot the components of the
display via a vector based printing system such as postscript or CGM.
First of all, has anybody else done this already? I'd hate to reinvent
the
weel.
If not, I have worked out a simple prototype of a system of doing this
which appears to work. It goes as follows:
Prepare your data as normal and visualise using a DisplayImplJ3D.
When the chart is ready to plot, create a DisplayImplJ2D off-screen.
Use getMapVector() method of DisplayImplJ3D to get all the ScalarMaps
used
in the on-screen display
Clone each of these ScalarMaps and add them to the off-screen display
Use getRenderers() method of DisplayImplJ3D to get the DataRenderers
from
the on-screen display
From each of the DataRenderers, use getLink().getData() to get the data
rendered on-screen
Create a DataReferenceImpl for each of these data items, and add to the
off-screen display
Tweak the off-screen ScalarMaps and Controls so that they have suitable
scales for an A1 image (or A4, etc)
Get the DisplayRendererJ2D from the off-screen display using
getDisplayRenderer()
Get the root VisADGroup from the display renderer using getRoot()
Recursively parse this group to access its VisADAppearance children
From these, extract the VisADGeometryArray objects and plot them to a
postscript file, PDF file, etc
Send the postscript file, PDF file, etc to the A1 printer
Does anybody have any comments on this way of printing? I have tested it
with some success, but before I invest more time in implementing it I would
be interested to know if anybody has any better ideas.
Thanks,
Rob