private void SetMarkers(Point p) { GameMap.MapCell cell = PointToCell(p); if (CellOnBoard(cell)) { List <GameMap.MapCell> list = PointToCellArray(p, brushSize); foreach (var c in list) { if (CellOnBoard(c)) { if (eraseMode) { map.DeleteAllMarkers(c); } else { GameMap.Marker marker = new GameMap.Marker(); marker.Style = markerStyle; marker.Color = markerColor; map.SetMarker(c, marker); } } } map.SaveMap(false); map.FireFogOrMarkerChanged(); } }
public Geometry CreateMarkerPath(int index, GameMap.Marker marker) { GameMap map = (GameMap)DataContext; if (map != null) { GameMap.MapCell cell = map.IndexToCell(index); Rect rect = CellRect(cell); double penWidth = CurrentScale; switch (marker.Style) { case GameMap.MarkerStyle.Square: return(rect.RectanglePath(penWidth)); case GameMap.MarkerStyle.Circle: Rect cicleRect = rect; cicleRect.ScaleCenter(.9, .9); return(rect.CirclePath(penWidth)); case GameMap.MarkerStyle.Diamond: return(rect.DiamondPath(penWidth)); case GameMap.MarkerStyle.Target: return(rect.TargetPath(penWidth)); case GameMap.MarkerStyle.Star: return(rect.StarPath(0)); } } return(null); }
public void DrawMarker(DrawingContext context, int index, GameMap.Marker marker) { GameMap map = (GameMap)DataContext; if (map != null) { GameMap.MapCell cell = map.IndexToCell(index); Rect rect = CellRect(cell); Color brushColor = marker.Color; brushColor.A = (byte)(brushColor.A / 2); double penWidth = Math.Min(UseCellSize.Width, UseCellSize.Height) / 25.0; Brush b = new SolidColorBrush(brushColor); Pen p = new Pen(new SolidColorBrush(marker.Color), penWidth); context.DrawGeometry(b, p, CreateMarkerPath(index, marker)); } }