[OpenMap Users] OMDrawingTool and other questions

From: Piotr Kamiński <Piotr.Kaminski@ctm.gdynia.pl>
Date: Thu Jul 17 2003 - 05:11:36 EDT

Hello,

I'd like to discuss some questions:
1. how to save drawings made with OMDrawingTool to files
2. how to load drawings from files for further edition
3. JFrame vs JDialog for floating windows
4. DrawingTool enchancement

1. 2.

I'm using OpneMap in my application. One of user's reqirements
is: "Make drawings on map, store drawings in file on disk,
read drawing from file for further edition".

I can use OMDrawingTool for edition, OK. I can save drawings
as 'Shape' file but during that process all additional attributes
(color, line thickness, and so on) are lost. If I try to read
shape file I have to set up parameters, (colors,..) but it works
for whole layer not for particular objects. One DrawingLayer
is saved to two files .shp and .sxx making it harder for user to
maintain. And I can't make further edition of stored drawings!

As a quick (and ugly) solution for persistent storage
I choose serialization. We've made simple class which
takes OMGraphics list and stores it in file. Of course you can
read it too. (please see attached files GraphicEditExport and
GraphicEditImport). Unfortunatly durring serialization there was
error in class DrawingAttributes. This class uses BasicStroke
and BasicStrokeEditor which are not serializabe. I have to
changed two class fields to transient (see attached file DrawingAttributes).

In export method:
1. whole OMGraphicsList is stored to file
2. all Stoke objects are break to field and those field are stored to file

In import method:
1. whole OMGraphicsList is read from file
2. all Stoke objects are read from file and set in OMGraphics objects.

It works now. I can treat one GraphicEditLayer (similar to DrawingLayer)
as one vector picture which I can save, load and edit.
One drawback is that serialization depend on internal class structure.
If I change one field, binary format also changes and I can't read
files saved in old format! Solution: don't use default serialization,
instaed write own methods for each object to save and load it, and carefully
add new field to ensure backward compatibility with files with older format.
Other solution is to use standard file format (maybe SVG?) or develop
own OpenMap graphics file format (XML based maybe?). What do you think about
it?

3.
In my application main window is almost all time maximized on screen to
display as big map as it can. When I launch my own dialog windows I use
JDialog
and set parent as main JFrame. It guarantee that dialog window is allways
over
main frame. When I launch any OpenMap window (especially
OMDrawingToolLauncher)
and click anywhere on main frame this windows hides under main frame. It is
very frustrating to the user especially during edition of graphics.
Is there any simple method to lauch all windows as JDialog? Can
WindowSupport
be used to this? Now it uses JInternalFrame or JFrame. I'd like to see
JDialog
also possible to use. I wonder if any other OpenMap user find JFrame windows
uncomfortable to use?

4.
My user wants to use text in drawings. Standard OpenMap has OMText class but
not
EditableOMText. We made such class with other needed tools (OMTextLoader,
and so on).
It works almost good, but:
- create new text (using OMDrawingToolLauncher)
- change some attributes, text and it changes immediately on map
- finish editing
- choose gestures mouse mode
- select drawn text (window should appear on screen)
- change colour and it changes immediately
- BUT change text and it doesn't change!
- MOVE text on map and after that you can change all parameters and
  changes appears immediately again

The same situaltion is with polyline:
- draw open polyline
- ...
- select polyline for edition
- try closing polyline (and change is not visible)
- try changind line parameters (and change is not visible)
- move polyline a little and all works good again

What's going on?

I hope all changes I've made could be included into main OpenMap source
tree.
You can modify it as you like. Now classes have com.obrctm.openmap package
but you can move them to com.bbn.openmap.

I'd like to see some other enchancement in drawing tool. In one of our
porducts
(written in C++ and Motif), we have graphics editor. Users use it to draw
additional layers on map (e.g. restricted areas). To make it precisely they
need to type (not click on map) latitude and longitude of points. For
polygons and polylines we used dialog window with list of point. User could
select any point and modify it location, add points and remove points.
Additionaly he/she could click on map to quickly draw something, and then
correct locations in dialog window.

Such dialog windows was used for all graphics objects (lines, circles,
rectangles,
text, and so on). If such feature would be added to OpenMap it could be used
to make not just drawings but real and precise layers. Storing those layer
in files
is indispensable (see point 1., 2.) and own file format would be nice to
have.

I'd like to see small change in OMDrawingToolLauncher:
add:
    protected JComboBox requestors;

    public void setRequestor(String aName) {
        if (requestors == null)
            return;
        requestors.setSelectedItem(aName);
    }

and use that field instead of local 'requestor' variable in method
resetGUI().

Regards,
Piotr Kaminski

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
editabletext.gif
Received on Thu Jul 17 05:22:03 2003

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:36 EDT