From 775d6b03c1194d88f5484f79179cd135ccc8467f Mon Sep 17 00:00:00 2001 From: David Spriggs Date: Fri, 25 Apr 2014 21:11:54 -0500 Subject: [PATCH] Updates. --- viewer/js/gis/dijit/LocateButton.js | 30 +++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/viewer/js/gis/dijit/LocateButton.js b/viewer/js/gis/dijit/LocateButton.js index b864543f1..652846ef7 100644 --- a/viewer/js/gis/dijit/LocateButton.js +++ b/viewer/js/gis/dijit/LocateButton.js @@ -5,9 +5,11 @@ define([ 'esri/renderers/SimpleRenderer', 'esri/symbols/PictureMarkerSymbol', 'esri/layers/GraphicsLayer', - 'esri/InfoTemplate' -], function(declare, lang, LocateButton, SimpleRenderer, PictureMarkerSymbol, GraphicsLayer, InfoTemplate) { + 'esri/InfoTemplate', + 'dojo/topic' +], function(declare, lang, LocateButton, SimpleRenderer, PictureMarkerSymbol, GraphicsLayer, InfoTemplate, topic) { return declare(null, { + growlTemplate: 'latitude: {latitude}
longitude: {longitude}
accuracy: {accuracy}
altitude: {altitude}
altitudeAccuracy: {altitudeAccuracy}
heading: {heading}
speed: {speed}', constructor: function(options, node) { this.options = options; this.parentNode = node; @@ -28,6 +30,30 @@ define([ this.locateButton = new LocateButton(this.options, this.parentNode); this.locateButton.startup(); + this.locateButton.on('locate', lang.hitch(this, '_growlLocation')); + }, + _growlLocation: function(evt) { + var stats = { + accuracy: (evt.position.coords.accuracy) ? evt.position.coords.accuracy : '', + altitude: (evt.position.coords.altitude) ? evt.position.coords.altitude : '', + altitudeAccuracy: (evt.position.coords.altitudeAccuracy) ? evt.position.coords.altitudeAccuracy : '', + heading: (evt.position.coords.heading) ? evt.position.coords.heading : '', + latitude: (evt.position.coords.latitude) ? evt.position.coords.latitude : '', + longitude: (evt.position.coords.longitude) ? evt.position.coords.longitude : '', + speed: (evt.position.coords.speed) ? evt.position.coords.speed : '' + }; + + if (this.graphics.graphics.length > 0) { + this.graphics.graphics[0].attributes = stats; + } + + topic.publish('growler/growl', { + title: "GPS Position", + message: lang.replace(this.growlTemplate, stats), + level: "default", //can be: 'default', 'warning', 'info', 'error', 'success'. + timeout: 10000, //set to 0 for no timeout + opacity: 1.0, + }); } }); }); \ No newline at end of file