Re: [OpenMap Users] OMPoly edition bug : fixed ?

From: Don Dietrick <dietrick_at_bbn.com>
Date: Fri, 21 Jul 2006 09:31:35 -0400

Ahh, Stephane, you are a hero. Thanks for tracking that down. I've
spent a few hours on it myself, and could never quite find it.

Thanks for reporting what you found!

- Don

On Jul 21, 2006, at 5:38 AM, Stéphane Wasserhardt wrote:

> Hi !
>
> I found a bug in OMPoly editing, but I don't know if my way to
> avoid it is the good one...
>
> Here is a summary of what happens when you edit an OMPoly :
>
> When you use the SelectMouseMode to click on an OMPoly which can be
> edited, it turns into an EditableOMPoly with GrabPoints to modify it.
> When you select it, many things happen, but three things are
> interesting :
> First, the OMPoly goes in edit mode : it is wrapped into an
> EditableOMPoly. This EditableOMPoly (EOMP) builds a list of
> GrabPoints (polyGrabPoints), and sets the EditableOMGraphic's
> "gPoints" array with these grabPoints (+ another fake
> OffsetGrabPoint to move the whole OMPoly).
> Another thing is that the OMDrawingToolMouseMode, used to edit the
> graphic is added to the MapBean's ProjectionListeners list, in
> order to update the grabPoints when projection changes...
> The last thing that happens is that if "showAttributes" is true on
> the parent EditorTool, a new ToolBar is added to the OpenMapFrame's
> ToolBar to show DrawingAttributes and EOMP tools (enclose poly, add
> grab point, remove grab point).
>
> Now that it is explained, here is the bug :
>
> When the tools are added to the ToolBar, depending on your ToolBar
> contents at this time (and the LookAndFeel, etc.) it may be
> possible that the ToolBar size changes. Then it will take a little
> more space on the MapBean. The MapBean will have its size changed,
> invoking a ProjectionChangedEvent !
> This event will be recieved by the OMDrawingToolMouseMode. It will
> regenerate the OMPoly for this new projection and recreate the
> grabPoints. But these grabPoints won't be changed in the gPoints
> array (of EditableOMGrpahic) ! So when you'll try to move a
> grabPoint, you will move a grabPoint of gPoints, not one of
> polyGrabPoints, so the EditableOMPoly won't change !!
>
> Finally the fix :
>
> polyGrabPoints is copied into gPoints in the method
> "EditableOMPoly.getGrabPoints()" if the following condition is true :
>
> int size = polyGrabPoints.size();
>
> if (gPoints.length != size + 1) {
> ...
> }
>
> But when the "bug" happens, the size isn't changed, so I changed to
> check if the first grabPoint has changed. If it's true, then all
> the array has to be rebuilt :
>
> if ((gPoints.length != size + 1) || ((size > 0) && (!gPoints
> [0].equals(polyGrabPoints.get(0))))) {
> ...
> }
>
> If this is the right fix, you can add it to the next OpenMap
> release... Or just find a better one !
>
> These ProjectionChanged events can be really annoying, I lost a
> couple of hours finding the reason why my OMPoly's grabPoints
> couldn't be grabbed !!
>
> Stephane
>
> --
> [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"]

--
[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 Fri Jul 21 2006 - 09:32:41 EDT

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