Skip to content

Commit

Permalink
Merge pull request #173 from AnalyticalGraphicsInc/tileset
Browse files Browse the repository at this point in the history
Add `tileset`.
  • Loading branch information
shunter authored Feb 20, 2020
2 parents e7333bc + 9e003dc commit 814e95f
Show file tree
Hide file tree
Showing 13 changed files with 1,330 additions and 0 deletions.
1 change: 1 addition & 0 deletions DotNet/CesiumLanguageWriter.sln
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Schema", "Schema", "{04E49F
..\Schema\String.json = ..\Schema\String.json
..\Schema\StripeMaterial.json = ..\Schema\StripeMaterial.json
..\Schema\StripeOrientation.json = ..\Schema\StripeOrientation.json
..\Schema\Tileset.json = ..\Schema\Tileset.json
..\Schema\Translation.json = ..\Schema\Translation.json
..\Schema\Uri.json = ..\Schema\Uri.json
..\Schema\validate.html = ..\Schema\validate.html
Expand Down
1 change: 1 addition & 0 deletions DotNet/CesiumLanguageWriter/CesiumLanguageWriter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@
<Compile Include="Generated\StripeOrientationCesiumWriter.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Generated\TilesetCesiumWriter.cs" />
<Compile Include="Generated\TranslationCesiumWriter.cs">
<SubType>Code</SubType>
</Compile>
Expand Down
24 changes: 24 additions & 0 deletions DotNet/CesiumLanguageWriter/Generated/PacketCesiumWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ public class PacketCesiumWriter : CesiumElementWriter
/// </summary>
public const string RectanglePropertyName = "rectangle";

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

/// <summary>
/// The name of the <c>wall</c> property.
/// </summary>
Expand Down Expand Up @@ -190,6 +195,7 @@ public class PacketCesiumWriter : CesiumElementWriter
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<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);
private readonly Lazy<ConicSensorCesiumWriter> m_agi_conicSensor = new Lazy<ConicSensorCesiumWriter>(() => new ConicSensorCesiumWriter(ConicSensorPropertyName), false);
private readonly Lazy<CustomPatternSensorCesiumWriter> m_agi_customPatternSensor = new Lazy<CustomPatternSensorCesiumWriter>(() => new CustomPatternSensorCesiumWriter(CustomPatternSensorPropertyName), false);
Expand Down Expand Up @@ -1144,6 +1150,24 @@ public RectangleCesiumWriter OpenRectangleProperty()
return OpenAndReturn(RectangleWriter);
}

/// <summary>
/// Gets the writer for the <c>tileset</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>tileset</c> property defines a 3D Tiles tileset.
/// </summary>
[NotNull]
public TilesetCesiumWriter TilesetWriter
{
get { return m_tileset.Value; }
}

/// <summary>
/// Opens and returns the writer for the <c>tileset</c> property. The <c>tileset</c> property defines a 3D Tiles tileset.
/// </summary>
[NotNull]
public TilesetCesiumWriter OpenTilesetProperty()
{
return OpenAndReturn(TilesetWriter);
}

/// <summary>
/// Gets the writer for the <c>wall</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>wall</c> property defines a two-dimensional wall which conforms to the curvature of the globe and can be placed along the surface or at altitude.
/// </summary>
Expand Down
411 changes: 411 additions & 0 deletions DotNet/CesiumLanguageWriter/Generated/TilesetCesiumWriter.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
<Compile Include="TestSolidColorMaterialCesiumWriter.cs" />
<Compile Include="TestStringCesiumWriter.cs" />
<Compile Include="TestStripeMaterialCesiumWriter.cs" />
<Compile Include="TestTilesetCesiumWriter.cs" />
<Compile Include="TestTimeInterval.cs" />
<Compile Include="TestUnitCartesian.cs" />
<Compile Include="TestUnitQuaternion.cs" />
Expand Down
57 changes: 57 additions & 0 deletions DotNet/CesiumLanguageWriterTests/TestGenerateValidationDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,24 @@ private void WriteConstantValues()
m_assertionsWriter.WriteLine(" expect(e.rectangle.zIndex.getValue(date)).toEqual(445);");
}
}
using (var w = packet.OpenTilesetProperty())
{
using (var w2 = w.OpenShowProperty())
{
w2.WriteBoolean(true);
m_assertionsWriter.WriteLine(" expect(e.tileset.show.getValue(date)).toEqual(true);");
}
using (var w2 = w.OpenUriProperty())
{
w2.WriteUri("http://example.com/6864", CesiumResourceBehavior.LinkTo);
m_assertionsWriter.WriteLine(" expect(e.tileset.uri.getValue(date).url).toEqual('http://example.com/6864');");
}
using (var w2 = w.OpenMaximumScreenSpaceErrorProperty())
{
w2.WriteNumber(51767.0);
m_assertionsWriter.WriteLine(" expect(e.tileset.maximumScreenSpaceError.getValue(date)).toEqual(51767.0);");
}
}
using (var w = packet.OpenWallProperty())
{
using (var w2 = w.OpenShowProperty())
Expand Down Expand Up @@ -1896,6 +1914,7 @@ private void WriteConstantValuesIndividual()
WriteConstantValuesIndividualPolygon();
WriteConstantValuesIndividualPolyline();
WriteConstantValuesIndividualRectangle();
WriteConstantValuesIndividualTileset();
WriteConstantValuesIndividualWall();
WriteConstantValuesIndividualConicSensor();
WriteConstantValuesIndividualCustomPatternSensor();
Expand Down Expand Up @@ -4938,6 +4957,9 @@ private void WriteConstantValuesIndividualRectangle()
}
}
}
private void WriteConstantValuesIndividualTileset()
{
}
private void WriteConstantValuesIndividualWall()
{
using (var packet = m_writer.OpenPacket(m_output))
Expand Down Expand Up @@ -10207,6 +10229,24 @@ private void WriteReferenceValues()
m_assertionsWriter.WriteLine(" expect(e.rectangle.zIndex.getValue(date)).toEqual(constant.rectangle.zIndex.getValue(date));");
}
}
using (var w = packet.OpenTilesetProperty())
{
using (var w2 = w.OpenShowProperty())
{
w2.WriteReference(new Reference("Constant", CreateList("tileset", "show")));
m_assertionsWriter.WriteLine(" expect(e.tileset.show.getValue(date)).toEqual(constant.tileset.show.getValue(date));");
}
using (var w2 = w.OpenUriProperty())
{
w2.WriteReference(new Reference("Constant", CreateList("tileset", "uri")));
m_assertionsWriter.WriteLine(" expect(e.tileset.uri.getValue(date)).toEqual(constant.tileset.uri.getValue(date));");
}
using (var w2 = w.OpenMaximumScreenSpaceErrorProperty())
{
w2.WriteReference(new Reference("Constant", CreateList("tileset", "maximumScreenSpaceError")));
m_assertionsWriter.WriteLine(" expect(e.tileset.maximumScreenSpaceError.getValue(date)).toEqual(constant.tileset.maximumScreenSpaceError.getValue(date));");
}
}
using (var w = packet.OpenWallProperty())
{
using (var w2 = w.OpenShowProperty())
Expand Down Expand Up @@ -10790,6 +10830,7 @@ private void WriteReferenceValuesIndividual()
WriteReferenceValuesIndividualPolygon();
WriteReferenceValuesIndividualPolyline();
WriteReferenceValuesIndividualRectangle();
WriteReferenceValuesIndividualTileset();
WriteReferenceValuesIndividualWall();
WriteReferenceValuesIndividualConicSensor();
WriteReferenceValuesIndividualCustomPatternSensor();
Expand Down Expand Up @@ -12405,6 +12446,9 @@ private void WriteReferenceValuesIndividualRectangle()
}
}
}
private void WriteReferenceValuesIndividualTileset()
{
}
private void WriteReferenceValuesIndividualWall()
{
using (var packet = m_writer.OpenPacket(m_output))
Expand Down Expand Up @@ -15415,6 +15459,15 @@ private void WriteSampledValues()
m_assertionsWriter.WriteLine(" expect(e.rectangle.zIndex.getValue(documentStopDate)).toEqual(53581);");
}
}
using (var w = packet.OpenTilesetProperty())
{
using (var w2 = w.OpenMaximumScreenSpaceErrorProperty())
{
w2.WriteNumber(CreateList(m_documentStartDate, m_documentStopDate), CreateList(17401.0, 7930.0));
m_assertionsWriter.WriteLine(" expect(e.tileset.maximumScreenSpaceError.getValue(documentStartDate)).toEqual(17401.0);");
m_assertionsWriter.WriteLine(" expect(e.tileset.maximumScreenSpaceError.getValue(documentStopDate)).toEqual(7930.0);");
}
}
using (var w = packet.OpenWallProperty())
{
using (var w2 = w.OpenGranularityProperty())
Expand Down Expand Up @@ -15858,6 +15911,7 @@ private void WriteSampledValuesIndividual()
WriteSampledValuesIndividualPolygon();
WriteSampledValuesIndividualPolyline();
WriteSampledValuesIndividualRectangle();
WriteSampledValuesIndividualTileset();
WriteSampledValuesIndividualWall();
WriteSampledValuesIndividualConicSensor();
WriteSampledValuesIndividualCustomPatternSensor();
Expand Down Expand Up @@ -18943,6 +18997,9 @@ private void WriteSampledValuesIndividualRectangle()
}
}
}
private void WriteSampledValuesIndividualTileset()
{
}
private void WriteSampledValuesIndividualWall()
{
using (var packet = m_writer.OpenPacket(m_output))
Expand Down
69 changes: 69 additions & 0 deletions DotNet/CesiumLanguageWriterTests/TestTilesetCesiumWriter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using System.Collections.Generic;
using CesiumLanguageWriter;
using CesiumLanguageWriter.Advanced;
using NUnit.Framework;

namespace CesiumLanguageWriterTests
{
[TestFixture]
public class TestTilesetCesiumWriter : TestCesiumPropertyWriter<TilesetCesiumWriter>
{
[Test]
public void TestShowProperty()
{
const bool expectedShow = true;

using (Packet)
using (var tileset = Packet.OpenTilesetProperty())
using (var interval = tileset.OpenInterval())
{
interval.WriteShowProperty(expectedShow);
}

AssertExpectedJson(PacketCesiumWriter.TilesetPropertyName, new Dictionary<string, object>
{
{ TilesetCesiumWriter.ShowPropertyName, expectedShow },
});
}

[Test]
public void TestUriProperty()
{
const string expectedUri = "test.tileset";

using (Packet)
using (var tileset = Packet.OpenTilesetProperty())
using (var interval = tileset.OpenInterval())
{
interval.WriteUriProperty(expectedUri, CesiumResourceBehavior.LinkTo);
}
AssertExpectedJson(PacketCesiumWriter.TilesetPropertyName, new Dictionary<string, object>
{
{ TilesetCesiumWriter.UriPropertyName, expectedUri },
});
}

[Test]
public void TestMaximumScreenSpaceErrorProperty()
{
const double expectedMaximumScreenSpaceError = 0.75;

using (Packet)
using (var tileset = Packet.OpenTilesetProperty())
using (var interval = tileset.OpenInterval())
{
interval.WriteMaximumScreenSpaceErrorProperty(expectedMaximumScreenSpaceError);
}

AssertExpectedJson(PacketCesiumWriter.TilesetPropertyName, new Dictionary<string, object>
{
{ TilesetCesiumWriter.MaximumScreenSpaceErrorPropertyName, expectedMaximumScreenSpaceError },
});
}

protected override CesiumPropertyWriter<TilesetCesiumWriter> CreatePropertyWriter(string propertyName)
{
return new TilesetCesiumWriter(propertyName);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import cesiumlanguagewriter.RectangleCesiumWriter;
import cesiumlanguagewriter.RectangularSensorCesiumWriter;
import cesiumlanguagewriter.StringCesiumWriter;
import cesiumlanguagewriter.TilesetCesiumWriter;
import cesiumlanguagewriter.VectorCesiumWriter;
import cesiumlanguagewriter.ViewFromCesiumWriter;
import cesiumlanguagewriter.WallCesiumWriter;
Expand Down Expand Up @@ -144,6 +145,10 @@ public class PacketCesiumWriter extends CesiumElementWriter {
*/
public static final String RectanglePropertyName = "rectangle";
/**
* The name of the {@code tileset} property.
*/
public static final String TilesetPropertyName = "tileset";
/**
* The name of the {@code wall} property.
*/
public static final String WallPropertyName = "wall";
Expand Down Expand Up @@ -262,6 +267,11 @@ public cesiumlanguagewriter.RectangleCesiumWriter invoke() {
return new RectangleCesiumWriter(RectanglePropertyName);
}
}, false);
private Lazy<TilesetCesiumWriter> m_tileset = new Lazy<cesiumlanguagewriter.TilesetCesiumWriter>(new Func1<cesiumlanguagewriter.TilesetCesiumWriter>() {
public cesiumlanguagewriter.TilesetCesiumWriter invoke() {
return new TilesetCesiumWriter(TilesetPropertyName);
}
}, false);
private Lazy<WallCesiumWriter> m_wall = new Lazy<cesiumlanguagewriter.WallCesiumWriter>(new Func1<cesiumlanguagewriter.WallCesiumWriter>() {
public cesiumlanguagewriter.WallCesiumWriter invoke() {
return new WallCesiumWriter(WallPropertyName);
Expand Down Expand Up @@ -1312,6 +1322,22 @@ public final RectangleCesiumWriter openRectangleProperty() {
return this.<RectangleCesiumWriter> openAndReturn(getRectangleWriter());
}

/**
* Gets the writer for the {@code tileset} property. The returned instance must be opened by calling the {@link CesiumElementWriter#open} method before it can be used for writing. The {@code tileset} property defines a 3D Tiles tileset.
*/
@Nonnull
public final TilesetCesiumWriter getTilesetWriter() {
return m_tileset.getValue();
}

/**
* Opens and returns the writer for the {@code tileset} property. The {@code tileset} property defines a 3D Tiles tileset.
*/
@Nonnull
public final TilesetCesiumWriter openTilesetProperty() {
return this.<TilesetCesiumWriter> openAndReturn(getTilesetWriter());
}

/**
* Gets the writer for the {@code wall} property. The returned instance must be opened by calling the {@link CesiumElementWriter#open} method before it can be used for writing. The {@code wall} property defines a two-dimensional wall which conforms to the curvature of the globe and can be placed along the surface or at altitude.
*/
Expand Down
Loading

0 comments on commit 814e95f

Please sign in to comment.