Exemple #1
0
		public AddAssetToMapPage (EIMAPin pin, bool editPin, MapModel model)
		{
			myModel = model;
			editAsset = editPin;
			hasCanceled = true;
			toEdit = pin;
			buildUI ();

		}
Exemple #2
0
		public void removePin(EIMAPin pin){
			this._pins.Remove(pin);							
		}
Exemple #3
0
		public void addPin(EIMAPin pin){
			this._pins.Add(pin);							
		}
Exemple #4
0
		static void updateMapData (JObject mapData)
		{
			var data = DataManager.getInstance ();
			var assetJArr = (JArray)mapData ["mapAssets"];
			var circJArr = (JArray)mapData ["mapCircles"];
			var polyJArr = (JArray)mapData ["mapPolygons"];

			var polyList = new List<EIMAPolygon> ();
			var circleList = new List<EIMACircle> ();
			var assetList = new List<EIMAPin> ();


			foreach (JObject item in polyJArr.Children()) {
				var poly = new EIMAPolygon();
				poly.note = (string)item ["note"];
				poly.uid = (string)item ["uid"];
				poly.type = (string)item ["type"];

				var cordList = new List<Position> ();

				JArray coords = (JArray)item ["points"];
				foreach (JObject pos in coords.Children()) {
					cordList.Add(new Position((double)pos["Latitude"],(double)pos["Longitude"]));
				}
				List<Position> copied = new List<Position>(cordList);
				poly.Coordinates = copied;
				polyList.Add (poly);
			}

			foreach(JObject item in assetJArr.Children()){
				EIMAPin toAdd = new EIMAPin ();

				toAdd.name = (string)item["name"];
				toAdd.uid = (string)item["uid"];
				toAdd.status = (string)item["status"];
				toAdd.organization = (string)item["organization"];
				toAdd.unit = (string)item ["unit"];

				toAdd.Subtitle = "Status:" + toAdd.status;

				JObject pos = (JObject)item ["position"];
				toAdd.Position = new Position ((double)pos["latitude"],(double)pos["longitude"]);
				toAdd.unitType = (string)item ["type"];

				assetList.Add (toAdd);
			}

			foreach (JObject item in circJArr.Children()) {
				var circle = new EIMACircle();
				circle.note = (string)item ["note"];
				circle.uid = (string)item ["uid"];
				circle.Radius = (double)item ["radius"];
				circle.type = (string)item ["type"];
				circle.Center = new Position ((double)item["center"]["lat"],(double)item["center"]["long"]);

				circleList.Add (circle);
			}

			data.setDangerZoneCircle (circleList);
			data.setAssets (assetList);
			data.setDangerZonePoly (polyList);

		}
Exemple #5
0
//		//MAP SPAN
//		public void setSpan(double num){
//			dataStore["incident"]["metainf"]["span"] = num;
//			rewriteObjectInMemory ();
//		}
//
//		//MAP DEFAULT LOCATION
//		public void setCenter(Position defLoc){
//			JObject pos = new JObject ();
//			pos ["lat"] = defLoc.Latitude;
//			pos ["long"] = defLoc.Longitude;
//
//			dataStore["incident"]["metainf"]["center"] = pos;
//			rewriteObjectInMemory ();
//		}
			
		//MAP ASSETS 
		public List<EIMAPin> getAssets(){
			List<EIMAPin> toReturn = new List<EIMAPin> ();

			JArray assets = (JArray)dataStore ["incident"] ["mapAssets"];

			foreach(JObject item in assets.Children()){
				EIMAPin toAdd = new EIMAPin ();

				toAdd.name = (string)item["name"];
				toAdd.uid = (string)item["uid"];
				toAdd.status = (string)item["status"];
				toAdd.organization = (string)item["organization"];
				toAdd.unit = (string)item ["unit"];

				toAdd.Title = toAdd.name + " (" + toAdd.organization + "," + toAdd.unit + ")";//Not sure how we want to format data
				toAdd.Subtitle = "Status:" + toAdd.status;


				toAdd.IsDraggable = !(bool)item["isUser"];


				toAdd.IsVisible = true;
				toAdd.Position = new Position ((double)item["location"]["lat"],(double)item["location"]["long"]);
				var name = ((string)item ["type"]);
				if(String.IsNullOrEmpty(name)){
					name = "Other";
				}
				toAdd.Image = (name.Replace(" ","") + ".png");
				toAdd.unitType = (string)item ["type"];
				toAdd.ShowCallout = true;

				toReturn.Add (toAdd);
			}

			return toReturn;
		}