예제 #1
0
 /**
  * Writes the <code>availability</code> property. The <code>availability</code> property specifies
  * when data for an object is available. If data for an object is known to be available at the
  * current animation time, but the client does not yet have that data (presumably because it will
  * arrive in a later packet), the client will pause with a message like "Buffering..." while it
  * waits to receive the data. 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 report
  * availability for all time, but then later the propagator throws an exception and the
  * availability needs to be adjusted. 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 available at a time, the client expects the
  * object to have at least one property, and it expects all properties that it needs to be defined
  * at that time. If the object doesn't have any properties, or a needed property is defined but
  * not at the animation time, the client will pause animation and wait for more data.
  *
  * @param start The earliest date of the interval.
  * @param stop The latest date of the interval.
  */
 public final void writeAvailability(JulianDate start, JulianDate stop) {
   writeAvailability(new TimeInterval(start, stop));
 }
 @Test
 @Ignore
 public final void sandbox() {
   JulianDate date = new JulianDate(2451545.0);
   {
     StringWriter sw = new StringWriter();
     try {
       CesiumOutputStream output = new CesiumOutputStream(sw);
       output.setPrettyFormatting(true);
       CesiumStreamWriter writer = new CesiumStreamWriter();
       {
         PacketCesiumWriter packet = writer.openPacket(output);
         try {
           packet.writeId("MyID");
           packet.writeAvailability(date, date.addDays(1.0));
           {
             PositionCesiumWriter position = packet.openPositionProperty();
             try {
               {
                 CesiumIntervalListWriter<cesiumlanguagewriter.PositionCesiumWriter> intervalList =
                     position.openMultipleIntervals();
                 try {
                   {
                     PositionCesiumWriter interval = intervalList.openInterval();
                     try {
                       interval.writeInterval(new TimeInterval(date, date.addDays(1.0)));
                       interval.writeCartesian(new Cartesian(1.0, 2.0, 3.0));
                     } finally {
                       DisposeHelper.dispose(interval);
                     }
                   }
                   {
                     PositionCesiumWriter interval =
                         intervalList.openInterval(date.addDays(1.0), date.addDays(2.0));
                     try {
                       ArrayList<cesiumlanguagewriter.JulianDate> dates =
                           new ArrayList<cesiumlanguagewriter.JulianDate>();
                       ArrayList<cesiumlanguagewriter.Cartographic> positions =
                           new ArrayList<cesiumlanguagewriter.Cartographic>();
                       dates.add(date.addDays(1.0));
                       positions.add(Cartographic.getZero());
                       dates.add(date.addDays(1.5));
                       positions.add(new Cartographic(1.0, 0.0, 0.0));
                       dates.add(date.addDays(2.0));
                       positions.add(new Cartographic(0.0, 1.0, 0.0));
                       interval.writeCartographicRadians(dates, positions);
                     } finally {
                       DisposeHelper.dispose(interval);
                     }
                   }
                 } finally {
                   DisposeHelper.dispose(intervalList);
                 }
               }
             } finally {
               DisposeHelper.dispose(position);
             }
           }
           {
             OrientationCesiumWriter orientation = packet.openOrientationProperty();
             try {
               {
                 CesiumIntervalListWriter<cesiumlanguagewriter.OrientationCesiumWriter>
                     intervalList = orientation.openMultipleIntervals();
                 try {
                   {
                     OrientationCesiumWriter interval = intervalList.openInterval();
                     try {
                       interval.writeAxes("MyMadeUpAxes");
                       interval.writeInterval(new TimeInterval(date, date.addDays(1.0)));
                       interval.writeUnitQuaternion(new UnitQuaternion(1D, 0D, 0D, 0D));
                     } finally {
                       DisposeHelper.dispose(interval);
                     }
                   }
                   {
                     OrientationCesiumWriter interval = intervalList.openInterval();
                     try {
                       interval.writeInterpolationAlgorithm(CesiumInterpolationAlgorithm.LINEAR);
                       interval.writeInterpolationDegree(1);
                       ArrayList<cesiumlanguagewriter.JulianDate> dates =
                           new ArrayList<cesiumlanguagewriter.JulianDate>();
                       ArrayList<cesiumlanguagewriter.UnitQuaternion> orientations =
                           new ArrayList<cesiumlanguagewriter.UnitQuaternion>();
                       dates.add(date.addDays(1.0));
                       orientations.add(UnitQuaternion.getIdentity());
                       dates.add(date.addDays(1.5));
                       orientations.add(new UnitQuaternion(0.0, 1.0, 0.0, 0.0));
                       dates.add(date.addDays(2.0));
                       orientations.add(new UnitQuaternion(0.0, 0.0, 1.0, 0.0));
                       interval.writeUnitQuaternion(dates, orientations);
                     } finally {
                       DisposeHelper.dispose(interval);
                     }
                   }
                 } finally {
                   DisposeHelper.dispose(intervalList);
                 }
               }
             } finally {
               DisposeHelper.dispose(orientation);
             }
           }
         } finally {
           DisposeHelper.dispose(packet);
         }
       }
       ConsoleHelper.writeLine(sw.toString());
     } finally {
       DisposeHelper.dispose(sw);
     }
   }
 }