From 7591030c4d2f228ac0ce03c6aa594c9fecc9f385 Mon Sep 17 00:00:00 2001 From: Scott Hunter Date: Wed, 8 Jun 2016 19:38:50 -0400 Subject: [PATCH 1/4] Mark CSToJava attributes as Conditional. --- .../Attributes/CSToJavaExcludeAttribute.cs | 3 ++- .../Attributes/CSToJavaExcludeBaseAttribute.cs | 3 ++- .../Attributes/CSToJavaImmutableValueType.cs | 3 ++- .../Attributes/CSToJavaRenameAttribute.cs | 3 ++- .../CSToJavaUseNullForDefaultGenericTypeValueAttribute.cs | 3 ++- .../Attributes/CoverageExcludeAttribute.cs | 4 ---- DotNet/CesiumLanguageWriter/CesiumLanguageWriter.csproj | 1 - 7 files changed, 10 insertions(+), 10 deletions(-) delete mode 100644 DotNet/CesiumLanguageWriter/Attributes/CoverageExcludeAttribute.cs diff --git a/DotNet/CesiumLanguageWriter/Attributes/CSToJavaExcludeAttribute.cs b/DotNet/CesiumLanguageWriter/Attributes/CSToJavaExcludeAttribute.cs index cf7e6721..937324d2 100644 --- a/DotNet/CesiumLanguageWriter/Attributes/CSToJavaExcludeAttribute.cs +++ b/DotNet/CesiumLanguageWriter/Attributes/CSToJavaExcludeAttribute.cs @@ -1,14 +1,15 @@ using System; +using System.Diagnostics; /// /// Mark code to be excluded by the CSToJava Java conversion tool. /// +[Conditional("CSTOJAVA")] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate)] [CSToJavaExclude] -[CoverageExcludeAttribute] internal sealed class CSToJavaExcludeAttribute : Attribute { public CSToJavaExcludeAttribute() diff --git a/DotNet/CesiumLanguageWriter/Attributes/CSToJavaExcludeBaseAttribute.cs b/DotNet/CesiumLanguageWriter/Attributes/CSToJavaExcludeBaseAttribute.cs index 91547d77..a317149d 100644 --- a/DotNet/CesiumLanguageWriter/Attributes/CSToJavaExcludeBaseAttribute.cs +++ b/DotNet/CesiumLanguageWriter/Attributes/CSToJavaExcludeBaseAttribute.cs @@ -1,12 +1,13 @@ using System; +using System.Diagnostics; /// /// Indicate that a particular base class or interface implementation should be excluded by the /// CSToJava Java conversion tool. /// +[Conditional("CSTOJAVA")] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, AllowMultiple = true)] [CSToJavaExclude] -[CoverageExcludeAttribute] internal class CSToJavaExcludeBaseAttribute : Attribute { public CSToJavaExcludeBaseAttribute(string typeName) diff --git a/DotNet/CesiumLanguageWriter/Attributes/CSToJavaImmutableValueType.cs b/DotNet/CesiumLanguageWriter/Attributes/CSToJavaImmutableValueType.cs index ac52fe8a..63fecbdc 100644 --- a/DotNet/CesiumLanguageWriter/Attributes/CSToJavaImmutableValueType.cs +++ b/DotNet/CesiumLanguageWriter/Attributes/CSToJavaImmutableValueType.cs @@ -1,11 +1,12 @@ using System; +using System.Diagnostics; /// /// Mark a value type as being immutable, and therefore not necessary to clone when making copies. /// +[Conditional("CSTOJAVA")] [AttributeUsage(AttributeTargets.Struct)] [CSToJavaExclude] -[CoverageExcludeAttribute] internal sealed class CSToJavaImmutableValueType : Attribute { } \ No newline at end of file diff --git a/DotNet/CesiumLanguageWriter/Attributes/CSToJavaRenameAttribute.cs b/DotNet/CesiumLanguageWriter/Attributes/CSToJavaRenameAttribute.cs index cf5a7e12..6446dd85 100644 --- a/DotNet/CesiumLanguageWriter/Attributes/CSToJavaRenameAttribute.cs +++ b/DotNet/CesiumLanguageWriter/Attributes/CSToJavaRenameAttribute.cs @@ -1,12 +1,13 @@ using System; +using System.Diagnostics; /// /// Mark code to be renamed by the CSToJava Java conversion tool. /// +[Conditional("CSTOJAVA")] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Interface)] [CSToJavaExclude] -[CoverageExcludeAttribute] internal sealed class CSToJavaRenameAttribute : Attribute { public CSToJavaRenameAttribute(string newName) diff --git a/DotNet/CesiumLanguageWriter/Attributes/CSToJavaUseNullForDefaultGenericTypeValueAttribute.cs b/DotNet/CesiumLanguageWriter/Attributes/CSToJavaUseNullForDefaultGenericTypeValueAttribute.cs index 9def0019..b4b481dd 100644 --- a/DotNet/CesiumLanguageWriter/Attributes/CSToJavaUseNullForDefaultGenericTypeValueAttribute.cs +++ b/DotNet/CesiumLanguageWriter/Attributes/CSToJavaUseNullForDefaultGenericTypeValueAttribute.cs @@ -1,16 +1,17 @@ using System; +using System.Diagnostics; /// /// Declare that the default value of a generic type, e.g. default(T), should be /// treated as null instead of using TypeLiterals to produce correct values at /// run-time. /// +[Conditional("CSTOJAVA")] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = true)] [CSToJavaExclude] -[CoverageExcludeAttribute] internal class CSToJavaUseNullForDefaultGenericTypeValueAttribute : Attribute { public CSToJavaUseNullForDefaultGenericTypeValueAttribute(string genericTypeName) diff --git a/DotNet/CesiumLanguageWriter/Attributes/CoverageExcludeAttribute.cs b/DotNet/CesiumLanguageWriter/Attributes/CoverageExcludeAttribute.cs deleted file mode 100644 index 3362a541..00000000 --- a/DotNet/CesiumLanguageWriter/Attributes/CoverageExcludeAttribute.cs +++ /dev/null @@ -1,4 +0,0 @@ -//Add support for coverage exclusion in NCover by adding the [CoverageExclude] attribute to any class or method. -[CSToJavaExclude] -[CoverageExcludeAttribute] -internal sealed class CoverageExcludeAttribute : System.Attribute { } \ No newline at end of file diff --git a/DotNet/CesiumLanguageWriter/CesiumLanguageWriter.csproj b/DotNet/CesiumLanguageWriter/CesiumLanguageWriter.csproj index 92055c9c..5d5ce163 100644 --- a/DotNet/CesiumLanguageWriter/CesiumLanguageWriter.csproj +++ b/DotNet/CesiumLanguageWriter/CesiumLanguageWriter.csproj @@ -60,7 +60,6 @@ - From 7574c115654f63315bb20a2dc53be39c5994c11d Mon Sep 17 00:00:00 2001 From: Scott Hunter Date: Wed, 8 Jun 2016 19:39:24 -0400 Subject: [PATCH 2/4] Add some additional tests. --- .../CesiumLanguageWriterTests.csproj | 7 ++ .../TestBillboardCesiumWriter.cs | 15 +++ .../TestBooleanCesiumWriter.cs | 42 +++++++ .../TestDoubleCesiumWriter.cs | 42 +++++++ .../TestHorizontalOriginCesiumWriter.cs | 42 +++++++ .../TestLabelStyleCesiumWriter.cs | 42 +++++++ .../TestOrientationCesiumWriter.cs | 117 ++++++++++-------- .../TestStringCesiumWriter.cs | 42 +++++++ .../TestVerticalOriginCesiumWriter.cs | 42 +++++++ 9 files changed, 338 insertions(+), 53 deletions(-) create mode 100644 DotNet/CesiumLanguageWriterTests/TestBillboardCesiumWriter.cs create mode 100644 DotNet/CesiumLanguageWriterTests/TestBooleanCesiumWriter.cs create mode 100644 DotNet/CesiumLanguageWriterTests/TestDoubleCesiumWriter.cs create mode 100644 DotNet/CesiumLanguageWriterTests/TestHorizontalOriginCesiumWriter.cs create mode 100644 DotNet/CesiumLanguageWriterTests/TestLabelStyleCesiumWriter.cs create mode 100644 DotNet/CesiumLanguageWriterTests/TestStringCesiumWriter.cs create mode 100644 DotNet/CesiumLanguageWriterTests/TestVerticalOriginCesiumWriter.cs diff --git a/DotNet/CesiumLanguageWriterTests/CesiumLanguageWriterTests.csproj b/DotNet/CesiumLanguageWriterTests/CesiumLanguageWriterTests.csproj index 41599887..09236255 100644 --- a/DotNet/CesiumLanguageWriterTests/CesiumLanguageWriterTests.csproj +++ b/DotNet/CesiumLanguageWriterTests/CesiumLanguageWriterTests.csproj @@ -46,9 +46,14 @@ + + + + + @@ -66,10 +71,12 @@ + + diff --git a/DotNet/CesiumLanguageWriterTests/TestBillboardCesiumWriter.cs b/DotNet/CesiumLanguageWriterTests/TestBillboardCesiumWriter.cs new file mode 100644 index 00000000..499053cf --- /dev/null +++ b/DotNet/CesiumLanguageWriterTests/TestBillboardCesiumWriter.cs @@ -0,0 +1,15 @@ +using CesiumLanguageWriter; +using CesiumLanguageWriter.Advanced; +using NUnit.Framework; + +namespace CesiumLanguageWriterTests +{ + [TestFixture] + public class TestBillboardCesiumWriter : TestCesiumPropertyWriter + { + protected override CesiumPropertyWriter CreatePropertyWriter(string propertyName) + { + return new BillboardCesiumWriter(propertyName); + } + } +} \ No newline at end of file diff --git a/DotNet/CesiumLanguageWriterTests/TestBooleanCesiumWriter.cs b/DotNet/CesiumLanguageWriterTests/TestBooleanCesiumWriter.cs new file mode 100644 index 00000000..5ef2405e --- /dev/null +++ b/DotNet/CesiumLanguageWriterTests/TestBooleanCesiumWriter.cs @@ -0,0 +1,42 @@ +using CesiumLanguageWriter; +using CesiumLanguageWriter.Advanced; +using NUnit.Framework; + +namespace CesiumLanguageWriterTests +{ + [TestFixture] + public class TestBooleanCesiumWriter : TestCesiumPropertyWriter + { + [Test] + public void BooleanCanBeWrittenAsSimpleBoolean() + { + using (Packet) + using (BooleanCesiumWriter writer = new BooleanCesiumWriter("foo")) + { + writer.Open(OutputStream); + writer.WriteBoolean(false); + } + Assert.AreEqual("{\"foo\":false}", StringWriter.ToString()); + } + + [Test] + public void BooleanCanBeWrittenInsideInterval() + { + JulianDate startDate = new GregorianDate(2012, 6, 7, 12, 0, 0).ToJulianDate(); + + using (Packet) + using (BooleanCesiumWriter writer = new BooleanCesiumWriter("foo")) + { + writer.Open(OutputStream); + writer.WriteInterval(startDate, startDate.AddSeconds(100.0)); + writer.WriteBoolean(false); + } + Assert.AreEqual("{\"foo\":{\"interval\":\"20120607T12Z/20120607T120140Z\",\"boolean\":false}}", StringWriter.ToString()); + } + + protected override CesiumPropertyWriter CreatePropertyWriter(string propertyName) + { + return new BooleanCesiumWriter(propertyName); + } + } +} \ No newline at end of file diff --git a/DotNet/CesiumLanguageWriterTests/TestDoubleCesiumWriter.cs b/DotNet/CesiumLanguageWriterTests/TestDoubleCesiumWriter.cs new file mode 100644 index 00000000..d8dacd75 --- /dev/null +++ b/DotNet/CesiumLanguageWriterTests/TestDoubleCesiumWriter.cs @@ -0,0 +1,42 @@ +using CesiumLanguageWriter; +using CesiumLanguageWriter.Advanced; +using NUnit.Framework; + +namespace CesiumLanguageWriterTests +{ + [TestFixture] + public class TestDoubleCesiumWriter : TestCesiumPropertyWriter + { + [Test] + public void DoubleCanBeWrittenAsSimpleNumber() + { + using (Packet) + using (DoubleCesiumWriter writer = new DoubleCesiumWriter("foo")) + { + writer.Open(OutputStream); + writer.WriteNumber(1.23); + } + Assert.AreEqual("{\"foo\":1.23}", StringWriter.ToString()); + } + + [Test] + public void DoubleCanBeWrittenInsideInterval() + { + JulianDate startDate = new GregorianDate(2012, 6, 7, 12, 0, 0).ToJulianDate(); + + using (Packet) + using (DoubleCesiumWriter writer = new DoubleCesiumWriter("foo")) + { + writer.Open(OutputStream); + writer.WriteInterval(startDate, startDate.AddSeconds(100.0)); + writer.WriteNumber(1.23); + } + Assert.AreEqual("{\"foo\":{\"interval\":\"20120607T12Z/20120607T120140Z\",\"number\":1.23}}", StringWriter.ToString()); + } + + protected override CesiumPropertyWriter CreatePropertyWriter(string propertyName) + { + return new DoubleCesiumWriter(propertyName); + } + } +} \ No newline at end of file diff --git a/DotNet/CesiumLanguageWriterTests/TestHorizontalOriginCesiumWriter.cs b/DotNet/CesiumLanguageWriterTests/TestHorizontalOriginCesiumWriter.cs new file mode 100644 index 00000000..80302e2d --- /dev/null +++ b/DotNet/CesiumLanguageWriterTests/TestHorizontalOriginCesiumWriter.cs @@ -0,0 +1,42 @@ +using CesiumLanguageWriter; +using CesiumLanguageWriter.Advanced; +using NUnit.Framework; + +namespace CesiumLanguageWriterTests +{ + [TestFixture] + public class TestHorizontalOriginCesiumWriter : TestCesiumPropertyWriter + { + [Test] + public void HorizontalOriginCanBeWrittenAsSimpleString() + { + using (Packet) + using (HorizontalOriginCesiumWriter writer = new HorizontalOriginCesiumWriter("foo")) + { + writer.Open(OutputStream); + writer.WriteHorizontalOrigin(CesiumHorizontalOrigin.Center); + } + Assert.AreEqual("{\"foo\":\"CENTER\"}", StringWriter.ToString()); + } + + [Test] + public void HorizontalOriginCanBeWrittenInsideInterval() + { + JulianDate startDate = new GregorianDate(2012, 6, 7, 12, 0, 0).ToJulianDate(); + + using (Packet) + using (HorizontalOriginCesiumWriter writer = new HorizontalOriginCesiumWriter("foo")) + { + writer.Open(OutputStream); + writer.WriteInterval(startDate, startDate.AddSeconds(100.0)); + writer.WriteHorizontalOrigin(CesiumHorizontalOrigin.Center); + } + Assert.AreEqual("{\"foo\":{\"interval\":\"20120607T12Z/20120607T120140Z\",\"horizontalOrigin\":\"CENTER\"}}", StringWriter.ToString()); + } + + protected override CesiumPropertyWriter CreatePropertyWriter(string propertyName) + { + return new HorizontalOriginCesiumWriter(propertyName); + } + } +} \ No newline at end of file diff --git a/DotNet/CesiumLanguageWriterTests/TestLabelStyleCesiumWriter.cs b/DotNet/CesiumLanguageWriterTests/TestLabelStyleCesiumWriter.cs new file mode 100644 index 00000000..d6e0b94d --- /dev/null +++ b/DotNet/CesiumLanguageWriterTests/TestLabelStyleCesiumWriter.cs @@ -0,0 +1,42 @@ +using CesiumLanguageWriter; +using CesiumLanguageWriter.Advanced; +using NUnit.Framework; + +namespace CesiumLanguageWriterTests +{ + [TestFixture] + public class TestLabelStyleCesiumWriter : TestCesiumPropertyWriter + { + [Test] + public void LabelStyleCanBeWrittenAsSimpleString() + { + using (Packet) + using (LabelStyleCesiumWriter writer = new LabelStyleCesiumWriter("foo")) + { + writer.Open(OutputStream); + writer.WriteLabelStyle(CesiumLabelStyle.FillAndOutline); + } + Assert.AreEqual("{\"foo\":\"FILL_AND_OUTLINE\"}", StringWriter.ToString()); + } + + [Test] + public void LabelStyleCanBeWrittenInsideInterval() + { + JulianDate startDate = new GregorianDate(2012, 6, 7, 12, 0, 0).ToJulianDate(); + + using (Packet) + using (LabelStyleCesiumWriter writer = new LabelStyleCesiumWriter("foo")) + { + writer.Open(OutputStream); + writer.WriteInterval(startDate, startDate.AddSeconds(100.0)); + writer.WriteLabelStyle(CesiumLabelStyle.FillAndOutline); + } + Assert.AreEqual("{\"foo\":{\"interval\":\"20120607T12Z/20120607T120140Z\",\"labelStyle\":\"FILL_AND_OUTLINE\"}}", StringWriter.ToString()); + } + + protected override CesiumPropertyWriter CreatePropertyWriter(string propertyName) + { + return new LabelStyleCesiumWriter(propertyName); + } + } +} \ No newline at end of file diff --git a/DotNet/CesiumLanguageWriterTests/TestOrientationCesiumWriter.cs b/DotNet/CesiumLanguageWriterTests/TestOrientationCesiumWriter.cs index b63a144d..ded826c1 100644 --- a/DotNet/CesiumLanguageWriterTests/TestOrientationCesiumWriter.cs +++ b/DotNet/CesiumLanguageWriterTests/TestOrientationCesiumWriter.cs @@ -16,79 +16,90 @@ protected override CesiumPropertyWriter CreatePropertyW } [Test] - [Explicit] - public void Sandbox() + public void TestCompleteExample() { - JulianDate date = new JulianDate(2451545.0); - - using (StringWriter sw = new StringWriter()) + using (var stringWriter = new StringWriter()) { - CesiumOutputStream output = new CesiumOutputStream(sw); - output.PrettyFormatting = true; - CesiumStreamWriter writer = new CesiumStreamWriter(); - - using (PacketCesiumWriter packet = writer.OpenPacket(output)) + var date = new JulianDate(2451545.0); + + const string id = "MyID"; + var availability = new TimeInterval(date, date.AddDays(2.0)); + + var interval1 = new TimeInterval(date, date.AddDays(1.0)); + + var interval1Position = new Cartesian(1.0, 2.0, 3.0); + var interval1Orientation = new UnitQuaternion(1, 0, 0, 0); + + var interval2 = new TimeInterval(date.AddDays(1.0), date.AddDays(2.0)); + + var interval2SampleDates = new List + { + date.AddDays(1.0), + date.AddDays(1.5), + date.AddDays(2.0) + }; + + var interval2SamplePositions = new List + { + Cartographic.Zero, + new Cartographic(1.0, 0.0, 0.0), + new Cartographic(0.0, 1.0, 0.0) + }; + var interval2SampleOrientations = new List + { + UnitQuaternion.Identity, + new UnitQuaternion(0.0, 1.0, 0.0, 0.0), + new UnitQuaternion(0.0, 0.0, 1.0, 0.0) + }; + + const CesiumInterpolationAlgorithm orientationInterpolationAlgorithm = CesiumInterpolationAlgorithm.Linear; + const int orientationInterpolationDegree = 1; + + var outputStream = new CesiumOutputStream(stringWriter) + { + PrettyFormatting = true + }; + var writer = new CesiumStreamWriter(); + + using (var packet = writer.OpenPacket(outputStream)) { - packet.WriteId("MyID"); - packet.WriteAvailability(date, date.AddDays(1.0)); + packet.WriteId(id); + packet.WriteAvailability(availability); - using (PositionCesiumWriter position = packet.OpenPositionProperty()) - using (CesiumIntervalListWriter intervalList = position.OpenMultipleIntervals()) + using (var positionWriter = packet.OpenPositionProperty()) + using (var intervalListWriter = positionWriter.OpenMultipleIntervals()) { - using (PositionCesiumWriter interval = intervalList.OpenInterval()) + using (var interval = intervalListWriter.OpenInterval()) { - interval.WriteInterval(new TimeInterval(date, date.AddDays(1.0))); - interval.WriteCartesian(new Cartesian(1.0, 2.0, 3.0)); + interval.WriteInterval(interval1); + interval.WriteCartesian(interval1Position); } - using (PositionCesiumWriter interval = intervalList.OpenInterval(date.AddDays(1.0), date.AddDays(2.0))) + using (var interval = intervalListWriter.OpenInterval(interval2.Start, interval2.Stop)) { - var dates = new List(); - var positions = new List(); - - dates.Add(date.AddDays(1.0)); - positions.Add(Cartographic.Zero); - - dates.Add(date.AddDays(1.5)); - positions.Add(new Cartographic(1.0, 0.0, 0.0)); - - dates.Add(date.AddDays(2.0)); - positions.Add(new Cartographic(0.0, 1.0, 0.0)); - - interval.WriteCartographicRadians(dates, positions); + interval.WriteCartographicRadians(interval2SampleDates, interval2SamplePositions); } } - using (OrientationCesiumWriter orientation = packet.OpenOrientationProperty()) - using (CesiumIntervalListWriter intervalList = orientation.OpenMultipleIntervals()) + using (var orientationWriter = packet.OpenOrientationProperty()) + using (var intervalListWriter = orientationWriter.OpenMultipleIntervals()) { - using (OrientationCesiumWriter interval = intervalList.OpenInterval()) + using (var interval = intervalListWriter.OpenInterval()) { - interval.WriteInterval(new TimeInterval(date, date.AddDays(1.0))); - interval.WriteUnitQuaternion(new UnitQuaternion(1, 0, 0, 0)); + interval.WriteInterval(interval1); + interval.WriteUnitQuaternion(interval1Orientation); } - using (OrientationCesiumWriter interval = intervalList.OpenInterval()) - { - interval.WriteInterpolationAlgorithm(CesiumInterpolationAlgorithm.Linear); - interval.WriteInterpolationDegree(1); - - var dates = new List(); - var orientations = new List(); - - dates.Add(date.AddDays(1.0)); - orientations.Add(UnitQuaternion.Identity); - dates.Add(date.AddDays(1.5)); - orientations.Add(new UnitQuaternion(0.0, 1.0, 0.0, 0.0)); - - dates.Add(date.AddDays(2.0)); - orientations.Add(new UnitQuaternion(0.0, 0.0, 1.0, 0.0)); + using (var interval = intervalListWriter.OpenInterval(interval2.Start, interval2.Stop)) + { + interval.WriteInterpolationAlgorithm(orientationInterpolationAlgorithm); + interval.WriteInterpolationDegree(orientationInterpolationDegree); - interval.WriteUnitQuaternion(dates, orientations); + interval.WriteUnitQuaternion(interval2SampleDates, interval2SampleOrientations); } } } - Console.WriteLine(sw.ToString()); + Console.WriteLine(stringWriter.ToString()); } } } diff --git a/DotNet/CesiumLanguageWriterTests/TestStringCesiumWriter.cs b/DotNet/CesiumLanguageWriterTests/TestStringCesiumWriter.cs new file mode 100644 index 00000000..028e156d --- /dev/null +++ b/DotNet/CesiumLanguageWriterTests/TestStringCesiumWriter.cs @@ -0,0 +1,42 @@ +using CesiumLanguageWriter; +using CesiumLanguageWriter.Advanced; +using NUnit.Framework; + +namespace CesiumLanguageWriterTests +{ + [TestFixture] + public class TestStringCesiumWriter : TestCesiumPropertyWriter + { + [Test] + public void StringCanBeWrittenAsSimpleString() + { + using (Packet) + using (StringCesiumWriter writer = new StringCesiumWriter("foo")) + { + writer.Open(OutputStream); + writer.WriteString("bar"); + } + Assert.AreEqual("{\"foo\":\"bar\"}", StringWriter.ToString()); + } + + [Test] + public void StringCanBeWrittenInsideInterval() + { + JulianDate startDate = new GregorianDate(2012, 6, 7, 12, 0, 0).ToJulianDate(); + + using (Packet) + using (StringCesiumWriter writer = new StringCesiumWriter("foo")) + { + writer.Open(OutputStream); + writer.WriteInterval(startDate, startDate.AddSeconds(100.0)); + writer.WriteString("bar"); + } + Assert.AreEqual("{\"foo\":{\"interval\":\"20120607T12Z/20120607T120140Z\",\"string\":\"bar\"}}", StringWriter.ToString()); + } + + protected override CesiumPropertyWriter CreatePropertyWriter(string propertyName) + { + return new StringCesiumWriter(propertyName); + } + } +} \ No newline at end of file diff --git a/DotNet/CesiumLanguageWriterTests/TestVerticalOriginCesiumWriter.cs b/DotNet/CesiumLanguageWriterTests/TestVerticalOriginCesiumWriter.cs new file mode 100644 index 00000000..2e0cad74 --- /dev/null +++ b/DotNet/CesiumLanguageWriterTests/TestVerticalOriginCesiumWriter.cs @@ -0,0 +1,42 @@ +using CesiumLanguageWriter; +using CesiumLanguageWriter.Advanced; +using NUnit.Framework; + +namespace CesiumLanguageWriterTests +{ + [TestFixture] + public class TestVerticalOriginCesiumWriter : TestCesiumPropertyWriter + { + [Test] + public void VerticalOriginCanBeWrittenAsSimpleString() + { + using (Packet) + using (VerticalOriginCesiumWriter writer = new VerticalOriginCesiumWriter("foo")) + { + writer.Open(OutputStream); + writer.WriteVerticalOrigin(CesiumVerticalOrigin.Center); + } + Assert.AreEqual("{\"foo\":\"CENTER\"}", StringWriter.ToString()); + } + + [Test] + public void VerticalOriginCanBeWrittenInsideInterval() + { + JulianDate startDate = new GregorianDate(2012, 6, 7, 12, 0, 0).ToJulianDate(); + + using (Packet) + using (VerticalOriginCesiumWriter writer = new VerticalOriginCesiumWriter("foo")) + { + writer.Open(OutputStream); + writer.WriteInterval(startDate, startDate.AddSeconds(100.0)); + writer.WriteVerticalOrigin(CesiumVerticalOrigin.Center); + } + Assert.AreEqual("{\"foo\":{\"interval\":\"20120607T12Z/20120607T120140Z\",\"verticalOrigin\":\"CENTER\"}}", StringWriter.ToString()); + } + + protected override CesiumPropertyWriter CreatePropertyWriter(string propertyName) + { + return new VerticalOriginCesiumWriter(propertyName); + } + } +} \ No newline at end of file From 069f200f941c5e0fded0380433498cea63b8b6c9 Mon Sep 17 00:00:00 2001 From: Scott Hunter Date: Wed, 8 Jun 2016 19:39:41 -0400 Subject: [PATCH 3/4] Add polyline arrow material. --- .../CesiumLanguageWriter.csproj | 1 + .../PolylineArrowMaterialCesiumWriter.cs | 171 ++++++++++++ .../Generated/PolylineMaterialCesiumWriter.cs | 23 ++ .../PolylineArrowMaterialCesiumWriter.java | 253 ++++++++++++++++++ .../PolylineMaterialCesiumWriter.java | 34 +++ Schema/PolylineArrowMaterial.jsonschema | 17 ++ Schema/PolylineMaterial.jsonschema | 4 + 7 files changed, 503 insertions(+) create mode 100644 DotNet/CesiumLanguageWriter/Generated/PolylineArrowMaterialCesiumWriter.cs create mode 100644 Java/CesiumLanguageWriter/translatedSrc/cesiumlanguagewriter/PolylineArrowMaterialCesiumWriter.java create mode 100644 Schema/PolylineArrowMaterial.jsonschema diff --git a/DotNet/CesiumLanguageWriter/CesiumLanguageWriter.csproj b/DotNet/CesiumLanguageWriter/CesiumLanguageWriter.csproj index 5d5ce163..43e1aa44 100644 --- a/DotNet/CesiumLanguageWriter/CesiumLanguageWriter.csproj +++ b/DotNet/CesiumLanguageWriter/CesiumLanguageWriter.csproj @@ -119,6 +119,7 @@ + diff --git a/DotNet/CesiumLanguageWriter/Generated/PolylineArrowMaterialCesiumWriter.cs b/DotNet/CesiumLanguageWriter/Generated/PolylineArrowMaterialCesiumWriter.cs new file mode 100644 index 00000000..e47beffe --- /dev/null +++ b/DotNet/CesiumLanguageWriter/Generated/PolylineArrowMaterialCesiumWriter.cs @@ -0,0 +1,171 @@ +// This file was generated automatically by GenerateFromSchema. Do NOT edit it. +// https://github.com/AnalyticalGraphicsInc/czml-writer + +using CesiumLanguageWriter.Advanced; +using System; +using System.Drawing; +using System.Collections.Generic; + +namespace CesiumLanguageWriter +{ + /// + /// Writes a PolylineArrowMaterial to a . A PolylineArrowMaterial is a material that fills the surface of a line with an arrow. + /// + public class PolylineArrowMaterialCesiumWriter : CesiumPropertyWriter + { + /// + /// The name of the color property. + /// + public const string ColorPropertyName = "color"; + + private readonly Lazy m_color = new Lazy(() => new ColorCesiumWriter(ColorPropertyName), false); + + /// + /// Initializes a new instance. + /// + public PolylineArrowMaterialCesiumWriter(string propertyName) + : base(propertyName) + { + } + + /// + /// Initializes a new instance as a copy of an existing instance. + /// + /// The existing instance to copy. + protected PolylineArrowMaterialCesiumWriter(PolylineArrowMaterialCesiumWriter existingInstance) + : base(existingInstance) + { + } + + /// + public override PolylineArrowMaterialCesiumWriter Clone() + { + return new PolylineArrowMaterialCesiumWriter(this); + } + + /// + /// Gets the writer for the color property. The returned instance must be opened by calling the method before it can be used for writing. The color property defines the color of the surface. + /// + public ColorCesiumWriter ColorWriter + { + get { return m_color.Value; } + } + + /// + /// Opens and returns the writer for the color property. The color property defines the color of the surface. + /// + public ColorCesiumWriter OpenColorProperty() + { + OpenIntervalIfNecessary(); + return OpenAndReturn(ColorWriter); + } + + /// + /// Writes a value for the color property as a rgba value. The color property specifies the color of the surface. + /// + /// The color. + public void WriteColorProperty(Color color) + { + using (var writer = OpenColorProperty()) + { + writer.WriteRgba(color); + } + } + + /// + /// Writes a value for the color property as a rgba value. The color property specifies the color of the surface. + /// + /// The red component in the range 0 to 255. + /// The green component in the range 0 to 255. + /// The blue component in the range 0 to 255. + /// The alpha component in the range 0 to 255. + public void WriteColorProperty(int red, int green, int blue, int alpha) + { + using (var writer = OpenColorProperty()) + { + writer.WriteRgba(red, green, blue, alpha); + } + } + + /// + /// Writes a value for the color property as a rgba value. The color property specifies the color of the surface. + /// + /// The dates at which the value is specified. + /// The color corresponding to each date. + /// The index of the first element to use in the `colors` collection. + /// The number of elements to use from the `colors` collection. + public void WriteColorProperty(IList dates, IList colors, int startIndex, int length) + { + using (var writer = OpenColorProperty()) + { + writer.WriteRgba(dates, colors, startIndex, length); + } + } + + /// + /// Writes a value for the color property as a rgbaf value. The color property specifies the color of the surface. + /// + /// The red component in the range 0 to 1.0. + /// The green component in the range 0 to 1.0. + /// The blue component in the range 0 to 1.0. + /// The alpha component in the range 0 to 1.0. + public void WriteColorPropertyRgbaf(float red, float green, float blue, float alpha) + { + using (var writer = OpenColorProperty()) + { + writer.WriteRgbaf(red, green, blue, alpha); + } + } + + /// + /// Writes a value for the color property as a reference value. The color property specifies the color of the surface. + /// + /// The reference. + public void WriteColorPropertyReference(Reference value) + { + using (var writer = OpenColorProperty()) + { + writer.WriteReference(value); + } + } + + /// + /// Writes a value for the color property as a reference value. The color property specifies the color of the surface. + /// + /// The earliest date of the interval. + public void WriteColorPropertyReference(string value) + { + using (var writer = OpenColorProperty()) + { + writer.WriteReference(value); + } + } + + /// + /// Writes a value for the color property as a reference value. The color property specifies the color of the surface. + /// + /// The identifier of the object which contains the referenced property. + /// The property on the referenced object. + public void WriteColorPropertyReference(string identifier, string propertyName) + { + using (var writer = OpenColorProperty()) + { + writer.WriteReference(identifier, propertyName); + } + } + + /// + /// Writes a value for the color property as a reference value. The color property specifies the color of the surface. + /// + /// The identifier of the object which contains the referenced property. + /// The hierarchy of properties to be indexed on the referenced object. + public void WriteColorPropertyReference(string identifier, string[] propertyNames) + { + using (var writer = OpenColorProperty()) + { + writer.WriteReference(identifier, propertyNames); + } + } + + } +} diff --git a/DotNet/CesiumLanguageWriter/Generated/PolylineMaterialCesiumWriter.cs b/DotNet/CesiumLanguageWriter/Generated/PolylineMaterialCesiumWriter.cs index 5524d716..392e2aa9 100644 --- a/DotNet/CesiumLanguageWriter/Generated/PolylineMaterialCesiumWriter.cs +++ b/DotNet/CesiumLanguageWriter/Generated/PolylineMaterialCesiumWriter.cs @@ -23,6 +23,11 @@ public class PolylineMaterialCesiumWriter : CesiumPropertyWriter public const string PolylineOutlinePropertyName = "polylineOutline"; + /// + /// The name of the polylineArrow property. + /// + public const string PolylineArrowPropertyName = "polylineArrow"; + /// /// The name of the polylineGlow property. /// @@ -45,6 +50,7 @@ public class PolylineMaterialCesiumWriter : CesiumPropertyWriter m_solidColor = new Lazy(() => new SolidColorMaterialCesiumWriter(SolidColorPropertyName), false); private readonly Lazy m_polylineOutline = new Lazy(() => new PolylineOutlineMaterialCesiumWriter(PolylineOutlinePropertyName), false); + private readonly Lazy m_polylineArrow = new Lazy(() => new PolylineArrowMaterialCesiumWriter(PolylineArrowPropertyName), false); private readonly Lazy m_polylineGlow = new Lazy(() => new PolylineGlowMaterialCesiumWriter(PolylineGlowPropertyName), false); private readonly Lazy m_image = new Lazy(() => new ImageMaterialCesiumWriter(ImagePropertyName), false); private readonly Lazy m_grid = new Lazy(() => new GridMaterialCesiumWriter(GridPropertyName), false); @@ -107,6 +113,23 @@ public PolylineOutlineMaterialCesiumWriter OpenPolylineOutlineProperty() return OpenAndReturn(PolylineOutlineWriter); } + /// + /// Gets the writer for the polylineArrow property. The returned instance must be opened by calling the method before it can be used for writing. The polylineArrow property defines a material that fills the line with an arrow. + /// + public PolylineArrowMaterialCesiumWriter PolylineArrowWriter + { + get { return m_polylineArrow.Value; } + } + + /// + /// Opens and returns the writer for the polylineArrow property. The polylineArrow property defines a material that fills the line with an arrow. + /// + public PolylineArrowMaterialCesiumWriter OpenPolylineArrowProperty() + { + OpenIntervalIfNecessary(); + return OpenAndReturn(PolylineArrowWriter); + } + /// /// Gets the writer for the polylineGlow property. The returned instance must be opened by calling the method before it can be used for writing. The polylineGlow property defines a material that fills the line with a glowing color. /// diff --git a/Java/CesiumLanguageWriter/translatedSrc/cesiumlanguagewriter/PolylineArrowMaterialCesiumWriter.java b/Java/CesiumLanguageWriter/translatedSrc/cesiumlanguagewriter/PolylineArrowMaterialCesiumWriter.java new file mode 100644 index 00000000..cdbf5a19 --- /dev/null +++ b/Java/CesiumLanguageWriter/translatedSrc/cesiumlanguagewriter/PolylineArrowMaterialCesiumWriter.java @@ -0,0 +1,253 @@ +package cesiumlanguagewriter; + + +import agi.foundation.compatibility.*; +import agi.foundation.compatibility.DisposeHelper; +import agi.foundation.compatibility.Func1; +import agi.foundation.compatibility.Lazy; +import cesiumlanguagewriter.advanced.*; +import cesiumlanguagewriter.ColorCesiumWriter; +import java.awt.Color; +import java.util.List; + +/** + * + Writes a PolylineArrowMaterial to a {@link CesiumOutputStream}. A PolylineArrowMaterial is a material that fills the surface of a line with an arrow. + + + */ +public class PolylineArrowMaterialCesiumWriter extends CesiumPropertyWriter { + /** + * + The name of the color property. + + + */ + public static final String ColorPropertyName = "color"; + private Lazy m_color = new Lazy(new Func1() { + public cesiumlanguagewriter.ColorCesiumWriter invoke() { + return new ColorCesiumWriter(ColorPropertyName); + } + }, false); + + /** + * + Initializes a new instance. + + + */ + public PolylineArrowMaterialCesiumWriter(String propertyName) { + super(propertyName); + } + + /** + * + Initializes a new instance as a copy of an existing instance. + + + + * @param existingInstance The existing instance to copy. + */ + protected PolylineArrowMaterialCesiumWriter(PolylineArrowMaterialCesiumWriter existingInstance) { + super(existingInstance); + } + + @Override + public PolylineArrowMaterialCesiumWriter clone() { + return new PolylineArrowMaterialCesiumWriter(this); + } + + /** + * Gets the writer for the color property. The returned instance must be opened by calling the {@link CesiumElementWriter#open} method before it can be used for writing. The color property defines the color of the surface. + + + */ + public final ColorCesiumWriter getColorWriter() { + return m_color.getValue(); + } + + /** + * + Opens and returns the writer for the color property. The color property defines the color of the surface. + + + */ + public final ColorCesiumWriter openColorProperty() { + openIntervalIfNecessary(); + return this. openAndReturn(getColorWriter()); + } + + /** + * + Writes a value for the color property as a rgba value. The color property specifies the color of the surface. + + + + * @param color The color. + */ + public final void writeColorProperty(Color color) { + { + cesiumlanguagewriter.ColorCesiumWriter writer = openColorProperty(); + try { + writer.writeRgba(color); + } finally { + DisposeHelper.dispose(writer); + } + } + } + + /** + * + Writes a value for the color property as a rgba value. The color property specifies the color of the surface. + + + + + + + * @param red The red component in the range 0 to 255. + * @param green The green component in the range 0 to 255. + * @param blue The blue component in the range 0 to 255. + * @param alpha The alpha component in the range 0 to 255. + */ + public final void writeColorProperty(int red, int green, int blue, int alpha) { + { + cesiumlanguagewriter.ColorCesiumWriter writer = openColorProperty(); + try { + writer.writeRgba(red, green, blue, alpha); + } finally { + DisposeHelper.dispose(writer); + } + } + } + + /** + * + Writes a value for the color property as a rgba value. The color property specifies the color of the surface. + + + + + + + * @param dates The dates at which the value is specified. + * @param colors The color corresponding to each date. + * @param startIndex The index of the first element to use in the `colors` collection. + * @param length The number of elements to use from the `colors` collection. + */ + public final void writeColorProperty(List dates, List colors, int startIndex, int length) { + { + cesiumlanguagewriter.ColorCesiumWriter writer = openColorProperty(); + try { + writer.writeRgba(dates, colors, startIndex, length); + } finally { + DisposeHelper.dispose(writer); + } + } + } + + /** + * + Writes a value for the color property as a rgbaf value. The color property specifies the color of the surface. + + + + + + + * @param red The red component in the range 0 to 1.0. + * @param green The green component in the range 0 to 1.0. + * @param blue The blue component in the range 0 to 1.0. + * @param alpha The alpha component in the range 0 to 1.0. + */ + public final void writeColorPropertyRgbaf(float red, float green, float blue, float alpha) { + { + cesiumlanguagewriter.ColorCesiumWriter writer = openColorProperty(); + try { + writer.writeRgbaf(red, green, blue, alpha); + } finally { + DisposeHelper.dispose(writer); + } + } + } + + /** + * + Writes a value for the color property as a reference value. The color property specifies the color of the surface. + + + + * @param value The reference. + */ + public final void writeColorPropertyReference(Reference value) { + { + cesiumlanguagewriter.ColorCesiumWriter writer = openColorProperty(); + try { + writer.writeReference(value); + } finally { + DisposeHelper.dispose(writer); + } + } + } + + /** + * + Writes a value for the color property as a reference value. The color property specifies the color of the surface. + + + + * @param value The earliest date of the interval. + */ + public final void writeColorPropertyReference(String value) { + { + cesiumlanguagewriter.ColorCesiumWriter writer = openColorProperty(); + try { + writer.writeReference(value); + } finally { + DisposeHelper.dispose(writer); + } + } + } + + /** + * + Writes a value for the color property as a reference value. The color property specifies the color of the surface. + + + + + * @param identifier The identifier of the object which contains the referenced property. + * @param propertyName The property on the referenced object. + */ + public final void writeColorPropertyReference(String identifier, String propertyName) { + { + cesiumlanguagewriter.ColorCesiumWriter writer = openColorProperty(); + try { + writer.writeReference(identifier, propertyName); + } finally { + DisposeHelper.dispose(writer); + } + } + } + + /** + * + Writes a value for the color property as a reference value. The color property specifies the color of the surface. + + + + + * @param identifier The identifier of the object which contains the referenced property. + * @param propertyNames The hierarchy of properties to be indexed on the referenced object. + */ + public final void writeColorPropertyReference(String identifier, String[] propertyNames) { + { + cesiumlanguagewriter.ColorCesiumWriter writer = openColorProperty(); + try { + writer.writeReference(identifier, propertyNames); + } finally { + DisposeHelper.dispose(writer); + } + } + } +} \ No newline at end of file diff --git a/Java/CesiumLanguageWriter/translatedSrc/cesiumlanguagewriter/PolylineMaterialCesiumWriter.java b/Java/CesiumLanguageWriter/translatedSrc/cesiumlanguagewriter/PolylineMaterialCesiumWriter.java index 5c7422cb..0e2bfa67 100644 --- a/Java/CesiumLanguageWriter/translatedSrc/cesiumlanguagewriter/PolylineMaterialCesiumWriter.java +++ b/Java/CesiumLanguageWriter/translatedSrc/cesiumlanguagewriter/PolylineMaterialCesiumWriter.java @@ -7,6 +7,7 @@ import cesiumlanguagewriter.advanced.*; import cesiumlanguagewriter.GridMaterialCesiumWriter; import cesiumlanguagewriter.ImageMaterialCesiumWriter; +import cesiumlanguagewriter.PolylineArrowMaterialCesiumWriter; import cesiumlanguagewriter.PolylineGlowMaterialCesiumWriter; import cesiumlanguagewriter.PolylineOutlineMaterialCesiumWriter; import cesiumlanguagewriter.SolidColorMaterialCesiumWriter; @@ -33,6 +34,13 @@ public class PolylineMaterialCesiumWriter extends CesiumPropertyWriterpolylineArrow property. + + + */ + public static final String PolylineArrowPropertyName = "polylineArrow"; /** * The name of the polylineGlow property. @@ -72,6 +80,12 @@ public cesiumlanguagewriter.PolylineOutlineMaterialCesiumWriter invoke() { return new PolylineOutlineMaterialCesiumWriter(PolylineOutlinePropertyName); } }, false); + private Lazy m_polylineArrow = new Lazy( + new Func1() { + public cesiumlanguagewriter.PolylineArrowMaterialCesiumWriter invoke() { + return new PolylineArrowMaterialCesiumWriter(PolylineArrowPropertyName); + } + }, false); private Lazy m_polylineGlow = new Lazy(new Func1() { public cesiumlanguagewriter.PolylineGlowMaterialCesiumWriter invoke() { return new PolylineGlowMaterialCesiumWriter(PolylineGlowPropertyName); @@ -160,6 +174,26 @@ public final PolylineOutlineMaterialCesiumWriter openPolylineOutlineProperty() { return this. openAndReturn(getPolylineOutlineWriter()); } + /** + * Gets the writer for the polylineArrow property. The returned instance must be opened by calling the {@link CesiumElementWriter#open} method before it can be used for writing. The polylineArrow property defines a material that fills the line with an arrow. + + + */ + public final PolylineArrowMaterialCesiumWriter getPolylineArrowWriter() { + return m_polylineArrow.getValue(); + } + + /** + * + Opens and returns the writer for the polylineArrow property. The polylineArrow property defines a material that fills the line with an arrow. + + + */ + public final PolylineArrowMaterialCesiumWriter openPolylineArrowProperty() { + openIntervalIfNecessary(); + return this. openAndReturn(getPolylineArrowWriter()); + } + /** * Gets the writer for the polylineGlow property. The returned instance must be opened by calling the {@link CesiumElementWriter#open} method before it can be used for writing. The polylineGlow property defines a material that fills the line with a glowing color. diff --git a/Schema/PolylineArrowMaterial.jsonschema b/Schema/PolylineArrowMaterial.jsonschema new file mode 100644 index 00000000..5b7a8b67 --- /dev/null +++ b/Schema/PolylineArrowMaterial.jsonschema @@ -0,0 +1,17 @@ +{ + "title": "PolylineArrowMaterial", + "description": "A material that fills the surface of a line with an arrow.", + "type": [ + "array", + "object" + ], + "items": { + "$ref": "#" + }, + "properties": { + "color": { + "$ref": "Color.jsonschema", + "description": "The color of the surface." + } + } +} \ No newline at end of file diff --git a/Schema/PolylineMaterial.jsonschema b/Schema/PolylineMaterial.jsonschema index 628b50f9..bac36737 100644 --- a/Schema/PolylineMaterial.jsonschema +++ b/Schema/PolylineMaterial.jsonschema @@ -17,6 +17,10 @@ "$ref": "PolylineOutlineMaterial.jsonschema", "description": "A material that fills the line with a color and outline." }, + "polylineArrow": { + "$ref": "PolylineArrowMaterial.jsonschema", + "description": "A material that fills the line with an arrow." + }, "polylineGlow": { "$ref": "PolylineGlowMaterial.jsonschema", "description": "A material that fills the line with a glowing color." From 2ef35538d7b06d3df2fe4f125833a41e1313d598 Mon Sep 17 00:00:00 2001 From: Scott Hunter Date: Wed, 8 Jun 2016 19:55:11 -0400 Subject: [PATCH 4/4] Retranslate Java. --- .../TestBillboardCesiumWriter.java | 25 +++++ .../TestBooleanCesiumWriter.java | 73 ++++++++++++ .../TestDoubleCesiumWriter.java | 73 ++++++++++++ .../TestHorizontalOriginCesiumWriter.java | 73 ++++++++++++ .../TestLabelStyleCesiumWriter.java | 73 ++++++++++++ .../TestOrientationCesiumWriter.java | 104 +++++++++--------- .../TestStringCesiumWriter.java | 73 ++++++++++++ .../TestVerticalOriginCesiumWriter.java | 73 ++++++++++++ 8 files changed, 518 insertions(+), 49 deletions(-) create mode 100644 Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestBillboardCesiumWriter.java create mode 100644 Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestBooleanCesiumWriter.java create mode 100644 Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestDoubleCesiumWriter.java create mode 100644 Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestHorizontalOriginCesiumWriter.java create mode 100644 Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestLabelStyleCesiumWriter.java create mode 100644 Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestStringCesiumWriter.java create mode 100644 Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestVerticalOriginCesiumWriter.java diff --git a/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestBillboardCesiumWriter.java b/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestBillboardCesiumWriter.java new file mode 100644 index 00000000..b4320d5b --- /dev/null +++ b/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestBillboardCesiumWriter.java @@ -0,0 +1,25 @@ +package cesiumlanguagewritertests; + + +import agi.foundation.compatibility.*; +import agi.foundation.compatibility.TestContextRule; +import cesiumlanguagewriter.*; +import cesiumlanguagewriter.advanced.*; +import org.junit.FixMethodOrder; +import org.junit.Rule; +import org.junit.runners.MethodSorters; + +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class TestBillboardCesiumWriter extends TestCesiumPropertyWriter { + @Override + protected CesiumPropertyWriter createPropertyWriter(String propertyName) { + return new BillboardCesiumWriter(propertyName); + } + + private TestContextRule rule$testContext = new TestContextRule(); + + @Rule + public TestContextRule getRule$testContext() { + return rule$testContext; + } +} \ No newline at end of file diff --git a/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestBooleanCesiumWriter.java b/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestBooleanCesiumWriter.java new file mode 100644 index 00000000..017c9e56 --- /dev/null +++ b/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestBooleanCesiumWriter.java @@ -0,0 +1,73 @@ +package cesiumlanguagewritertests; + + +import agi.foundation.compatibility.*; +import agi.foundation.compatibility.DisposeHelper; +import agi.foundation.compatibility.TestContextRule; +import cesiumlanguagewriter.*; +import cesiumlanguagewriter.advanced.*; +import java.io.StringWriter; +import org.junit.Assert; +import org.junit.FixMethodOrder; +import org.junit.Rule; +import org.junit.runners.MethodSorters; +import org.junit.Test; + +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class TestBooleanCesiumWriter extends TestCesiumPropertyWriter { + @Test + public final void booleanCanBeWrittenAsSimpleBoolean() { + { + PacketCesiumWriter disposable_0 = (getPacket()); + try { + { + BooleanCesiumWriter writer = new BooleanCesiumWriter("foo"); + try { + writer.open(getOutputStream()); + writer.writeBoolean(false); + } finally { + DisposeHelper.dispose(writer); + } + } + } finally { + DisposeHelper.dispose(disposable_0); + } + } + Assert.assertEquals("{\"foo\":false}", getStringWriter().toString()); + } + + @Test + public final void booleanCanBeWrittenInsideInterval() { + JulianDate startDate = new GregorianDate(2012, 6, 7, 12, 0, 0D).toJulianDate(); + { + PacketCesiumWriter disposable_1 = (getPacket()); + try { + { + BooleanCesiumWriter writer = new BooleanCesiumWriter("foo"); + try { + writer.open(getOutputStream()); + writer.writeInterval(startDate, startDate.addSeconds(100.0)); + writer.writeBoolean(false); + } finally { + DisposeHelper.dispose(writer); + } + } + } finally { + DisposeHelper.dispose(disposable_1); + } + } + Assert.assertEquals("{\"foo\":{\"interval\":\"20120607T12Z/20120607T120140Z\",\"boolean\":false}}", getStringWriter().toString()); + } + + @Override + protected CesiumPropertyWriter createPropertyWriter(String propertyName) { + return new BooleanCesiumWriter(propertyName); + } + + private TestContextRule rule$testContext = new TestContextRule(); + + @Rule + public TestContextRule getRule$testContext() { + return rule$testContext; + } +} \ No newline at end of file diff --git a/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestDoubleCesiumWriter.java b/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestDoubleCesiumWriter.java new file mode 100644 index 00000000..0df3ef0f --- /dev/null +++ b/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestDoubleCesiumWriter.java @@ -0,0 +1,73 @@ +package cesiumlanguagewritertests; + + +import agi.foundation.compatibility.*; +import agi.foundation.compatibility.DisposeHelper; +import agi.foundation.compatibility.TestContextRule; +import cesiumlanguagewriter.*; +import cesiumlanguagewriter.advanced.*; +import java.io.StringWriter; +import org.junit.Assert; +import org.junit.FixMethodOrder; +import org.junit.Rule; +import org.junit.runners.MethodSorters; +import org.junit.Test; + +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class TestDoubleCesiumWriter extends TestCesiumPropertyWriter { + @Test + public final void doubleCanBeWrittenAsSimpleNumber() { + { + PacketCesiumWriter disposable_0 = (getPacket()); + try { + { + DoubleCesiumWriter writer = new DoubleCesiumWriter("foo"); + try { + writer.open(getOutputStream()); + writer.writeNumber(1.23); + } finally { + DisposeHelper.dispose(writer); + } + } + } finally { + DisposeHelper.dispose(disposable_0); + } + } + Assert.assertEquals("{\"foo\":1.23}", getStringWriter().toString()); + } + + @Test + public final void doubleCanBeWrittenInsideInterval() { + JulianDate startDate = new GregorianDate(2012, 6, 7, 12, 0, 0D).toJulianDate(); + { + PacketCesiumWriter disposable_1 = (getPacket()); + try { + { + DoubleCesiumWriter writer = new DoubleCesiumWriter("foo"); + try { + writer.open(getOutputStream()); + writer.writeInterval(startDate, startDate.addSeconds(100.0)); + writer.writeNumber(1.23); + } finally { + DisposeHelper.dispose(writer); + } + } + } finally { + DisposeHelper.dispose(disposable_1); + } + } + Assert.assertEquals("{\"foo\":{\"interval\":\"20120607T12Z/20120607T120140Z\",\"number\":1.23}}", getStringWriter().toString()); + } + + @Override + protected CesiumPropertyWriter createPropertyWriter(String propertyName) { + return new DoubleCesiumWriter(propertyName); + } + + private TestContextRule rule$testContext = new TestContextRule(); + + @Rule + public TestContextRule getRule$testContext() { + return rule$testContext; + } +} \ No newline at end of file diff --git a/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestHorizontalOriginCesiumWriter.java b/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestHorizontalOriginCesiumWriter.java new file mode 100644 index 00000000..d92d4ebd --- /dev/null +++ b/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestHorizontalOriginCesiumWriter.java @@ -0,0 +1,73 @@ +package cesiumlanguagewritertests; + + +import agi.foundation.compatibility.*; +import agi.foundation.compatibility.DisposeHelper; +import agi.foundation.compatibility.TestContextRule; +import cesiumlanguagewriter.*; +import cesiumlanguagewriter.advanced.*; +import java.io.StringWriter; +import org.junit.Assert; +import org.junit.FixMethodOrder; +import org.junit.Rule; +import org.junit.runners.MethodSorters; +import org.junit.Test; + +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class TestHorizontalOriginCesiumWriter extends TestCesiumPropertyWriter { + @Test + public final void horizontalOriginCanBeWrittenAsSimpleString() { + { + PacketCesiumWriter disposable_0 = (getPacket()); + try { + { + HorizontalOriginCesiumWriter writer = new HorizontalOriginCesiumWriter("foo"); + try { + writer.open(getOutputStream()); + writer.writeHorizontalOrigin(CesiumHorizontalOrigin.CENTER); + } finally { + DisposeHelper.dispose(writer); + } + } + } finally { + DisposeHelper.dispose(disposable_0); + } + } + Assert.assertEquals("{\"foo\":\"CENTER\"}", getStringWriter().toString()); + } + + @Test + public final void horizontalOriginCanBeWrittenInsideInterval() { + JulianDate startDate = new GregorianDate(2012, 6, 7, 12, 0, 0D).toJulianDate(); + { + PacketCesiumWriter disposable_1 = (getPacket()); + try { + { + HorizontalOriginCesiumWriter writer = new HorizontalOriginCesiumWriter("foo"); + try { + writer.open(getOutputStream()); + writer.writeInterval(startDate, startDate.addSeconds(100.0)); + writer.writeHorizontalOrigin(CesiumHorizontalOrigin.CENTER); + } finally { + DisposeHelper.dispose(writer); + } + } + } finally { + DisposeHelper.dispose(disposable_1); + } + } + Assert.assertEquals("{\"foo\":{\"interval\":\"20120607T12Z/20120607T120140Z\",\"horizontalOrigin\":\"CENTER\"}}", getStringWriter().toString()); + } + + @Override + protected CesiumPropertyWriter createPropertyWriter(String propertyName) { + return new HorizontalOriginCesiumWriter(propertyName); + } + + private TestContextRule rule$testContext = new TestContextRule(); + + @Rule + public TestContextRule getRule$testContext() { + return rule$testContext; + } +} \ No newline at end of file diff --git a/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestLabelStyleCesiumWriter.java b/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestLabelStyleCesiumWriter.java new file mode 100644 index 00000000..dfa493d3 --- /dev/null +++ b/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestLabelStyleCesiumWriter.java @@ -0,0 +1,73 @@ +package cesiumlanguagewritertests; + + +import agi.foundation.compatibility.*; +import agi.foundation.compatibility.DisposeHelper; +import agi.foundation.compatibility.TestContextRule; +import cesiumlanguagewriter.*; +import cesiumlanguagewriter.advanced.*; +import java.io.StringWriter; +import org.junit.Assert; +import org.junit.FixMethodOrder; +import org.junit.Rule; +import org.junit.runners.MethodSorters; +import org.junit.Test; + +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class TestLabelStyleCesiumWriter extends TestCesiumPropertyWriter { + @Test + public final void labelStyleCanBeWrittenAsSimpleString() { + { + PacketCesiumWriter disposable_0 = (getPacket()); + try { + { + LabelStyleCesiumWriter writer = new LabelStyleCesiumWriter("foo"); + try { + writer.open(getOutputStream()); + writer.writeLabelStyle(CesiumLabelStyle.FILL_AND_OUTLINE); + } finally { + DisposeHelper.dispose(writer); + } + } + } finally { + DisposeHelper.dispose(disposable_0); + } + } + Assert.assertEquals("{\"foo\":\"FILL_AND_OUTLINE\"}", getStringWriter().toString()); + } + + @Test + public final void labelStyleCanBeWrittenInsideInterval() { + JulianDate startDate = new GregorianDate(2012, 6, 7, 12, 0, 0D).toJulianDate(); + { + PacketCesiumWriter disposable_1 = (getPacket()); + try { + { + LabelStyleCesiumWriter writer = new LabelStyleCesiumWriter("foo"); + try { + writer.open(getOutputStream()); + writer.writeInterval(startDate, startDate.addSeconds(100.0)); + writer.writeLabelStyle(CesiumLabelStyle.FILL_AND_OUTLINE); + } finally { + DisposeHelper.dispose(writer); + } + } + } finally { + DisposeHelper.dispose(disposable_1); + } + } + Assert.assertEquals("{\"foo\":{\"interval\":\"20120607T12Z/20120607T120140Z\",\"labelStyle\":\"FILL_AND_OUTLINE\"}}", getStringWriter().toString()); + } + + @Override + protected CesiumPropertyWriter createPropertyWriter(String propertyName) { + return new LabelStyleCesiumWriter(propertyName); + } + + private TestContextRule rule$testContext = new TestContextRule(); + + @Rule + public TestContextRule getRule$testContext() { + return rule$testContext; + } +} \ No newline at end of file diff --git a/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestOrientationCesiumWriter.java b/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestOrientationCesiumWriter.java index 8e262117..4a6faf24 100644 --- a/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestOrientationCesiumWriter.java +++ b/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestOrientationCesiumWriter.java @@ -11,7 +11,6 @@ import java.util.ArrayList; import java.util.Collection; import org.junit.FixMethodOrder; -import org.junit.Ignore; import org.junit.Rule; import org.junit.runners.MethodSorters; import org.junit.Test; @@ -24,107 +23,114 @@ protected CesiumPropertyWriter createPropertyWriter(Str } @Test - @Ignore - public final void sandbox() { - JulianDate date = new JulianDate(2451545.0); + public final void testCompleteExample() { { - StringWriter sw = new StringWriter(); + StringWriter stringWriter = new StringWriter(); try { - CesiumOutputStream output = new CesiumOutputStream(sw); - output.setPrettyFormatting(true); - CesiumStreamWriter writer = new CesiumStreamWriter(); + cesiumlanguagewriter.JulianDate date = new JulianDate(2451545.0); + String id = "MyID"; + cesiumlanguagewriter.TimeInterval availability = new TimeInterval(date, date.addDays(2.0)); + cesiumlanguagewriter.TimeInterval interval1 = new TimeInterval(date, date.addDays(1.0)); + cesiumlanguagewriter.Cartesian interval1Position = new Cartesian(1.0, 2.0, 3.0); + cesiumlanguagewriter.UnitQuaternion interval1Orientation = new UnitQuaternion(1D, 0D, 0D, 0D); + cesiumlanguagewriter.TimeInterval interval2 = new TimeInterval(date.addDays(1.0), date.addDays(2.0)); + ArrayList tempCollection_0 = new ArrayList(); + tempCollection_0.add(date.addDays(1.0)); + tempCollection_0.add(date.addDays(1.5)); + tempCollection_0.add(date.addDays(2.0)); + ArrayList interval2SampleDates = tempCollection_0; + ArrayList tempCollection_1 = new ArrayList(); + tempCollection_1.add(Cartographic.getZero()); + tempCollection_1.add(new Cartographic(1.0, 0.0, 0.0)); + tempCollection_1.add(new Cartographic(0.0, 1.0, 0.0)); + ArrayList interval2SamplePositions = tempCollection_1; + ArrayList tempCollection_2 = new ArrayList(); + tempCollection_2.add(UnitQuaternion.getIdentity()); + tempCollection_2.add(new UnitQuaternion(0.0, 1.0, 0.0, 0.0)); + tempCollection_2.add(new UnitQuaternion(0.0, 0.0, 1.0, 0.0)); + ArrayList interval2SampleOrientations = tempCollection_2; + CesiumInterpolationAlgorithm orientationInterpolationAlgorithm = CesiumInterpolationAlgorithm.LINEAR; + int orientationInterpolationDegree = 1; + CesiumOutputStream temp_0 = new CesiumOutputStream(stringWriter); + temp_0.setPrettyFormatting(true); + cesiumlanguagewriter.CesiumOutputStream outputStream = temp_0; + cesiumlanguagewriter.CesiumStreamWriter writer = new CesiumStreamWriter(); { - PacketCesiumWriter packet = writer.openPacket(output); + cesiumlanguagewriter.PacketCesiumWriter packet = writer.openPacket(outputStream); try { - packet.writeId("MyID"); - packet.writeAvailability(date, date.addDays(1.0)); + packet.writeId(id); + packet.writeAvailability(availability); { - PositionCesiumWriter position = packet.openPositionProperty(); + cesiumlanguagewriter.PositionCesiumWriter positionWriter = packet.openPositionProperty(); try { { - CesiumIntervalListWriter intervalList = position.openMultipleIntervals(); + cesiumlanguagewriter.CesiumIntervalListWriter intervalListWriter = positionWriter.openMultipleIntervals(); try { { - PositionCesiumWriter interval = intervalList.openInterval(); + cesiumlanguagewriter.PositionCesiumWriter interval = intervalListWriter.openInterval(); try { - interval.writeInterval(new TimeInterval(date, date.addDays(1.0))); - interval.writeCartesian(new Cartesian(1.0, 2.0, 3.0)); + interval.writeInterval(interval1); + interval.writeCartesian(interval1Position); } finally { DisposeHelper.dispose(interval); } } { - PositionCesiumWriter interval = intervalList.openInterval(date.addDays(1.0), date.addDays(2.0)); + cesiumlanguagewriter.PositionCesiumWriter interval = intervalListWriter.openInterval(interval2.getStart(), interval2.getStop()); try { - ArrayList dates = new ArrayList(); - ArrayList positions = new ArrayList(); - dates.add(date.addDays(1.0)); - positions.add(Cartographic.getZero()); - dates.add(date.addDays(1.5)); - positions.add(new Cartographic(1.0, 0.0, 0.0)); - dates.add(date.addDays(2.0)); - positions.add(new Cartographic(0.0, 1.0, 0.0)); - interval.writeCartographicRadians(dates, positions); + interval.writeCartographicRadians(interval2SampleDates, interval2SamplePositions); } finally { DisposeHelper.dispose(interval); } } } finally { - DisposeHelper.dispose(intervalList); + DisposeHelper.dispose(intervalListWriter); } } } finally { - DisposeHelper.dispose(position); + DisposeHelper.dispose(positionWriter); } } { - OrientationCesiumWriter orientation = packet.openOrientationProperty(); + cesiumlanguagewriter.OrientationCesiumWriter orientationWriter = packet.openOrientationProperty(); try { { - CesiumIntervalListWriter intervalList = orientation.openMultipleIntervals(); + cesiumlanguagewriter.CesiumIntervalListWriter intervalListWriter = orientationWriter.openMultipleIntervals(); try { { - OrientationCesiumWriter interval = intervalList.openInterval(); + cesiumlanguagewriter.OrientationCesiumWriter interval = intervalListWriter.openInterval(); try { - interval.writeInterval(new TimeInterval(date, date.addDays(1.0))); - interval.writeUnitQuaternion(new UnitQuaternion(1D, 0D, 0D, 0D)); + interval.writeInterval(interval1); + interval.writeUnitQuaternion(interval1Orientation); } finally { DisposeHelper.dispose(interval); } } { - OrientationCesiumWriter interval = intervalList.openInterval(); + cesiumlanguagewriter.OrientationCesiumWriter interval = intervalListWriter.openInterval(interval2.getStart(), interval2.getStop()); try { - interval.writeInterpolationAlgorithm(CesiumInterpolationAlgorithm.LINEAR); - interval.writeInterpolationDegree(1); - ArrayList dates = new ArrayList(); - ArrayList orientations = new ArrayList(); - dates.add(date.addDays(1.0)); - orientations.add(UnitQuaternion.getIdentity()); - dates.add(date.addDays(1.5)); - orientations.add(new UnitQuaternion(0.0, 1.0, 0.0, 0.0)); - dates.add(date.addDays(2.0)); - orientations.add(new UnitQuaternion(0.0, 0.0, 1.0, 0.0)); - interval.writeUnitQuaternion(dates, orientations); + interval.writeInterpolationAlgorithm(orientationInterpolationAlgorithm); + interval.writeInterpolationDegree(orientationInterpolationDegree); + interval.writeUnitQuaternion(interval2SampleDates, interval2SampleOrientations); } finally { DisposeHelper.dispose(interval); } } } finally { - DisposeHelper.dispose(intervalList); + DisposeHelper.dispose(intervalListWriter); } } } finally { - DisposeHelper.dispose(orientation); + DisposeHelper.dispose(orientationWriter); } } } finally { DisposeHelper.dispose(packet); } } - ConsoleHelper.writeLine(sw.toString()); + ConsoleHelper.writeLine(stringWriter.toString()); } finally { - DisposeHelper.dispose(sw); + DisposeHelper.dispose(stringWriter); } } } diff --git a/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestStringCesiumWriter.java b/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestStringCesiumWriter.java new file mode 100644 index 00000000..b194fb27 --- /dev/null +++ b/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestStringCesiumWriter.java @@ -0,0 +1,73 @@ +package cesiumlanguagewritertests; + + +import agi.foundation.compatibility.*; +import agi.foundation.compatibility.DisposeHelper; +import agi.foundation.compatibility.TestContextRule; +import cesiumlanguagewriter.*; +import cesiumlanguagewriter.advanced.*; +import java.io.StringWriter; +import org.junit.Assert; +import org.junit.FixMethodOrder; +import org.junit.Rule; +import org.junit.runners.MethodSorters; +import org.junit.Test; + +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class TestStringCesiumWriter extends TestCesiumPropertyWriter { + @Test + public final void stringCanBeWrittenAsSimpleString() { + { + PacketCesiumWriter disposable_0 = (getPacket()); + try { + { + StringCesiumWriter writer = new StringCesiumWriter("foo"); + try { + writer.open(getOutputStream()); + writer.writeString("bar"); + } finally { + DisposeHelper.dispose(writer); + } + } + } finally { + DisposeHelper.dispose(disposable_0); + } + } + Assert.assertEquals("{\"foo\":\"bar\"}", getStringWriter().toString()); + } + + @Test + public final void stringCanBeWrittenInsideInterval() { + JulianDate startDate = new GregorianDate(2012, 6, 7, 12, 0, 0D).toJulianDate(); + { + PacketCesiumWriter disposable_1 = (getPacket()); + try { + { + StringCesiumWriter writer = new StringCesiumWriter("foo"); + try { + writer.open(getOutputStream()); + writer.writeInterval(startDate, startDate.addSeconds(100.0)); + writer.writeString("bar"); + } finally { + DisposeHelper.dispose(writer); + } + } + } finally { + DisposeHelper.dispose(disposable_1); + } + } + Assert.assertEquals("{\"foo\":{\"interval\":\"20120607T12Z/20120607T120140Z\",\"string\":\"bar\"}}", getStringWriter().toString()); + } + + @Override + protected CesiumPropertyWriter createPropertyWriter(String propertyName) { + return new StringCesiumWriter(propertyName); + } + + private TestContextRule rule$testContext = new TestContextRule(); + + @Rule + public TestContextRule getRule$testContext() { + return rule$testContext; + } +} \ No newline at end of file diff --git a/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestVerticalOriginCesiumWriter.java b/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestVerticalOriginCesiumWriter.java new file mode 100644 index 00000000..9280c8ba --- /dev/null +++ b/Java/CesiumLanguageWriterTests/translatedSrc/cesiumlanguagewritertests/TestVerticalOriginCesiumWriter.java @@ -0,0 +1,73 @@ +package cesiumlanguagewritertests; + + +import agi.foundation.compatibility.*; +import agi.foundation.compatibility.DisposeHelper; +import agi.foundation.compatibility.TestContextRule; +import cesiumlanguagewriter.*; +import cesiumlanguagewriter.advanced.*; +import java.io.StringWriter; +import org.junit.Assert; +import org.junit.FixMethodOrder; +import org.junit.Rule; +import org.junit.runners.MethodSorters; +import org.junit.Test; + +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class TestVerticalOriginCesiumWriter extends TestCesiumPropertyWriter { + @Test + public final void verticalOriginCanBeWrittenAsSimpleString() { + { + PacketCesiumWriter disposable_0 = (getPacket()); + try { + { + VerticalOriginCesiumWriter writer = new VerticalOriginCesiumWriter("foo"); + try { + writer.open(getOutputStream()); + writer.writeVerticalOrigin(CesiumVerticalOrigin.CENTER); + } finally { + DisposeHelper.dispose(writer); + } + } + } finally { + DisposeHelper.dispose(disposable_0); + } + } + Assert.assertEquals("{\"foo\":\"CENTER\"}", getStringWriter().toString()); + } + + @Test + public final void verticalOriginCanBeWrittenInsideInterval() { + JulianDate startDate = new GregorianDate(2012, 6, 7, 12, 0, 0D).toJulianDate(); + { + PacketCesiumWriter disposable_1 = (getPacket()); + try { + { + VerticalOriginCesiumWriter writer = new VerticalOriginCesiumWriter("foo"); + try { + writer.open(getOutputStream()); + writer.writeInterval(startDate, startDate.addSeconds(100.0)); + writer.writeVerticalOrigin(CesiumVerticalOrigin.CENTER); + } finally { + DisposeHelper.dispose(writer); + } + } + } finally { + DisposeHelper.dispose(disposable_1); + } + } + Assert.assertEquals("{\"foo\":{\"interval\":\"20120607T12Z/20120607T120140Z\",\"verticalOrigin\":\"CENTER\"}}", getStringWriter().toString()); + } + + @Override + protected CesiumPropertyWriter createPropertyWriter(String propertyName) { + return new VerticalOriginCesiumWriter(propertyName); + } + + private TestContextRule rule$testContext = new TestContextRule(); + + @Rule + public TestContextRule getRule$testContext() { + return rule$testContext; + } +} \ No newline at end of file