Skip to content

Commit

Permalink
Disable and Enable Nexrad Radars
Browse files Browse the repository at this point in the history
  • Loading branch information
k2fc committed Oct 3, 2020
1 parent d009801 commit be24b9c
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion scope/NexradDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ public int Transparency
alphafactor = 1 - (value / 255d);
}
}
public string Name { get; set; }
bool enabled = true;
public bool Enabled {
get
{
return enabled;
}
set
{
if (!enabled && value)
timer.Change(0, DownloadInterval);
enabled = value;
}
}
public string URL { get; set; }
public int DownloadInterval { get; set; } = 300;
public int Range { get; set; } = 124;
Expand All @@ -98,6 +112,8 @@ public int Transparency
bool gotdata = false;
void GetRadarData(string url)
{
if (!Enabled)
return;
using (var client = new WebClient())
{
try
Expand Down Expand Up @@ -139,7 +155,7 @@ public Polygon[] Polygons(GeoPoint center, double scale, double rotation = 0)
if (timer == null)
timer = new System.Threading.Timer(new System.Threading.TimerCallback(cbTimerElapsed), null,0,DownloadInterval * 1000);

if (polygons == null)
if (polygons == null || !Enabled)
return new Polygon[0];
return polygons;
}
Expand Down Expand Up @@ -178,6 +194,11 @@ public void RecomputeVertices(GeoPoint center, double scale, double rotation = 0
this.polygons = polygons.ToArray();
}

public override string ToString()
{
return Name;
}

// ftp://tgftp.nws.noaa.gov/SL.us008001/DF.of/DC.radar/DS.p19r0/SI.kokx/sn.last
}

Expand Down

0 comments on commit be24b9c

Please sign in to comment.