Keywords: SVG-Tiny, SVG Viewer, Open Source, PersonalJava
Tobias Dahinden (b. 1973) studied geodesy. Currently he's a PHD student at the Institute of Cartography of the Swiss Federal Institute of Technology. He is working with SVG since spring 2000. He was part of the organization committee of the 1st SVGopen conference. He coaches students in works concerning SVG. Since 2004 he's main-developer of the IKA-SVG-Viewer (an open source SVG-Viewer based on PersonalJava).
Last year we introduced JNSS [Dahinden, 2003] , a Java based Navigation Software System. A part of this system is a client that has an SVG-Viewer. During the last year we made some improvements to the system specially to the SVG-Viewer. We made the Viewer also available under a Opensource License.
Introduction - a brief review
Text and Fonts
Graphical User Interface
Missing things, Outlook
Where and how to use the IKA-SVG-Viewer
In 2002 Andrea Terribilini programmed a Navigation System. The system has a client-server architecture. Where the current position of a receiver is provided by a http or udp server. A client can request the server. The answer of the server is an XML-String with the position and some metadata. [Dahinden, 2003]
One client of the system contains an SVG-Viewer. The idea of the client is to show the current position on a map. Because the system should run on PersonalJava also the Viewer has to run on PersonalJava. Its obvious that it is possible to make the Viewer availabe for displaying SVG without the navigation part. When we do this we get a SVG-Viewer based on PersonalJava. We call this Viewer "IKA-SVG-Viewer" (that's to the same as the "Alternative SVG-Viewer at IKA" [Baer, 2004] which is a full SVG Viewer)
When we got the source of the Viewer last year we remarked that the Viewer is far away from fulfilling a current SVG-Profile. It didn't show bezier-curves, polylines, polygons, ... It was also necessary to set always one whitespace between coordinates. So we decided to improve the Viewer and to fulfill at least SVG-Tiny.
During the last year the code size of the viewer grew. The Tar-Gzipped size is now about 170 KB. Figure 1 shows the IDE with the main project of the viewer. Some of the improvements are described in the next subsections.
The viewer now supports basic shapes. We had to add path and polyline. It may be useful to know that PersonalJava does not implement Bezier-Curves. So we had to programm them ourself. We had also to implement routines that remove and add white space. With PersonalJava this was more complex than one might expect.
Another problem is that PersonalJava only draws Integer values. That means a value like 0.5 is rounded to 1, 0.4 is rounded to 0 and -0.5 is rounded to -1. To increase the quality of an image we scale every value by 10. With this it is possible to draw a value like 0.1 but this task is time consuming.
We also programmed the rendering of squares with rounded corners and as a more complex task we enable stroke width for shapes. We have to calculate several strokes to get a stroke larger than 1. Unfortunately the result is not very nice (see Figure 2 and compare with the rendering of squiggle Figure 3 ).
The only possibility we increased is the use of UTF-8 and ISO-8859-1 encoding. Text is shown rather correct. That's we didn't change a lot here.
We enabled ICC color-names and commands like "!important". The color-names ends in a long dictionary with rgb values. It is not very clear for us why color by names is a part of SVG-Tiny because it uses a lot of space and is rather seldom used. In our opinion it is not important to be able to create images with colorvalues like "lightslategray" or "springgreen" and "ghostwhite".
We also tried to implement fill-rule. But we were not sucessful until now. We were more sucessful with the line-cap attribute. There is also an implementation of "style" and "class". Style attributes that are described all alone (e.g. font="Helvetica") are not yet full implemented.
Currently we are working on the transformation attribute. But we were not yet able to solve the problem of rotation and skewing. These are options that are not directly supported by the Graphics library of PersonalJava.
Enities are implemented like a special character. We just remove the entity reference by the entity description. You also remark this when you have a look at the source editor of the viewer. This idea works as long as there are no & or XML-Code in the entity.
We made implementation of defs, switch, title, polyline and polygon. Now we have 16 Tags that are known by the viewer. These are rect, circle, ellipse, text, line, path, group, image, symbol, use, svg, polygon, polyline, defs, title, switch.
Still missing are tags like anchor, all kind of animate, glyphs.
The graphical user interface (GUI) is implemented for our test purposes. So you find a "file-open", a "reload", and a "URL-File-open and reload" button. Of course it would be more intuitive to use the same buttons for both tasks. But it was much easier to do this like we did. We expect that the GUI is the first thing that is changed if someone uses this viewer. So we did not spend much work in it. The GUI is just for debugging reasons.
There are several things that are not implemented yet. The most prominent are animations. This is because animations are used very seldom in cartography. (Usually they don't make a lot of sense.) Further we have to implement anchors and also dashed lines. To be continued...
Last year Chris Lilley asked if we would open the source of the Viewer. Because the viewer is not a commercial product we agreed. Yet it should be able to include the viewer in other applications like JNSS. And this applications should not be opensource. That's why we looked for a opensource license for libraries. On the other side we are very interested in keeping the source open. So we decided to use the Lesser GPL [GNU L-GPL, 1999] as license.
It is important that the viewer consists of four project. Only the main project has this license. The other projects are usually taken from somewhere else: e.g. our XML-Parser is NanoXML [NanoXML, 2001] with it's own license.
You can use the Viewer for your applications. It should work on every device with a JVM that is able to interpret Personal Java. These are devices like Sharp Zaurus as well as Personal Computer.
Precompiled binaries or source are available via our project main page [Dahinden, 2004] . But we recommend to ask the developers if you need a special version. As we already showed the GUI is programmed for debugging not for daily use. Of course you can change the source and combine it with other programmes.
XHTML rendition created by gcapaper Web Publisher v2.0, © 2001-3 Schema Software Inc.