Plane.FormationCreator/Plane.FormationCreator/Formation/Copter.cs
zxd 273988c34a 飞机LED灯光修改
GPS不精准时,显示飞机位置(用于室内写航点)
2018-07-23 16:27:11 +08:00

54 lines
1.8 KiB
C#

using Plane.Copters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Plane.Communication;
using System.Threading;
using System.Windows.Media;
namespace Plane.FormationCreator.Formation
{
class Copter : PLCopter
{
public Copter(IConnection Connection, SynchronizationContext uiThreadContext) : base(Connection, uiThreadContext,false)
{
Brush = _brushes[NextBrushIndex()];
}
public Copter(IConnection Connection, SynchronizationContext uiThreadContext, double lat, double lng) : base(Connection, uiThreadContext, false)
{
Brush = _brushes[NextBrushIndex()];
RecordLat = lat;
RecordLng = lng;
//RaiseLocationChangedIfNeeded();
}
static SolidColorBrush[] _brushes = new[]
{
new SolidColorBrush(Color.FromArgb(180, 255, 0, 0)),
new SolidColorBrush(Color.FromArgb(180, 235, 97, 0)),
new SolidColorBrush(Color.FromArgb(180, 255, 255, 0)),
new SolidColorBrush(Color.FromArgb(180, 0, 255, 0)),
new SolidColorBrush(Color.FromArgb(180, 0, 198, 255)),
new SolidColorBrush(Color.FromArgb(180, 0, 122, 204)),
new SolidColorBrush(Color.FromArgb(180, 174, 0, 255))
};
static int _brushIndex = 0;
static int NextBrushIndex()
{
return _brushIndex++ % _brushes.Length;
}
internal static SolidColorBrush DefaultBrush { get; } = new SolidColorBrush(Color.FromRgb(28, 151, 234));
private SolidColorBrush _Brush;
public SolidColorBrush Brush
{
get { return _Brush ?? DefaultBrush; }
set { Set(nameof(Brush), ref _Brush, value); }
}
}
}