1. Jay Lonnquist
  2. AIRSafecast-public

Commits

Jay Lonnquist  committed 12b461b

- Update Mad Components.
- Allow user to specify detection radius in meters.

  • Participants
  • Parent commits 780ede2
  • Branches default

Comments (0)

Files changed (6)

File AIRSafecast.as3proj

View file
  • Ignore whitespace
     <element path="lib\ExtendedMadnessLib0_1_4.swc" />
     <element path="lib\MadComponentsLib0_7_2.swc" />
     <element path="lib\MQFlashMapsAPI_7.1.1_OSM_MOBILE.swc" />
-    <element path="lib\ExtendedMadnessLib0_1_5.swc" />
-    <element path="lib\MadComponentsLib0_7_3.swc" />
     <element path="lib\MadComponentsPureHelpers.swc" />
+    <element path="lib\MadComponentsLib0_7_6.swc" />
+    <element path="lib\ExtendedMadnessLib0_1_8.swc" />
   </libraryPaths>
   <!-- External Libraries -->
   <externalLibraryPaths>

File lib/ExtendedMadnessLib0_1_5.swc

  • Ignore whitespace
Binary file removed.

File lib/ExtendedMadnessLib0_1_8.swc

  • Ignore whitespace
Binary file added.

File lib/MadComponentsLib0_7_3.swc

  • Ignore whitespace
Binary file removed.

File lib/MadComponentsLib0_7_6.swc

  • Ignore whitespace
Binary file added.

File src/com/mobiledesign/airsafecast/Application.as

View file
  • Ignore whitespace
 		private var _latlong_popup_txt:TextField;
 		private var _ot_lat:String;
 		private var _ot_lon:String;
+		private var _within_meters_bg:Sprite;
+		private var _within_meters_label_txt:TextField;
+		private var _within_meters_txt:TextField;
 		
 		//Safecast API key. https://api.safecast.org
 		private var _safecast_api_key:String = '';
 			//////////////////////////////
 			
 			//////////////////////////////
+			//Detection radius (meters).
+			//////////////////////////////
+			_within_meters_bg = _ui.drawMatte(2, 0xffffff, 0x000000, 5, (_app_height - 200), 170, 60, 'roundrect', 10, 10, 0.7, true, '_within_meters_bg');
+			addChild(_within_meters_bg);
+			_within_meters_label_txt = _ui.drawTextfield(Fontlib.DroidSans, 0, 0, 0xffffff, 5, 5, 160, 20, 14, true, 0x000000, false, 0x8CC63F, 'dynamic', 'left', false, '_within_meters_label_txt', false, true, true, false);
+			_within_meters_txt = _ui.drawTextfield(Fontlib.DroidSans, 0, 0, 0xffffff, 30, 35, 100, 20, 16, true, 0x000000, false, 0x8CC63F, 'input', 'center', true, '_within_meters_txt', false, true, true, false);
+			_within_meters_bg.addChild(_within_meters_label_txt);
+			_within_meters_bg.addChild(_within_meters_txt);
+			_within_meters_label_txt.text = 'Detection Radius (meters):';
+			_within_meters_txt.text = '700';
+			_within_meters_txt.maxChars = 6;
+			_within_meters_txt.restrict = '0-9';
+			//////////////////////////////
+			
+			//////////////////////////////
 			//Add activity indicator (on demand).
 			//////////////////////////////
 			_actind_demand = _ui.buildActivityIndicator((_app_width / 2), (_app_height / 2), _app_width, _app_height);
 			//Scale nominatim popup.
 			_nominatim_popup_bg.addEventListener(MouseEvent.CLICK, nomPopUpClickHandler, false, 0, false);
 			//////////////////////////////
-			
+		
 			//////////////////////////////
 			//Audio device handling.
 			//Mic, line-in etc.
 				_nominatim_popup_bg.removeChildAt(2);
 			}
 			//Construct query string.
+			var detect_radius:String = (_within_meters_txt.text == '') ? '700' : _within_meters_txt.text;
 			var lat_str:String = '&latitude=' + ot_lat;
 			var lon_str:String = '&longitude=' + ot_lon;
-			var dist_str:String = '&distance=1000';
-			var num_points_str:String = '&page_size=15';
+			var dist_str:String = '&distance=' + detect_radius;
+			var num_points_str:String = '&page_size=10';
 			var num_pages_str:String = '&page=1';
 			var safecast_url:String = 'https://api.safecast.org/api/measurements.json?api_key=' + _safecast_api_key + lat_str + lon_str + dist_str + num_points_str + num_pages_str;
+			
+			trace(safecast_url);
+			
 			//Safecast API.
 			_safecastdata = new Httpserv(safecast_url, 'GET', 'text', null);
 			//HTTP service listener.