Пример #1
0
 /// <summary>
 /// Writes a <see cref="Rectangular"/> value as an array in X, Y order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="value">The value to write.</param>
 public static void WriteCartesian2(CesiumOutputStream output, Rectangular value)
 {
     output.WriteStartSequence();
     output.WriteValue(value.X);
     output.WriteValue(value.Y);
     output.WriteEndSequence();
 }
Пример #2
0
 /// <summary>
 /// Writes a <see cref="Rectangular"/> value as an array in X, Y order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="value">The value to write.</param>
 public static void WriteCartesian2(CesiumOutputStream output, Rectangular value)
 {
     output.WriteStartSequence();
     output.WriteValue(value.X);
     output.WriteValue(value.Y);
     output.WriteEndSequence();
 }
Пример #3
0
        /// <summary>
        /// Writes time-tagged color values as an array in [Time, Red, Green, Blue, Alpha] order.
        /// Times are epoch seconds since an epoch that is determined from the first date to be written.
        /// The epoch property is written as well.
        /// </summary>
        /// <param name="output">The stream to which to write the array.</param>
        /// <param name="propertyName">The name of the property to write.</param>
        /// <param name="dates">The dates at which the value is specified.</param>
        /// <param name="values">The corresponding value for each date.</param>
        /// <param name="startIndex">The index of the first element to use in the <paramref name="values"/> collection.</param>
        /// <param name="length">The number of elements to use from the <paramref name="values"/> collection.</param>
        public static void WriteRgba(CesiumOutputStream output, string propertyName, IList <JulianDate> dates, IList <Color> values, int startIndex, int length)
        {
            if (dates.Count != values.Count)
            {
                throw new ArgumentException(CesiumLocalization.MismatchedNumberOfDatesAndValues, "values");
            }

            JulianDate epoch = GetAndWriteEpoch(output, dates, startIndex, length);

            output.WritePropertyName(propertyName);
            output.WriteStartSequence();
            int last = startIndex + length;

            for (int i = startIndex; i < last; ++i)
            {
                output.WriteValue(epoch.SecondsDifference(dates[i]));
                Color value = values[i];
                output.WriteValue(value.R);
                output.WriteValue(value.G);
                output.WriteValue(value.B);
                output.WriteValue(value.A);
                output.WriteLineBreak();
            }

            output.WriteEndSequence();
        }
Пример #4
0
 /// <summary>
 /// Writes a <see cref="UnitSpherical"/> value as an array in Clock, Cone order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="value">The value to write.</param>
 public static void WriteUnitSpherical(CesiumOutputStream output, UnitSpherical value)
 {
     output.WriteStartSequence();
     output.WriteValue(value.Clock);
     output.WriteValue(value.Cone);
     output.WriteEndSequence();
 }
Пример #5
0
 /// <summary>
 /// Writes a <see cref="Cartographic"/> value as an array in Longitude, Latitude, Height order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="value">The value to write.</param>
 public static void WriteCartographic(CesiumOutputStream output, Cartographic value)
 {
     output.WriteStartSequence();
     output.WriteValue(value.Longitude);
     output.WriteValue(value.Latitude);
     output.WriteValue(value.Height);
     output.WriteEndSequence();
 }
Пример #6
0
 /// <summary>
 /// Writes a <see cref="UnitCartesian"/> value as an array in X, Y, Z order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="value">The value to write.</param>
 public static void WriteUnitCartesian3(CesiumOutputStream output, UnitCartesian value)
 {
     output.WriteStartSequence();
     output.WriteValue(value.X);
     output.WriteValue(value.Y);
     output.WriteValue(value.Z);
     output.WriteEndSequence();
 }
 /// <summary>
 /// Writes a <see cref="BoundingRectangle"/> value as an array in X, Y, Width, Height order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="value">The value to write.</param>
 public static void WriteBoundingRectangle(CesiumOutputStream output, BoundingRectangle value)
 {
     output.WriteStartSequence();
     output.WriteValue(value.Left);
     output.WriteValue(value.Bottom);
     output.WriteValue(value.Width);
     output.WriteValue(value.Height);
     output.WriteEndSequence();
 }
Пример #8
0
 /// <summary>
 /// Writes a <see cref="UnitQuaternion"/> as an array in [X, Y, Z, W] order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="value">The value to write.</param>
 public static void WriteUnitQuaternion(CesiumOutputStream output, UnitQuaternion value)
 {
     output.WriteStartSequence();
     output.WriteValue(value.X);
     output.WriteValue(value.Y);
     output.WriteValue(value.Z);
     output.WriteValue(value.W);
     output.WriteEndSequence();
 }
Пример #9
0
 /// <summary>
 /// Writes a <see cref="NearFarScalar"/> value as an array in Clock, Cone, Magnitude order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="value">The value to write.</param>
 public static void WriteNearFarScalar(CesiumOutputStream output, NearFarScalar value)
 {
     output.WriteStartSequence();
     output.WriteValue(value.NearDistance);
     output.WriteValue(value.NearValue);
     output.WriteValue(value.FarDistance);
     output.WriteValue(value.FarValue);
     output.WriteEndSequence();
 }
Пример #10
0
 /// <summary>
 /// Writes a <see cref="BoundingRectangle"/> value as an array in X, Y, Width, Height order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="value">The value to write.</param>
 public static void WriteBoundingRectangle(CesiumOutputStream output, BoundingRectangle value)
 {
     output.WriteStartSequence();
     output.WriteValue(value.Left);
     output.WriteValue(value.Bottom);
     output.WriteValue(value.Width);
     output.WriteValue(value.Height);
     output.WriteEndSequence();
 }
Пример #11
0
 /// <summary>
 /// Writes a <see cref="CartographicExtent"/> value as an array in WestLongitude, SouthLatitude, EastLongitude, NorthLatitude order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="value">The value to write.</param>
 public static void WriteCartographicExtent(CesiumOutputStream output, CartographicExtent value)
 {
     output.WriteStartSequence();
     output.WriteValue(value.WestLongitude);
     output.WriteValue(value.SouthLatitude);
     output.WriteValue(value.EastLongitude);
     output.WriteValue(value.NorthLatitude);
     output.WriteEndSequence();
 }
Пример #12
0
 /// <summary>
 /// Writes a color value as an array in Red, Green, Blue, Alpha order.
 /// </summary>
 /// <param name="output">The stream to which to write the color.</param>
 /// <param name="red">The red component in the range 0.0-1.0.</param>
 /// <param name="green">The green component in the range 0.0-1.0.</param>
 /// <param name="blue">The blue component in the range 0.0-1.0.</param>
 /// <param name="alpha">The alpha component in the range 0.0-1.0.</param>
 public static void WriteRgbaf(CesiumOutputStream output, float red, float green, float blue, float alpha)
 {
     output.WriteStartSequence();
     output.WriteValue(red);
     output.WriteValue(green);
     output.WriteValue(blue);
     output.WriteValue(alpha);
     output.WriteEndSequence();
 }
Пример #13
0
 /// <summary>
 /// Writes a color value as an array in Red, Green, Blue, Alpha order as floating-point values.
 /// </summary>
 /// <param name="output">The stream to which to write the color.</param>
 /// <param name="red">The red component in the range 0.0-1.0.</param>
 /// <param name="green">The green component in the range 0.0-1.0.</param>
 /// <param name="blue">The blue component in the range 0.0-1.0.</param>
 /// <param name="alpha">The alpha component in the range 0.0-1.0.</param>
 public static void WriteRgbaf(CesiumOutputStream output, double red, double green, double blue, double alpha)
 {
     output.WriteStartSequence();
     output.WriteValue(red);
     output.WriteValue(green);
     output.WriteValue(blue);
     output.WriteValue(alpha);
     output.WriteEndSequence();
 }
Пример #14
0
 /// <summary>
 /// Writes a list of <see cref="UnitSpherical"/> values as an array in Clock, Cone order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="values">The values to write.</param>
 public static void WriteUnitSphericalList(CesiumOutputStream output, IEnumerable <UnitSpherical> values)
 {
     output.WriteStartSequence();
     foreach (UnitSpherical value in values)
     {
         output.WriteValue(value.Clock);
         output.WriteValue(value.Cone);
     }
     output.WriteEndSequence();
 }
Пример #15
0
 /// <summary>
 /// Writes a list of <see cref="UnitCartesian"/> values as an array in X, Y, Z order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="values">The values to write.</param>
 public static void WriteUnitCartesian3List(CesiumOutputStream output, IEnumerable <UnitCartesian> values)
 {
     output.WriteStartSequence();
     foreach (UnitCartesian value in values)
     {
         output.WriteValue(value.X);
         output.WriteValue(value.Y);
         output.WriteValue(value.Z);
     }
     output.WriteEndSequence();
 }
Пример #16
0
 /// <summary>
 /// Writes a list of <see cref="Cartographic"/> values as an array in Longitude, Latitude, Height order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="values">The values to write.</param>
 public static void WriteCartographicList(CesiumOutputStream output, IEnumerable <Cartographic> values)
 {
     output.WriteStartSequence();
     foreach (Cartographic value in values)
     {
         output.WriteValue(value.Longitude);
         output.WriteValue(value.Latitude);
         output.WriteValue(value.Height);
     }
     output.WriteEndSequence();
 }
Пример #17
0
        /// <summary>
        /// Writes time-tagged <see cref="Motion&lt;Cartesian&gt;"/> values as an array in [Time, X, Y, Z, vX, vY, vZ] order.
        /// Times are epoch seconds since an epoch that is determined from the first date to be written.
        /// The epoch property is written as well.
        /// </summary>
        /// <param name="output">The stream to which to write the array.</param>
        /// <param name="propertyName">The name of the property to write.</param>
        /// <param name="dates">The dates at which the value is specified.</param>
        /// <param name="values">The corresponding value for each date.</param>
        /// <param name="startIndex">The index of the first element to use in the <paramref name="values"/> collection.</param>
        /// <param name="length">The number of elements to use from the <paramref name="values"/> collection.</param>
        public static void WriteCartesian3Velocity(CesiumOutputStream output, string propertyName, IList <JulianDate> dates, IList <Motion <Cartesian> > values, int startIndex, int length)
        {
            if (dates.Count != values.Count)
            {
                throw new ArgumentException(CesiumLocalization.MismatchedNumberOfDatesAndValues, "values");
            }

            JulianDate epoch = GetAndWriteEpoch(output, dates, startIndex, length);

            output.WritePropertyName(propertyName);
            output.WriteStartSequence();
            int last = startIndex + length;

            for (int i = startIndex; i < last; ++i)
            {
                output.WriteValue(epoch.SecondsDifference(dates[i]));
                Cartesian value    = values[i].Value;
                Cartesian velocity = values[i].FirstDerivative;
                output.WriteValue(value.X);
                output.WriteValue(value.Y);
                output.WriteValue(value.Z);
                output.WriteValue(velocity.X);
                output.WriteValue(velocity.Y);
                output.WriteValue(velocity.Z);
                output.WriteLineBreak();
            }

            output.WriteEndSequence();
        }
Пример #18
0
 /// <summary>
 /// Writes a list of references.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="references">The list of references.</param>
 public static void WriteReferences(CesiumOutputStream output, IEnumerable <Reference> references)
 {
     output.WriteStartSequence();
     foreach (var reference in references)
     {
         output.WriteValue(reference.Value);
     }
     output.WriteEndSequence();
 }
Пример #19
0
 /// <summary>
 /// Writes a list of <see cref="double"/> values as an array in X, Y, Z order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="values">The values to write.</param>
 public static void WriteDoubleList(CesiumOutputStream output, IEnumerable <double> values)
 {
     output.WriteStartSequence();
     foreach (double value in values)
     {
         output.WriteValue(value);
     }
     output.WriteEndSequence();
 }
Пример #20
0
 /// <summary>
 /// Writes a list of references.
 /// </summary>
 /// <param name="output">The stream to which to write.</param>
 /// <param name="references">The list of references to write.</param>
 public static void WriteReferences(CesiumOutputStream output, IEnumerable <string> references)
 {
     output.WriteStartSequence();
     foreach (string reference in references)
     {
         output.WriteValue(reference);
         output.WriteLineBreak();
     }
     output.WriteEndSequence();
 }
        /// <summary>
        /// Writes time-tagged <see cref="BoundingRectangle"/> values as an array in [Time, Clock, Cone, Magnitude] order.
        /// Times are epoch seconds since an epoch that is determined from the first date to be written.
        /// The epoch property is written as well.
        /// </summary>
        /// <param name="output">The stream to which to write the array.</param>
        /// <param name="propertyName">The name of the property to write.</param>
        /// <param name="dates">The dates at which the value is specified.</param>
        /// <param name="values">The corresponding value for each date.</param>
        /// <param name="startIndex">The index of the first element to use in the <paramref name="values"/> collection.</param>
        /// <param name="length">The number of elements to use from the <paramref name="values"/> collection.</param>
        public static void WriteBoundingRectangle(CesiumOutputStream output, string propertyName, IList<JulianDate> dates, IList<BoundingRectangle> values, int startIndex, int length)
        {
            if (dates.Count != values.Count)
                throw new ArgumentException(CesiumLocalization.MismatchedNumberOfDatesAndValues, "values");

            JulianDate epoch = GetAndWriteEpoch(output, dates, startIndex, length);

            output.WritePropertyName(propertyName);
            output.WriteStartSequence();
            int last = startIndex + length;
            for (int i = startIndex; i < last; ++i)
            {
                output.WriteValue(epoch.SecondsDifference(dates[i]));
                BoundingRectangle value = values[i];
                output.WriteValue(value.Left);
                output.WriteValue(value.Bottom);
                output.WriteValue(value.Width);
                output.WriteValue(value.Height);
                output.WriteLineBreak();
            }

            output.WriteEndSequence();
        }
Пример #22
0
 /// <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);
     }
 }
Пример #23
0
 /// <summary>
 /// Writes a <see cref="Motion&lt;Cartesian&gt;"/> value as an array in X, Y, Z, vX, vY, vZ order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="value">The value to write.</param>
 public static void WriteCartesian3Velocity(CesiumOutputStream output, Motion <Cartesian> value)
 {
     output.WriteStartSequence();
     output.WriteValue(value.Value.X);
     output.WriteValue(value.Value.Y);
     output.WriteValue(value.Value.Z);
     output.WriteValue(value.FirstDerivative.X);
     output.WriteValue(value.FirstDerivative.Y);
     output.WriteValue(value.FirstDerivative.Z);
     output.WriteEndSequence();
 }
Пример #24
0
 /// <summary>
 /// Writes a <see cref="UnitSpherical"/> value as an array in Clock, Cone order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="value">The value to write.</param>
 public static void WriteUnitSpherical(CesiumOutputStream output, UnitSpherical value)
 {
     output.WriteStartSequence();
     output.WriteValue(value.Clock);
     output.WriteValue(value.Cone);
     output.WriteEndSequence();
 }
Пример #25
0
 /// <summary>
 /// Writes a <see cref="Cartographic"/> value as an array in Longitude, Latitude, Height order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="value">The value to write.</param>
 public static void WriteCartographic(CesiumOutputStream output, Cartographic value)
 {
     output.WriteStartSequence();
     output.WriteValue(value.Longitude);
     output.WriteValue(value.Latitude);
     output.WriteValue(value.Height);
     output.WriteEndSequence();
 }
Пример #26
0
 /// <summary>
 /// Writes a <see cref="UnitCartesian"/> value as an array in X, Y, Z order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="value">The value to write.</param>
 public static void WriteUnitCartesian3(CesiumOutputStream output, UnitCartesian value)
 {
     output.WriteStartSequence();
     output.WriteValue(value.X);
     output.WriteValue(value.Y);
     output.WriteValue(value.Z);
     output.WriteEndSequence();
 }
Пример #27
0
 /// <summary>
 /// Writes a <see cref="TimeInterval"/> as an ISO 8601 interval string.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="interval">The interval to write.</param>
 public static void WriteTimeInterval(CesiumOutputStream output, TimeInterval interval)
 {
     output.WriteValue(CesiumFormattingHelper.ToIso8601Interval(interval.Start, interval.Stop, output.PrettyFormatting ? Iso8601Format.Extended : Iso8601Format.Compact));
 }
Пример #28
0
 /// <summary>
 /// Writes a list of <see cref="UnitCartesian"/> values as an array in X, Y, Z order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="values">The values to write.</param>
 public static void WriteUnitCartesian3List(CesiumOutputStream output, IEnumerable<UnitCartesian> values)
 {
     output.WriteStartSequence();
     foreach (UnitCartesian value in values)
     {
         output.WriteValue(value.X);
         output.WriteValue(value.Y);
         output.WriteValue(value.Z);
     }
     output.WriteEndSequence();
 }
        /// <summary>
        /// Writes time-tagged <see cref="CartographicExtent"/> values as an array in [Time, WestLongitude, SouthLatitude, EastLongitude, NorthLatitude] order.
        /// Times are epoch seconds since an epoch that is determined from the first date to be written.
        /// The epoch property is written as well.
        /// </summary>
        /// <param name="output">The stream to which to write the array.</param>
        /// <param name="propertyName">The name of the property to write.</param>
        /// <param name="dates">The dates at which the value is specified.</param>
        /// <param name="values">The corresponding value for each date.</param>
        /// <param name="startIndex">The index of the first element to use in the <paramref name="values"/> collection.</param>
        /// <param name="length">The number of elements to use from the <paramref name="values"/> collection.</param>
        public static void WriteCartographicExtent(CesiumOutputStream output, string propertyName, IList<JulianDate> dates, IList<CartographicExtent> values, int startIndex, int length)
        {
            if (dates.Count != values.Count)
                throw new ArgumentException(CesiumLocalization.MismatchedNumberOfDatesAndValues, "values");

            JulianDate epoch = GetAndWriteEpoch(output, dates, startIndex, length);

            output.WritePropertyName(propertyName);
            output.WriteStartSequence();
            int last = startIndex + length;
            for (int i = startIndex; i < last; ++i)
            {
                output.WriteValue(epoch.SecondsDifference(dates[i]));
                CartographicExtent value = values[i];
                output.WriteValue(value.WestLongitude);
                output.WriteValue(value.SouthLatitude);
                output.WriteValue(value.EastLongitude);
                output.WriteValue(value.NorthLatitude);
                output.WriteLineBreak();
            }

            output.WriteEndSequence();
        }
Пример #30
0
 /// <summary>
 /// Writes a <see cref="UnitQuaternion"/> as an array in [X, Y, Z, W] order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="value">The value to write.</param>
 public static void WriteUnitQuaternion(CesiumOutputStream output, UnitQuaternion value)
 {
     output.WriteStartSequence();
     output.WriteValue(value.X);
     output.WriteValue(value.Y);
     output.WriteValue(value.Z);
     output.WriteValue(value.W);
     output.WriteEndSequence();
 }
Пример #31
0
 /// <summary>
 /// Writes a reference.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="value">The value to write.</param>
 public static void WriteReference(CesiumOutputStream output, string value)
 {
     output.WriteValue(value);
 }
 /// <summary>
 /// Writes a list of <see cref="double"/> values as an array in X, Y, Z order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="values">The values to write.</param>
 public static void WriteDoubleList(CesiumOutputStream output, IEnumerable<double> values)
 {
     output.WriteStartSequence();
     foreach (double value in values)
     {
         output.WriteValue(value);
     }
     output.WriteEndSequence();
 }
Пример #33
0
 /// <summary>
 /// Writes a list of <see cref="Cartographic"/> values as an array in Longitude, Latitude, Height order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="values">The values to write.</param>
 public static void WriteCartographicList(CesiumOutputStream output, IEnumerable<Cartographic> values)
 {
     output.WriteStartSequence();
     foreach (Cartographic value in values)
     {
         output.WriteValue(value.Longitude);
         output.WriteValue(value.Latitude);
         output.WriteValue(value.Height);
     }
     output.WriteEndSequence();
 }
Пример #34
0
 /// <summary>
 /// Writes a list of <see cref="UnitSpherical"/> values as an array in Clock, Cone order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="values">The values to write.</param>
 public static void WriteUnitSphericalList(CesiumOutputStream output, IEnumerable<UnitSpherical> values)
 {
     output.WriteStartSequence();
     foreach (UnitSpherical value in values)
     {
         output.WriteValue(value.Clock);
         output.WriteValue(value.Cone);
     }
     output.WriteEndSequence();
 }
Пример #35
0
 /// <summary>
 /// Writes a <see cref="JulianDate"/> as an ISO 8601 interval string.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="date">The date to write.</param>
 public static void WriteDate(CesiumOutputStream output, JulianDate date)
 {
     output.WriteValue(CesiumFormattingHelper.ToIso8601(date, output.PrettyFormatting ? Iso8601Format.Extended : Iso8601Format.Compact));
 }
Пример #36
0
 /// <summary>
 /// Writes a reference.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="value">The value to write.</param>
 public static void WriteReference(CesiumOutputStream output, string value)
 {
     output.WriteValue(value);
 }
 /// <summary>
 /// Writes a <see cref="CartographicExtent"/> value as an array in WestLongitude, SouthLatitude, EastLongitude, NorthLatitude order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="value">The value to write.</param>
 public static void WriteCartographicExtent(CesiumOutputStream output, CartographicExtent value)
 {
     output.WriteStartSequence();
     output.WriteValue(value.WestLongitude);
     output.WriteValue(value.SouthLatitude);
     output.WriteValue(value.EastLongitude);
     output.WriteValue(value.NorthLatitude);
     output.WriteEndSequence();
 }
 /// <summary>
 /// Writes a color value as an array in Red, Green, Blue, Alpha order as floating-point values.
 /// </summary>
 /// <param name="output">The stream to which to write the color.</param>
 /// <param name="red">The red component in the range 0.0-1.0.</param>
 /// <param name="green">The green component in the range 0.0-1.0.</param>
 /// <param name="blue">The blue component in the range 0.0-1.0.</param>
 /// <param name="alpha">The alpha component in the range 0.0-1.0.</param>
 public static void WriteRgbaf(CesiumOutputStream output, double red, double green, double blue, double alpha)
 {
     output.WriteStartSequence();
     output.WriteValue(red);
     output.WriteValue(green);
     output.WriteValue(blue);
     output.WriteValue(alpha);
     output.WriteEndSequence();
 }
Пример #39
0
 /// <summary>
 /// Writes a color value as an array in Red, Green, Blue, Alpha order.
 /// </summary>
 /// <param name="output">The stream to which to write the color.</param>
 /// <param name="red">The red component in the range 0.0-1.0.</param>
 /// <param name="green">The green component in the range 0.0-1.0.</param>
 /// <param name="blue">The blue component in the range 0.0-1.0.</param>
 /// <param name="alpha">The alpha component in the range 0.0-1.0.</param>
 public static void WriteRgbaf(CesiumOutputStream output, float red, float green, float blue, float alpha)
 {
     output.WriteStartSequence();
     output.WriteValue(red);
     output.WriteValue(green);
     output.WriteValue(blue);
     output.WriteValue(alpha);
     output.WriteEndSequence();
 }
Пример #40
0
 /// <summary>
 /// Writes a <see cref="Motion&lt;Cartesian&gt;"/> value as an array in X, Y, Z, vX, vY, vZ order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="value">The value to write.</param>
 public static void WriteCartesian3Velocity(CesiumOutputStream output, Motion<Cartesian> value)
 {
     output.WriteStartSequence();
     output.WriteValue(value.Value.X);
     output.WriteValue(value.Value.Y);
     output.WriteValue(value.Value.Z);
     output.WriteValue(value.FirstDerivative.X);
     output.WriteValue(value.FirstDerivative.Y);
     output.WriteValue(value.FirstDerivative.Z);
     output.WriteEndSequence();
 }
Пример #41
0
        /// <summary>
        /// Writes the time-tagged <see cref="UnitQuaternion"/> collection as an array in
        /// [Time, X, Y, Z, W] order.
        /// Times are epoch seconds since an epoch that is determined from the first date to be written.
        /// The epoch property is written as well.
        /// </summary>
        /// <param name="output">The stream to which to write the array.</param>
        /// <param name="propertyName">The name of the property to write.</param>
        /// <param name="dates">The dates at which the value is specified.</param>
        /// <param name="values">The corresponding value for each date.</param>
        /// <param name="startIndex">The index of the first element to use in the <paramref name="values"/> collection.</param>
        /// <param name="length">The number of elements to use from the <paramref name="values"/> collection.</param>
        public static void WriteUnitQuaternion(CesiumOutputStream output, string propertyName, IList<JulianDate> dates, IList<UnitQuaternion> values, int startIndex, int length)
        {
            if (dates.Count != values.Count)
                throw new ArgumentException(CesiumLocalization.MismatchedNumberOfDatesAndValues, "values");

            JulianDate epoch = GetAndWriteEpoch(output, dates, startIndex, length);

            output.WritePropertyName(propertyName);
            output.WriteStartSequence();
            int last = startIndex + length;
            for (int i = startIndex; i < last; ++i)
            {
                output.WriteValue(epoch.SecondsDifference(dates[i]));
                UnitQuaternion quaternion = values[i];
                output.WriteValue(quaternion.X);
                output.WriteValue(quaternion.Y);
                output.WriteValue(quaternion.Z);
                output.WriteValue(quaternion.W);
                output.WriteLineBreak();
            }

            output.WriteEndSequence();
        }
Пример #42
0
        /// <summary>
        /// Writes time-tagged <see cref="Motion&lt;Cartesian&gt;"/> values as an array in [Time, X, Y, Z, vX, vY, vZ] order.
        /// Times are epoch seconds since an epoch that is determined from the first date to be written.
        /// The epoch property is written as well.
        /// </summary>
        /// <param name="output">The stream to which to write the array.</param>
        /// <param name="propertyName">The name of the property to write.</param>
        /// <param name="dates">The dates at which the value is specified.</param>
        /// <param name="values">The corresponding value for each date.</param>
        /// <param name="startIndex">The index of the first element to use in the <paramref name="values"/> collection.</param>
        /// <param name="length">The number of elements to use from the <paramref name="values"/> collection.</param>
        public static void WriteCartesian3Velocity(CesiumOutputStream output, string propertyName, IList<JulianDate> dates, IList<Motion<Cartesian>> values, int startIndex, int length)
        {
            if (dates.Count != values.Count)
                throw new ArgumentException(CesiumLocalization.MismatchedNumberOfDatesAndValues, "values");

            JulianDate epoch = GetAndWriteEpoch(output, dates, startIndex, length);

            output.WritePropertyName(propertyName);
            output.WriteStartSequence();
            int last = startIndex + length;
            for (int i = startIndex; i < last; ++i)
            {
                output.WriteValue(epoch.SecondsDifference(dates[i]));
                Cartesian value = values[i].Value;
                Cartesian velocity = values[i].FirstDerivative;
                output.WriteValue(value.X);
                output.WriteValue(value.Y);
                output.WriteValue(value.Z);
                output.WriteValue(velocity.X);
                output.WriteValue(velocity.Y);
                output.WriteValue(velocity.Z);
                output.WriteLineBreak();
            }

            output.WriteEndSequence();
        }
Пример #43
0
 /// <summary>
 /// Writes a list of references.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="references">The list of references.</param>
 public static void WriteReferences(CesiumOutputStream output, IEnumerable<Reference> references)
 {
     output.WriteStartSequence();
     foreach (var reference in references)
     {
         output.WriteValue(reference.Value);
     }
     output.WriteEndSequence();
 }
Пример #44
0
 /// <summary>
 /// Writes a <see cref="JulianDate"/> as an ISO 8601 interval string.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="date">The date to write.</param>
 public static void WriteDate(CesiumOutputStream output, JulianDate date)
 {
     output.WriteValue(CesiumFormattingHelper.ToIso8601(date, output.PrettyFormatting ? Iso8601Format.Extended : Iso8601Format.Compact));
 }
 /// <summary>
 /// Writes a list of references.
 /// </summary>
 /// <param name="output">The stream to which to write.</param>
 /// <param name="references">The list of references to write.</param>
 public static void WriteReferences(CesiumOutputStream output, IEnumerable<string> references)
 {
     output.WriteStartSequence();
     foreach (string reference in references)
     {
         output.WriteValue(reference);
         output.WriteLineBreak();
     }
     output.WriteEndSequence();
 }
Пример #46
0
 /// <summary>
 /// Writes a <see cref="TimeInterval"/> as an ISO 8601 interval string.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="interval">The interval to write.</param>
 public static void WriteTimeInterval(CesiumOutputStream output, TimeInterval interval)
 {
     output.WriteValue(CesiumFormattingHelper.ToIso8601Interval(interval.Start, interval.Stop, output.PrettyFormatting ? Iso8601Format.Extended : Iso8601Format.Compact));
 }
Пример #47
0
 /// <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;
     }
 }
 /// <summary>
 /// Writes a <see cref="NearFarScalar"/> value as an array in Clock, Cone, Magnitude order.
 /// </summary>
 /// <param name="output">The stream to which to write the value.</param>
 /// <param name="value">The value to write.</param>
 public static void WriteNearFarScalar(CesiumOutputStream output, NearFarScalar value)
 {
     output.WriteStartSequence();
     output.WriteValue(value.NearDistance);
     output.WriteValue(value.NearValue);
     output.WriteValue(value.FarDistance);
     output.WriteValue(value.FarValue);
     output.WriteEndSequence();
 }