-
Notifications
You must be signed in to change notification settings - Fork 91
Expand file tree
/
Copy pathNavBookmark.cs
More file actions
210 lines (181 loc) · 5.69 KB
/
NavBookmark.cs
File metadata and controls
210 lines (181 loc) · 5.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
using JetBrains.Annotations;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
namespace EddiDataDefinitions
{
public class NavBookmark : INotifyPropertyChanged
{
// The bookmark system
[JsonProperty("system")]
public string systemname
{
get => _systemname;
set
{
if (_systemname != value)
{
_systemname = value;
NotifyPropertyChanged(nameof(systemname));
}
}
}
[JsonIgnore] private string _systemname;
public ulong systemAddress { get; set; }
public decimal? x { get; set; }
public decimal? y { get; set; }
public decimal? z { get; set; }
[JsonIgnore]
public decimal? distanceLy
{
get => _distanceLy;
set
{
if (_distanceLy != value)
{
_distanceLy = value;
NotifyPropertyChanged(nameof(distanceLy));
}
}
}
[JsonIgnore] private decimal? _distanceLy;
// The bookmark body
[JsonProperty("body")]
public string bodyname
{
get => _bodyname;
set
{
if (_bodyname != value)
{
_bodyname = value;
NotifyPropertyChanged(nameof(bodyname));
}
}
}
[JsonIgnore] private string _bodyname;
[JsonIgnore]
public string bodyshortname => Body.GetShortName(bodyname, systemname);
public string poi { get; set; }
public bool isstation { get; set; }
public string comment { get; set; }
public decimal? latitude
{
get => _latitude;
set
{
if (_latitude != value)
{
_latitude = value;
NotifyPropertyChanged(nameof(latitude));
}
}
}
[JsonIgnore] private decimal? _latitude;
public decimal? longitude
{
get => _longitude;
set
{
if (_longitude != value)
{
_longitude = value;
NotifyPropertyChanged(nameof(longitude));
}
}
}
[JsonIgnore] private decimal? _longitude;
[JsonIgnore]
public bool landable => latitude != null && longitude != null;
[JsonIgnore]
public decimal? heading
{
get => _heading;
set
{
if (_heading != value)
{
_heading = value;
NotifyPropertyChanged(nameof(heading));
}
}
}
[JsonIgnore] private decimal? _heading;
[JsonIgnore]
public decimal? distanceKm
{
get => _distanceKm;
set
{
if (_distanceKm != value)
{
_distanceKm = value;
NotifyPropertyChanged(nameof(distanceKm));
}
}
}
[JsonIgnore] private decimal? _distanceKm;
public long? arrivalRadiusMeters
{
get => _arrivalRadiusMeters;
set
{
if (_arrivalRadiusMeters != value)
{
_arrivalRadiusMeters = value;
NotifyPropertyChanged(nameof(arrivalRadiusMeters));
}
}
}
[JsonIgnore] private long? _arrivalRadiusMeters = 1000;
public bool nearby = false;
public bool useStraightPath { get; set; }
public SortedSet<DateTime> visitLog
{
get => _visitLog;
set
{
if (_visitLog != value)
{
_visitLog = value;
NotifyPropertyChanged(nameof(visitLog));
}
}
}
[JsonIgnore] private SortedSet<DateTime> _visitLog = [ ];
[JsonIgnore] public bool visited => visitLog.Count > 0;
#region POI Bookmark Properties
// Galactic POI URL
public string url { get; set; }
// Galactic POI Description (markdown format)
public string descriptionMarkdown { get; set; }
// Galactic POI Description state
[JsonIgnore] public bool descriptionMarkdownHasValue => !string.IsNullOrEmpty(descriptionMarkdown);
#endregion
// Drop down visibility
[JsonIgnore, UsedImplicitly] public bool hasRowDetails => descriptionMarkdownHasValue || landable;
// Default Constructor
public NavBookmark() { }
[JsonConstructor]
public NavBookmark(string systemname, ulong systemAddress, decimal? x, decimal? y, decimal? z, string bodyname, string poi, bool isstation, decimal? latitude, decimal? longitude, bool nearby)
{
this.systemname = systemname;
this.systemAddress = systemAddress;
this.x = x;
this.y = y;
this.z = z;
this.bodyname = bodyname;
this.poi = poi;
this.isstation = isstation;
this.latitude = latitude;
this.longitude = longitude;
this.nearby = nearby;
}
public event PropertyChangedEventHandler PropertyChanged;
public void NotifyPropertyChanged(string propName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));
}
}
}