Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add arcType to polyline and polygon. #158

Merged
merged 1 commit into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions DotNet/CesiumLanguageWriter.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Schema", "Schema", "{04E49F4E-CD74-44F3-9A80-604BCA10FB67}"
ProjectSection(SolutionItems) = preProject
..\Schema\AlignedAxis.json = ..\Schema\AlignedAxis.json
..\Schema\ArcType.json = ..\Schema\ArcType.json
..\Schema\ArcTypeValue.json = ..\Schema\ArcTypeValue.json
..\Schema\BackgroundPadding.json = ..\Schema\BackgroundPadding.json
..\Schema\Billboard.json = ..\Schema\Billboard.json
..\Schema\Boolean.json = ..\Schema\Boolean.json
Expand Down
21 changes: 21 additions & 0 deletions DotNet/CesiumLanguageWriter/Advanced/CesiumFormattingHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,27 @@ public static string LabelStyleToString(CesiumLabelStyle value)
}
}

/// <summary>
/// Converts a <see cref="CesiumArcType"/> to the corresponding string in a CZML stream.
/// </summary>
/// <param name="value">The value to convert.</param>
/// <returns>The string representing the specified value.</returns>
[NotNull]
public static string ArcTypeToString(CesiumArcType value)
{
switch (value)
{
case CesiumArcType.None:
return "NONE";
case CesiumArcType.Geodesic:
return "GEODESIC";
case CesiumArcType.Rhumb:
return "RHUMB";
default:
throw new ArgumentException(CesiumLocalization.UnknownEnumerationValue, "value");
}
}

/// <summary>
/// Converts a <see cref="CesiumCornerType"/> to the corresponding string in a CZML stream.
/// </summary>
Expand Down
23 changes: 23 additions & 0 deletions DotNet/CesiumLanguageWriter/CesiumArcType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace CesiumLanguageWriter
{
/// <summary>
/// Specifies the type of an arc.
/// </summary>
public enum CesiumArcType
{
/// <summary>
/// The arc is a straight line that does not conform to the surface of an ellipsoid.
/// </summary>
None,

/// <summary>
/// The arc is a geodesic, which is the shortest path conforming to the surface of an ellipsoid.
/// </summary>
Geodesic,

/// <summary>
/// The arc is a rhumb line, or loxodrome, which is the path of constant heading conforming to the surface of an ellipsoid.
/// </summary>
Rhumb,
}
}
2 changes: 2 additions & 0 deletions DotNet/CesiumLanguageWriter/CesiumLanguageWriter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<Compile Include="Cartographic.cs" />
<Compile Include="CartographicExtent.cs" />
<Compile Include="CesiumColorBlendMode.cs" />
<Compile Include="CesiumArcType.cs" />
<Compile Include="CesiumCornerType.cs" />
<Compile Include="CesiumHeightReference.cs" />
<Compile Include="CesiumSensorVolumePortionToDisplay.cs" />
Expand All @@ -99,6 +100,7 @@
<Compile Include="Generated\AlignedAxisCesiumWriter.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Generated\ArcTypeCesiumWriter.cs" />
<Compile Include="Generated\BackgroundPaddingCesiumWriter.cs" />
<Compile Include="Generated\BillboardCesiumWriter.cs">
<SubType>Code</SubType>
Expand Down
155 changes: 155 additions & 0 deletions DotNet/CesiumLanguageWriter/Generated/ArcTypeCesiumWriter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
// <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;

namespace CesiumLanguageWriter
{
/// <summary>
/// Writes a <c>ArcType</c> to a <see cref="CesiumOutputStream" />. A <c>ArcType</c> is the type of an arc.
/// </summary>
public class ArcTypeCesiumWriter : CesiumPropertyWriter<ArcTypeCesiumWriter>
{
/// <summary>
/// The name of the <c>ArcType</c> property.
/// </summary>
public const string ArcTypePropertyName = "ArcType";

/// <summary>
/// The name of the <c>reference</c> property.
/// </summary>
public const string ReferencePropertyName = "reference";

private readonly Lazy<ICesiumValuePropertyWriter<CesiumArcType>> m_asArcType;
private readonly Lazy<ICesiumValuePropertyWriter<Reference>> m_asReference;

/// <summary>
/// Initializes a new instance.
/// </summary>
/// <param name="propertyName">The name of the property.</param>
public ArcTypeCesiumWriter([NotNull] string propertyName)
: base(propertyName)
{
m_asArcType = new Lazy<ICesiumValuePropertyWriter<CesiumArcType>>(CreateArcTypeAdaptor, false);
m_asReference = new Lazy<ICesiumValuePropertyWriter<Reference>>(CreateReferenceAdaptor, false);
}

/// <summary>
/// Initializes a new instance as a copy of an existing instance.
/// </summary>
/// <param name="existingInstance">The existing instance to copy.</param>
protected ArcTypeCesiumWriter([NotNull] ArcTypeCesiumWriter existingInstance)
: base(existingInstance)
{
m_asArcType = new Lazy<ICesiumValuePropertyWriter<CesiumArcType>>(CreateArcTypeAdaptor, false);
m_asReference = new Lazy<ICesiumValuePropertyWriter<Reference>>(CreateReferenceAdaptor, false);
}

/// <inheritdoc />
public override ArcTypeCesiumWriter Clone()
{
return new ArcTypeCesiumWriter(this);
}

/// <summary>
/// Writes the value expressed as a <c>ArcType</c>, which is the arc type.
/// </summary>
/// <param name="value">The style of an arc.</param>
public void WriteArcType(CesiumArcType value)
{
const string PropertyName = ArcTypePropertyName;
if (ForceInterval)
{
OpenIntervalIfNecessary();
}
if (IsInterval)
{
Output.WritePropertyName(PropertyName);
}
Output.WriteValue(CesiumFormattingHelper.ArcTypeToString(value));
}

/// <summary>
/// Writes the value expressed as a <c>reference</c>, which is the arc type specified as a reference to another property.
/// </summary>
/// <param name="value">The reference.</param>
public void WriteReference(Reference value)
{
const string PropertyName = ReferencePropertyName;
OpenIntervalIfNecessary();
Output.WritePropertyName(PropertyName);
CesiumWritingHelper.WriteReference(Output, value);
}

/// <summary>
/// Writes the value expressed as a <c>reference</c>, which is the arc type specified as a reference to another property.
/// </summary>
/// <param name="value">The earliest date of the interval.</param>
public void WriteReference(string value)
{
const string PropertyName = ReferencePropertyName;
OpenIntervalIfNecessary();
Output.WritePropertyName(PropertyName);
CesiumWritingHelper.WriteReference(Output, value);
}

/// <summary>
/// Writes the value expressed as a <c>reference</c>, which is the arc type specified as a reference to another property.
/// </summary>
/// <param name="identifier">The identifier of the object which contains the referenced property.</param>
/// <param name="propertyName">The property on the referenced object.</param>
public void WriteReference(string identifier, string propertyName)
{
const string PropertyName = ReferencePropertyName;
OpenIntervalIfNecessary();
Output.WritePropertyName(PropertyName);
CesiumWritingHelper.WriteReference(Output, identifier, propertyName);
}

/// <summary>
/// Writes the value expressed as a <c>reference</c>, which is the arc type specified as a reference to another property.
/// </summary>
/// <param name="identifier">The identifier of the object which contains the referenced property.</param>
/// <param name="propertyNames">The hierarchy of properties to be indexed on the referenced object.</param>
public void WriteReference(string identifier, string[] propertyNames)
{
const string PropertyName = ReferencePropertyName;
OpenIntervalIfNecessary();
Output.WritePropertyName(PropertyName);
CesiumWritingHelper.WriteReference(Output, identifier, propertyNames);
}

/// <summary>
/// Returns a wrapper for this instance that implements <see cref="ICesiumValuePropertyWriter{T}" /> to write a value in <c>ArcType</c> format. 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 ICesiumValuePropertyWriter<CesiumArcType> AsArcType()
{
return m_asArcType.Value;
}

private ICesiumValuePropertyWriter<CesiumArcType> CreateArcTypeAdaptor()
{
return new CesiumWriterAdaptor<ArcTypeCesiumWriter, CesiumArcType>(this, (me, value) => me.WriteArcType(value));
}

/// <summary>
/// Returns a wrapper for this instance that implements <see cref="ICesiumValuePropertyWriter{T}" /> to write a value in <c>Reference</c> format. 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 ICesiumValuePropertyWriter<Reference> AsReference()
{
return m_asReference.Value;
}

private ICesiumValuePropertyWriter<Reference> CreateReferenceAdaptor()
{
return new CesiumWriterAdaptor<ArcTypeCesiumWriter, Reference>(this, (me, value) => me.WriteReference(value));
}

}
}
87 changes: 87 additions & 0 deletions DotNet/CesiumLanguageWriter/Generated/PolygonCesiumWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ public class PolygonCesiumWriter : CesiumPropertyWriter<PolygonCesiumWriter>
/// </summary>
public const string PositionsPropertyName = "positions";

/// <summary>
/// The name of the <c>arcType</c> property.
/// </summary>
public const string ArcTypePropertyName = "arcType";

/// <summary>
/// The name of the <c>height</c> property.
/// </summary>
Expand Down Expand Up @@ -103,6 +108,7 @@ public class PolygonCesiumWriter : CesiumPropertyWriter<PolygonCesiumWriter>

private readonly Lazy<BooleanCesiumWriter> m_show = new Lazy<BooleanCesiumWriter>(() => new BooleanCesiumWriter(ShowPropertyName), false);
private readonly Lazy<PositionListCesiumWriter> m_positions = new Lazy<PositionListCesiumWriter>(() => new PositionListCesiumWriter(PositionsPropertyName), false);
private readonly Lazy<ArcTypeCesiumWriter> m_arcType = new Lazy<ArcTypeCesiumWriter>(() => new ArcTypeCesiumWriter(ArcTypePropertyName), false);
private readonly Lazy<DoubleCesiumWriter> m_height = new Lazy<DoubleCesiumWriter>(() => new DoubleCesiumWriter(HeightPropertyName), false);
private readonly Lazy<DoubleCesiumWriter> m_extrudedHeight = new Lazy<DoubleCesiumWriter>(() => new DoubleCesiumWriter(ExtrudedHeightPropertyName), false);
private readonly Lazy<DoubleCesiumWriter> m_stRotation = new Lazy<DoubleCesiumWriter>(() => new DoubleCesiumWriter(StRotationPropertyName), false);
Expand Down Expand Up @@ -291,6 +297,87 @@ public void WritePositionsPropertyReferences(IEnumerable<Reference> references)
}
}

/// <summary>
/// Gets the writer for the <c>arcType</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>arcType</c> property defines the type of arc that should connect the positions of the polygon. If not specified, the default value is GEODESIC.
/// </summary>
[NotNull]
public ArcTypeCesiumWriter ArcTypeWriter
{
get { return m_arcType.Value; }
}

/// <summary>
/// Opens and returns the writer for the <c>arcType</c> property. The <c>arcType</c> property defines the type of arc that should connect the positions of the polygon. If not specified, the default value is GEODESIC.
/// </summary>
[NotNull]
public ArcTypeCesiumWriter OpenArcTypeProperty()
{
OpenIntervalIfNecessary();
return OpenAndReturn(ArcTypeWriter);
}

/// <summary>
/// Writes a value for the <c>arcType</c> property as a <c>ArcType</c> value. The <c>arcType</c> property specifies the type of arc that should connect the positions of the polygon. If not specified, the default value is GEODESIC.
/// </summary>
/// <param name="value">The style of an arc.</param>
public void WriteArcTypeProperty(CesiumArcType value)
{
using (var writer = OpenArcTypeProperty())
{
writer.WriteArcType(value);
}
}

/// <summary>
/// Writes a value for the <c>arcType</c> property as a <c>reference</c> value. The <c>arcType</c> property specifies the type of arc that should connect the positions of the polygon. If not specified, the default value is GEODESIC.
/// </summary>
/// <param name="value">The reference.</param>
public void WriteArcTypePropertyReference(Reference value)
{
using (var writer = OpenArcTypeProperty())
{
writer.WriteReference(value);
}
}

/// <summary>
/// Writes a value for the <c>arcType</c> property as a <c>reference</c> value. The <c>arcType</c> property specifies the type of arc that should connect the positions of the polygon. If not specified, the default value is GEODESIC.
/// </summary>
/// <param name="value">The earliest date of the interval.</param>
public void WriteArcTypePropertyReference(string value)
{
using (var writer = OpenArcTypeProperty())
{
writer.WriteReference(value);
}
}

/// <summary>
/// Writes a value for the <c>arcType</c> property as a <c>reference</c> value. The <c>arcType</c> property specifies the type of arc that should connect the positions of the polygon. If not specified, the default value is GEODESIC.
/// </summary>
/// <param name="identifier">The identifier of the object which contains the referenced property.</param>
/// <param name="propertyName">The property on the referenced object.</param>
public void WriteArcTypePropertyReference(string identifier, string propertyName)
{
using (var writer = OpenArcTypeProperty())
{
writer.WriteReference(identifier, propertyName);
}
}

/// <summary>
/// Writes a value for the <c>arcType</c> property as a <c>reference</c> value. The <c>arcType</c> property specifies the type of arc that should connect the positions of the polygon. If not specified, the default value is GEODESIC.
/// </summary>
/// <param name="identifier">The identifier of the object which contains the referenced property.</param>
/// <param name="propertyNames">The hierarchy of properties to be indexed on the referenced object.</param>
public void WriteArcTypePropertyReference(string identifier, string[] propertyNames)
{
using (var writer = OpenArcTypeProperty())
{
writer.WriteReference(identifier, propertyNames);
}
}

/// <summary>
/// Gets the writer for the <c>height</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>height</c> property defines the height of the polygon when <c>perPositionHeight</c> is false. If not specified, the default value is 0.0.
/// </summary>
Expand Down
Loading