private Map GetMap(string map) { string[] lines = map.Split(new char[] { '\n', '\r' }); Map mapObject = new Models.Map(); int rowNumber = 0; foreach (var line in lines) { int columnNumber = 0; foreach (var column in line) { if (column == 'A') { mapObject.StartingPoint = new Models.Point(columnNumber, rowNumber, column); mapObject.CurrentPoint = new Models.Point(columnNumber, rowNumber, column); } else if (column == 'B') { mapObject.EndPoint = new Models.Point(columnNumber, rowNumber, column); } mapObject.Grid.Add(new Point(columnNumber, rowNumber, column)); columnNumber++; } mapObject.MaximumX = columnNumber; rowNumber++; } mapObject.MaximumY = rowNumber; return(mapObject); }
public ActionResult Index() { ViewBag.Title = "Interactive Map Page"; var db = new ApplicationDbContext(); var measureService = new MeasureService(db); var listMarker = new List <Marker>(); db.ProductionUnits.Include(p => p.owner).ToList().ForEach(p => listMarker.Add(new Marker(p.locationLatitude, p.locationLongitude, String.Format("{0} </br> start since {1}", p.info, p.startDate.ToShortDateString())) { shape = "redMarker" })); var map = new Models.Map() { Name = "map", CenterLatitude = 46.094602, CenterLongitude = 10.998050, Zoom = 4, TileUrlTemplate = "http://#= subdomain #.tile.openstreetmap.org/#= zoom #/#= x #/#= y #.png", TileSubdomains = new string[] { "a", "b", "c" }, TileAttribution = "© <a href='http://osm.org/copyright'>OpenStreetMap contributors</a>", Markers = listMarker }; return(View(map)); }
//public RelayCommand AddMarkFromDeviceCommand //{ // get // { // return addMarkFromDeviceCommand ?? // (addMarkFromDeviceCommand = new RelayCommand((o) => // { // AddMarkFromDeviceCommandMethod(); // } // )); // } //} public void AddMarkCommandMethod() { Models.Mark mark = new Models.Mark(); mark.MarkNumber = CurrnetMarks.Count > 0 ? CurrnetMarks.Last().MarkNumber + 1 : 1; ViewModels.AddMarkViewModel addMarkViewModel = new AddMarkViewModel(mark); addMarkViewModel.CurrentRoute = CurrentRoute; Views.AddMarkView addMarkView = new Views.AddMarkView(addMarkViewModel); MakeLogEntry(8, null, null, "open AddMark. Start adding mark"); if ((bool)addMarkView.ShowDialog()) { Models.Mark mark_to_base = Models.Mark.GetCopyOfMark(addMarkViewModel.CurrentMark); AddEntry <Models.Mark>(mark_to_base); CurrnetMarks.Add(mark_to_base); Models.Map map = new Models.Map() { MarkId = mark_to_base.Id, CoordX = 0, CoordY = 0, DefaultHeight = 0, DefaultWidth = 0 }; AddEntry <Models.Map>(map); UpdateMapVisual(); } else { MakeLogEntry(8, null, null, "open AddMark. Cancel adding mark"); } }
public void drawFFXIVCoordDot(int x, int y, System.Drawing.Color color, int territoryId) { Models.Map myMap = Globals.exdreader.GetMap(territoryId); if (myMap != null) { int a = (mapPictureBox.Height / 2) + (x / (System.Convert.ToInt32(myMap.sizeFactor) / 100)); int b = (mapPictureBox.Height / 2) + (y / (System.Convert.ToInt32(myMap.sizeFactor) / 100)); System.Drawing.Graphics graphics = mapPictureBox.CreateGraphics(); System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle( a, b, 7, 7); graphics.FillEllipse(new System.Drawing.SolidBrush(color), rectangle); } }
public static Models.Map GetCopyOfMark(Models.Map entry_to_copy) { return(new Models.Map() { Id = entry_to_copy.Id, CoordX = entry_to_copy.CoordX, CoordY = entry_to_copy.CoordY, DefaultHeight = entry_to_copy.DefaultHeight, DefaultWidth = entry_to_copy.DefaultWidth, MapImage = entry_to_copy.MapImage, MarkId = entry_to_copy.MarkId, Mark = entry_to_copy.Mark, MarkColor = entry_to_copy.MarkColor }); }
public override async Task GenerateContent() { await Task.Factory.StartNew(() => { List<Models.Map> maps = new List<Models.Map>(); foreach (Demo demo in Demos) { Models.Map currentMap = new Models.Map { Name = demo.MapName }; if (maps.Contains(currentMap)) { Models.Map map = maps.First(m => m.Equals(currentMap)); UpdateMapStats(demo, map); } else { UpdateMapStats(demo, currentMap); maps.Add(currentMap); } } int rowCount = 1; foreach (Models.Map map in maps) { IRow row = Sheet.CreateRow(rowCount++); int columnNumber = 0; SetCellValue(row, columnNumber++, CellType.String, map.Name); SetCellValue(row, columnNumber++, CellType.String, map.MatchCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.RoundCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.WinCounterTerroritsCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.WinTerroristCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.WinPistolRoundCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.WinEcoRoundCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.WinSemiEcoCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.WinForceBuyCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.BombPlantedCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.BombDefusedCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.BombExplodedCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.BombPlantedOnACount); SetCellValue(row, columnNumber, CellType.Numeric, map.BombPlantedOnBCount); } }); }
public override async Task GenerateContent() { await Task.Factory.StartNew(() => { List <Models.Map> maps = new List <Models.Map>(); foreach (Demo demo in Demos) { Models.Map currentMap = new Models.Map { Name = demo.MapName }; if (maps.Contains(currentMap)) { Models.Map map = maps.First(m => m.Equals(currentMap)); UpdateMapStats(demo, map); } else { UpdateMapStats(demo, currentMap); maps.Add(currentMap); } } int rowCount = 1; foreach (Models.Map map in maps) { IRow row = Sheet.CreateRow(rowCount++); int columnNumber = 0; SetCellValue(row, columnNumber++, CellType.String, map.Name); SetCellValue(row, columnNumber++, CellType.String, map.MatchCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.RoundCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.WinCounterTerroritsCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.WinTerroristCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.WinPistolRoundCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.WinEcoRoundCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.WinSemiEcoCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.WinForceBuyCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.BombPlantedCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.BombDefusedCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.BombExplodedCount); SetCellValue(row, columnNumber++, CellType.Numeric, map.BombPlantedOnACount); SetCellValue(row, columnNumber, CellType.Numeric, map.BombPlantedOnBCount); } }); }
public void CreateMapTest() { //teCoria.PublicApi.Map map = new teCoria.PublicApi.Map(); //teCoria.InternalApi.CoriaMap cMap = new teCoria.InternalApi.CoriaMap(); //cMap = teCoria.InternalApi.CoriaDataService.CreateUpdateMap(cMap); kharta.coria.graphica.Models.Map map = new Models.Map(); Models.MapBook mapbook = new Models.MapBook(); using (kharta.coria.graphica.Models.KhartaDataModel dbcontext = new kharta.coria.graphica.Models.KhartaDataModel()) { mapbook = (from m in dbcontext.MapBooks where m.GroupId.Equals(8) select m).First(); } map.Title = "new test map"; map.Description = "description is not required, Title, MapId, MapTypeId are required"; map.MapId = Guid.NewGuid(); map.MapTypeId = mapbook.ApplicationId; map.CreateByUserId = 2100; map = te.extension.coria.InternalApi.CoriaDataService.CreateMap(map); Assert.IsTrue(map.Id > 0); }
public ObservableCollection <Models.Map> UpdateMapCollection() { ObservableCollection <Models.Map> observableCollectionForMap = new ObservableCollection <Models.Map>(); foreach (Models.Mark mark in CurrnetMarks) { Models.Map map = Maps.FirstOrDefault(o => o.MarkId == mark.Id); if (map == null) { map = new Models.Map() { MarkId = mark.Id, CoordX = 0, CoordY = 0, DefaultHeight = 0, DefaultWidth = 0 }; } observableCollectionForMap.Add(map); } return(observableCollectionForMap); }
private static void UpdateMapStats(Demo demo, Models.Map map) { map.MatchCount++; map.RoundCount += demo.Rounds.Count(); map.BombPlantedCount += demo.BombPlantedCount; map.BombDefusedCount += demo.BombDefusedCount; map.BombExplodedCount += demo.BombExplodedCount; foreach (Round round in demo.Rounds) { if (Properties.Settings.Default.SelectedStatsAccountSteamID != 0) { PlayerExtended player = demo.Players.FirstOrDefault(p => p.SteamId == Properties.Settings.Default.SelectedStatsAccountSteamID); if (player != null) { if (player.TeamName != round.WinnerName) { continue; } } } if (round.WinnerSide == Team.CounterTerrorist) { map.WinCounterTerroritsCount++; } if (round.WinnerSide == Team.Terrorist) { map.WinTerroristCount++; } if (round.SideTrouble != Team.Spectate) { switch (round.Type) { case RoundType.ECO: map.WinEcoRoundCount++; break; case RoundType.SEMI_ECO: map.WinSemiEcoCount++; break; case RoundType.FORCE_BUY: map.WinForceBuyCount++; break; case RoundType.PISTOL_ROUND: map.WinPistolRoundCount++; break; } } } foreach (BombPlantedEvent plantedEvent in demo.BombPlanted) { if (Properties.Settings.Default.SelectedStatsAccountSteamID != 0 && plantedEvent.PlanterSteamId != Properties.Settings.Default.SelectedStatsAccountSteamID) { continue; } if (plantedEvent.Site == "A") { map.BombPlantedOnACount++; } else { map.BombPlantedOnBCount++; } } }