/// <summary> /// MarkersGroup class constructor. /// </summary> /// <param name="_locations">Locations represented by map markers.</param> /// <param name="_markersColor">Color of the map markers.</param> /// <param name="_markersSize">Size of the map markers.</param> /// <param name="_markersLabel">Label of the map markers. Only {A-Z, 0-9} uppercase chars are allowed.</param> public MarkersGroup(List <Location> _locations, MarkerColor _markersColor, MarkerSize _markersSize, char _markersLabel) { locations = _locations; markersColor = _markersColor; markersSize = _markersSize; markersLabel = _markersLabel; }
public void AddImageMarker(MarkerColor color, bool isQueen = false) { if (color != MarkerColor.Undefined) { this.Children.Add(GetVisualHost(color, isQueen)); } }
public MapGoogleMarker(MapGooglePoint markerPoint, MarkerSize mSize, MarkerColor mColor) { this._markerPoint = markerPoint; this._markerSize = mSize; this._markerColor = mColor; this._markerStatus = MarkerStatus.psc; }
Bitmap Filter(Bitmap bitmap, MarkerColor color) { var filter = new ChannelFiltering(); filter.Red = filter.Green = filter.Blue = new IntRange(0, 0); switch (color) { case MarkerColor.Red: filter.Red = new IntRange(0, 255); break; case MarkerColor.Green: filter.Green = new IntRange(0, 255); break; case MarkerColor.Blue: filter.Blue = new IntRange(0, 255); break; case MarkerColor.White: filter.Red = new IntRange(0, 255); filter.Green = new IntRange(0, 255); filter.Blue = new IntRange(0, 255); break; default: throw new NotImplementedException(); } return(filter.Apply(bitmap)); }
public MapGoogleMarker(MapGooglePoint markerPoint, string label, MarkerColor mColor) { this._label = label; this._markerPoint = markerPoint; this._markerColor = mColor; this._markerStatus = MarkerStatus.plc; }
private static bool IsThereEnemyMark(Position position) { MarkerColor enemyColor = GetEnemyColor(); Cell cell = GetCell(position); return(cell != null && cell.Owner.Color == enemyColor); }
public Player(MarkerColor color, string name, bool isActive, int score = 0) { Name = name; IsActive = isActive; Score = score; Color = color; }
public static string GetMarkerPath(MarkerColor color, bool isQueen) { string markerName = isQueen ? (color == MarkerColor.White ? WhiteMarkerQueenName : BlackMarkerQueenName) : (color == MarkerColor.White ? WhiteMarkerName : BlackMarkerName); return(ResourcePath + markerName); }
private void MarkerSettingsControl_Load(object sender, EventArgs e) { _settingProperties = true; MarkerColor.Configure(); MarkerExtraColor.Configure(); MarkerExtraColor.ColorPicker.AutomaticColor = Color.Transparent; _settingProperties = false; }
private bool IsGameOver() { MarkerColor color = ActivePlayer.Color; bool isAnyEnemyMark = GameManager.GetAllCellsWithOwner().Any(); bool existStartBeatableCells = GameManager.PlayerCanBeat(); bool existStartGameableCells = GameManager.ExistStartGameableCells(); return(!isAnyEnemyMark || (!existStartBeatableCells && !existStartGameableCells)); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (Item != null) { hashCode = hashCode * 59 + Item.GetHashCode(); } if (Axis != null) { hashCode = hashCode * 59 + Axis.GetHashCode(); } if (Label != null) { hashCode = hashCode * 59 + Label.GetHashCode(); } if (Chart != null) { hashCode = hashCode * 59 + Chart.GetHashCode(); } if (Legend != null) { hashCode = hashCode * 59 + Legend.GetHashCode(); } if (Fill != null) { hashCode = hashCode * 59 + Fill.GetHashCode(); } if (LineColor != null) { hashCode = hashCode * 59 + LineColor.GetHashCode(); } if (LineWidth != null) { hashCode = hashCode * 59 + LineWidth.GetHashCode(); } if (LineStyle != null) { hashCode = hashCode * 59 + LineStyle.GetHashCode(); } if (MarkerColor != null) { hashCode = hashCode * 59 + MarkerColor.GetHashCode(); } if (MarkerSymbol != null) { hashCode = hashCode * 59 + MarkerSymbol.GetHashCode(); } if (RepeatTime != null) { hashCode = hashCode * 59 + RepeatTime.GetHashCode(); } return(hashCode); } }
public MarkerLabelStyle(string text, MarkerType type, MarkerColor color) { Text = text; BackColor = null; Halo = null; Offset = new Offset(type.size, 0, false); Font = markerFont; ForeColor = color.ToMapsuiColor(); HorizontalAlignment = LabelStyle.HorizontalAlignmentEnum.Left; }
public void AddMarker(Coordinates Center, MarkerColor color, MarkerSign sign) { StringBuilder l_sb = new StringBuilder(); l_sb.AppendFormat( "{0},{1},{2}{3}", Center.Latitude.ToString(), Center.Longitude.ToString(), color.ToString(), (sign == MarkerSign.none) ? string.Empty : sign.ToString() ); m_al_Markers.Add(l_sb.ToString()); }
private void GenerateMarker(Cell cell, int rowNumber) { if (rowNumber >= 0) { MarkerColor color = rowNumber < 3 ? MarkerColor.Black : rowNumber > 4 ? MarkerColor.White : MarkerColor.Undefined; cell.AddImageMarker(color); cell.Owner.Color = color; } else if (cell?.Owner?.Color != MarkerColor.Undefined) { cell.AddImageMarker(cell.Owner.Color, cell.Owner.IsQueen); } }
public Marker(PointLatLng pos, MarkerType type, MarkerColor color) { this.Position = pos; this.Type = type; this.Color = color; this.Text = string.Empty; this.TooltipMode = MarkerTooltipMode.OnMouseOver; this.Visible = true; this.CustomMarkerAlign = CustomMarkerAlign.MiddleMiddle; this.CustomMarkerCenter = Point.Empty; this.IsMouseOver = false; this.ToolTipOffset = new Point(14, -44); }
public async Task <int> GetBitmapId(MarkerType type, MarkerColor color) { var image = await GetImage(type, color); var content = new MemoryStream(image.Encode().ToArray()); int bitmapId; lock (BitmapRegistry.Instance) { bitmapId = BitmapRegistry.Instance.Register(content); } return(bitmapId); }
private VisualHost GetVisualHost(MarkerColor color, bool isQueen) { VisualHost visualHost = null; if (color != MarkerColor.Undefined) { string path = GameManager.GetMarkerPath(color, isQueen); DrawingVisual drawingVisual = new DrawingVisual(); DrawingContext drawingContext = drawingVisual.RenderOpen(); BitmapImage img = new BitmapImage(new Uri(path)); drawingContext.DrawImage(img, new Rect(4, 4, img.PixelWidth / 6, img.PixelHeight / 6)); drawingContext.Close(); visualHost = new VisualHost { Visual = drawingVisual, IsHitTestVisible = false }; } return(visualHost); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { MarkerColor color = (MarkerColor)value; Uri uri; switch (color) { case MarkerColor.Green: uri = new Uri("Resources/green.png"); break; case MarkerColor.Red: uri = new Uri("Resources/red.png"); break; //... default: uri = new Uri("Resources/default.png"); break; } return(new BitmapImage(uri)); }
public MapGoogleMarker(MapGooglePoint markerPoint, MarkerColor mColor) { this._markerPoint = markerPoint; this._markerColor = mColor; this._markerStatus = MarkerStatus.pc; }
public void AcceptAttributeMarkerColor(MarkerColor markerColor, PrintContext parameter) { parameter.WriteLine("Marker Color: {0}", markerColor.Color); }
public Task <SKImage> GetImage(MarkerType type, MarkerColor color) { lock (requests) { var path = $"{type.name}_{color?.name ?? ""}"; if (requests.ContainsKey(path)) { return(requests[path].completionSource.Task); } var request = new MarkerRequest { path = path, completionSource = new TaskCompletionSource <SKImage>() }; requests[path] = request; void ContinuationFunction(SKImage image) { if (color != null) { image = image.ApplyImageFilter( SkiaSharp.SKImageFilter.CreateColorFilter(SkiaSharp.SKColorFilter.CreateLighting(color.ToSKColor(), new SKColor(0, 0, 0))), new SkiaSharp.SKRectI(0, 0, image.Width, image.Height), new SkiaSharp.SKRectI(0, 0, image.Width, image.Height), out var outSUbs, out SKPoint outoffs ); } if (type.shadow) { image = image.ApplyImageFilter( SkiaSharp.SKImageFilter.CreateDropShadow(2, 2, 2, 2, SKColors.Black), new SkiaSharp.SKRectI(0, 0, image.Width, image.Height), new SkiaSharp.SKRectI(0, 0, image.Width, image.Height), out var outSUbs2, out SKPoint outoffs2 ); } request.completionSource.SetResult(image); } if (type.iconImage != null) { ContinuationFunction(type.iconImage); } else if (type.icon.StartsWith("#")) { var image = GenerateProcedural(type.icon); ContinuationFunction(image); } else { ImageDirectory.Instance.GetImage(type.icon) .ContinueWith( x => ContinuationFunction(x.Result)); } return(request.completionSource.Task); } }
void OnMarkerOnPropertyChangedIcon(object a, PropertyChangedEventArgs e) { if (e.PropertyName == nameof(ActiveMarker.text)) { this["Label"] = marker.text; //#TODO update Label style foreach (var label in Styles.Where(x => x is MarkerIconStyle)) { (label as MarkerIconStyle).text = marker.text; } DataHasChanged(); } else if (e.PropertyName == nameof(ActiveMarker.pos)) { Geometry = new Point(marker.pos[0], marker.pos[1]); DataHasChanged(); } else if (e.PropertyName == nameof(ActiveMarker.dir)) { foreach (var sym in Styles.Where(x => x is MarkerIconStyle)) //#TODO just store the style in a variable { (sym as MarkerIconStyle).SymbolRotation = marker.dir; } DataHasChanged(); } else if (e.PropertyName == nameof(ActiveMarker.type)) { MarkerIconStyle iconStyle = (MarkerIconStyle)Styles.First(x => x is MarkerIconStyle); if (iconStyle == null) { return; } if (!GameState.Instance.marker.markerTypes.ContainsKey(marker.type)) { return; } var markerType = GameState.Instance.marker.markerTypes[marker.type]; if (marker.color == "Default") { markerColor = new MarkerColor { color = markerType.color, name = markerType.name } } ; iconStyle.color = markerColor.ToSKColor(); iconStyle.typeSize = markerType.size; iconStyle.shadow = markerType.shadow; MarkerCache.Instance.GetImage(markerType, null) .ContinueWith((image) => { iconStyle.markerIcon = image.Result; }); DataHasChanged(); } else if (e.PropertyName == nameof(ActiveMarker.color)) { MarkerIconStyle iconStyle = (MarkerIconStyle)Styles.First(x => x is MarkerIconStyle); if (iconStyle == null) { return; } if (!GameState.Instance.marker.markerColors.ContainsKey(marker.color)) { return; } markerColor = GameState.Instance.marker.markerColors[marker.color]; if (marker.color == "Default") { if (!GameState.Instance.marker.markerTypes.ContainsKey(marker.type)) { return; } var markerType = GameState.Instance.marker.markerTypes[marker.type]; markerColor = new MarkerColor { color = markerType.color, name = markerType.name }; } iconStyle.color = markerColor.ToSKColor(); DataHasChanged(); } }
public Task <SKImage> GetImage(MarkerBrush brush, MarkerColor color) { lock (brushRequests) { var path = $"{brush.name}_{color?.name ?? ""}"; if (brushRequests.ContainsKey(path)) { return(brushRequests[path].completionSource.Task); } var request = new BrushRequest { path = path, completionSource = new TaskCompletionSource <SKImage>() }; brushRequests[path] = request; if (brush.texture == "") { brush.texture = "#(argb,8,8,3)color(0.5,0.5,0.5,0.5)"; } if (brush.texture.StartsWith("#")) { var bmp = GenerateProcedural(brush.texture); if (color != null) { bmp = bmp.ApplyImageFilter( SkiaSharp.SKImageFilter.CreateColorFilter( SkiaSharp.SKColorFilter.CreateLighting(color.ToSKColor(), new SKColor(0, 0, 0)) ), new SkiaSharp.SKRectI(0, 0, bmp.Width, bmp.Height), new SkiaSharp.SKRectI(0, 0, bmp.Width, bmp.Height), out var outSUbs, out SKPoint outoffs); } request.completionSource.SetResult(bmp); } else { ImageDirectory.Instance.GetImage(brush.texture) .ContinueWith( (x) => { var image = x.Result; if (color != null) { image = image.ApplyImageFilter( SkiaSharp.SKImageFilter.CreateColorFilter( SkiaSharp.SKColorFilter.CreateLighting(color.ToSKColor(), new SKColor(0, 0, 0)) ), new SkiaSharp.SKRectI(0, 0, image.Width, image.Height), new SkiaSharp.SKRectI(0, 0, image.Width, image.Height), out var outSUbs, out SKPoint outoffs); } request.completionSource.SetResult(image); }); } return(request.completionSource.Task); } }
private void DrawMarker(SKPaintSurfaceEventArgs e) { SKImageInfo info = e.Info; SKSurface surface = e.Surface; SKCanvas canvas = surface.Canvas; SKPoint center = new SKPoint(info.Width / 2, info.Height / 2); // draw live FixMaxMin(); float livePixelsYStart = info.Height + bottomFluidGlassCircleCenterY - bottomFluidGlassHullRadius - startMarkerDistance; float livePixelsYEnd = topFluidGlassCircleCenterY; // map real temp to pixels from marker start to end float temperatureY = Temperature.Map(MinTemperature, MaxTemperature, livePixelsYStart, livePixelsYEnd); int tempRange = Math.Abs(MinTemperature) + Math.Abs(MaxTemperature); int markerCount = tempRange / markerStep; float thermometerPixelHeight = livePixelsYStart - livePixelsYEnd; float pixelStep = thermometerPixelHeight / markerCount; float yMarkerStep = livePixelsYStart; SKPaint markerPaint = new SKPaint { IsAntialias = true, Style = SKPaintStyle.Fill, Color = MarkerColor.ToSKColor(), TextSize = 40, TextAlign = SKTextAlign.Center, }; for (int i = 0; i <= markerCount; i++) { SKRect marker = new SKRect { Left = center.X + (topFluidGlassWidth / 2) + markerOffsetX, Top = yMarkerStep + 2, Bottom = yMarkerStep - 2 }; marker.Right = marker.Left + 100; canvas.DrawRect(marker, markerPaint); canvas.DrawText((MinTemperature + (i * markerStep)).ToString(), marker.Right - 30, yMarkerStep - 10, markerPaint); yMarkerStep -= pixelStep; } SKPaint indicatorGeometryPaint = new SKPaint { IsAntialias = true, Style = SKPaintStyle.StrokeAndFill, Color = IndicatorColor.ToSKColor(), StrokeWidth = 6, }; SKPoint indicatorTextPosition = new SKPoint(center.X - indicatorOffset, (livePixelsYStart - (thermometerPixelHeight * indicatorPositionY))); SKPoint indicatorUnderlineStart = new SKPoint(indicatorTextPosition.X, indicatorTextPosition.Y); SKPoint indicatorUnderlineEnd = new SKPoint(indicatorTextPosition.X + 120, indicatorTextPosition.Y); SKPoint connectionLineStart = new SKPoint(indicatorUnderlineEnd.X, indicatorUnderlineEnd.Y); SKPoint connectionLineEnd = new SKPoint(center.X, temperatureY); SKPoint[] points = new SKPoint[] { indicatorUnderlineStart, indicatorUnderlineEnd, connectionLineStart, connectionLineEnd, }; canvas.DrawPoints(SKPointMode.Lines, points, indicatorGeometryPaint); canvas.DrawCircle(center.X, temperatureY, 10, indicatorGeometryPaint); SKPaint indicatorTextPaint = new SKPaint { IsAntialias = true, Style = SKPaintStyle.StrokeAndFill, Color = IndicatorTextColor.ToSKColor(), TextSize = 50, TextAlign = SKTextAlign.Left, }; canvas.DrawText(Temperature.ToString("0.00"), indicatorTextPosition.X, indicatorTextPosition.Y - 10, indicatorTextPaint); }
public virtual void AcceptAttributeMarkerColor(MarkerColor markerColor, T parameter) { // intentionally left blank }
private void OnMarkerOnPropertyChangedTiled(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == nameof(ActiveMarker.text)) { this["Label"] = marker.text; } else if (e.PropertyName == nameof(ActiveMarker.pos)) { TiledBitmapStyle iconStyle = (TiledBitmapStyle)Styles.First(x => x is TiledBitmapStyle); //#TODO make interface for both styles with setters for pos/dir/color/stuff if (iconStyle == null) { return; } CultureInfo ci = (CultureInfo)CultureInfo.CurrentCulture.Clone(); ci.NumberFormat.NumberDecimalSeparator = "."; var markerSize = marker.size.Split(',').Select(xy => float.Parse(xy, NumberStyles.Any, ci)).ToArray(); var center = new Point(marker.pos[0], marker.pos[1]); Geometry = new BoundBox(center.Offset(-markerSize[0], -markerSize[1]), center.Offset(markerSize[0], markerSize[1])); iconStyle.rect = new SkiaSharp.SKRect(-markerSize[0], -markerSize[1], markerSize[0], markerSize[1]); DataHasChanged(); } else if (e.PropertyName == nameof(ActiveMarker.dir)) { foreach (var sym in Styles.Where(x => x is TiledBitmapStyle)) //#TODO just store the style in a variable { (sym as TiledBitmapStyle).rotation = marker.dir; } DataHasChanged(); } else if (e.PropertyName == nameof(ActiveMarker.brush)) { TiledBitmapStyle iconStyle = (TiledBitmapStyle)Styles.First(x => x is TiledBitmapStyle); if (iconStyle == null) { return; } if (!GameState.Instance.marker.markerBrushes.ContainsKey(marker.brush)) { return; } var markerBrush = GameState.Instance.marker.markerBrushes[marker.brush]; if (marker.color == "Default") { markerColor = new MarkerColor { color = marker.color, name = markerBrush.name } } ; iconStyle.color = markerColor.ToSKColor(); //set rect MarkerCache.Instance.GetImage(markerBrush, null).ContinueWith( (image) => { iconStyle.image = image.Result; }); DataHasChanged(); } else if (e.PropertyName == nameof(ActiveMarker.color)) { TiledBitmapStyle iconStyle = (TiledBitmapStyle)Styles.First(x => x is TiledBitmapStyle); if (iconStyle == null) { return; } if (!GameState.Instance.marker.markerColors.ContainsKey(marker.color)) { return; } markerColor = GameState.Instance.marker.markerColors[marker.color]; if (marker.color == "Default") { if (!GameState.Instance.marker.markerTypes.ContainsKey(marker.type)) { return; } var markerType = GameState.Instance.marker.markerTypes[marker.type]; markerColor = new MarkerColor { color = markerType.color, name = markerType.name }; } iconStyle.color = markerColor.ToSKColor(); DataHasChanged(); } }
/// <summary> /// Returns true if ChartItemConfigBean instances are equal /// </summary> /// <param name="input">Instance of ChartItemConfigBean to be compared</param> /// <returns>Boolean</returns> public bool Equals(ChartItemConfigBean input) { if (input == null) { return(false); } return (( Item == input.Item || (Item != null && Item.Equals(input.Item)) ) && ( Axis == input.Axis || (Axis != null && Axis.Equals(input.Axis)) ) && ( Label == input.Label || (Label != null && Label.Equals(input.Label)) ) && ( Chart == input.Chart || (Chart != null && Chart.Equals(input.Chart)) ) && ( Legend == input.Legend || (Legend != null && Legend.Equals(input.Legend)) ) && ( Fill == input.Fill || (Fill != null && Fill.Equals(input.Fill)) ) && ( LineColor == input.LineColor || (LineColor != null && LineColor.Equals(input.LineColor)) ) && ( LineWidth == input.LineWidth || (LineWidth != null && LineWidth.Equals(input.LineWidth)) ) && ( LineStyle == input.LineStyle || (LineStyle != null && LineStyle.Equals(input.LineStyle)) ) && ( MarkerColor == input.MarkerColor || (MarkerColor != null && MarkerColor.Equals(input.MarkerColor)) ) && ( MarkerSymbol == input.MarkerSymbol || (MarkerSymbol != null && MarkerSymbol.Equals(input.MarkerSymbol)) ) && ( RepeatTime == input.RepeatTime || (RepeatTime != null && RepeatTime.Equals(input.RepeatTime)) )); }
public MarkerFeature(ActiveMarker marker) { this.marker = marker; this["Label"] = marker.text; Geometry = new Point(marker.pos[0], marker.pos[1]); CultureInfo ci = (CultureInfo)CultureInfo.CurrentCulture.Clone(); ci.NumberFormat.NumberDecimalSeparator = "."; if (!GameState.Instance.marker.markerColors.ContainsKey(marker.color)) { throw new InvalidOperationException(); } markerColor = GameState.Instance.marker.markerColors[marker.color]; if (string.IsNullOrEmpty(marker.size)) { marker.size = "64,64"; } if (marker.shape == "ICON") { if (string.IsNullOrEmpty(marker.type)) { return; //Can happen, somehow } if (!GameState.Instance.marker.markerTypes.ContainsKey(marker.type)) { throw new InvalidOperationException(); } var markerType = GameState.Instance.marker.markerTypes[marker.type]; if (marker.color == "Default") { markerColor = new MarkerColor { color = markerType.color, name = markerType.name } } ; try { var symStyle = new MarkerIconStyle { SymbolRotation = marker.dir, Opacity = marker.alpha, size = marker.size.Split(',').Select(xy => float.Parse(xy, NumberStyles.Any, ci)).ToArray(), typeSize = markerType.size, color = markerColor.ToSKColor(), shadow = markerType.shadow, text = marker.text }; MarkerCache.Instance.GetImage(markerType, null) .ContinueWith( (image) => { symStyle.markerIcon = image.Result; }); Styles.Add(symStyle); marker.PropertyChanged += OnMarkerOnPropertyChangedIcon; } catch (System.FormatException ex) { } } else if (marker.shape == "RECTANGLE" || marker.shape == "ELLIPSE") { if (!GameState.Instance.marker.markerBrushes.ContainsKey(marker.brush)) { throw new InvalidOperationException(); } var markerBrush = GameState.Instance.marker.markerBrushes[marker.brush]; var markerSize = marker.size.Split(',').Select(xy => float.Parse(xy, NumberStyles.Any, ci)).ToArray(); var center = new Point(marker.pos[0], marker.pos[1]); //set rect Geometry = new BoundBox(center.Offset(-markerSize[0], -markerSize[1]), center.Offset(markerSize[0], markerSize[1])); var tiledBitmap = new TiledBitmapStyle { image = null, rect = new SkiaSharp.SKRect(-markerSize[0], -markerSize[1], markerSize[0], markerSize[1]), rotation = marker.dir, ellipse = marker.shape == "ELLIPSE", border = markerBrush.drawBorder, color = markerColor.ToSKColor() }; Styles.Add(tiledBitmap); MarkerCache.Instance.GetImage(markerBrush, null).ContinueWith( (image) => { tiledBitmap.image = image.Result; }); marker.PropertyChanged += OnMarkerOnPropertyChangedTiled; } else if (marker.shape == "POLYLINE") { if (marker.polyline.Count == 0) { return; } Geometry = new BoundBox(marker.polyline); var polyMarker = new PolylineMarkerStyle(marker.polyline) { color = markerColor.ToSKColor() }; Styles.Add(polyMarker); //Polylines have no propertychanged as (in ACE) they cannot be edited } }
public void AddMarker(string Address, MarkerColor color, MarkerSign sign) { StringCoordinates l_sc = GeocodingRequest(Address, m_str_APIKey); if (l_sc != null) { StringBuilder l_sb = new StringBuilder(); l_sb.AppendFormat( "{0},{1},{2}{3}", l_sc.m_str_Latitude, l_sc.m_str_Longitude, color.ToString(), (sign == MarkerSign.none) ? string.Empty : sign.ToString() ); m_al_Markers.Add(l_sb.ToString()); } }