Skip to content

Commit

Permalink
Add velocityReference orientation support.
Browse files Browse the repository at this point in the history
  • Loading branch information
shunter committed Sep 1, 2017
1 parent cf7a178 commit eabc7e3
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 0 deletions.
72 changes: 72 additions & 0 deletions DotNet/CesiumLanguageWriter/Generated/OrientationCesiumWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ public class OrientationCesiumWriter : CesiumInterpolatablePropertyWriter<Orient
/// </summary>
public const string ReferencePropertyName = "reference";

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

private readonly Lazy<ICesiumInterpolatableValuePropertyWriter<UnitQuaternion>> m_asUnitQuaternion;
private readonly Lazy<ICesiumValuePropertyWriter<Reference>> m_asReference;
private readonly Lazy<ICesiumValuePropertyWriter<Reference>> m_asVelocityReference;

/// <summary>
/// Initializes a new instance.
Expand All @@ -33,6 +39,7 @@ public OrientationCesiumWriter(string propertyName)
{
m_asUnitQuaternion = new Lazy<ICesiumInterpolatableValuePropertyWriter<UnitQuaternion>>(CreateUnitQuaternionAdaptor, false);
m_asReference = new Lazy<ICesiumValuePropertyWriter<Reference>>(CreateReferenceAdaptor, false);
m_asVelocityReference = new Lazy<ICesiumValuePropertyWriter<Reference>>(CreateVelocityReferenceAdaptor, false);
}

/// <summary>
Expand All @@ -44,6 +51,7 @@ protected OrientationCesiumWriter(OrientationCesiumWriter existingInstance)
{
m_asUnitQuaternion = new Lazy<ICesiumInterpolatableValuePropertyWriter<UnitQuaternion>>(CreateUnitQuaternionAdaptor, false);
m_asReference = new Lazy<ICesiumValuePropertyWriter<Reference>>(CreateReferenceAdaptor, false);
m_asVelocityReference = new Lazy<ICesiumValuePropertyWriter<Reference>>(CreateVelocityReferenceAdaptor, false);
}

/// <inheritdoc />
Expand Down Expand Up @@ -138,6 +146,56 @@ public void WriteReference(string identifier, string[] propertyNames)
CesiumWritingHelper.WriteReference(Output, identifier, propertyNames);
}

/// <summary>
/// Writes the value expressed as a <c>velocityReference</c>, which is the orientation specified as the normalized velocity vector of a position property. The reference must be to a <c>position</c> property.
/// </summary>
/// <param name="value">The reference.</param>
public void WriteVelocityReference(Reference value)
{
const string PropertyName = VelocityReferencePropertyName;
OpenIntervalIfNecessary();
Output.WritePropertyName(PropertyName);
CesiumWritingHelper.WriteReference(Output, value);
}

/// <summary>
/// Writes the value expressed as a <c>velocityReference</c>, which is the orientation specified as the normalized velocity vector of a position property. The reference must be to a <c>position</c> property.
/// </summary>
/// <param name="value">The earliest date of the interval.</param>
public void WriteVelocityReference(string value)
{
const string PropertyName = VelocityReferencePropertyName;
OpenIntervalIfNecessary();
Output.WritePropertyName(PropertyName);
CesiumWritingHelper.WriteReference(Output, value);
}

/// <summary>
/// Writes the value expressed as a <c>velocityReference</c>, which is the orientation specified as the normalized velocity vector of a position property. The reference must be to a <c>position</c> 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 WriteVelocityReference(string identifier, string propertyName)
{
const string PropertyName = VelocityReferencePropertyName;
OpenIntervalIfNecessary();
Output.WritePropertyName(PropertyName);
CesiumWritingHelper.WriteReference(Output, identifier, propertyName);
}

/// <summary>
/// Writes the value expressed as a <c>velocityReference</c>, which is the orientation specified as the normalized velocity vector of a position property. The reference must be to a <c>position</c> 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 WriteVelocityReference(string identifier, string[] propertyNames)
{
const string PropertyName = VelocityReferencePropertyName;
OpenIntervalIfNecessary();
Output.WritePropertyName(PropertyName);
CesiumWritingHelper.WriteReference(Output, identifier, propertyNames);
}

/// <summary>
/// Returns a wrapper for this instance that implements <see cref="ICesiumInterpolatableValuePropertyWriter{T}" /> to write a value in <c>UnitQuaternion</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>
Expand Down Expand Up @@ -166,5 +224,19 @@ private ICesiumValuePropertyWriter<Reference> CreateReferenceAdaptor()
return new CesiumWriterAdaptor<OrientationCesiumWriter, Reference>(this, (me, value) => me.WriteReference(value));
}

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

private ICesiumValuePropertyWriter<Reference> CreateVelocityReferenceAdaptor()
{
return new CesiumWriterAdaptor<OrientationCesiumWriter, Reference>(this, (me, value) => me.WriteVelocityReference(value));
}

}
}
50 changes: 50 additions & 0 deletions DotNet/CesiumLanguageWriter/Generated/PacketCesiumWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,56 @@ public void WriteOrientationPropertyReference(string identifier, string[] proper
}
}

/// <summary>
/// Writes a value for the <c>orientation</c> property as a <c>velocityReference</c> value. The <c>orientation</c> property specifies the orientation of the object in the world. The orientation has no direct visual representation, but it is used to orient models, cones, pyramids, and other graphical items attached to the object.
/// </summary>
/// <param name="value">The reference.</param>
public void WriteOrientationPropertyVelocityReference(Reference value)
{
using (var writer = OpenOrientationProperty())
{
writer.WriteVelocityReference(value);
}
}

/// <summary>
/// Writes a value for the <c>orientation</c> property as a <c>velocityReference</c> value. The <c>orientation</c> property specifies the orientation of the object in the world. The orientation has no direct visual representation, but it is used to orient models, cones, pyramids, and other graphical items attached to the object.
/// </summary>
/// <param name="value">The earliest date of the interval.</param>
public void WriteOrientationPropertyVelocityReference(string value)
{
using (var writer = OpenOrientationProperty())
{
writer.WriteVelocityReference(value);
}
}

/// <summary>
/// Writes a value for the <c>orientation</c> property as a <c>velocityReference</c> value. The <c>orientation</c> property specifies the orientation of the object in the world. The orientation has no direct visual representation, but it is used to orient models, cones, pyramids, and other graphical items attached to the object.
/// </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 WriteOrientationPropertyVelocityReference(string identifier, string propertyName)
{
using (var writer = OpenOrientationProperty())
{
writer.WriteVelocityReference(identifier, propertyName);
}
}

/// <summary>
/// Writes a value for the <c>orientation</c> property as a <c>velocityReference</c> value. The <c>orientation</c> property specifies the orientation of the object in the world. The orientation has no direct visual representation, but it is used to orient models, cones, pyramids, and other graphical items attached to the object.
/// </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 WriteOrientationPropertyVelocityReference(string identifier, string[] propertyNames)
{
using (var writer = OpenOrientationProperty())
{
writer.WriteVelocityReference(identifier, propertyNames);
}
}

/// <summary>
/// Gets the writer for the <c>viewFrom</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>viewFrom</c> property defines a suggested camera location when viewing this object. The property is specified as a Cartesian position in the East (x), North (y), Up (z) reference frame relative to the object's position.
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions Schema/Orientation.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
"$ref": "ReferenceValue.json",
"description": "The orientation specified as a reference to another property.",
"czmlValue": true
},
"velocityReference": {
"$ref": "ReferenceValue.json",
"description": "The orientation specified as the normalized velocity vector of a position property. The reference must be to a `position` property.",
"czmlValue": true
}
}
}

0 comments on commit eabc7e3

Please sign in to comment.