Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<Nullable>disable</Nullable>
<LangVersion>latest</LangVersion>

<VersionPrefix>5.8.0</VersionPrefix>
<BuildIncrement>46</BuildIncrement>
<VersionPrefix>5.8.1</VersionPrefix>
<BuildIncrement>47</BuildIncrement>
<VersionSuffix></VersionSuffix>
<Product>FitEdit</Product>
<Copyright>EnduraByte LLC 2024</Copyright>
Expand Down
4 changes: 2 additions & 2 deletions Ui/FitEdit.Ui.iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleIdentifier</key>
<string>com.endurabyte.fitedit</string>
<key>CFBundleShortVersionString</key>
<string>5.8.0</string>
<string>5.8.1</string>
<key>LSRequiresIPhoneOS</key>
<true />
<key>MinimumOSVersion</key>
Expand Down Expand Up @@ -57,6 +57,6 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>46</string>
<string>47</string>
</dict>
</plist>
24 changes: 22 additions & 2 deletions Ui/FitEdit.Ui/ViewModels/MapViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -408,19 +408,39 @@ private ILayer? AddTrace
int count = -1
)
{
var range = Enumerable.Range(index < 0 ? 0 : index, count < 0 ? fit.Records.Count : count);
var range = Enumerable
.Range(index < 0 ? 0 : index, count < 0 ? fit.Records.Count : count)
.ToList();

Coordinate[] coords = range
.Select(i => fit.Records[i])
.Select(r => r.MapCoordinate())
.Where(c => c.X != 0 && c.Y != 0)
.ToArray();

// Prevent zero lat lon
foreach (int i in range.Skip(1))
{
PreventZeroLatLon(coords, i);
}

return editable
? AddEditTrace(coords, name, color, FitColor.RedCrayon)
: AddTrace(coords, name, layer, color, lineWidth);
}

private static void PreventZeroLatLon(Coordinate[] coords, int i)
{
Coordinate coord = coords[i];
Coordinate prev = coords[i - 1];

const double tol = 1e-6;
if (Math.Abs(coord.X) < tol && Math.Abs(coord.Y) < tol)
{
coord.X = prev.X;
coord.Y = prev.Y;
}
}

private ILayer? AddTrace(Coordinate[] coords, string name, int layer, Avalonia.Media.Color color, int lineWidth)
{
if (coords.Length < 2) { return null; }
Expand Down