Example #1
0
        private void WritePacket(int index)
        {
            ShapePart part = simplifiedRings[index];

            using (PacketCesiumWriter packetWriter = m_document.CesiumStreamWriter.OpenPacket(m_document.CesiumOutputStream))
            {
                packetWriter.WriteId(Guid.NewGuid().ToString());

                using (PolygonCesiumWriter polygonWriter = packetWriter.OpenPolygonProperty())
                {
                    using (MaterialCesiumWriter materialWriter = polygonWriter.OpenMaterialProperty())
                    {
                        using (SolidColorMaterialCesiumWriter colorWriter = materialWriter.OpenSolidColorProperty())
                        {
                            colorWriter.WriteColorProperty(m_color);
                        }
                    }
                }

                using (PositionListCesiumWriter positionWriter = packetWriter.OpenVertexPositionsProperty())
                {
                    PolygonShape        polygon   = (PolygonShape)m_shape;
                    List <Cartographic> positions = new List <Cartographic>();
                    for (int i = 0; i < part.Count; i++)
                    {
                        positions.Add(part[i]);
                    }
                    positionWriter.WriteCartographicRadians(positions);
                }
            }
        }
Example #2
0
 /// <inheritdoc />
 protected override void Write()
 {
     using (PositionCesiumWriter position = PacketWriter.OpenPositionProperty())
     {
         position.WriteCartographicRadians(m_position);
     }
     if (m_extrude)
     {
         List <Cartographic> positions = new List <Cartographic>();
         positions.Add(m_position);
         positions.Add(new Cartographic(m_position.Longitude, m_position.Latitude, 0.0));
         using (PositionListCesiumWriter polyline = PacketWriter.OpenVertexPositionsProperty())
         {
             polyline.WriteCartographicRadians(positions);
         }
     }
 }
Example #3
0
 /// <summary>
 /// Writes a new polyline packet for each part of the shape.
 /// </summary>
 /// <param name="part">The <see cref="ShapePart"/> of the <see cref="PolylineShape"/> to write</param>
 private void WritePacket(ShapePart part)
 {
     using (PacketCesiumWriter packetWriter = m_document.CesiumStreamWriter.OpenPacket(m_document.CesiumOutputStream))
     {
         packetWriter.WriteId(Guid.NewGuid().ToString());
         using (PositionListCesiumWriter position = packetWriter.OpenVertexPositionsProperty())
         {
             PolylineShape       polyline  = (PolylineShape)m_shape;
             List <Cartographic> positions = new List <Cartographic>();
             for (int i = 0; i < part.Count; i++)
             {
                 positions.Add(part[i]);
             }
             position.WriteCartographicRadians(positions);
         }
         using (PolylineCesiumWriter polylineWriter = packetWriter.OpenPolylineProperty())
         {
             polylineWriter.WriteColorProperty(m_color);
         }
     }
 }
Example #4
0
 /// <summary>
 /// Writes the czml packet of the given coordinate in the series.
 /// </summary>
 /// <param name="index">The index of the coordinate to write as a packet.</param>
 public void WritePacket(int index)
 {
     if (index < m_coordinates.Length)
     {
         using (PacketCesiumWriter packetWriter = m_document.CesiumStreamWriter.OpenPacket(m_document.CesiumOutputStream))
         {
             packetWriter.WriteId(m_id + index);
             using (PolylineCesiumWriter polyline = packetWriter.OpenPolylineProperty())
             {
                 polyline.WriteColorProperty(ColorFromHSV(0.6 - (m_coordinates[index].Height * 0.5), 1.0, 1.0));
             }
             using (PositionListCesiumWriter vertexPositions = packetWriter.OpenVertexPositionsProperty())
             {
                 Cartographic[] positions = new Cartographic[] {
                     new Cartographic(m_coordinates[index].Longitude, m_coordinates[index].Latitude, 0.0),
                     new Cartographic(m_coordinates[index].Longitude, m_coordinates[index].Latitude, m_coordinates[index].Height * m_scalar)
                 };
                 vertexPositions.WriteCartographicDegrees(positions);
             }
         }
     }
 }