[OpenMap Users] Submission for MIF Package

From: Simon Bowen <sbowen_at_gammaprojects.com>
Date: Tue, 24 Aug 2004 11:53:43 +0100

Heard that you were integrating for next version of OpenMap, I have made
some more changed to the mif package, the changes were made to address
specific memory and performance issues that I was having with my
This submission may not be for everyone as I have taken some fairly radical
approaches to improve memory and performance, please chop and change this as
you please for submission. I have fully tested this with OpenMap 4.5 (That's
what I'm currently using), I have run a quick test of the package against
OpenMap 4.6 and it seems to work OK, however Don you may want to make some
There are still some issues with the code (see below), I was going to hold
off submission until they were fixed, but as it's integration time, and I
have been getting personal emails for people regarding the mif package I
thought I would get it out now. The problems I've listed below are not that
major, they do not really have an impact for my application, using large mif
files in WGS84 around Europe.
Changes Made
Created new Graphic objects for MIF Graphics, these graphic objects use the
java2d api directly and bypass the OMGraphics, I have done this to save on
memory and improve rendering speed. The downside to this is that once the
graphics are rendered to the buffer you can no longer interact with them as
you would be able to with an OMGraphics object.
Implemented some cache for AWT Colours, the previous version would make a
new colour object every time it needed one, so you could end up with say
1000 copies of a particular colour in memory at anyone time, the AWTCache
eliminates this so that only 1 instance of any given color will be in memory
at anyone time.
For performance of reading the MIF data, I have implemented a mechanism in
the MIFLoader, when a MIF file is loaded for the first time the MIF data is
parsed and all the appropriate graphic objects are attached to the MIF
Layer, these objects are then serialized to disk in the same directory as
the original mif file, a CheckSum of the original MIF file is also
serialized. Subsequent attempts to load the MIF file will check for the
existence of the serialized version of the MIF file, ensure the CheckSum
still matches the original MIF data file, if so the serialized MIF layer is
then unserialized and used, if the CheckSum does not match the serialized
object is deleted and recreated from the MIF file.
For performance of rendering the MIF Layer, the graphics get rendered to an
offscreen buffer, that get blitted to the screen when ready, the paint
method will just keep blitting the buffer every time paint(Graphics) is
called, when a reprojection occurs the Buffer is cleared down and
regerenated. I have put this in place as paint method was getting called
many times even though the projection hadn't changed, just blitting the
buffer every time gives a significant improvement when moving windows
around, turning layers on/off etc..
Rendering of Region borders fixed so that the appear as they do in MapInfo
Note that there is a file com.bbn.openmap.CheckSum, this is some code from
Sun that I have modified, Don you should move this to what ever package you
think is appropriate.
There are still some issues with this code however:-
1. Looks like there is a issue projecting or rendering points that intersect
the -180/+180 line (Maybe some one can fix this, I can provide test data if
2. The MIFLoader parser does not fully comply with the MapInfo MIF
specification, however it will work for 99% of files
3. There is a problem in the Coordinate System header validation in the
MIFLoader class, where it can wrongly mistake an invalid coordinate system
as being valid
4. There is a bug in some version of JDK 1.4.1 where if the JVM (on Windows)
does not have read permission for a file, any attempt to open it as a stream
will result in the file being deleted (Yes, I know this is quite odd). See
<http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4804606> . I recommend
using JDK 1.4.2, however it will still work ok with 1.4.1 unless you have
certain permissions on your data files.
5. There may be some other issues that I have missed, please fix and mail
them to the community, or let me know about them and I will fix them when I
have time.
I am open to anyone who has any questions regarding this, I will try to
answer all your questions as soon as I can, don't be surprised if it takes
me a few days to reply as I'm very busy at the moment!
Happy MIF'ing!

[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Aug 24 2004 - 07:12:28 EDT

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