Is there any example of using czmlwriter C# version?

Hi

I just started to learning the czml writer. If there is any example code or tutorial, that will help a lot.

thank you.

Chris

Here’s a little code that should give you an idea how it works.

Scott

        StringWriter sw = new StringWriter();

        CesiumOutputStream czOutputStream = new CesiumOutputStream(sw);

        czOutputStream.PrettyFormatting = true;

        CesiumStreamWriter czStreamWriter = new CesiumStreamWriter();

        // A CZML file contains an array of objects which the following opens.

        czOutputStream.WriteStartSequence();

        // Create the document czPacket

        PacketCesiumWriter czPacket = czStreamWriter.OpenPacket(czOutputStream);

        czPacket.WriteId("document");

        czPacket.WriteVersion("1.0");

        czPacket.Close();

        // Create packet for an object

        czPacket = czStreamWriter.OpenPacket(czOutputStream);

        czPacket.WriteId("ID_0001");

        czPacket.WriteName("Name_0001");

        // Add position to object's packet

        PositionCesiumWriter czPosition = czPacket.OpenPositionProperty();

        czPosition.WriteCartographicDegrees(

            new Cartographic(-75.5966, 40.0386, 0.0));

        czPosition.Close();

        // Add label to object's packet

        LabelCesiumWriter czLabel = czPacket.OpenLabelProperty();

        czLabel.WriteTextProperty("Exton");

        czLabel.Close();

        // Add point to object's packet

        PointCesiumWriter czPoint = czPacket.OpenPointProperty();

        czPoint.WritePixelSizeProperty(5.0);

        czPoint.WriteOutlineWidthProperty(2.0);

        czPoint.WriteColorProperty(Color.DodgerBlue);

        czPoint.WriteOutlineColorProperty(Color.White);

        czPoint.Close();

        // Close the object's packet

        czPacket.Close();

        // Closes the array

        czOutputStream.WriteEndSequence();

        sw.Close();

``

Thanks Scott. That helps a lot.

在 2015年10月26日星期一 UTC+8上午9:37:03,Scott Reynolds写道: