Re: [OpenMap Users] bug ? in Location.distance()

From: Thomas Coffin <thomas.coffin_at_artelys.com>
Date: Mon, 21 Feb 2005 17:39:25 +0100

Oops I intended to send this mail to openmap_at_bbn.com, it seems that
Outlook's automatic completion did not agree with this.

Sorry !

Thomas

----- Original Message -----
From: "Thomas Coffin" <thomas.coffin_at_artelys.com>
To: <openmap-users_at_bbn.com>
Sent: Friday, February 18, 2005 3:24 PM
Subject: [OpenMap Users] bug ? in Location.distance()


> Hi,
>
> I noticed a bug - or at least a strange feature - in Location.distance(),
> openmap v4.6.1 :
> public float distance(int x, int y) {
> float labelDist = Float.MAX_VALUE;
> float locationDist = Float.MAX_VALUE;
> boolean globalShowLocations = false;
> boolean globalShowNames = false;
>
> if (handler != null) {
> globalShowLocations = handler.isShowLocations();
> globalShowNames = handler.isShowNames();
> }
>
> if (showLocation && location != null) {
> locationDist = location.distance(x, y);
> }
>
> if (showName && label != null) {
> labelDist = label.distance(x, y);
> }
>
> return (locationDist > labelDist ? labelDist : locationDist);
> }
>
> the globalShowLocations and globalShowNames local variables are
> initialized
> but never accessed.
> I believe the two last "if" conditions should rather be like the ones in
> renderName and renderLocation (introducing a forceGlobal variable) :
>
>
> if (((forceGlobal && globalShowLocations) || (!forceGlobal &&
> showLocation)) && location != null) {
> locationDist = location.distance(x, y);
> }
>
> if (((forceGlobal && globalShowNames) || (!forceGlobal && showName)) &&
> label != null) {
> labelDist = label.distance(x, y);
> }
>
> Regards,
>
> Thomas
>
> --------------------------------------
> Thomas Coffin
> Artelys
> http://www.artelys.com
> Tel. : + (33|0)1.41.46.19.00
>
> --
> [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 Mon Feb 21 2005 - 11:40:02 EST

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