Hi Chris,
Thanks for bringing this up. This has come up a couple of times, so I
reworked the code a little.
I added a field in the EditableOMGraphic that holds an integer action
mask. The OMDrawingTool sets it depending on what it is doing to the
graphic, and then sends that value to the requestor later. So the
requestor will now be receiving an ADD_GRAPHIC_MASK for creations, and
UPDATE_GRAPHIC_MASK for edits.
I also modified the OMGraphicList.doAction() method so it will add the
graphic to the list if the action is UPDATE_GRAPHIC_MASK and the graphic
isn't already on the list. Otherwise, the list does nothing.
This should provide the expected behavior.
Thanks again,
Don
On Sunday, April 14, 2002, at 04:09 PM, chrisvanlith@b3partners.nl
wrote:
>
> 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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, BBN Technologies, dietrick@bbn.com
10 Moulton Street, Cambridge, MA 02138
617-873-3031 [fax]-2794
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-- [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 Mon Apr 15 08:53:47 2002
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:32 EDT