public void AddFrom(GeoMarker marker) { foreach (Vector2 coord in marker.geoCoords) { AddMarker(coord); } }
public GeoMarker(GeoMarker markA, GeoMarker markB, Transform trans, Transform eTransform, float eRadius, GameObject prefab) { geoCoords = new List <Vector2>(); geoCoords.AddRange(markA.geoCoords); geoCoords.AddRange(markB.geoCoords); calculateCenter(); transform = trans; earthRadius = eRadius; markerPrefab = prefab; earthTransform = eTransform; CreateMarker(); }
public bool CheckMarker(GeoMarker marker) { foreach (GeoMarker gmark in gmarkers) { //Debug.Log((gmark.geoCoordCenter - marker.geoCoordCenter).sqrMagnitude); if ((gmark.geoCoordCenter - marker.geoCoordCenter).sqrMagnitude <= radiusCheck * radiusCheck) { gmark.AddFrom(marker); return(false); } } gmarkers.Add(marker); return(true); }
public ImportadorMarkers() { GoogleMaps maps = new GoogleMaps(); var model = new EdugeoModel(); foreach (var escuela in model.Escuelas.OrderBy(i => i.Id).Include(i => i.GeoMarker).ToList()) { Console.Write(escuela.Nombre + " - " + escuela.Domicilio + " - "); try { if (escuela.GeoMarker == null) { var geocode = maps.GetGeocode("CALLE " + escuela.Domicilio); if (geocode != null && geocode.Results != null && geocode.Results.Count() > 0) { var result = geocode.Results.First(); GeoMarker marker = new GeoMarker(); marker.DireccionFormateada = result.FormattedAddress; marker.Latitud = result.Geometry.Location.Latitude; marker.Longitud = result.Geometry.Location.Longitude; escuela.GeoMarker = marker; model.SaveChanges(); Console.WriteLine(marker.DireccionFormateada); } else { Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(geocode)); } } else { Console.WriteLine("Ya tiene marker"); } System.Threading.Thread.Sleep(100); } catch (Exception ex) { Console.WriteLine(ex.Message); } } }
public void AddNewMarker(Vector2 coords) { GeoMarker mark = new GeoMarker(coords, transform, earthTransform, earthRadius, markerPrefab); gmarkers.Add(mark); }