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

From: Thomas Coffin <thomas.coffin_at_artelys.com>
Date: Fri, 18 Feb 2005 15:24:44 +0100

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"]
Received on Mon Feb 21 2005 - 10:56:06 EST

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