public PacketCesiumWriter invoke() { return new PacketCesiumWriter(); } }, false);
/** * Starts a new CZML packet on the given stream. * @param output The stream to which to write the packet. * @return The packet writer. */ @Nonnull public final PacketCesiumWriter openPacket(@Nonnull CesiumOutputStream output) { PacketCesiumWriter packetWriter = m_packetWriter.getValue(); packetWriter.open(output); return packetWriter; }
/** * Writes a value for the {@code orientation} property as a {@code unitQuaternion} value. The {@code orientation} 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. * @param value The value. */ public final void writeOrientationProperty(@Nonnull UnitQuaternion value) { { cesiumlanguagewriter.OrientationCesiumWriter writer = openOrientationProperty(); try { writer.writeUnitQuaternion(value); } finally { DisposeHelper.dispose(writer); } } }
/** * Opens and returns the writer for the {@code billboard} property. The {@code billboard} property defines a billboard, or viewport-aligned image, sometimes called a marker. The billboard is positioned in the scene by the {@code position} property. */ @Nonnull public final BillboardCesiumWriter openBillboardProperty() { return this.<BillboardCesiumWriter> openAndReturn(getBillboardWriter()); }
/** * Opens and returns the writer for the {@code box} property. The {@code box} property defines a box, which is a closed rectangular cuboid. The box is positioned and oriented using the {@code position} and {@code orientation} properties. */ @Nonnull public final BoxCesiumWriter openBoxProperty() { return this.<BoxCesiumWriter> openAndReturn(getBoxWriter()); }
/** * Opens and returns the writer for the {@code clock} property. The {@code clock} property defines the clock settings for the entire data set. Only valid on the document object. */ @Nonnull public final ClockCesiumWriter openClockProperty() { return this.<ClockCesiumWriter> openAndReturn(getClockWriter()); }
/** * Writes a value for the {@code position} property as a {@code cartographicDegrees} value. The {@code position} property specifies the position of the object in the world. The position has no direct visual representation, but it is used to locate billboards, labels, and other graphical items attached to the object. * @param value The interval. */ public final void writePositionPropertyCartographicDegrees(@Nonnull Cartographic value) { { cesiumlanguagewriter.PositionCesiumWriter writer = openPositionProperty(); try { writer.writeCartographicDegrees(value); } finally { DisposeHelper.dispose(writer); } } }
packet.writeId(id); packet.writeAvailability(availability); cesiumlanguagewriter.PositionCesiumWriter positionWriter = packet.openPositionProperty(); try { cesiumlanguagewriter.OrientationCesiumWriter orientationWriter = packet.openOrientationProperty(); try {
@Test public final void opensObjectLiteralOnOpenAndClosesItOnClose() { PacketCesiumWriter packet = new PacketCesiumWriter(); packet.open(m_outputStream); Assert.assertEquals("{", m_stringWriter.toString()); packet.close(); Assert.assertEquals("{}", m_stringWriter.toString()); }
@Test public void runExample() throws IOException { StringWriter stringWriter = new StringWriter(); CesiumOutputStream output = new CesiumOutputStream(stringWriter); output.setPrettyFormatting(true); CesiumStreamWriter stream = new CesiumStreamWriter(); try (PacketCesiumWriter packet = stream.openPacket(output)) { packet.writeId("Test"); try (BillboardCesiumWriter billboard = packet.openBillboardProperty()) { billboard.writeColorProperty(123, 67, 0, 255); billboard.writeImageProperty(URI.create("http://cesiumjs.org/images/CesiumHeaderLogo.png"), CesiumResourceBehavior.EMBED); } try (PositionCesiumWriter position = packet.openPositionProperty()) { position.writeCartographicDegrees(new Cartographic(-75.0, 45.0, 100.0)); } } stringWriter.close(); System.out.println(stringWriter.toString()); } }
@Test public final void testDeleteProperty() { PacketCesiumWriter packet = m_writer.openPacket(m_outputStream); packet.writeId("foo"); packet.writeDelete(true); packet.close(); Assert.assertEquals("{\"id\":\"foo\",\"delete\":true}", m_stringWriter.toString()); }
/** * Writes the value expressed as a {@code availability}, which is the set of time intervals over which data for an object is available. The property can be a single string specifying a single interval, or an array of strings representing intervals. A later Cesium packet can update this availability if it changes or is found to be incorrect. For example, an SGP4 propagator may initially report availability for all time, but then later the propagator throws an exception and the availability can be adjusted to end at that time. If this optional property is not present, the object is assumed to be available for all time. Availability is scoped to a particular CZML stream, so two different streams can list different availability for a single object. Within a single stream, the last availability stated for an object is the one in effect and any availabilities in previous packets are ignored. If an object is not available at a time, the client will not draw that object. If not specified, the default value is 0000-00-00T00:00:00Z/9999-12-31T24:00:00Z. * @param start The earliest date of the interval. * @param stop The latest date of the interval. */ public final void writeAvailability(@Nonnull JulianDate start, @Nonnull JulianDate stop) { writeAvailability(new TimeInterval(start, stop)); }
/** * Opens and returns the writer for the {@code agi_conicSensor} property. The {@code agi_conicSensor} property defines a conical sensor volume taking into account occlusion of an ellipsoid, i.e., the globe. The sensor is positioned and oriented using the {@code position} and {@code orientation} properties. */ @Nonnull public final ConicSensorCesiumWriter openConicSensorProperty() { return this.<ConicSensorCesiumWriter> openAndReturn(getConicSensorWriter()); }
@Test public final void testDescriptionProperty() { PacketCesiumWriter packet = m_writer.openPacket(m_outputStream); packet.writeDescriptionProperty("blah"); packet.close(); Assert.assertEquals("{\"description\":\"blah\"}", m_stringWriter.toString()); }
@Test public final void newPacketWritesObjectLiteral() { PacketCesiumWriter packet = m_writer.openPacket(m_outputStream); packet.close(); Assert.assertEquals("{}", m_stringWriter.toString()); }
/** * Writes a value for the {@code position} property as a {@code cartesian} value. The {@code position} property specifies the position of the object in the world. The position has no direct visual representation, but it is used to locate billboards, labels, and other graphical items attached to the object. * @param value The value. */ public final void writePositionProperty(@Nonnull Cartesian value) { { cesiumlanguagewriter.PositionCesiumWriter writer = openPositionProperty(); try { writer.writeCartesian(value); } finally { DisposeHelper.dispose(writer); } } }
packet.writeAvailability(start, stop); } finally { DisposeHelper.dispose(packet); packet.writeAvailability(new TimeInterval(start, stop)); } finally { DisposeHelper.dispose(packet); tempCollection$0.add(new TimeInterval(start.addDays(2.0), stop.addDays(2.0))); ArrayList<cesiumlanguagewriter.TimeInterval> intervals = tempCollection$0; packet.writeAvailability(intervals); } finally { DisposeHelper.dispose(packet);
@Test public final void successiveCallsToNewPacketReturnSameInstance() { m_outputStream.writeStartSequence(); PacketCesiumWriter packet1 = m_writer.openPacket(m_outputStream); packet1.close(); PacketCesiumWriter packet2 = m_writer.openPacket(m_outputStream); packet2.close(); m_outputStream.writeEndSequence(); Assert.assertSame(packet1, packet2); }
/** * Writes a value for the {@code position} property as a {@code cartographicRadians} value. The {@code position} property specifies the position of the object in the world. The position has no direct visual representation, but it is used to locate billboards, labels, and other graphical items attached to the object. * @param value The interval. */ public final void writePositionPropertyCartographicRadians(@Nonnull Cartographic value) { { cesiumlanguagewriter.PositionCesiumWriter writer = openPositionProperty(); try { writer.writeCartographicRadians(value); } finally { DisposeHelper.dispose(writer); } } }