Add support for `polylineVolume`.

上级 b6555382

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2008
# Visual Studio Version 16
VisualStudioVersion = 16.0.31005.135
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CesiumLanguageWriter", "CesiumLanguageWriter\CesiumLanguageWriter.csproj", "{085359F8-CC1D-4561-94C7-0BF067B8E370}"
EndProject
......@@ -70,6 +70,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Schema", "Schema", "{04E49F
..\Schema\PolylineGlowMaterial.json = ..\Schema\PolylineGlowMaterial.json
..\Schema\PolylineMaterial.json = ..\Schema\PolylineMaterial.json
..\Schema\PolylineOutlineMaterial.json = ..\Schema\PolylineOutlineMaterial.json
..\Schema\PolylineVolume.json = ..\Schema\PolylineVolume.json
..\Schema\Position.json = ..\Schema\Position.json
..\Schema\PositionList.json = ..\Schema\PositionList.json
..\Schema\PositionListOfLists.json = ..\Schema\PositionListOfLists.json
......@@ -79,6 +80,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Schema", "Schema", "{04E49F
..\Schema\Rotation.json = ..\Schema\Rotation.json
..\Schema\Scale.json = ..\Schema\Scale.json
..\Schema\ShadowMode.json = ..\Schema\ShadowMode.json
..\Schema\Shape.json = ..\Schema\Shape.json
..\Schema\SolidColorMaterial.json = ..\Schema\SolidColorMaterial.json
..\Schema\String.json = ..\Schema\String.json
..\Schema\StripeMaterial.json = ..\Schema\StripeMaterial.json
......@@ -165,6 +167,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ValueProperties", "ValuePro
..\Schema\ValueProperties\ArcTypeValueProperty.json = ..\Schema\ValueProperties\ArcTypeValueProperty.json
..\Schema\ValueProperties\BooleanValueProperty.json = ..\Schema\ValueProperties\BooleanValueProperty.json
..\Schema\ValueProperties\BoundingRectangleValueProperty.json = ..\Schema\ValueProperties\BoundingRectangleValueProperty.json
..\Schema\ValueProperties\Cartesian2ListValueProperty.json = ..\Schema\ValueProperties\Cartesian2ListValueProperty.json
..\Schema\ValueProperties\Cartesian2ValueProperty.json = ..\Schema\ValueProperties\Cartesian2ValueProperty.json
..\Schema\ValueProperties\Cartesian3ListOfListsValueProperty.json = ..\Schema\ValueProperties\Cartesian3ListOfListsValueProperty.json
..\Schema\ValueProperties\Cartesian3ListValueProperty.json = ..\Schema\ValueProperties\Cartesian3ListValueProperty.json
......@@ -215,6 +218,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Values", "Values", "{A9C205
..\Schema\Values\ArcTypeValue.json = ..\Schema\Values\ArcTypeValue.json
..\Schema\Values\BooleanValue.json = ..\Schema\Values\BooleanValue.json
..\Schema\Values\BoundingRectangleValue.json = ..\Schema\Values\BoundingRectangleValue.json
..\Schema\Values\Cartesian2ListValue.json = ..\Schema\Values\Cartesian2ListValue.json
..\Schema\Values\Cartesian2Value.json = ..\Schema\Values\Cartesian2Value.json
..\Schema\Values\Cartesian3ListOfListsValue.json = ..\Schema\Values\Cartesian3ListOfListsValue.json
..\Schema\Values\Cartesian3ListValue.json = ..\Schema\Values\Cartesian3ListValue.json
......
using System.Collections.Generic;
using JetBrains.Annotations;
namespace CesiumLanguageWriter.Advanced
{
/// <summary>
/// Adapts a class that implements <see cref="ICesiumCartesian2ListValuePropertyWriter"/> to implement
/// <see cref="ICesiumPropertyWriter"/> for a list of <see cref="Rectangular"/> values.
/// </summary>
/// <typeparam name="TFrom">The class that implements <see cref="ICesiumCartesian2ListValuePropertyWriter"/> to adapt.</typeparam>
public class CesiumCartesian2ListValuePropertyAdaptor<TFrom> : CesiumWriterAdaptor<TFrom, IEnumerable<Rectangular>>
where TFrom : class, ICesiumCartesian2ListValuePropertyWriter
{
/// <summary>
/// Initializes a new instance.
/// </summary>
/// <param name="parent">The instance to wrap.</param>
/// <param name="writeValueCallback">The callback to write a list of <see cref="Rectangular"/> values.</param>
/// <param name="writeDeleteValueCallback">The callback to write an indication that the client should delete existing data.</param>
public CesiumCartesian2ListValuePropertyAdaptor([NotNull] TFrom parent,
[NotNull] CesiumWriterAdaptorWriteCallback<TFrom, IEnumerable<Rectangular>> writeValueCallback,
[NotNull] CesiumWriterAdaptorWriteDeleteCallback<TFrom> writeDeleteValueCallback)
: base(parent, writeValueCallback, writeDeleteValueCallback)
{
}
}
}
\ No newline at end of file
......@@ -93,6 +93,19 @@ namespace CesiumLanguageWriter.Advanced
return new CesiumCartesian3VelocityValuePropertyAdaptor<TFrom>(parent, (writer, value) => writer.WriteCartesianVelocity(value), (writer, dates, values, startIndex, length) => writer.WriteCartesianVelocity(dates, values, startIndex, length), CreateWriteDeleteCallback<TFrom>());
}
/// <summary>
/// Create an adaptor for lists of <see cref="Rectangular"/> values.
/// </summary>
/// <typeparam name="TFrom">The class that implements <see cref="ICesiumCartesian3ListValuePropertyWriter"/> to adapt.</typeparam>
/// <param name="parent">The instance to wrap.</param>
/// <returns>The new adaptor.</returns>
[NotNull]
public static CesiumCartesian2ListValuePropertyAdaptor<TFrom> CreateCartesian2List<TFrom>([NotNull] TFrom parent)
where TFrom : class, ICesiumCartesian2ListValuePropertyWriter, ICesiumDeletablePropertyWriter
{
return new CesiumCartesian2ListValuePropertyAdaptor<TFrom>(parent, (writer, value) => writer.WriteCartesian2(value), CreateWriteDeleteCallback<TFrom>());
}
/// <summary>
/// Create an adaptor for lists of <see cref="Cartesian"/> values.
/// </summary>
......
......@@ -571,6 +571,24 @@ namespace CesiumLanguageWriter.Advanced
output.WriteEndSequence();
}
/// <summary>
/// Writes a list of <see cref="Rectangular"/> values as an array in X, Y order.
/// </summary>
/// <param name="output">The stream to which the value will be written.</param>
/// <param name="values">The values to write.</param>
public static void WriteCartesian2List(CesiumOutputStream output, IEnumerable<Rectangular> values)
{
output.WriteStartSequence();
foreach (Rectangular value in values)
{
output.WriteValue(value.X);
output.WriteValue(value.Y);
output.WriteLineBreak();
}
output.WriteEndSequence();
}
/// <summary>
/// Writes a list of <see cref="Cartesian"/> values as an array in X, Y, Z order.
/// </summary>
......
using System.Collections.Generic;
namespace CesiumLanguageWriter.Advanced
{
/// <summary>
/// A writer that can write a value as a list of two-dimensional Cartesian values.
/// </summary>
public interface ICesiumCartesian2ListValuePropertyWriter : ICesiumPropertyWriter
{
/// <summary>
/// Writes the value as a list of two-dimensional Cartesian values.
/// </summary>
/// <param name="values">The values.</param>
void WriteCartesian2(IEnumerable<Rectangular> values);
}
}
\ No newline at end of file
......@@ -49,6 +49,7 @@
<Compile Include="Advanced\CesiumArcTypeValuePropertyAdaptor.cs" />
<Compile Include="Advanced\CesiumBooleanValuePropertyAdaptor.cs" />
<Compile Include="Advanced\CesiumBoundingRectangleValuePropertyAdaptor.cs" />
<Compile Include="Advanced\CesiumCartesian2ListValuePropertyAdaptor.cs" />
<Compile Include="Advanced\CesiumCartesian2ValuePropertyAdaptor.cs" />
<Compile Include="Advanced\CesiumCartesian3ListOfListsValuePropertyAdaptor.cs" />
<Compile Include="Advanced\CesiumCartesian3ListValuePropertyAdaptor.cs" />
......@@ -107,6 +108,7 @@
<Compile Include="Advanced\ICesiumArcTypeValuePropertyWriter.cs" />
<Compile Include="Advanced\ICesiumBooleanValuePropertyWriter.cs" />
<Compile Include="Advanced\ICesiumBoundingRectangleValuePropertyWriter.cs" />
<Compile Include="Advanced\ICesiumCartesian2ListValuePropertyWriter.cs" />
<Compile Include="Advanced\ICesiumCartesian2ValuePropertyWriter.cs" />
<Compile Include="Advanced\ICesiumCartesian3ListOfListsValuePropertyWriter.cs" />
<Compile Include="Advanced\ICesiumCartesian3ListValuePropertyWriter.cs" />
......@@ -354,6 +356,7 @@
<Compile Include="Generated\PolylineOutlineMaterialCesiumWriter.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Generated\PolylineVolumeCesiumWriter.cs" />
<Compile Include="Generated\PositionCesiumWriter.cs">
<SubType>Code</SubType>
</Compile>
......@@ -383,6 +386,7 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="Generated\ShadowModeCesiumWriter.cs" />
<Compile Include="Generated\ShapeCesiumWriter.cs" />
<Compile Include="Generated\SolidColorMaterialCesiumWriter.cs">
<SubType>Code</SubType>
</Compile>
......
......@@ -136,6 +136,11 @@ namespace CesiumLanguageWriter
/// </summary>
public const string PolylinePropertyName = "polyline";
/// <summary>
/// The name of the <c>polylineVolume</c> property.
/// </summary>
public const string PolylineVolumePropertyName = "polylineVolume";
/// <summary>
/// The name of the <c>rectangle</c> property.
/// </summary>
......@@ -194,6 +199,7 @@ namespace CesiumLanguageWriter
private readonly Lazy<PointCesiumWriter> m_point = new Lazy<PointCesiumWriter>(() => new PointCesiumWriter(PointPropertyName), false);
private readonly Lazy<PolygonCesiumWriter> m_polygon = new Lazy<PolygonCesiumWriter>(() => new PolygonCesiumWriter(PolygonPropertyName), false);
private readonly Lazy<PolylineCesiumWriter> m_polyline = new Lazy<PolylineCesiumWriter>(() => new PolylineCesiumWriter(PolylinePropertyName), false);
private readonly Lazy<PolylineVolumeCesiumWriter> m_polylineVolume = new Lazy<PolylineVolumeCesiumWriter>(() => new PolylineVolumeCesiumWriter(PolylineVolumePropertyName), false);
private readonly Lazy<RectangleCesiumWriter> m_rectangle = new Lazy<RectangleCesiumWriter>(() => new RectangleCesiumWriter(RectanglePropertyName), false);
private readonly Lazy<TilesetCesiumWriter> m_tileset = new Lazy<TilesetCesiumWriter>(() => new TilesetCesiumWriter(TilesetPropertyName), false);
private readonly Lazy<WallCesiumWriter> m_wall = new Lazy<WallCesiumWriter>(() => new WallCesiumWriter(WallPropertyName), false);
......@@ -1132,6 +1138,24 @@ namespace CesiumLanguageWriter
return OpenAndReturn(PolylineWriter);
}
/// <summary>
/// Gets the writer for the <c>polylineVolume</c> property. The returned instance must be opened by calling the <see cref="CesiumElementWriter.Open"/> method before it can be used for writing. The <c>polylineVolume</c> property defines a polyline with a volume, defined as a 2D shape extruded along a polyline.
/// </summary>
[NotNull]
public PolylineVolumeCesiumWriter PolylineVolumeWriter
{
get { return m_polylineVolume.Value; }
}
/// <summary>
/// Opens and returns the writer for the <c>polylineVolume</c> property. The <c>polylineVolume</c> property defines a polyline with a volume, defined as a 2D shape extruded along a polyline.
/// </summary>
[NotNull]
public PolylineVolumeCesiumWriter OpenPolylineVolumeProperty()
{
return OpenAndReturn(PolylineVolumeWriter);
}
/// <summary>
/// Gets the writer for the <c>rectangle</c> property. The returned instance must be opened by calling the <see cref="CesiumElementWriter.Open"/> method before it can be used for writing. The <c>rectangle</c> property defines a cartographic rectangle, which conforms to the curvature of the globe and can be placed along the surface or at altitude.
/// </summary>
......
// <auto-generated>
// This file was generated automatically by GenerateFromSchema. Do NOT edit it.
// https://github.com/AnalyticalGraphicsInc/czml-writer
// </auto-generated>
using CesiumLanguageWriter.Advanced;
using System;
using JetBrains.Annotations;
using System.Collections.Generic;
namespace CesiumLanguageWriter
{
/// <summary>
/// Writes a <c>Shape</c> to a <see cref="CesiumOutputStream"/>. A <c>Shape</c> is a list of two-dimensional positions defining a shape.
/// </summary>
public class ShapeCesiumWriter : CesiumPropertyWriter<ShapeCesiumWriter>, ICesiumDeletablePropertyWriter, ICesiumCartesian2ListValuePropertyWriter
{
/// <summary>
/// The name of the <c>cartesian2</c> property.
/// </summary>
public const string Cartesian2PropertyName = "cartesian2";
/// <summary>
/// The name of the <c>delete</c> property.
/// </summary>
public const string DeletePropertyName = "delete";
private readonly Lazy<CesiumCartesian2ListValuePropertyAdaptor<ShapeCesiumWriter>> m_asCartesian2;
/// <summary>
/// Initializes a new instance.
/// </summary>
/// <param name="propertyName">The name of the property.</param>
public ShapeCesiumWriter([NotNull] string propertyName)
: base(propertyName)
{
m_asCartesian2 = CreateAsCartesian2();
}
/// <summary>
/// Initializes a new instance as a copy of an existing instance.
/// </summary>
/// <param name="existingInstance">The existing instance to copy.</param>
protected ShapeCesiumWriter([NotNull] ShapeCesiumWriter existingInstance)
: base(existingInstance)
{
m_asCartesian2 = CreateAsCartesian2();
}
/// <inheritdoc/>
public override ShapeCesiumWriter Clone()
{
return new ShapeCesiumWriter(this);
}
/// <summary>
/// Writes the value expressed as a <c>cartesian2</c>, which is the list of positions specified as two-dimensional Cartesian values <c>[X, Y, X, Y, ...]</c>.
/// </summary>
/// <param name="values">The values.</param>
public void WriteCartesian2(IEnumerable<Rectangular> values)
{
const string PropertyName = Cartesian2PropertyName;
OpenIntervalIfNecessary();
Output.WritePropertyName(PropertyName);
CesiumWritingHelper.WriteCartesian2List(Output, values);
}
/// <summary>
/// Writes the value expressed as a <c>delete</c>, which is whether the client should delete existing samples or interval data for this property. Data will be deleted for the containing interval, or if there is no containing interval, then all data. If true, all other properties in this property will be ignored.
/// </summary>
/// <param name="value">The value.</param>
public void WriteDelete(bool value)
{
const string PropertyName = DeletePropertyName;
OpenIntervalIfNecessary();
Output.WritePropertyName(PropertyName);
Output.WriteValue(value);
}
/// <summary>
/// Returns a wrapper for this instance that implements <see cref="ICesiumCartesian2ListValuePropertyWriter"/>. Because the returned instance is a wrapper for this instance, you may call <see cref="ICesiumElementWriter.Close"/> on either this instance or the wrapper, but you must not call it on both.
/// </summary>
/// <returns>The wrapper.</returns>
public CesiumCartesian2ListValuePropertyAdaptor<ShapeCesiumWriter> AsCartesian2()
{
return m_asCartesian2.Value;
}
private Lazy<CesiumCartesian2ListValuePropertyAdaptor<ShapeCesiumWriter>> CreateAsCartesian2()
{
return new Lazy<CesiumCartesian2ListValuePropertyAdaptor<ShapeCesiumWriter>>(CreateCartesian2List, false);
}
private CesiumCartesian2ListValuePropertyAdaptor<ShapeCesiumWriter> CreateCartesian2List()
{
return CesiumValuePropertyAdaptors.CreateCartesian2List(this);
}
}
}
......@@ -96,10 +96,12 @@
<Compile Include="TestPolylineDashMaterialCesiumWriter.cs" />
<Compile Include="TestPolylineGlowMaterialCesiumWriter.cs" />
<Compile Include="TestPolylineOutlineMaterialCesiumWriter.cs" />
<Compile Include="TestPolylineVolumeCesiumWriter.cs" />
<Compile Include="TestPositionCesiumWriter.cs" />
<Compile Include="TestRectangleCesiumWriter.cs" />
<Compile Include="TestRectangularSensorCesiumWriter.cs" />
<Compile Include="TestReference.cs" />
<Compile Include="TestShapeCesiumWriter.cs" />
<Compile Include="TestSolidColorMaterialCesiumWriter.cs" />
<Compile Include="TestStringCesiumWriter.cs" />
<Compile Include="TestStripeMaterialCesiumWriter.cs" />
......
......@@ -104,6 +104,15 @@ namespace CesiumLanguageWriterTests
});
}
if (value is Bounds)
{
var bounds = (Bounds)value;
return CreateExpectedJson(new Dictionary<string, object>
{
{ "distanceDisplayCondition", new List<object> { bounds.LowerBound, bounds.UpperBound } },
});
}
if (value is NearFarScalar)
{
var nearFarScalar = (NearFarScalar)value;
......
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using CesiumLanguageWriter;
using CesiumLanguageWriter.Advanced;
using NUnit.Framework;
namespace CesiumLanguageWriterTests
{
[TestFixture]
public class TestPolylineVolumeCesiumWriter : TestCesiumPropertyWriter<PolylineVolumeCesiumWriter>
{
[Test]
public void TestShowProperty()
{
const bool expectedShow = true;
using (Packet)
using (var polylineVolume = Packet.OpenPolylineVolumeProperty())
using (var interval = polylineVolume.OpenInterval())
{
interval.WriteShowProperty(expectedShow);
}
AssertExpectedJson(PacketCesiumWriter.PolylineVolumePropertyName, new Dictionary<string, object>
{
{ PolylineVolumeCesiumWriter.ShowPropertyName, expectedShow },
});
}
[Test]
public void TestShowPropertyInterval()
{
var startDate = new GregorianDate(2012, 4, 2, 12, 0, 0).ToJulianDate();
var stopDate = new GregorianDate(2012, 4, 2, 12, 1, 0).ToJulianDate();
var interval1Start = startDate;
var interval1Stop = startDate.AddSeconds(1);
var interval2Start = interval1Stop;
var interval2Stop = startDate.AddSeconds(2);
var interval3Start = interval2Stop;
var interval3Stop = stopDate;
const bool interval1Value = true;
const bool interval2Value = false;
const bool interval3Value = true;
using (Packet)
using (var polylineVolume = Packet.OpenPolylineVolumeProperty())
using (var show = polylineVolume.OpenShowProperty())
using (var showIntervals = show.OpenMultipleIntervals())
{
using (var interval = showIntervals.OpenInterval(interval1Start, interval1Stop))
{
interval.WriteBoolean(interval1Value);
}
using (var interval = showIntervals.OpenInterval(interval2Start, interval2Stop))
{
interval.WriteBoolean(interval2Value);
}
using (var interval = showIntervals.OpenInterval(interval3Start, interval3Stop))
{
interval.WriteBoolean(interval3Value);
}
}
AssertExpectedJson(PacketCesiumWriter.PolylineVolumePropertyName, new Dictionary<string, object>
{
{
PolylineVolumeCesiumWriter.ShowPropertyName, new List<Dictionary<string, object>>
{
new Dictionary<string, object>
{
{ "interval", CesiumFormattingHelper.ToIso8601Interval(interval1Start, interval1Stop, Iso8601Format.Compact) },
{ BooleanCesiumWriter.BooleanPropertyName, interval1Value },
},
new Dictionary<string, object>
{
{ "interval", CesiumFormattingHelper.ToIso8601Interval(interval2Start, interval2Stop, Iso8601Format.Compact) },
{ BooleanCesiumWriter.BooleanPropertyName, interval2Value },
},
new Dictionary<string, object>
{
{ "interval", CesiumFormattingHelper.ToIso8601Interval(interval3Start, interval3Stop, Iso8601Format.Compact) },
{ BooleanCesiumWriter.BooleanPropertyName, interval3Value },
},
}
},
});
}
[Test]
public void TestShape()
{
using (Packet)
using (var polylineVolume = Packet.OpenPolylineVolumeProperty())
{
var shape = new List<Rectangular>
{
new Rectangular(-5, -5),
new Rectangular(6, -6),
new Rectangular(7, 7),
new Rectangular(-8, 8),
};
polylineVolume.WriteShapeProperty(shape);
}
Assert.AreEqual("{\"polylineVolume\":{\"shape\":{\"cartesian2\":[-5,-5,6,-6,7,7,-8,8]}}}", StringWriter.ToString());
}
[Test]
public void TestDistanceDisplayCondition()
{
var expectedBounds = new Bounds(10, 1234);
using (Packet)
using (var polylineVolume = Packet.OpenPolylineVolumeProperty())
using (var interval = polylineVolume.OpenInterval())
{
interval.WriteDistanceDisplayConditionProperty(expectedBounds);
}
AssertExpectedJson(PacketCesiumWriter.PolylineVolumePropertyName, new Dictionary<string, object>
{
{ PolylineVolumeCesiumWriter.DistanceDisplayConditionPropertyName, expectedBounds },
});
}
/// <summary>
/// Create the example CZML file included in the Cesium Sandcastle.
/// </summary>
[Test]
public void TestExample()
{
var stringWriter = new StringWriter();
var outputStream = new CesiumOutputStream(stringWriter)
{
PrettyFormatting = true
};
var writer = new CesiumStreamWriter();
outputStream.WriteStartSequence();
using (var packet = writer.OpenPacket(outputStream))
{
packet.WriteId("document");
packet.WriteName("CZML Geometries: Polyline Volume");
packet.WriteVersion("1.0");
}
using (var packet = writer.OpenPacket(outputStream))
{
packet.WriteId("greenBox");
packet.WriteName("Green box with beveled corners and outline");
using (var polylineVolume = packet.OpenPolylineVolumeProperty())
{
using (var positions = polylineVolume.OpenPositionsProperty())
{
positions.WriteCartographicDegrees(new List<Cartographic>
{
new Cartographic(-90.0, 32.0, 0),
new Cartographic(-90.0, 36.0, 100000),
new Cartographic(-94.0, 36.0, 0),
});
}
using (var shape = polylineVolume.OpenShapeProperty())
{
shape.WriteCartesian2(new List<Rectangular>
{
new Rectangular(-50000, -50000),
new Rectangular(50000, -50000),
new Rectangular(50000, 50000),
new Rectangular(-50000, 50000),
});
}
polylineVolume.WriteCornerTypeProperty(CesiumCornerType.Beveled);
using (var material = polylineVolume.OpenMaterialProperty())
{
using (var solidColor = material.OpenSolidColorProperty())
{
solidColor.WriteColorProperty(Color.FromArgb(128, Color.Lime));
}
}
polylineVolume.WriteOutlineProperty(true);
polylineVolume.WriteOutlineColorProperty(Color.Black);
}
}
using (var packet = writer.OpenPacket(outputStream))
{
packet.WriteId("blueStar");
packet.WriteName("Blue star with mitered corners and outline");
using (var polylineVolume = packet.OpenPolylineVolumeProperty())
{
using (var positions = polylineVolume.OpenPositionsProperty())
{
positions.WriteCartographicDegrees(new List<Cartographic>
{
new Cartographic(-95.0, 32.0, 0),
new Cartographic(-95.0, 36.0, 100000),
new Cartographic(-99.0, 36.0, 200000),
});
}
using (var shape = polylineVolume.OpenShapeProperty())
{
const int arms = 7;
const double rOuter = 70000.0;
const double rInner = 50000.0;
const double angle = Math.PI / arms;
var vertices = new List<Rectangular>();
for (int i = 0; i < 2 * arms; i++)
{
double r = i % 2 == 0 ? rOuter : rInner;
vertices.Add(new Rectangular(Math.Cos(i * angle) * r, Math.Sin(i * angle) * r));
}
shape.WriteCartesian2(vertices);
}
polylineVolume.WriteCornerTypeProperty(CesiumCornerType.Mitered);
using (var material = polylineVolume.OpenMaterialProperty())
{
using (var solidColor = material.OpenSolidColorProperty())
{
solidColor.WriteColorProperty(Color.Blue);
}
}
}
}
outputStream.WriteEndSequence();
Console.WriteLine(stringWriter.ToString());
}
protected override CesiumPropertyWriter<PolylineVolumeCesiumWriter> CreatePropertyWriter(string propertyName)
{
return new PolylineVolumeCesiumWriter(propertyName);
}
}
}
\ No newline at end of file
using System.Collections.Generic;
using System.Linq;