Skip to content

Commit ed608d8

Browse files
committed
Add Radar Sample
1 parent f4780b2 commit ed608d8

10 files changed

Lines changed: 491 additions & 2 deletions

File tree

‎README.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,15 @@ dotnet add package DevWinUI.Shader
148148

149149
## 🕰️ History
150150

151+
### Radar
152+
![Radar](https://raw.githubusercontent.com/ghost1372/DevWinUI-Resources/refs/heads/main/DevWinUI-Docs/Radar3.gif)
153+
154+
### Radar
155+
![Radar](https://raw.githubusercontent.com/ghost1372/DevWinUI-Resources/refs/heads/main/DevWinUI-Docs/Radar2.gif)
156+
157+
### Radar
158+
![Radar](https://raw.githubusercontent.com/ghost1372/DevWinUI-Resources/refs/heads/main/DevWinUI-Docs/Radar1.gif)
159+
151160
### FlightStatusCard
152161
![FlightStatusCard](https://raw.githubusercontent.com/ghost1372/DevWinUI-Resources/refs/heads/main/DevWinUI-Docs/FlightStatusCard.gif)
153162

‎dev/DevWinUI.Gallery/Assets/NavViewMenu/AppData.json‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{
1+
{
22
"$schema": "https://raw.githubusercontent.com/Ghost1372/DevWinUI/refs/heads/main/tools/AppData.Schema.json",
33
"Groups": [
44
{
@@ -1126,6 +1126,13 @@
11261126
"Title": "Features (Win2D)",
11271127
"ImagePath": "ms-appx:///Assets/Fluent/Canvas.png",
11281128
"Items": [
1129+
{
1130+
"UniqueId": "DevWinUIGallery.Views.RadarPage",
1131+
"Title": "Radar",
1132+
"Subtitle": "A radar display with sweep and pulse modes, moving blips, scan-only visibility, zones, jammed sectors and phosphor afterglow",
1133+
"IsNew": true,
1134+
"ImagePath": "ms-appx:///Assets/Fluent/Circle.png"
1135+
},
11291136
{
11301137
"UniqueId": "DevWinUIGallery.Views.FlightStatusCardPage",
11311138
"Title": "Flight Status Card",
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
public ObservableCollection<RadarAircraft> Aircraft { get; } = new()
2+
{
3+
new RadarAircraft("AC-101", 30, 0.8, 6),
4+
new RadarAircraft("AC-102", 140, 0.55, -4),
5+
new RadarAircraft("AC-103", 250, 0.9, 8),
6+
};
7+
8+
public RadarAircraftMapper Mapper { get; } = new();
9+
10+
public sealed class RadarAircraftMapper : IRadarBlipMapper
11+
{
12+
public void Map(object item, RadarBlip blip)
13+
{
14+
var aircraft = (RadarAircraft)item;
15+
16+
blip.Angle = aircraft.Bearing;
17+
blip.Distance = aircraft.Range;
18+
blip.Heading = aircraft.Bearing + (aircraft.Speed >= 0 ? 90 : -90);
19+
blip.Label = aircraft.Callsign;
20+
blip.Marker = RadarMarker.Plane;
21+
blip.State = aircraft.IsAlert ? RadarBlipState.Alert : RadarBlipState.Normal;
22+
}
23+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<dev:Radar Clutter="0.1"
2+
ItemMapper="{x:Bind Mapper}"
3+
ItemsSource="{x:Bind Aircraft}"
4+
Targets="0" />
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<dev:Radar Clutter="0.15" Targets="0">
2+
<dev:RadarBlip Angle="40"
3+
Distance="1.15"
4+
Duration="14"
5+
EndDistance="0"
6+
Foreground="{ThemeResource AircraftBrush}"
7+
Label="AC-101&#x0a;FL350"
8+
Marker="Plane"
9+
Motion="Linear"
10+
Repeat="Loop"
11+
TrailLength="6" />
12+
13+
<dev:RadarBlip Angle="300"
14+
Distance="0.8"
15+
Duration="8"
16+
EndAngle="60"
17+
EndDistance="0.3"
18+
Foreground="{ThemeResource AircraftBrush}"
19+
Label="AC-207"
20+
Marker="Plane"
21+
Motion="Linear"
22+
Repeat="PingPong"
23+
TrailLength="6" />
24+
25+
<dev:RadarBlip Angle="120"
26+
Distance="0.6"
27+
Foreground="{ThemeResource HostileBrush}"
28+
Label="UNKNOWN"
29+
Marker="Diamond"
30+
Size="3.5"
31+
State="Alert" />
32+
33+
<dev:RadarBlip Angle="235"
34+
Distance="0.45"
35+
Foreground="{ThemeResource FriendlyBrush}"
36+
Label="ALPHA"
37+
Marker="Triangle"
38+
State="Selected" />
39+
</dev:Radar>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<dev:Radar BlipVisibility="ScanOnly"
2+
Clutter="0.1"
3+
ScanFade="2"
4+
TargetBrush="{ThemeResource FriendlyBrush}"
5+
TargetVisibility="ScanOnly"
6+
Targets="5">
7+
8+
<dev:RadarBlip Angle="40"
9+
Distance="1.15"
10+
Duration="14"
11+
EndDistance="0"
12+
Foreground="{ThemeResource AircraftBrush}"
13+
Marker="Plane"
14+
Motion="Linear"
15+
Repeat="Loop" />
16+
17+
<dev:RadarBlip Angle="150"
18+
Distance="0.65"
19+
Foreground="{ThemeResource HostileBrush}"
20+
Marker="Diamond"
21+
Size="3.5" />
22+
23+
<dev:RadarBlip Angle="260"
24+
Distance="0.5"
25+
Foreground="{ThemeResource AircraftBrush}"
26+
Marker="Square"
27+
Visibility="Always" />
28+
</dev:Radar>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<dev:Radar Clutter="0.1"
2+
MaxRange="200"
3+
RadarScale="0.8"
4+
RangeUnit="km"
5+
ShowCompass="True"
6+
ShowRangeLabels="True"
7+
ShowReadout="True"
8+
Targets="0">
9+
10+
<dev:Radar.Zones>
11+
<dev:RadarZone Angle="200"
12+
Distance="0.55"
13+
Foreground="{ThemeResource HostileBrush}"
14+
Label="RESTRICTED"
15+
Radius="0.18"
16+
Shape="Circle" />
17+
18+
<dev:RadarZone Foreground="{ThemeResource FriendlyBrush}"
19+
Label="CORRIDOR"
20+
Points="20,0.35 50,0.9 80,0.9 60,0.35"
21+
Shape="Polygon"
22+
Visibility="ScanOnly" />
23+
</dev:Radar.Zones>
24+
25+
<dev:Radar.Jams>
26+
<dev:RadarJam EndAngle="330"
27+
Foreground="{ThemeResource HostileBrush}"
28+
Intensity="0.7"
29+
StartAngle="285" />
30+
</dev:Radar.Jams>
31+
32+
<dev:RadarBlip Angle="310"
33+
Distance="0.6"
34+
Foreground="{ThemeResource AircraftBrush}"
35+
Label="JAMMED"
36+
Marker="Plane" />
37+
38+
<dev:RadarBlip Angle="70"
39+
Distance="0.6"
40+
Duration="12"
41+
EndAngle="30"
42+
EndDistance="0.85"
43+
Foreground="{ThemeResource AircraftBrush}"
44+
Label="IN CORRIDOR"
45+
Marker="Plane"
46+
Motion="Linear"
47+
Repeat="PingPong" />
48+
</dev:Radar>

0 commit comments

Comments
 (0)