提交 9e003dc8 编写于 作者: S Scott Hunter

Add `tileset`.

上级 e7333bcd
......@@ -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
......
......@@ -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>
......
......@@ -141,6 +141,11 @@ namespace CesiumLanguageWriter
/// </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>
......@@ -190,6 +195,7 @@ namespace CesiumLanguageWriter
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);
......@@ -1144,6 +1150,24 @@ namespace CesiumLanguageWriter
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>
......
......@@ -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" />
......
......@@ -1268,6 +1268,24 @@ namespace CesiumLanguageWriterTests
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())
......@@ -1896,6 +1914,7 @@ namespace CesiumLanguageWriterTests
WriteConstantValuesIndividualPolygon();
WriteConstantValuesIndividualPolyline();
WriteConstantValuesIndividualRectangle();
WriteConstantValuesIndividualTileset();
WriteConstantValuesIndividualWall();
WriteConstantValuesIndividualConicSensor();
WriteConstantValuesIndividualCustomPatternSensor();
......@@ -4938,6 +4957,9 @@ namespace CesiumLanguageWriterTests
}
}
}
private void WriteConstantValuesIndividualTileset()
{
}
private void WriteConstantValuesIndividualWall()
{
using (var packet = m_writer.OpenPacket(m_output))
......@@ -10207,6 +10229,24 @@ namespace CesiumLanguageWriterTests
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())
......@@ -10790,6 +10830,7 @@ namespace CesiumLanguageWriterTests
WriteReferenceValuesIndividualPolygon();
WriteReferenceValuesIndividualPolyline();
WriteReferenceValuesIndividualRectangle();
WriteReferenceValuesIndividualTileset();
WriteReferenceValuesIndividualWall();
WriteReferenceValuesIndividualConicSensor();
WriteReferenceValuesIndividualCustomPatternSensor();
......@@ -12405,6 +12446,9 @@ namespace CesiumLanguageWriterTests
}
}
}
private void WriteReferenceValuesIndividualTileset()
{
}
private void WriteReferenceValuesIndividualWall()
{
using (var packet = m_writer.OpenPacket(m_output))
......@@ -15415,6 +15459,15 @@ namespace CesiumLanguageWriterTests
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())
......@@ -15858,6 +15911,7 @@ namespace CesiumLanguageWriterTests
WriteSampledValuesIndividualPolygon();
WriteSampledValuesIndividualPolyline();
WriteSampledValuesIndividualRectangle();
WriteSampledValuesIndividualTileset();
WriteSampledValuesIndividualWall();
WriteSampledValuesIndividualConicSensor();
WriteSampledValuesIndividualCustomPatternSensor();
......@@ -18943,6 +18997,9 @@ namespace CesiumLanguageWriterTests
}
}
}
private void WriteSampledValuesIndividualTileset()
{
}
private void WriteSampledValuesIndividualWall()
{
using (var packet = m_writer.OpenPacket(m_output))
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);
}
}
}
\ No newline at end of file
......@@ -28,6 +28,7 @@ import cesiumlanguagewriter.PositionCesiumWriter;
import cesiumlanguagewriter.RectangleCesiumWriter;
import cesiumlanguagewriter.RectangularSensorCesiumWriter;
import cesiumlanguagewriter.StringCesiumWriter;
import cesiumlanguagewriter.TilesetCesiumWriter;
import cesiumlanguagewriter.VectorCesiumWriter;
import cesiumlanguagewriter.ViewFromCesiumWriter;
import cesiumlanguagewriter.WallCesiumWriter;
......@@ -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";
......@@ -262,6 +267,11 @@ public class PacketCesiumWriter extends CesiumElementWriter {
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);
......@@ -1312,6 +1322,22 @@ public class PacketCesiumWriter extends CesiumElementWriter {
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.
*/
......
......@@ -2324,6 +2324,40 @@ public class TestGenerateValidationDocument {
DisposeHelper.dispose(w);
}
}
{
TilesetCesiumWriter w = packet.openTilesetProperty();
try {
{
BooleanCesiumWriter w2 = w.openShowProperty();
try {
w2.writeBoolean(true);
TextWriterHelper.writeLine(m_assertionsWriter, " expect(e.tileset.show.getValue(date)).toEqual(true);");
} finally {
DisposeHelper.dispose(w2);
}
}
{
UriCesiumWriter w2 = w.openUriProperty();
try {
w2.writeUri("http://example.com/6864", CesiumResourceBehavior.LINK_TO);
TextWriterHelper.writeLine(m_assertionsWriter, " expect(e.tileset.uri.getValue(date).url).toEqual('http://example.com/6864');");
} finally {
DisposeHelper.dispose(w2);
}
}
{
DoubleCesiumWriter w2 = w.openMaximumScreenSpaceErrorProperty();
try {
w2.writeNumber(51767.0);
TextWriterHelper.writeLine(m_assertionsWriter, " expect(e.tileset.maximumScreenSpaceError.getValue(date)).toEqual(51767.0);");
} finally {
DisposeHelper.dispose(w2);
}
}
} finally {
DisposeHelper.dispose(w);
}
}
{
WallCesiumWriter w = packet.openWallProperty();
try {
......@@ -3531,6 +3565,7 @@ public class TestGenerateValidationDocument {
writeConstantValuesIndividualPolygon();
writeConstantValuesIndividualPolyline();
writeConstantValuesIndividualRectangle();
writeConstantValuesIndividualTileset();
writeConstantValuesIndividualWall();
writeConstantValuesIndividualConicSensor();
writeConstantValuesIndividualCustomPatternSensor();
......@@ -11327,6 +11362,8 @@ public class TestGenerateValidationDocument {
}
}
private final void writeConstantValuesIndividualTileset() {}
private final void writeConstantValuesIndividualWall() {
{
PacketCesiumWriter packet = m_writer.openPacket(m_output);
......@@ -24285,6 +24322,41 @@ public class TestGenerateValidationDocument {
DisposeHelper.dispose(w);
}
}
{
TilesetCesiumWriter w = packet.openTilesetProperty();
try {
{
BooleanCesiumWriter w2 = w.openShowProperty();
try {
w2.writeReference(new Reference("Constant", TestGenerateValidationDocument.<String> createList("tileset", "show")));
TextWriterHelper.writeLine(m_assertionsWriter, " expect(e.tileset.show.getValue(date)).toEqual(constant.tileset.show.getValue(date));");
} finally {
DisposeHelper.dispose(w2);
}
}
{
UriCesiumWriter w2 = w.openUriProperty();
try {
w2.writeReference(new Reference("Constant", TestGenerateValidationDocument.<String> createList("tileset", "uri")));
TextWriterHelper.writeLine(m_assertionsWriter, " expect(e.tileset.uri.getValue(date)).toEqual(constant.tileset.uri.getValue(date));");
} finally {
DisposeHelper.dispose(w2);
}
}
{
DoubleCesiumWriter w2 = w.openMaximumScreenSpaceErrorProperty();
try {
w2.writeReference(new Reference("Constant", TestGenerateValidationDocument.<String> createList("tileset", "maximumScreenSpaceError")));
TextWriterHelper.writeLine(m_assertionsWriter,
" expect(e.tileset.maximumScreenSpaceError.getValue(date)).toEqual(constant.tileset.maximumScreenSpaceError.getValue(date));");
} finally {
DisposeHelper.dispose(w2);
}
}
} finally {
DisposeHelper.dispose(w);
}
}
{
WallCesiumWriter w = packet.openWallProperty();
try {
......@@ -25547,6 +25619,7 @@ public class TestGenerateValidationDocument {
writeReferenceValuesIndividualPolygon();
writeReferenceValuesIndividualPolyline();
writeReferenceValuesIndividualRectangle();
writeReferenceValuesIndividualTileset();
writeReferenceValuesIndividualWall();
writeReferenceValuesIndividualConicSensor();
writeReferenceValuesIndividualCustomPatternSensor();
......@@ -29462,6 +29535,8 @@ public class TestGenerateValidationDocument {
}
}
private final void writeReferenceValuesIndividualTileset() {}
private final void writeReferenceValuesIndividualWall() {
{
PacketCesiumWriter packet = m_writer.openPacket(m_output);
......@@ -36902,6 +36977,24 @@ public class TestGenerateValidationDocument {
DisposeHelper.dispose(w);
}
}
{
TilesetCesiumWriter w = packet.openTilesetProperty();
try {
{
DoubleCesiumWriter w2 = w.openMaximumScreenSpaceErrorProperty();
try {
w2.writeNumber(TestGenerateValidationDocument.<JulianDate> createList(m_documentStartDate, m_documentStopDate), TestGenerateValidationDocument.<Double> createList(
17401.0, 7930.0));
TextWriterHelper.writeLine(m_assertionsWriter, " expect(e.tileset.maximumScreenSpaceError.getValue(documentStartDate)).toEqual(17401.0);");
TextWriterHelper.writeLine(m_assertionsWriter, " expect(e.tileset.maximumScreenSpaceError.getValue(documentStopDate)).toEqual(7930.0);");
} finally {
DisposeHelper.dispose(w2);
}
}
} finally {
DisposeHelper.dispose(w);
}
}
{
WallCesiumWriter w = packet.openWallProperty();
try {
......@@ -37812,6 +37905,7 @@ public class TestGenerateValidationDocument {
writeSampledValuesIndividualPolygon();
writeSampledValuesIndividualPolyline();
writeSampledValuesIndividualRectangle();
writeSampledValuesIndividualTileset();
writeSampledValuesIndividualWall();
writeSampledValuesIndividualConicSensor();
writeSampledValuesIndividualCustomPatternSensor();
......@@ -46122,6 +46216,8 @@ public class TestGenerateValidationDocument {
}
}
private final void writeSampledValuesIndividualTileset() {}
private final void writeSampledValuesIndividualWall() {
{
PacketCesiumWriter packet = m_writer.openPacket(m_output);
package cesiumlanguagewritertests;
import agi.foundation.compatibility.*;
import agi.foundation.compatibility.DisposeHelper;
import agi.foundation.compatibility.MapHelper;
import agi.foundation.compatibility.TestContextRule;
import cesiumlanguagewriter.*;
import cesiumlanguagewriter.advanced.*;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.annotation.Nonnull;
import org.junit.FixMethodOrder;
import org.junit.Rule;
import org.junit.runners.MethodSorters;
import org.junit.Test;
@SuppressWarnings( {
"unused",
"deprecation",
"serial"
})
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestTilesetCesiumWriter extends TestCesiumPropertyWriter<TilesetCesiumWriter> {
@Test
public final void testShowProperty() {
final boolean expectedShow = true;
{
final PacketCesiumWriter usingExpression_0 = (getPacket());
try {
{
TilesetCesiumWriter tileset = getPacket().openTilesetProperty();
try {
{
TilesetCesiumWriter interval = tileset.openInterval();
try {
interval.writeShowProperty(expectedShow);
} finally {
DisposeHelper.dispose(interval);
}
}
} finally {
DisposeHelper.dispose(tileset);
}
}
} finally {
DisposeHelper.dispose(usingExpression_0);
}
}
final Map<String, Object> tempCollection$0 = new LinkedHashMap<String, Object>();
MapHelper.add(tempCollection$0, TilesetCesiumWriter.ShowPropertyName, expectedShow);
assertExpectedJson(PacketCesiumWriter.TilesetPropertyName, tempCollection$0);
}
@Test
public final void testUriProperty() {
final String expectedUri = "test.tileset";
{
final PacketCesiumWriter usingExpression_1 = (getPacket());
try {
{
TilesetCesiumWriter tileset = getPacket().openTilesetProperty();
try {
{
TilesetCesiumWriter interval = tileset.openInterval();
try {
interval.writeUriProperty(expectedUri, CesiumResourceBehavior.LINK_TO);
} finally {
DisposeHelper.dispose(interval);
}
}
} finally {
DisposeHelper.dispose(tileset);
}
}
} finally {
DisposeHelper.dispose(usingExpression_1);
}
}
final Map<String, Object> tempCollection$1 = new LinkedHashMap<String, Object>();
MapHelper.add(tempCollection$1, TilesetCesiumWriter.UriPropertyName, expectedUri);
assertExpectedJson(PacketCesiumWriter.TilesetPropertyName, tempCollection$1);
}
@Test
public final void testMaximumScreenSpaceErrorProperty() {
final double expectedMaximumScreenSpaceError = 0.75;
{
final PacketCesiumWriter usingExpression_2 = (getPacket());
try {
{
TilesetCesiumWriter tileset = getPacket().openTilesetProperty();
try {
{
TilesetCesiumWriter interval = tileset.openInterval();
try {
interval.writeMaximumScreenSpaceErrorProperty(expectedMaximumScreenSpaceError);
} finally {
DisposeHelper.dispose(interval);
}
}
} finally {
DisposeHelper.dispose(tileset);
}
}
} finally {
DisposeHelper.dispose(usingExpression_2);
}
}
final Map<String, Object> tempCollection$2 = new LinkedHashMap<String, Object>();
MapHelper.add(tempCollection$2, TilesetCesiumWriter.MaximumScreenSpaceErrorPropertyName, expectedMaximumScreenSpaceError);
assertExpectedJson(PacketCesiumWriter.TilesetPropertyName, tempCollection$2);
}
@Override
protected CesiumPropertyWriter<TilesetCesiumWriter> createPropertyWriter(String propertyName) {
return new TilesetCesiumWriter(propertyName);
}
@Nonnull
private final TestContextRule rule$testContext = new TestContextRule();
@Nonnull
@Rule
public TestContextRule getRule$testContext() {
return rule$testContext;
}
}
\ No newline at end of file
......@@ -115,6 +115,10 @@
"$ref": "Rectangle.json",
"description": "A cartographic rectangle, which conforms to the curvature of the globe and can be placed along the surface or at altitude."
},
"tileset": {