Re: [OpenMap Users] Serializing OMGraphics

From: David Ward <>
Date: Sun, 10 Apr 2005 13:10:45 -0700

Don, Piotr;

1. I've been successful in serializing OmGraphics using Java serialization
to an ObjectStream and also serializing to XML.

2. I had to make a modification to OMGraphic so that it would serialize the
transient "stroke" membe.. Implementing custom serialization of "stroke"
corrected the "stroke" serialization problem for all OMGraphic subclasses.

3. OMSpline needed the natCubic and natCubicClosed transients to be
instantiate upon deserialization.

4. OMText needed custom serialization/deserialization of the "font" member
to preserve the font characteristics.

5. After serialization of the OMGraphic (and subclasses) was working with
Java serialization I used Joe Walnes's XStream
( to serialize to/from XML. XStream work very
well as it requires no additional coding beyond the standard Java
serialization conventions.

6. In our system we store the user's graphics on an http server which might
be accessed via a restricted bandwidth pipe. So, we compress the XML stream
with GZIPOutputStream to reduce bandwidth consumption.



David J. Ward

>From: Piotr Kamiński <>
>To: David Ward <>
>Subject: Re: [OpenMap Users] Serializing OMGraphics
>Date: Sun, 10 Apr 2005 11:54:10 +0200
>Hi David,
>I had the same problem when I tried to store OMGraphic created in
>DrawingTool into file on disk. (User wanted to store his drawings and load
>them later, just like in regular drawing program.) Serialization didn't
>work for all OMGraphic classes. I modified some of them and it helped a
>little. I've submitted my changes to openmap-users list
>But after any change in OMGraphic classes (new field, method, etc.)
>my stored files could not be loaded any more - this is due to default
>serialization feature - serial id.
>In my opinion OMGraphic *should* serialize properly and problems you wrote
>about should be fixed. Here Don is a person which decide what to do with
>I don't know what exactly mean 'later' in your case. If it is short time
>and you are not planning to permanently store created graphics, simple
>serialization should work for you.
>If you want to store your graphics for longer time (just as I wanted) I
>would recommend using Java 1.4 XML storing mechanism. I will send you
>another letter which contains some code which might help you. This is a
>library which I used to store OMGraphic now instead of simple
>Hope this helps,
>Piotr Kaminski
>David Ward napisał(a):
>>I'm trying to preserve OMGraphics by serializing them to a stream which is
>>stored on a server and later retrieved.
>>It appears that the OMGraphics don't serialize all of their members
>>necessary to properly reconstitute the graphic. Specifically the stroke
>>is not serialized with the OMGraphic because stroke is declared as
>>Is there a technique to fully serialize the OMGraphics?
>>David J. Ward
>>>From: "Ellwein, Brent A" <>
>>>Subject: [OpenMap Users] Minimum zoom
>>>Date: Wed, 6 Apr 2005 11:18:28 -0600
>>>It seems like there is only so far that OpenMap will allow me to zoom
>>>out. After some cutoff point (which I haven't exactly determined yet)
>>>why can I not make the map any smaller? Maybe I'm doing something
>>[To unsubscribe to this list send an email to ""
>>with the following text in the BODY of the message "unsubscribe
>[To unsubscribe to this list send an email to ""
>with the following text in the BODY of the message "unsubscribe

[To unsubscribe to this list send an email to ""
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Sun Apr 10 2005 - 16:13:06 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:06 EDT