ShowDistance.js
Summary
No overview generated for 'ShowDistance.js'
mapbuilder.loadScript(baseDir+"/widget/WidgetBaseXSL.js");
function ShowDistance(widgetNode, model) {
WidgetBaseXSL.apply(this,new Array(widgetNode, model));
this.showDistance = function(objRef) {
objRef.distForm = document.getElementById(objRef.formName);
var totalDistance = objRef.model.values.showDistance;
if (totalDistance == null) {
document.getElementById(objRef.htmlTagId).style.display = 'none';
} else {
document.getElementById(objRef.htmlTagId).style.display = '';
if (totalDistance > 1000.000) { // >1000m = 1.000km
if (totalDistance > 1000000.000) outputDistance = Math.round(totalDistance/1000)+" km"; // >1000km
else outputDistance = Math.round(totalDistance/100)/10+" km";
}
else if (totalDistance > 0) { outputDistance = Math.round(totalDistance)+" m"; }
else outputDistance = '';
if (objRef.distForm) {
objRef.distForm.distance.value = outputDistance;
}
}
}
this.model.addListener("showDistance", this.showDistance, this);
this.formName = "ShowDistance_" + mbIds.getId();
this.stylesheet.setParameter("formName", this.formName);
}
Documentation generated by
JSDoc on Tue Aug 21 08:12:28 2007