-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from wrk-fmd/develop
RELEASE: Version 1.1.1
- Loading branch information
Showing
27 changed files
with
698 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,40 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace GeoClient.Models | ||
namespace GeoClient.Models | ||
{ | ||
public class GeoPoint | ||
{ | ||
public string Latitude { get; } | ||
public string Longitude { get; } | ||
public double Latitude { get; } | ||
public double Longitude { get; } | ||
|
||
public GeoPoint(string latitude, string longitude) | ||
public GeoPoint(double latitude, double longitude) | ||
{ | ||
Latitude = latitude; | ||
Longitude = longitude; | ||
} | ||
|
||
protected bool Equals(GeoPoint other) | ||
{ | ||
return Latitude.Equals(other.Latitude) && Longitude.Equals(other.Longitude); | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
if (ReferenceEquals(null, obj)) return false; | ||
if (ReferenceEquals(this, obj)) return true; | ||
if (obj.GetType() != this.GetType()) return false; | ||
return Equals((GeoPoint) obj); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
unchecked | ||
{ | ||
return (Latitude.GetHashCode() * 397) ^ Longitude.GetHashCode(); | ||
} | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return $"{nameof(Latitude)}: {Latitude}, {nameof(Longitude)}: {Longitude}"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,25 @@ | ||
namespace GeoClient.Models | ||
using System.ComponentModel; | ||
|
||
namespace GeoClient.Models | ||
{ | ||
public enum IncidentTaskState | ||
{ | ||
[Description("Alarmiert")] | ||
Assigned, | ||
|
||
[Description("Zum Berufungsort")] | ||
Zbo, | ||
|
||
[Description("Am Berufungsort")] | ||
Abo, | ||
|
||
[Description("Zum Abgabeort")] | ||
Zao, | ||
|
||
[Description("Am Abgabeort")] | ||
Aao, | ||
|
||
[Description("Unbekannt")] | ||
Unknown | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
using GeoClient.Services.Utils; | ||
using System; | ||
|
||
namespace GeoClient.Models | ||
{ | ||
public class Unit : IComparable<Unit> | ||
{ | ||
public string Id { get; } | ||
public string Name { get; } | ||
|
||
// TODO: This is actually a position, not only a point. There is more detailed information available. | ||
public GeoPoint LastPoint { get; } | ||
public IncidentTaskState State { get; } | ||
|
||
public string TaskStateIcon => GetTaskStateIcon(); | ||
|
||
public Unit( | ||
string id, | ||
string name, | ||
GeoPoint lastPoint = null, | ||
IncidentTaskState state = IncidentTaskState.Unknown) | ||
{ | ||
Id = id; | ||
Name = name; | ||
LastPoint = lastPoint; | ||
State = state; | ||
} | ||
|
||
public int CompareTo(Unit other) | ||
{ | ||
if (ReferenceEquals(this, other)) return 0; | ||
if (ReferenceEquals(null, other)) return 1; | ||
return string.Compare(Name, other.Name, StringComparison.OrdinalIgnoreCase); | ||
} | ||
|
||
protected bool Equals(Unit other) | ||
{ | ||
return string.Equals(Id, other.Id) | ||
&& string.Equals(Name, other.Name) | ||
&& Equals(LastPoint, other.LastPoint) | ||
&& State == other.State; | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
if (ReferenceEquals(null, obj)) return false; | ||
if (ReferenceEquals(this, obj)) return true; | ||
if (obj.GetType() != GetType()) return false; | ||
return Equals((Unit) obj); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
unchecked | ||
{ | ||
var hashCode = (Id != null ? Id.GetHashCode() : 0); | ||
hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0); | ||
hashCode = (hashCode * 397) ^ (LastPoint != null ? LastPoint.GetHashCode() : 0); | ||
hashCode = (hashCode * 397) ^ (int) State; | ||
return hashCode; | ||
} | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return | ||
$"{nameof(Id)}: {Id}, {nameof(Name)}: {Name}, {nameof(LastPoint)}: {LastPoint}, {nameof(State)}: {State}"; | ||
} | ||
|
||
private string GetTaskStateIcon() | ||
{ | ||
return StatusIconResolver.GetIconForTaskState(State); | ||
} | ||
} | ||
} |
Oops, something went wrong.