/// <summary>
/// Gets an appropriate epoch from a list of dates and writes it to the <see cref="CesiumOutputStream"/>
/// as the "epoch" property. If the <paramref name="dates"/> collection is empty, the <paramref name="startIndex"/>
/// is past the end of the collection, or the <paramref name="length"/> is zero, this method does not write
/// the "epoch" property and returns <see cref="JulianDate.MinValue"/>.
/// </summary>
/// <param name="output">The stream to which to write the epoch.</param>
/// <param name="dates">The collection of dates from which to determine the epoch.</param>
/// <param name="startIndex">The first index in the collection to use.</param>
/// <param name="length">The number of items from the collection to use.</param>
/// <returns>A suitable epoch determined from the collection.</returns>
private static JulianDate GetAndWriteEpoch(CesiumOutputStream output, IList <JulianDate> dates, int startIndex, int length)
{
if (startIndex < dates.Count)
{
JulianDate epoch = dates[startIndex];
output.WritePropertyName("epoch");
output.WriteValue(CesiumFormattingHelper.ToIso8601(epoch, output.PrettyFormatting ? Iso8601Format.Extended : Iso8601Format.Compact));
return(epoch);
}
else
{
return(JulianDate.MinValue);
}
}