Skip to content

Commit 0ea53fc

Browse files
EMS90EMS90
EMS90
authored and
EMS90
committed
replacing NaNs resulting from invalid scale with zero. This only should occur for the closing (last) element of a TRA file.
1 parent 3b69f40 commit 0ea53fc

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

TRA.Lib/TrassierungInterface.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,14 @@ public static void ExportTRA(TRATrasse trasse, string fileName,ESaveScale saveSc
238238
writer.Write(element.T);
239239
writer.Write(element.S);
240240
writer.Write((short)element.Kz);
241-
writer.Write(saveScale == ESaveScale.discard ? element.L : element.L*element.Scale);
241+
if (double.IsNaN(element.Scale))
242+
{
243+
writer.Write((double)0.0); //set 0 if scale was NaN (should only occur for the closing element (last) as there no scale is defined. We set length to zero.
244+
}
245+
else
246+
{
247+
writer.Write(saveScale == ESaveScale.discard ? element.L : element.L * element.Scale); //if discarding scale we set the original length, otherwise apply scale.
248+
}
242249
writer.Write(element.U1);
243250
writer.Write(element.U2);
244251
writer.Write((float)element.Cf);

0 commit comments

Comments
 (0)