Hello all,
The API docs for BasicGeometry.distanceToEdge(x,y) say that it returns the
shortest distance from the edge of a graphic to an XY-point. The actual
implementation of this method checks if the shape contains x,y, doing
nothing if not. In other words, it won't return the shortest distance from
the shape to the point if the point is outside the shape.
In my tests, this is causing problems with editing certain OMLines -- all
lines except great circle lines always return a distance of infinity to any
mouse click, no matter how carefully you try to click on the line. Great
circle lines are the only ones I've had luck editing, but you still have to
click very carefully because of the contains() constraint.
I'm planning a rough fix to distanceToEdge as follows: If the shape doesn't
contain the x,y point, use the java.awt.Shape.intersects() method to see if
the shape intersects a rectangular area around the point. Refining the
rectangular region could give a fairly precise answer to the distance, but I
plan to do very minimal refining -- I want distanceToEdge to remain very
responsive since it is a candidate for being called on mouseovers (and lots
of refining wouldn't be perceived by users anyway). The primary goal is to
provide more clicking leeway, making it easier for users to select graphics.
I'm curious if anyone else has experienced difficulties with editing lines
(or other graphics) and, if so, what their approaches were in fixing it.
Thanks!
Kim
-- [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 Tue Jul 1 16:56:24 2003
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:36 EDT