/// <summary> /// Writes a value for the <code>verticalOrigin</code> property as a <code>verticalOrigin</code> value. The <code>verticalOrigin</code> property specifies the vertical origin of the label. It controls whether the label image is bottom-, center-, or top-aligned with the `position`. /// </summary> /// <param name="value">The vertical origin.</param> public void WriteVerticalOriginProperty(CesiumVerticalOrigin value) { using (var writer = OpenVerticalOriginProperty()) { writer.WriteVerticalOrigin(value); } }
/// <summary> /// Writes the <code>verticalOrigin</code> property. The <code>verticalOrigin</code> property specifies the vertical origin. Valid values are "BOTTOM", "CENTER", and "TOP". /// </summary> /// <param name="value">The vertical origin.</param> public void WriteVerticalOrigin(CesiumVerticalOrigin value) { const string PropertyName = VerticalOriginPropertyName; if (IsInterval) { Output.WritePropertyName(PropertyName); } Output.WriteValue(CesiumFormattingHelper.VerticalOriginToString(value)); }
/// <summary> /// Converts a <see cref="CesiumVerticalOrigin"/> to the corresponding string in a /// CZML stream. /// </summary> /// <param name="verticalOrigin">The vertical origin to convert.</param> /// <returns>The string representation of the specified <see cref="CesiumVerticalOrigin"/>.</returns> public static string VerticalOriginToString(CesiumVerticalOrigin verticalOrigin) { switch (verticalOrigin) { case CesiumVerticalOrigin.Bottom: return("BOTTOM"); case CesiumVerticalOrigin.Center: return("CENTER"); case CesiumVerticalOrigin.Top: return("TOP"); default: throw new ArgumentException(CesiumLocalization.UnknownEnumerationValue, "verticalOrigin"); } }
public void VerticalOriginCanBeWrittenAsSimpleString() { const string expectedPropertyName = "foo"; const CesiumVerticalOrigin expectedValue = CesiumVerticalOrigin.Center; using (Packet) using (var writer = new VerticalOriginCesiumWriter(expectedPropertyName)) { writer.Open(OutputStream); writer.WriteVerticalOrigin(expectedValue); } AssertExpectedJson(new Dictionary <string, object> { { expectedPropertyName, CesiumFormattingHelper.VerticalOriginToString(expectedValue) }, }); }
public void VerticalOriginCanBeWrittenInsideInterval() { var start = new GregorianDate(2012, 6, 7, 12, 0, 0).ToJulianDate(); var stop = start.AddSeconds(100.0); const string expectedPropertyName = "foo"; const CesiumVerticalOrigin expectedValue = CesiumVerticalOrigin.Center; using (Packet) using (var writer = new VerticalOriginCesiumWriter(expectedPropertyName)) { writer.Open(OutputStream); writer.WriteInterval(start, stop); writer.WriteVerticalOrigin(expectedValue); } AssertExpectedJson(expectedPropertyName, new Dictionary <string, object> { { "interval", CesiumFormattingHelper.ToIso8601Interval(start, stop, Iso8601Format.Compact) }, { VerticalOriginCesiumWriter.VerticalOriginPropertyName, CesiumFormattingHelper.VerticalOriginToString(expectedValue) }, }); }
public void TestVerticalOriginToString(CesiumVerticalOrigin value) { string s = CesiumFormattingHelper.VerticalOriginToString(value); Assert.IsNotNull(s); }
/// <summary> /// Converts a <see cref="CesiumVerticalOrigin"/> to the corresponding string in a /// CZML stream. /// </summary> /// <param name="verticalOrigin">The vertical origin to convert.</param> /// <returns>The string representation of the specified <see cref="CesiumVerticalOrigin"/>.</returns> public static string VerticalOriginToString(CesiumVerticalOrigin verticalOrigin) { switch (verticalOrigin) { case CesiumVerticalOrigin.Bottom: return "BOTTOM"; case CesiumVerticalOrigin.Center: return "CENTER"; case CesiumVerticalOrigin.Top: return "TOP"; default: throw new ArgumentException(CesiumLocalization.UnknownEnumerationValue, "verticalOrigin"); } }