public GoogleMapMarker(string size, string color, string label, GoogleMapLocation location) { this.size = size; this.color = color; this.label = label; this.location = location; }
public GoogleMapMarker(GoogleMapMarkerSize size, GoogleMapColor color, string label, GoogleMapLocation location) { Location = location; _size = size; _color = color; _label = label; }
public static List <GoogleMapLocation> GetGoogleMapZoomLinks() { XmlDocument vals = new XmlDocument(); List <GoogleMapLocation> linklist = new List <GoogleMapLocation>(); GoogleMapLocation link = new GoogleMapLocation(); try { vals.Load(Root.Domain + "/Lists/Modules/NetworkMapList/config.xml"); } catch (Exception e) { throw new Exception(e.Message); } foreach (XmlElement x in vals.SelectNodes("mapconfig/Zoom")) { link.Latitude = x.SelectSingleNode("CenterLat").InnerText; link.Longitude = x.SelectSingleNode("CenterLong").InnerText; link.ZoomLevel = x.SelectSingleNode("ZoomLevel").InnerText; link.Label = x.SelectSingleNode("Label").InnerText; link.SortOrder = x.SelectSingleNode("SortOrder").InnerText; link.DefaultLevel = x.SelectSingleNode("DefaultLevel").InnerText; linklist.Add(link); link = new GoogleMapLocation(); } linklist.Sort(delegate(GoogleMapLocation p1, GoogleMapLocation p2) { return(p1.SortOrder.CompareTo(p2.SortOrder)); }); return(linklist); }
//*************************************************************************************************************************************** public GoogleMapLocation GetDefaultZoom() { GoogleMapLocation loc = null; loc = Profiles.Lists.Utilities.DataIO.GetGoogleMapZoomLinks().Find(x => x.DefaultLevel == "True"); return(loc); }
private static string GenerateLocHtml(GoogleMapLocation mapLoc) { var htmlBuilder = new StringBuilder(); htmlBuilder.Append("<div style=\"text-align:left\">"); htmlBuilder.Append("<div style=\"font-weight:bold;font-size:14px;\">" + mapLoc.Address + "</div>"); htmlBuilder.Append(mapLoc.PersonsAtagString); htmlBuilder.Append("</div><br />"); return(htmlBuilder.ToString().Replace("'", "\'")); }
public void SearchLocationCountry() { panelSearch.SetActive(false); mapObject.SetActive(true); googleMap.centerLocation.latitude = double.Parse(latObj.text); googleMap.centerLocation.longitude = double.Parse(lonObj.text); GetAmmountMarkers(); googleMap.Refresh(); country = googleMap.centerLocation; }
private string _createApiQuery(GoogleMapLocation center, int zoom, bool includeUser) { var qs = ""; if (center.Specified()) { if (center.Address != "") { qs += "center=" + WWW.UnEscapeURL(center.Address); } else { qs += "center=" + WWW.UnEscapeURL( string.Format("{0},{1}", center.Latitude, center.Longitude)); } qs += "&zoom=" + zoom; } qs += "&language=ru"; qs += "&size=" + WWW.UnEscapeURL(string.Format("{0}x{1}", _width, _height)); qs += "&scale=" + (DoubleResolution ? "2" : "1"); qs += "&maptype=" + _mapType.ToString().ToLower(); foreach (var marker in _markers) { qs += "&markers=" + _markerToQuery(marker); } if (includeUser) { qs += "&markers=" + _markerToQuery(_userLocation); } foreach (var path in _paths) { qs += "&path=" + string.Format("weight:{0}|color:{1}", path.Weight, path.Color); if (path.Fill) { qs += "|fillcolor:" + path.FillColor; } foreach (var loc in path.Locations) { if (loc.Address != "") { qs += "|" + WWW.UnEscapeURL(loc.Address); } else { qs += "|" + WWW.UnEscapeURL(string.Format("{0},{1}", loc.Latitude, loc.Longitude)); } } } return(qs.Replace(" ", "%20")); }
private IEnumerator _cacheAll() { yield return(StartCoroutine(_cacheLocationCoroutine(GoogleMapLocation.Empty()))); foreach (var marker in _markers) { if (marker.Location.Address.Equals("")) { continue; } marker.Color = GoogleMapColor.Red; yield return(StartCoroutine(_cacheLocationCoroutine(marker.Location))); marker.Color = GoogleMapColor.Green; } }
private void WorkerFrm_Load(object sender, EventArgs e) { try { if (!_longLat.IsEmpty) { GoogleMapLocation location; if (!_longLat.HasLongLat) { //if there aint any long lat info, then try and get some location = new GoogleMapLocation(new GoogleMapAddress(_longLat.pCode, "UK")); } else if (_longLat.pCode == null && _longLat.HasLongLat) { //if there aint post code information then use this to get it location = new GoogleMapLocation(_longLat); } else { //if there is both then whoopdie do basil! location = new GoogleMapLocation(new GoogleMapAddress(_longLat.pCode, "UK"), _longLat); } //get the current long lat _longLat = location.LongLat; //set the postcode to match PostCode = _longLat.pCode; //try to add the marker location webBrowser1.AddLocationMarker(location); } } catch (Exception ex) { //ignore } if (_id != 0) { eNumberTxt.ReadOnly = true; eNumberTxt.BackColor = ColorTranslator.FromHtml("#FFEDE5"); } }
// Initialises the marker arrays in the class public void initMarkers() { int noMarkerTypes = 6, markersAllowed = 100; markers = new GoogleMapMarker[noMarkerTypes]; for (int i = 0; i < noMarkerTypes; i++) { GoogleMapMarker marker = new GoogleMapMarker(); marker.size = GoogleMapMarker.GoogleMapMarkerSize.Mid; GoogleMapLocation[] locs = new GoogleMapLocation[markersAllowed]; for (int j = 0; j < markersAllowed; j++) { locs[j] = new GoogleMapLocation(); locs[j].address = ""; } marker.locations = locs; markers[i] = marker; } }
public void AddPoint(float lt, float ln) { Debug.Log("AddPoint: " + lt + " : " + ln); GoogleMapMarker mk = new GoogleMapMarker(); mk.color = GoogleMapColor.red; mk.label = "Moscow"; GoogleMapLocation loc = new GoogleMapLocation(); loc.address = ""; loc.latitude = lt; loc.longitude = ln; mk.locations = new GoogleMapLocation[1]; mk.locations[0] = loc; markers.Add(mk); Refresh(); }
void Start() { #if UNITY_EDITOR loadWithoutGPS = true; // Test if this caues bugs on android #endif googleMap = GetComponent <GoogleMap>(); geoCalculations = GetComponent <GeoCalculations>(); currentLocation = new GoogleMapLocation(); currentLocation.address = ""; if (loadWithoutGPS) { Debug.LogError("Not using GPS"); } else { StartCoroutine(StartLocation()); } }
public void AddPoint(float lt, float ln) { Debug.Log("AddPoint: " + lt + " : " + ln); GoogleMapMarker mk = new GoogleMapMarker(); mk.color = GoogleMapColor.red; mk.label = "Moscow"; GoogleMapLocation loc = new GoogleMapLocation(); loc.address = ""; loc.latitude = lt; loc.longitude = ln; mk.locations = new GoogleMapLocation[1]; mk.locations[0] = loc; markers.Add(mk); Refresh(); }
private IEnumerator _cacheLocationCoroutine(GoogleMapLocation location) { for (var i = MinZoom; i <= MaxZoom; i++) { var qs = _createApiQuery(location, i, false); if (LocalStorage.FileExists(MapDir + "/" + qs.GetHashCode())) { continue; } var query = _wrapQueryWithLinks(qs); ServicePointManager.ServerCertificateValidationCallback = _remoteCertificateValidationCallback; var webAsync = new WebAsync(); var webRequest = HttpWebRequest.Create(query); webRequest.Method = "GET"; yield return(webAsync.GetResponse(webRequest)); if (webAsync.requestState.errorMessage != null) { Debug.Log("Error:" + webAsync.requestState.errorMessage); yield break; } var reader = new BinaryReader(webAsync.requestState.webResponse.GetResponseStream()); var bytesResponce = reader.ReadBytes(1 * 1024 * 1024 * 10); Destroy(_texture); _reinitializeTextureBuffer(); _texture.LoadImage(bytesResponce); _textureBufferUpdated.Invoke(); LocalStorage.Save(MapDir + "/" + qs.GetHashCode(), _texture.EncodeToJPG()); } }
//Последовательность //Первым делом берем нужный участок голый (без маршрутов) //Далее запрос той же местности + координаты участка (N раз), тоесть имею N+1 изображение //Далее сравниваю все N изображений по пиксельно с исходным, рисую карту разниц, типа если не совпало тикущее с исходным, значит на результирующем надо отрисовать public GoogleMapPath GetPathFromString(string coords) { var p = new GoogleMapPath(); try { coords = coords.Trim(); if (coords[coords.Length - 1] == ';') { coords = coords.Remove(coords.Length - 1); } p.color = GoogleMapColor.red; var locat = new List <GoogleMapLocation>(); foreach (var c in coords.Split(';')) { var l = new GoogleMapLocation(); try { l.latitude = float.Parse(c.Split(',')[0]); l.longitude = float.Parse(c.Split(',')[1]); locat.Add(l); } catch (Exception e) { Debug.Log(e.Message + "=" + c); throw; } } p.locations = locat; } catch (Exception e) { Debug.Log(e.Message); throw; } return(p); }
private static Dictionary <string, GoogleMapLocation> GenerateGMapLocations(SqlDataReader reader) { var locationsDict = new Dictionary <string, GoogleMapLocation>(); while (reader.Read()) { var address = reader["address1"].ToString().Replace("'", "\\'") + "<br />" + reader["address2"].ToString().Replace("'", "\\'"); var latitude = reader["latitude"].ToString(); var longitude = reader["longitude"].ToString(); var latLongHash = latitude + longitude; var personname = reader["display_name"].ToString(); GoogleMapLocation gMapLocation; var personATag = GeneratePersonAtag(reader["URI"].ToString(), reader["display_name"].ToString()); if (locationsDict.ContainsKey(latLongHash)) { gMapLocation = locationsDict[latLongHash]; gMapLocation.PersonsAtagString += personATag; } else { gMapLocation = new GoogleMapLocation { Address = address, Latitude = latitude, Longitude = longitude, PersonsAtagString = personATag, PersonName = personname }; locationsDict.Add(latLongHash, gMapLocation); } } reader.Close(); return(locationsDict); }
public void ReadJSON() { string JSONToParse = "{\"values\":" + jsonData.text + "}"; RootObject nodes = null; nodes = JsonUtility.FromJson <RootObject>(JSONToParse); locations = new GoogleMapLocation[limitArray]; //nodes.values.Length]; for (int i = 0; i < limitArray; i++) // locations.Length; i++) { locations[i] = new GoogleMapLocation(); locations[i].address = ""; if (nodes.values[i].coordinates.Count == 2) { locations[i].latitude = nodes.values[i].coordinates[0]; locations[i].longitude = nodes.values[i].coordinates[1]; } } GoogleMapMarker markers = new GoogleMapMarker(); markers.locations = locations; map.markers = new GoogleMapMarker[1]; map.markers[0] = markers; //markers.locations = locations; }
public void swapMarkers(List <Marker> spatialMarkers) { Debug.Log("swaping markers"); if (spatialMarkers == null) { Debug.Log("no markers"); return; } markers = new GoogleMapMarker[spatialMarkers.Count]; // Convert from one marker type to another int count = 0; foreach (Marker marker in spatialMarkers) { GoogleMapLocation[] gml_list = new GoogleMapLocation[] { new GoogleMapLocation("", (float)marker.loc.coordinates[0], (float)marker.loc.coordinates[1]) }; markers[count] = new GoogleMapMarker(GoogleMapMarker.GoogleMapMarkerSize.Mid, GoogleMapColor.gray, marker.name, gml_list); count++; } // Refresh after finish everything Refresh(); }
private IEnumerator _getAdresses() { var www = new WWW(InfoStorage.Server + InfoStorage.EventsApi + "getAll?api=address"); yield return(www); if (www.error == null) { _markers.Clear(); var json = JSON.Parse(www.text); foreach (JSONNode jsonNode in json.AsArray) { string address = jsonNode["address"]; if (address == null || address.Equals("")) { continue; } var gml = new GoogleMapLocation(address); var gmm = new GoogleMapMarker(gml); _markers.Add(gmm); } LocalStorage.Save(FileName, _markers); } else { if (LocalStorage.FileExists(FileName)) { _markers = (List <GoogleMapMarker>)LocalStorage.Load(FileName); } } }
private static string GenerateLocHtml(GoogleMapLocation mapLoc) { var htmlBuilder = new StringBuilder(); htmlBuilder.Append("<div style=\"text-align:left\">"); htmlBuilder.Append("<div style=\"font-weight:bold;font-size:14px;\">" + mapLoc.Address + "</div>"); htmlBuilder.Append(mapLoc.PersonsAtagString); htmlBuilder.Append("</div><br />"); return htmlBuilder.ToString().Replace("'", "\'"); }
private static Dictionary<string, GoogleMapLocation> GenerateGMapLocations(SqlDataReader reader) { var locationsDict = new Dictionary<string, GoogleMapLocation>(); while (reader.Read()) { var address = reader["address1"].ToString().Replace("'", "\\'") + "<br />" + reader["address2"].ToString().Replace("'", "\\'"); var latitude = reader["latitude"].ToString(); var longitude = reader["longitude"].ToString(); var latLongHash = latitude + longitude; var personname = reader["display_name"].ToString(); GoogleMapLocation gMapLocation; var personATag = GeneratePersonAtag(reader["URI"].ToString(), reader["display_name"].ToString()); if (locationsDict.ContainsKey(latLongHash)) { gMapLocation = locationsDict[latLongHash]; gMapLocation.PersonsAtagString += personATag; } else { gMapLocation = new GoogleMapLocation { Address = address, Latitude = latitude, Longitude = longitude, PersonsAtagString = personATag, PersonName = personname }; locationsDict.Add(latLongHash, gMapLocation); } } reader.Close(); return locationsDict; }
private void ServiceUserFrm_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult != System.Windows.Forms.DialogResult.OK) { return; } if (firstnametxt.Text.Trim().Length == 0) { firstnameerrorpic.Visible = true; e.Cancel = true; } if (surnametxt.Text.Trim().Length == 0) { surnameerrorpic.Visible = true; e.Cancel = true; } if (_id == 0 && !PNumberAvailable) { pnumbererrorpic.Visible = true; pnumbererrodlbl.Text = "( Already Exists )"; pnumbererrodlbl.Visible = true; e.Cancel = true; } else if (pNumberTxt.Text.Trim().Length == 0) { pnumbererrorpic.Visible = true; pnumbererrodlbl.Text = "( Invalid PNumber )"; pnumbererrodlbl.Visible = true; e.Cancel = true; } //change this to use call history stuff instead //if (_id != 0) //{ // DateTime serviceStart = PeriodStartDate; // DateTime serviceEnd = serviceStart.AddDays(PeriodWeekCount * 7); // if (CallManager.Instance.Calls.Where(c => c.ServiceUser.id == _id && !c.HasFullWorkers && // !(c.TimeTo > serviceStart && c.TimeFrom < serviceEnd)).Count() > 0) // { // MessageBox.Show("There are still unassigned calls outside this service period.", "Unassigned Calls", MessageBoxButtons.OK); // e.Cancel = true; // } //} //all good, update the location stuff try { if (PostCode == "") { _longLat.Empty(); } else if (PostCode != _longLat.pCode) { //if the postcode has changed GoogleMapLocation location; location = new GoogleMapLocation(new GoogleMapAddress(PostCode, "UK")); _longLat = location.LongLat; } } catch (Exception ex) { //ignore } }
public GoogleMapPath(float startLat, float startLong, float endLat, float endLong) { weight = 2; color = GoogleMapColor.black; fill = false; fillColor = GoogleMapColor.black; locations = new GoogleMapLocation[2]; locations[0] = new GoogleMapLocation(startLat, startLong); locations[1] = new GoogleMapLocation(endLat, endLong); }
public GoogleMapMarker(GoogleMapLocation location) { Location = location; }
private GoogleMapMarker() { Location = GoogleMapLocation.Empty(); }
public GoogleMapMarker(Data.ResourceNames r) { size = GoogleMapMarkerSize.Mid; locations = new GoogleMapLocation[0]; icon = "http://ro4m3r.servebeer.com:1337/pictures/SocialGaming/" + r.ToString() + ".png"; Debug.Log(icon); //if (r == Data.ResourceNames.WOOD) // icon = "http://images2.wikia.nocookie.net/farmville/images/thumb/c/c4/Wood_Pile-icon.png/35px-Wood_Pile-icon.png"; //else if (r == Data.ResourceNames.ORE) // icon = "http://www.top1gaming.com/images/wonderlandonline//iron_ore.png"; //else if (r == Data.ResourceNames.CLAY) // icon = "http://premierreclaimedbricks.co.uk/wp-content/uploads/2011/09/brick-icon4.png"; }
IEnumerator _Refresh() { centerLocation = new GoogleMapLocation(); centerLocation.address = ""; centerLocation.latitude = Input.location.lastData.latitude; centerLocation.longitude = Input.location.lastData.longitude; //centerLocation.latitude = 37.015244f; //centerLocation.longitude = -121.886125f; // Stop service if there is no need to query location updates continuously //Input.location.Stop(); markers = new GoogleMapMarker[1]; markers[0] = new GoogleMapMarker(); markers [0].size = GoogleMapMarker.GoogleMapMarkerSize.Mid; markers[0].color = new GoogleMapColor(); markers[0].color = GoogleMapColor.red; markers [0].label = "YourLocation"; var text = new WebClient().DownloadString(url2); Debug.Log("text is: \n" + text); var N = JSON.Parse(text); //Debug.Log ("RES>>>" + N[1]["_id"].Value); //Debug.Log ("Count: " + N.Count); Debug.Log(">>N.count (number of records parsed from json string) is: " + N.Count + "\n"); markers [0].locations = new GoogleMapLocation[N.Count + 1]; markers[0].locations[0] = new GoogleMapLocation(); markers[0].locations[0].address = ""; //markers[0].locations[0].latitude = 37.015244f; float lat = Input.location.lastData.latitude; markers [0].locations [0].latitude = lat; //markers [0].locations [0].longitude = -121.886125f; float longi = Input.location.lastData.longitude; markers [0].locations [0].longitude = longi; Debug.Log("Length of markers array is (should be 1): " + markers.Length); Debug.Log("Length of locations array is (should be 1 + number of products): " + markers[0].locations.Length); /* * * markers[1] = new GoogleMapMarker(); * markers [1].size = GoogleMapMarker.GoogleMapMarkerSize.Mid; * markers[1].color = new GoogleMapColor(); * markers[1].color = GoogleMapColor.yellow; * markers [1].label = "product"; * * * * * markers [1].locations = new GoogleMapLocation[1]; * markers[1].locations[0] = new GoogleMapLocation(); * markers[1].locations[0].address = ""; * * markers[1].locations[0].latitude = 37.015244f; * //float lat = Input.location.lastData.latitude; * //markers [0].locations [0].latitude = lat; * markers [1].locations [0].longitude = -121.886125f; * // * * * */ //String text = ""; //StartCoroutine (GET ( text)); //getJSON(ref text); //var text = new WebClient().DownloadString ("http://104.199.124.21:3000/api/products"); //var text = new WebClient().DownloadString ("http://localhost:3000/api/products"); //markers [1].locations = new GoogleMapLocation[N.Count]; for (int i = 1; i < N.Count + 1; i++) { markers [0].locations [i] = new GoogleMapLocation(); markers [0].locations [i].address = ""; //markers[0].locations[i].latitude = 37.015244f; Debug.Log("i is: " + i + "\n"); Debug.Log("FLAGX"); //Debug.Log ("N [i] [latitude] is: " + N [i] ["latitude"] + "\n"); Debug.Log("N [i] [latitude] is: " + 44 + "\n"); //Debug.Log ("N [i] [longitude] is: " + N [i] ["longitude"] + "\n"); Debug.Log("N [i] [latitude] is: " + 55 + "\n"); //markers[0].locations[i].latitude = 37.015244f; string lat2String = N [i] ["latitude"]; float lat2Float = Convert.ToSingle(lat2String); markers [0].locations [i].latitude = lat2Float; //markers [0].locations [i].longitude = -121.886125f; string longi2String = N [i] ["longitude"]; float longi2Float = Convert.ToSingle(longi2String); markers [0].locations [i].longitude = longi2Float; } //Debug.Log ("LOCFLAG>>>>: " + markers [0].locations [3].latitude + "\n"); //Debug.Log ("Lattest1: " + markers [1].locations [0].latitude); //N [i] ["altitude"]; //*/ var url = "http://maps.googleapis.com/maps/api/staticmap"; var qs = ""; if (!autoLocateCenter) { if (centerLocation.address != "") { qs += "center=" + WWW.UnEscapeURL(centerLocation.address); } else { qs += "center=" + WWW.UnEscapeURL(string.Format("{0},{1}", centerLocation.latitude, centerLocation.longitude)); } qs += "&zoom=" + zoom.ToString(); } qs += "&size=" + WWW.UnEscapeURL(string.Format("{0}x{0}", size)); qs += "&scale=" + (doubleResolution ? "2" : "1"); qs += "&maptype=" + mapType.ToString().ToLower(); var usingSensor = false; #if UNITY_IPHONE usingSensor = Input.location.isEnabledByUser && Input.location.status == LocationServiceStatus.Running; #endif qs += "&sensor=" + (usingSensor ? "true" : "false"); foreach (var i in markers) { qs += "&markers=" + string.Format("size:{0}|color:{1}|label:{2}", i.size.ToString().ToLower(), i.color, i.label); foreach (var loc in i.locations) { if (loc.address != "") { qs += "|" + WWW.UnEscapeURL(loc.address); Debug.Log("flag1"); } else { qs += "|" + WWW.UnEscapeURL(string.Format("{0},{1}", loc.latitude, loc.longitude)); } Debug.Log("flag2"); Debug.Log("latitude is: " + loc.latitude); Debug.Log("longitude is: " + loc.longitude); Debug.Log("qs is: " + qs); } } foreach (var i in paths) { qs += "&path=" + string.Format("weight:{0}|color:{1}", i.weight, i.color); if (i.fill) { qs += "|fillcolor:" + i.fillColor; } foreach (var loc in i.locations) { if (loc.address != "") { qs += "|" + WWW.UnEscapeURL(loc.address); } else { qs += "|" + WWW.UnEscapeURL(string.Format("{0},{1}", loc.latitude, loc.longitude)); } } } var req = new WWW(url + "?" + qs); Debug.Log(url + "?" + qs); yield return(req); GetComponent <Renderer>().material.mainTexture = req.texture; yield return(3); }
private void WorkerFrm_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult != System.Windows.Forms.DialogResult.OK) { return; } if (firstnametxt.Text.Trim().Length == 0) { firstnameerrorpic.Visible = true; e.Cancel = true; } if (surnametxt.Text.Trim().Length == 0) { surnameerrorpic.Visible = true; e.Cancel = true; } if (_id == 0 && !ENumberAvailable) { pnumbererrorpic.Visible = true; pnumbererrodlbl.Text = "( Already Exists )"; pnumbererrodlbl.Visible = true; e.Cancel = true; } else if (eNumberTxt.Text.Trim().Length == 0) { pnumbererrorpic.Visible = true; pnumbererrodlbl.Text = "( Invalid PNumber )"; pnumbererrodlbl.Visible = true; e.Cancel = true; } //all good, update the location stuff try { if (PostCode == "") { _longLat.Empty(); } else if (PostCode != _longLat.pCode) { //if the postcode has changed _longLat.Empty(); _longLat.pCode = PostCode; //get the google long lat locations (this will insert into pcodes.db) GoogleMapLocation location; location = new GoogleMapLocation(new GoogleMapAddress(PostCode, "UK")); _longLat = location.LongLat; } } catch (Exception ex) { //ignore } }
public GoogleMapMarker() { size = GoogleMapMarkerSize.Mid; locations = new GoogleMapLocation[0]; icon = "http://icons.iconarchive.com/icons/icons8/windows-8/16/Transport-Road-Worker-icon.png"; }
public GoogleMapMarker(float latitude, float longitude) { size = GoogleMapMarkerSize.Mid; locations = new GoogleMapLocation[1]; locations[0] = new GoogleMapLocation(latitude, longitude); icon = "http://www.elkgames.com/templates/red/images/star.png"; }