duplicate graphics in OMDrawingTool

From: <chrisvanlith@b3partners.nl>
Date: Sun Apr 14 2002 - 16:09:48 EDT

Hello,

Although I may not be the first to notice, there appears to be a small bug
in OMDrawingTool.
Whenever a graphic is moved to a new position, the same graphic is added
second (or third) time to the graphic list.

I added a boolean to check if the graphic is being created or editted to
the OMDrawingTool class and set the boolean depending if the user entered
through create or edit. On deactivation I check for this and only set the
ADD_GRAPHIC_MASK if I was creating. Using the DESELECTALL_GRAPHIC_MASK
works for the other case, but I think should be UPDATE_GRAPHIC_MASK.

I hope this helps.

Regards

Chris

_______________________________________________________
Code snippets.

OMDrawingTool

        // cut code
    /** If just created than add otherwise replace graphic */
    protected boolean currentJustCreated = true;
        // cut code

    public OMGraphic create(String classname, GraphicAttributes ga,
                            DrawingToolRequestor requestor,
                            boolean showGUI) {
        // cut code
    setCurrentJustCreated(true); // so add graphic
        return edit(eomg, requestor);
    }
 
    public OMGraphic edit(OMGraphic g, DrawingToolRequestor requestor,
        boolean showGUI) {
        // cut code
    setCurrentJustCreated(false); // so replace graphic
        return edit(eomg, requestor);
        // cut code

    public synchronized void deactivate() {
        // cut code
        OMAction action = new OMAction();
    if (isCurrentJustCreated())
        action.setMask(OMGraphic.ADD_GRAPHIC_MASK);
    else
        action.setMask(OMGraphic.DESELECTALL_GRAPHIC_MASK); // maybe use
UPDATE_GRAPHIC_MASK
        notifyListener(g, action);
        // cut code

--
[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"]
Received on Sun Apr 14 16:12:05 2002

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