public IEnumerator GetGoogleMap(float latitude, float longitude) { // Generate the complete url url = "https://maps.googleapis.com/maps/api/staticmap?center=" + latitude + "," + longitude + "&zoom=" + zoom + "&size=" + mapWidth + "x" + mapHeight + "&maptype=" + mapSelected; url += TR_Toolbox.generateURL(GameObject.FindGameObjectsWithTag("Player")); // Draw a play circle on the map float lat = MapTools.getLatO(); float lng = MapTools.getLonO(); url += TR_Toolbox.drawCircle(range, lat, lng, 5); // Add the key at the tail of the url url += key1; // url += key2; // url += key3; WWW www = new WWW(url); yield return(www); Destroy(mapTexture); // Catch the error if there is one if (www.error == null) { // Get the texture downloaded mapTexture = www.texture; // Assign it to the UI myMap.GetComponent <RawImage>().texture = mapTexture; StopCoroutine(mapCoroutine); } }
private void Init() { if (MapTools.IsOutOfBounds(x, y)) { return; } if (GameTools.Base.IsWithinBase(x, y)) { return; } int tileTrapCount = GameTools.Map.TrapData[x, y].Count; if (tileTrapCount > 0) { if (GameTools.Map.TrapData[x, y][0].spell.SpellColour != this.spell.SpellColour) { for (int j = 0; j < tileTrapCount; j++) { GameTools.Map.TrapData[x, y][j].Destroy(); } GameTools.Map.TrapData[x, y] = new List <Trap>(); } } this.count = GameTools.Map.TrapData[x, y].Count; GameTools.Map.TrapData[x, y].Add(this); InitGameObject(); CleanTools.GetInstance().SubscribeCleanable(this); }
public static void Simulate(List <Gateway> partners, DateTime until) { Logger.BeginRequest("", null); Logger.Log("Sim Configuration"); Logger.Tab(); foreach (Gateway p in partners) { p.Log(); } Logger.Untab(); Logger.EndRequest(null); MapTools.SetGeodataFilenames("../../App_Data/Geo-Location-Names.txt", "../../App_Data/Geo-Routes.txt", "../../App_Data/Geo-Location-Addresses.csv"); TimeSpan simInterval = new TimeSpan(0, 0, 10); while (DateTime.UtcNow < until) { Logger.BeginRequest("Heartbeat", null); tripthru.Update(); Logger.EndRequest(null); MapTools.WriteGeoData(); System.Threading.Thread.Sleep(simInterval); tripthru.LogStats(); } Logger.Untab(); }
public void logic_tick() { //flush buffered spells BufferedSpells = new List <Spell>(); int castRange = MainSpell.CastRange; if (RechargeTime >= MaxRechargeTime) { for (int i = -castRange; i <= castRange; i++) { for (int j = castRange - Mathf.Abs(i); j >= -(castRange - Mathf.Abs(i)); j--) { if (!MapTools.IsOutOfBounds(Map_position_x + i, Map_position_y + j) && GameTools.Map.map_unit_occupy[Map_position_x + i, Map_position_y + j] != null) { MainSpell.loadInfo(new int[2] { Map_position_x, Map_position_y }, new int[2] { Map_position_x + i, Map_position_y + j }); ProjectileManager.getInstance().queueProjectile(MainSpell, game_object.transform.position, GameTools.Map.map_unit_occupy[Map_position_x + i, Map_position_y + j].game_object.transform.position); RechargeTime = 0; i = castRange + 1; j = castRange + 1; break; } } } } RechargeTime++; }
private void DrawLine(PointLatLng latlng) { //UnityEngine.Debug.Log("draw line " + latlng); if (m_currentRoute == null) { UnityEngine.Debug.Log("create line " + latlng); string handleName = MapTools.CreateMapName(MapLayer.Line); m_currentPoints.Clear(); m_currentPoints.Add(latlng); m_currentRoute = new GMapRoute(m_currentPoints, handleName); m_currentRoute.Stroke = new Pen(Color.Yellow, 3); m_mapLayers[MapLayer.Line].Routes.Add(m_currentRoute); if (GameEvent.MapEvent.OnAddRoute != null) { GameEvent.MapEvent.OnAddRoute(handleName, MapLayer.Line, m_currentRoute); } } else { m_currentRoute.Points.Add(latlng); //m_currentRoute. m_map.UpdateRouteLocalPosition(m_currentRoute); m_map.Refresh(); } }
static void Main(string[] args) { List <PartnerConfiguration> partnerConfigurations = GetPartnersConfigurations(); foreach (var partnerConfiguration in partnerConfigurations) { foreach (var possibleTrip in partnerConfiguration.Fleets.ElementAt(0).PossibleTrips) { MapTools.GetRoute(possibleTrip.Start, possibleTrip.End); } } var routesString = JsonConvert.SerializeObject(MapTools.routes); var locationNamesString = JsonConvert.SerializeObject(MapTools.locationNames); var locationAddresses = JsonConvert.SerializeObject(MapTools.locationAddresses); File.WriteAllText(@"App_Data\Geo-Routes.txt", String.Empty); using (StreamWriter sr = new StreamWriter(@"App_Data\Geo-Routes.txt")) { string routesJson = JsonConvert.SerializeObject(routesString); sr.Write(routesJson); } int ocho = 9; }
protected override async void OnClick() { try { Module1.Current.MapFinishedLoading = false; Layout oLayout = await MapTools.GetDefaultLayoutAsync(Constants.MAPS_AOI_LOCATION_LAYOUT); if (oLayout != null) { foreach (var pane in FrameworkApplication.Panes) { if (!(pane is ILayoutPane layoutPane)) //if not a layout view, continue to the next pane { continue; } if (layoutPane.LayoutView.Layout == oLayout) //if there is a match, activate the view { (layoutPane as Pane).Activate(); } } } Module1.Current.MapFinishedLoading = true; Module1.Current.DisplayedMap = Constants.FILE_EXPORT_MAP_AOI_LOCATION_PDF; } catch (Exception e) { MessageBox.Show("Unable to display AOI location map!!" + e.Message, "BAGIS-PRO"); } }
private void DrawArea(PointLatLng latlng) { //UnityEngine.Debug.Log("draw line " + latlng); if (m_currentPolygon == null) { UnityEngine.Debug.Log("create area " + latlng); string handleName = MapTools.CreateMapName(MapLayer.Area); m_currentPoints.Clear(); m_currentPoints.Add(latlng); m_currentPolygon = new GMapPolygon(m_currentPoints, handleName); m_currentPolygon.Fill = new Alt.Sketch.SolidColorBrush(Color.FromArgb(50, Color.Red)); m_currentPolygon.Stroke = new Pen(Color.Blue, 2); m_currentPolygon.IsHitTestVisible = true; if (GameEvent.MapEvent.OnAddRoute != null) { GameEvent.MapEvent.OnAddRoute(handleName, MapLayer.Area, m_currentPolygon); } m_mapLayers[MapLayer.Area].Polygons.Add(m_currentPolygon); } else { m_currentPolygon.Points.Add(latlng); m_map.UpdatePolygonLocalPosition(m_currentPolygon); m_map.Refresh(); } }
static float GetLineThroughProvinceColorDistance( int resolution, Texture2D provinceTex, Vector2Int[] lineSamples, Color32 operativeColorID) { Vector2Int firstEdge = Vector2Int.zero; Vector2Int secondEdge = Vector2Int.zero; bool foundFirstEdge = false; //Raycast both lines to determine which is longer. //raycast horizontal for (int i = 0; i < resolution; i++) { //See if PixelsXInt contains the operative sampleX Color32 col = provinceTex.GetPixel(lineSamples[i].x, lineSamples[i].y); if (MapTools.ColorIDEquals(col, operativeColorID)) { if (foundFirstEdge) { secondEdge = lineSamples[i]; } else { firstEdge = lineSamples[i]; foundFirstEdge = true; } } } return(Vector2Int.Distance(firstEdge, secondEdge)); }
public override Gateway.QuoteTripResponse QuoteTrip(Gateway.QuoteTripRequest request) { Logger.BeginRequest("QuoteTrip received from " + tripthru.name, request); Gateway.QuoteTripResponse response = null; { // TDispatch requires that we supply the string address and postal code in addition to the Lng/Lat coordinates Pair <string, string> pickup_address = MapTools.GetReverseGeoLocAddress(request.pickupLocation); Pair <string, string> dropoff_address = MapTools.GetReverseGeoLocAddress(request.dropoffLocation); TDispatchAPI.GetFareRequest createRequest = new TDispatchAPI.GetFareRequest { payment_method = "cash", pickup_location = new TDispatchAPI.Location { lat = request.pickupLocation.Lat, lng = request.pickupLocation.Lng }, pickup_time = request.pickupTime.ToString("yyyy-MM-dd'T'HH:mm:ssK", DateTimeFormatInfo.InvariantInfo), dropoff_location = new TDispatchAPI.Location { lat = request.dropoffLocation.Lat, lng = request.dropoffLocation.Lng } }; // TODO: replace with POST /locations/fare TDispatchAPI.GetFareResponse createResponse = api.GetFare(createRequest); List <Quote> quotes = new List <Quote>(); var price = 0.0; try { price = double.Parse(createResponse.fare.formatted_total_cost.Replace("$", "")); } catch (Exception e) { } quotes.Add(new Quote(partnerID: ID, partnerName: name, fleetID: ID, fleetName: name, price: price, ETA: DateTime.UtcNow + new TimeSpan(1, 0, createResponse.fare.time_to_wait))); response = new Gateway.QuoteTripResponse(quotes, Result.OK); } Logger.EndRequest(response); return(response); }
public bool IsPlacedOnLand(int x, int y) { if (MapTools.IsOutOfBounds(x, y)) { return(false); } for (int k = -1; k < 2; k++) { for (int l = -1; l < 2; l++) { if (MapTools.IsOutOfBounds(x + k, y + l)) { return(false); } if (!TileTools.IsLand(GameTools.Map.TileMapData[x + k, y + l])) { return(false); } else { } } } return(true); }
void actionFollowRunning() { List <Entity> neighbourhood = new List <Entity>(); for (int i = -temp; i <= temp; i++) { for (int j = -temp; j <= temp; j++) { if (!MapTools.IsOutOfBounds(unit.Map_position_x + i, unit.Map_position_y + j)) { if (GameTools.Map.map_unit_occupy[unit.Map_position_x + i, unit.Map_position_y + j] == unit) { continue; } if (GameTools.Map.map_unit_occupy[unit.Map_position_x + i, unit.Map_position_y + j] != null) { if (((Unit)GameTools.Map.map_unit_occupy[unit.Map_position_x + i, unit.Map_position_y + j]).IsAggroed) { unit.IsAggroed = true; } neighbourhood.Add(GameTools.Map.map_unit_occupy[unit.Map_position_x + i, unit.Map_position_y + j]); } } } } unit.MoveWithNeighbours(neighbourhood); }
public static async Task Toggle(BagisMapType mapType) { //Get map definition BA_Objects.MapDefinition thisMap = MapTools.LoadMapDefinition(mapType); // toggle layers according to map definition var allLayers = MapView.Active.Map.Layers.ToList(); await QueuedTask.Run(() => { foreach (var layer in allLayers) { if (thisMap.LayerList.Contains(layer.Name)) { layer.SetVisibility(true); } else { layer.SetVisibility(false); } } }); Layout layout = await MapTools.GetDefaultLayoutAsync(Constants.MAPS_DEFAULT_LAYOUT_NAME); await MapTools.UpdateMapElementsAsync(layout, Module1.Current.Aoi.Name.ToUpper(), thisMap); await MapTools.UpdateLegendAsync(layout, thisMap); Module1.Current.DisplayedMap = thisMap.PdfFileName; }
static void Main(string[] args) { List <PartnerConfiguration> partnerConfigurations = GetPartnersConfigurations(); foreach (var partnerConfiguration in partnerConfigurations) { foreach (var possibleTrip in partnerConfiguration.Fleets.ElementAt(0).PossibleTrips) { MapTools.GetRoute(possibleTrip.Start, possibleTrip.End); } } }
private void DetonateNeighbours() { int newX, newY; newX = x + 1; newY = y; if (!MapTools.IsOutOfBounds(newX, newY)) { if (GameTools.Map.TrapData[newX, newY].Count > 0) { if (GameTools.Map.TrapData[newX, newY][0].spell.SpellColour == this.spell.SpellColour) { GameTools.Map.TrapData[newX, newY][0].Detonate(); } } } newX = x - 1; newY = y; if (!MapTools.IsOutOfBounds(newX, newY)) { if (GameTools.Map.TrapData[newX, newY].Count > 0) { if (GameTools.Map.TrapData[newX, newY][0].spell.SpellColour == this.spell.SpellColour) { GameTools.Map.TrapData[newX, newY][0].Detonate(); } } } newX = x; newY = y + 1; if (!MapTools.IsOutOfBounds(newX, newY)) { if (GameTools.Map.TrapData[newX, newY].Count > 0) { if (GameTools.Map.TrapData[newX, newY][0].spell.SpellColour == this.spell.SpellColour) { GameTools.Map.TrapData[newX, newY][0].Detonate(); } } } newX = x; newY = y - 1; if (!MapTools.IsOutOfBounds(newX, newY)) { if (GameTools.Map.TrapData[newX, newY].Count > 0) { if (GameTools.Map.TrapData[newX, newY][0].spell.SpellColour == this.spell.SpellColour) { GameTools.Map.TrapData[newX, newY][0].Detonate(); } } } }
static void Main(string[] args) { List <PartnerConfiguration> partnerConfigurations = GetPartnersConfigurations(); foreach (var partnerConfiguration in partnerConfigurations) { foreach (var possibleTrip in partnerConfiguration.Fleets.ElementAt(0).PossibleTrips) { MapTools.GetRoute(possibleTrip.Start, possibleTrip.End); } } var routesString = JsonConvert.SerializeObject(MapTools.routes); }
public void SetUp() { Logger.OpenLog("Nunit", splunkEnabled: false); MapTools.ClearCache(); Logger.Log("Setting up"); Logger.Tab(); MapTools.distance_and_time_scale = .05; MapTools.SetGeodataFilenames(locationNames: "Test_GeoData/Geo-Location-Names.csv", routes: "Test_GeoData/Geo-Routes.csv", locationAddresses: "Test_GeoData/Geo-Location-Addresses.csv"); MapTools.LoadGeoData(); Logger.Untab(); }
public Location(double lat, double lng, string address = null) { this.Lng = lng; this.Lat = lat; if (address == null) { this.Address = MapTools.GetReverseGeoLoc(this); } else { this.Address = address; } }
/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Constructor. /// </summary> public MapControl() { InitializeComponent(); MapLayersWidget.ActiveBaseLayerChanged += new RoutedEventHandler(MapLayersWidget_ActiveBaseLayerChanged); _mapTips = new MapTips(); _tools = new MapTools(this, toolPanel); _clustering = new Clustering(this); _mapSelectionManager = new MapSelectionManager(this, _clustering, _objectLayers); _mapEventsManager = new MapEventsManager(this, _mapSelectionManager, _clustering, _tools, _mapTips); _mapExtentManager = new MapExtentManager(this, _clustering, _mapSelectionManager); }
private void ValidNeighbour(int[,] Map_data_passable, CheckPassable isPassable, GraphNode neighbour, PriorityListWrapper <GraphNode> openSet, HashSet <GraphNode> closedSet) { if (!MapTools.IsOutOfBounds(neighbour.x, neighbour.y) && isPassable(Map_data_passable[neighbour.x, neighbour.y]) && !closedSet.Contains(neighbour) && !openSet.Contains(neighbour)) { openSet.Push(neighbour); } }
static void Main() { var partnerConfigurations = GetPartnersConfigurations(); using (var sr = new StreamReader("App_Data\\Geo-Routes.txt")) { var lines = sr.ReadToEnd(); MapTools.routes = JsonConvert.DeserializeObject <Dictionary <string, Route> >(lines) ?? new Dictionary <string, Route>(); } using (var sr = new StreamReader("App_Data\\Geo-Location-Names.txt")) { var lines = sr.ReadToEnd(); MapTools.locationNames = JsonConvert.DeserializeObject <Dictionary <string, string> >(lines) ?? new Dictionary <string, string>(); } using (var sr = new StreamReader("App_Data\\Geo-Location-Addresses.txt")) { var lines = sr.ReadToEnd(); MapTools.locationAddresses = JsonConvert.DeserializeObject <Dictionary <string, Pair <string, string> > >(lines) ?? new Dictionary <string, Pair <string, string> >(); } foreach (var possibleTrip in partnerConfigurations.SelectMany(partnerConfiguration => partnerConfiguration.Fleets.ElementAt(0).PossibleTrips)) { MapTools.GetRoute(possibleTrip.Start, possibleTrip.End); } var routesString = JsonConvert.SerializeObject(MapTools.routes); var locationNamesString = JsonConvert.SerializeObject(MapTools.locationNames); var locationAddresses = JsonConvert.SerializeObject(MapTools.locationAddresses); File.WriteAllText("App_Data\\Geo-Routes.txt", String.Empty); using (var sr = new StreamWriter("App_Data\\Geo-Routes.txt")) { sr.Write(routesString); } File.WriteAllText("App_Data\\Geo-Location-Names.txt", String.Empty); using (var sr = new StreamWriter("App_Data\\Geo-Location-Names.txt")) { sr.Write(locationNamesString); } File.WriteAllText("App_Data\\Geo-Location-Addresses.txt", String.Empty); using (var sr = new StreamWriter("App_Data\\Geo-Location-Addresses.txt")) { sr.Write(locationAddresses); } }
private void StartSimulation() { try { Console.WriteLine(_partner.name + ": sim start"); Logger.OpenLog(_partner.name); Logger.Disable(); //Logger.OpenLog(_partner.name, "c:\\Users\\Edward\\"); Logger.BeginRequest("Simulation started", null); Logger.Log("Sim Configuration"); _partner.Log(); Logger.Log("Simulation started at " + DateTime.UtcNow); Logger.EndRequest(null); var interval = new TimeSpan(0, 0, _configuration.SimInterval); _partner.tripthru.RegisterPartner( new Gateway.RegisterPartnerRequest(_configuration.Partner.ClientId, _configuration.Partner.Name, _configuration.Partner.CallbackUrl ?? _configuration.Partner.CallbackUrlMono, _configuration.Partner.AccessToken)); var lastHealthCheck = DateTime.UtcNow; Thread.Sleep(new TimeSpan(0, 3, 0)); //This Sleep to give other partners time to initialize Console.WriteLine("Simulation Start."); while (true) { try { lock (_partner) { _partner.Update(); if (DateTime.UtcNow > lastHealthCheck + new TimeSpan(0, 1, 0)) { _partner.HealthCheck(); lastHealthCheck = DateTime.UtcNow; } } MapTools.WriteGeoData(); } catch (Exception e) { Logger.LogDebug(_partner.name + ", simulation cycle error :" + e.Message, e.StackTrace); } System.Threading.Thread.Sleep(interval); } } catch (Exception e) { Logger.LogDebug(_partner.name + ", simulation start error :" + e.Message, e.StackTrace); } }
public void MoveRandomly() { int newX = 0, newY = 0; list_directions = new List <Direction>(); for (int i = 0; i < 10; i++) { Direction d = (Direction)Random.Range(1, 5); switch (d) { case Direction.Right: newX = Map_position_x + 1; newY = Map_position_y; break; case Direction.Left: newX = Map_position_x - 1; newY = Map_position_y; break; case Direction.Up: newX = Map_position_x; newY = Map_position_y + 1; break; case Direction.Down: newX = Map_position_x; newY = Map_position_y - 1; break; default: Debug.LogError("Defaulted"); break; } if (!MapTools.IsOutOfBounds(newX, newY) && (GameTools.Map.map_unit_occupy[newX, newY] == null && (GameTools.Player.Map_position_x != newX || GameTools.Player.Map_position_y != newY) && TileTools.IsLand(GameTools.Map.TileMapData[newX, newY]))) { list_directions.Add(d); GameTools.Map.map_unit_occupy[Map_position_x, Map_position_y] = null; GameTools.Map.map_unit_occupy[newX, newY] = this; Map_position_x = newX; Map_position_y = newY; break; } } }
protected async override void OnClick() { string tempAoiPath = "C:\\Docs\\animas_AOI_prms"; try { await MapTools.DisplayMaps(tempAoiPath); Module1.Current.DisplayedMap = Constants.FILE_EXPORT_MAP_ELEV_PDF; Module1.ToggleState("BtnMapLoad_State"); } catch (Exception e) { MessageBox.Show("An error occurred while trying to load the maps!! " + e.Message, "BAGIS PRO"); } }
public override Gateway.DispatchTripResponse DispatchTrip(Gateway.DispatchTripRequest request) { Logger.BeginRequest("DispatchTrip recieved from " + tripthru.name, request, request.tripID); Gateway.DispatchTripResponse response = null; { // TDispatch requires that we supply the string address and postal code in addition to the Lng/Lat coordinates Pair <string, string> pickup_address = MapTools.GetReverseGeoLocAddress(request.pickupLocation); Pair <string, string> dropoff_address = MapTools.GetReverseGeoLocAddress(request.dropoffLocation); TDispatchAPI.CreateBookingRequest createRequest = new TDispatchAPI.CreateBookingRequest { passenger = api.passengerProxyPK, customer_name = request.passengerName, luggage = 1, passengers = 1, payment_method = "cash", pickup_location = new TDispatchAPI.Address { address = pickup_address.First, location = new TDispatchAPI.Location { lat = request.pickupLocation.Lat, lng = request.pickupLocation.Lng }, postcode = pickup_address.Second }, pickup_time = request.pickupTime.ToString("yyyy-MM-dd'T'HH:mm:ssK", DateTimeFormatInfo.InvariantInfo), dropoff_location = new TDispatchAPI.Address { address = dropoff_address.First, location = new TDispatchAPI.Location { lat = request.dropoffLocation.Lat, lng = request.dropoffLocation.Lng }, postcode = dropoff_address.Second }, status = "incoming", pre_paid = false }; TDispatchAPI.CreateBookingResponse createResponse = api.CreateBooking(createRequest); if (createResponse.booking.pk == null) { throw new Exception("Fatal Error: null booking pk"); } activeTrips.Add(request.tripID, createResponse.booking); // TODO: need to clean these up later response = new Gateway.DispatchTripResponse(createResponse.status_code == 200 ? Result.OK : Result.UnknownError); } Logger.EndRequest(response); return(response); }
public object Any(InitGateway request) { try { Logger.OpenLog("TripThruGateway"); StorageManager.OpenStorage(new SqliteStorage("~/../../Db/db.sqlite".MapHostAbsolutePath())); PartnerAccount partnerAccount = new PartnerAccount { UserName = "******", Password = "******", Email = "", AccessToken = "iUaySN4P1v3a1m5kQ3K1XvCIa8NkV1Psr", RefreshToken = "", ClientId = "*****@*****.**", ClientSecret = "", TripThruAccessToken = "" }; StorageManager.CreatePartnerAccount(partnerAccount); GatewayService.gateway = new TripThru(); //Logger.OpenLog("TripThruGateway", "c:\\Users\\Edward\\"); foreach (PartnerAccount account in StorageManager.GetPartnerAccounts()) { if (account.CallbackUrl != null && account.PartnerName != null) { GatewayService.gateway.RegisterPartner( new GatewayClient( account.ClientId, account.PartnerName, account.TripThruAccessToken, account.CallbackUrl ) ); } } MapTools.SetGeodataFilenames("~/App_Data/Geo-Location-Names.csv".MapHostAbsolutePath(), "~/App_Data/Geo-Routes.csv".MapHostAbsolutePath(), "~/App_Data/Geo-Location-Addresses.csv".MapHostAbsolutePath()); MapTools.LoadGeoData(); } catch (Exception e) { Console.WriteLine(e.StackTrace); } return(new InitGatewayResponse()); }
public static async Task ToggleAsync(BagisMapType mapType) { //Get map definition BA_Objects.MapDefinition thisMap = MapTools.LoadMapDefinition(mapType); Layout oLayout = await MapTools.GetDefaultLayoutAsync(Constants.MAPS_DEFAULT_LAYOUT_NAME); if (oLayout != null) { foreach (var pane in FrameworkApplication.Panes) { if (!(pane is ILayoutPane layoutPane)) //if not a layout view, continue to the next pane { continue; } if (layoutPane.LayoutView.Layout == oLayout) //if there is a match, activate the view { (layoutPane as Pane).Activate(); } } } // toggle layers according to map definition Module1.Current.MapFinishedLoading = false; var allLayers = MapView.Active.Map.Layers.ToList(); await QueuedTask.Run(() => { foreach (var layer in allLayers) { if (thisMap.LayerList.Contains(layer.Name)) { layer.SetVisibility(true); } else { layer.SetVisibility(false); } } }); await MapTools.UpdateMapElementsAsync(Module1.Current.Aoi.NwccName.ToUpper(), thisMap); BA_ReturnCode success = await MapTools.UpdateLegendAsync(oLayout, thisMap.LegendLayerList); Module1.Current.MapFinishedLoading = true; Module1.Current.DisplayedMap = thisMap.PdfFileName; }
protected override async void OnClick() { try { Module1.Current.MapFinishedLoading = false; int idxSQ4 = 3; string strAnalysisGdb = GeodatabaseTools.GetGeodatabasePath(Module1.Current.Aoi.FilePath, GeodatabaseNames.Analysis); await MapTools.UpdateMapAsync(strAnalysisGdb, Constants.FILES_SEASON_PRECIP_CONTRIB[idxSQ4], Module1.Current.DisplayedSeasonalPrecipContribMap, Constants.LAYER_NAMES_SEASON_PRECIP_CONTRIB[idxSQ4], "SEASONAL PRECIP CONTRIBUTION: SEP, OCT, & NOV", "% Annual Precipitation", true, Constants.FILE_EXPORT_MAPS_SEASONAL_PRECIP_CONTRIB[idxSQ4]); Module1.Current.MapFinishedLoading = true; } catch (Exception e) { MessageBox.Show("Unable to display Seasonal Precipitation Q4 map!!" + e.Message, "BAGIS-PRO"); } }
public object Any(IReturn <InitPartner> request) { MapTools.SetGeodataFilenames("~/App_Data/Geo-Location-Names.csv".MapHostAbsolutePath(), "~/App_Data/Geo-Routes.csv".MapHostAbsolutePath(), "~/App_Data/Geo-Location-Addresses.csv".MapHostAbsolutePath()); MapTools.LoadGeoData(); MapTools.WriteGeoData(); PartnerConfiguration configuration = TripThruCore.Partner.LoadPartnerConfigurationFromJsonFile("~/PartnerConfiguration.txt".MapHostAbsolutePath()); TripThruCore.Partner partner = new TripThruCore.Partner(configuration.Partner.ClientId, configuration.Partner.Name, new GatewayClient("TripThru", "TripThru", configuration.Partner.AccessToken, configuration.TripThruUrl ?? configuration.TripThruUrlMono), configuration.partnerFleets); GatewayService.gateway = partner; MapTools.WriteGeoData(); var sim = new SimulationThread(partner, configuration); return(new InitPartnerResponse()); }
public void InitGateway() { try { var configuration = JsonSerializer.DeserializeFromString <HostConfiguration>( File.ReadAllText("~/HostConfig.txt".MapHostAbsolutePath())); if (configuration.debug) { //StorageManager.OpenStorage(new SqliteStorage("~/../../Db/db.sqlite".MapHostAbsolutePath())); StorageManager.OpenStorage(new MongoDbStorage("mongodb://192.168.0.104:27017/", "TripThru")); } else { StorageManager.OpenStorage(new MongoDbStorage("mongodb://SG-TripThru-3328.servers.mongodirector.com:27017/", "TripThru")); } var accounts = StorageManager.GetPartnerAccounts(); Logger.OpenLog("TripThruGateway"); GatewayService.gateway = new TripThru(); foreach (var account in accounts) { if (Storage.UserRole.partner == account.Role && account.CallbackUrl != null && account.PartnerName != null && account.TripThruAccessToken != null && account.ClientId != null) { GatewayService.gateway.RegisterPartner( new GatewayClient( account.ClientId, account.PartnerName, account.CallbackUrl, account.TripThruAccessToken ) ); } } MapTools.SetGeodataFilenames("~/App_Data/Geo-Location-Names.txt".MapHostAbsolutePath(), "~/App_Data/Geo-Routes.txt".MapHostAbsolutePath(), "~/App_Data/Geo-Location-Addresses.txt".MapHostAbsolutePath()); MapTools.LoadGeoData(); } catch (Exception e) { Console.WriteLine(e.StackTrace); } }