Esempio n. 1
0
 /// <summary>
 /// Given a shapefile <see cref="Shape"/> object, return a <see cref="CzmlShape"/> that can be written to CZML.
 /// </summary>
 /// <param name="shape">Te shapefile <see cref="Shape"/>.</param>
 /// <param name="document">The <see cref="CzmlDocument"/> to which the shape will be written when its Write() method is called.</param>
 /// <param name="color">A color for the shape's visualization.</param>
 /// <returns>A new <see cref="CzmlShape"/>.</returns>
 static public CzmlShape Create(Shape shape, CzmlDocument document, Color color)
 {
     switch (shape.ShapeType)
     {
         case ShapeType.Point:
         case ShapeType.PointM:
         case ShapeType.PointZ:
             return new Point((PointShape)shape, document, color);
         case ShapeType.MultiPoint:
         case ShapeType.MultiPointM:
         case ShapeType.MultiPointZ:
             return new MultiPoint((MultiPointShape)shape, document, color);
         case ShapeType.Polyline:
         case ShapeType.PolylineM:
         case ShapeType.PolylineZ:
             return new Polyline((PolylineShape)shape, document, color);
         case ShapeType.Polygon:
         case ShapeType.PolygonM:
         case ShapeType.PolygonZ:
             return new Polygon((PolygonShape)shape, document, color);
         case ShapeType.MultiPatch:
             return new MultiPatch((MultiPatchShape)shape, document, color);
     }
     throw new NotImplementedException();
 }
Esempio n. 2
0
 private static void Convert(ShapefileReader shapefile, CzmlDocument document, Color color)
 {
     foreach (Shape shape in shapefile)
     {
         ShapeFactory.Create(shape, document, color).Write();
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Given a shapefile <see cref="Shape"/> object, return a <see cref="CzmlShape"/> that can be written to CZML.
        /// </summary>
        /// <param name="shape">Te shapefile <see cref="Shape"/>.</param>
        /// <param name="document">The <see cref="CzmlDocument"/> to which the shape will be written when its Write() method is called.</param>
        /// <param name="color">A color for the shape's visualization.</param>
        /// <returns>A new <see cref="CzmlShape"/>.</returns>
        static public CzmlShape Create(Shape shape, CzmlDocument document, Color color)
        {
            switch (shape.ShapeType)
            {
            case ShapeType.Point:
            case ShapeType.PointM:
            case ShapeType.PointZ:
                return(new Point((PointShape)shape, document, color));

            case ShapeType.MultiPoint:
            case ShapeType.MultiPointM:
            case ShapeType.MultiPointZ:
                return(new MultiPoint((MultiPointShape)shape, document, color));

            case ShapeType.Polyline:
            case ShapeType.PolylineM:
            case ShapeType.PolylineZ:
                return(new Polyline((PolylineShape)shape, document, color));

            case ShapeType.Polygon:
            case ShapeType.PolygonM:
            case ShapeType.PolygonZ:
                return(new Polygon((PolygonShape)shape, document, color));

            case ShapeType.MultiPatch:
                return(new MultiPatch((MultiPatchShape)shape, document, color));
            }
            throw new NotImplementedException();
        }
Esempio n. 4
0
 /// <summary>
 /// Converts a Shapefile to CZML.
 /// </summary>
 /// <param name="shapefile">The ShapefileReader to convert.</param>
 /// <param name="document">The CzmlDocument to write to.</param>
 /// <param name="color">An optional color for the shapes in the shapefile.</param>
 public static void ShapefileToCesiumLanguage(ShapefileReader shapefile, CzmlDocument document, Color? color = null)
 {
     document.CesiumOutputStream.WriteStartSequence();
     Color c = color.HasValue ? color.Value : Color.Blue;
     Convert(shapefile, document, c);
     document.CesiumOutputStream.WriteEndSequence();
 }
Esempio n. 5
0
 private static void Convert(ShapefileReader shapefile, CzmlDocument document, Color color)
 {
     foreach (Shape shape in shapefile) 
     {
         ShapeFactory.Create(shape, document, color).Write();
     }
 }
Esempio n. 6
0
        /// <summary>
        /// Converts a Shapefile to CZML.
        /// </summary>
        /// <param name="shapefile">The ShapefileReader to convert.</param>
        /// <param name="document">The CzmlDocument to write to.</param>
        /// <param name="color">An optional color for the shapes in the shapefile.</param>
        public static void ShapefileToCesiumLanguage(ShapefileReader shapefile, CzmlDocument document, Color?color = null)
        {
            document.CesiumOutputStream.WriteStartSequence();
            Color c = color.HasValue ? color.Value : Color.Blue;

            Convert(shapefile, document, c);
            document.CesiumOutputStream.WriteEndSequence();
        }
 public void SetUp()
 {
     m_stringWriter = new StringWriter();
     m_document = new CzmlDocument(m_stringWriter);
     m_metadata = new StringDictionary();
     m_pointPattern = @"{""id"":""[0-9a-zA-Z-]+"",""position"":{""cartographicRadians"":\[-?(\d)*(\.([\de-])*)?,-?(\d)*(\.([\de-])*)?,-?(\d)*(\.([\de-])*)?\]},""point"":{""color"":{""rgba"":\[\d{1,3},\d{1,3},\d{1,3},\d{1,3}\]}}}";
     m_polygonPattern = @"{""id"":""[0-9a-zA-Z-]+"",""polygon"":{""material"":{""solidColor"":{""color"":{""rgba"":\[\d{1,3},\d{1,3},\d{1,3},\d{1,3}\]}}},""positions"":{""cartographicRadians"":\[(-?(\d)*(\.([\de-])*)?,-?(\d)*(\.([\de-])*)?,-?(\d)*(\.([\de-])*)?,?)+\]}}}";
     m_polylinePattern = @"{""id"":""[0-9a-zA-Z-]+"",""polyline"":{""material"":{""solidColor"":{""color"":{""rgba"":\[\d{1,3},\d{1,3},\d{1,3},\d{1,3}\]}}},""positions"":{""cartographicRadians"":\[(-?(\d)*(\.([\de-])*)?,-?(\d)*(\.([\de-])*)?,-?(\d)*(\.([\de-])*)?,?)+\]}}}";
     m_trianglePattern = @"{""id"":""[0-9a-zA-Z-]+"",""polygon"":{""material"":{""solidColor"":{""color"":{""rgba"":\[\d{1,3},\d{1,3},\d{1,3},\d{1,3}\]}}},""positions"":{""cartographicRadians"":\[(-?(\d)*(\.([\de-])*)?,?){9}\]}}}";
 }
Esempio n. 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Polygon"/> class.
 /// </summary>
 /// <param name="polygon">A PolygonShape object read from a shapefile.</param>
 /// <param name="document">The CzmlDocument to write to.</param>
 /// <param name="color">The polygon's color.</param>
 public Polygon(PolygonShape polygon, CzmlDocument document, Color color)
     : base(document, color)
 {
     m_shape         = polygon;
     simplifiedRings = new List <ShapePart>();
 }
Esempio n. 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Polyline"/> class.
 /// </summary>
 /// <param name="polyline">A PolylineShape object read from a shapefile.</param>
 /// <param name="document">The CzmlDocument to write to.</param>
 /// <param name="color">The polyline's color.</param>
 public Polyline(PolylineShape polyline, CzmlDocument document, Color color)
     : base(document, color)
 {
     m_shape = polyline;
 }
Esempio n. 10
0
 /// <summary>
 /// Constructs a new <see cref="CzmlShape"/>.
 /// </summary>
 /// <param name="document">The <see cref="CzmlDocument"/> to which the shape's CZML is written.</param>
 /// <param name="color">A color for the shape's visualization.</param>
 protected CzmlShape(CzmlDocument document, Color color)
 {
     m_document = document;
     m_color    = color;
 }
Esempio n. 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Point"/> class.
 /// </summary>
 /// <param name="point">A PointShape object read from a shapefile.</param>
 /// <param name="document">The CzmlDocument to write to.</param>
 /// <param name="color">The points's color.</param>
 public Point(PointShape point, CzmlDocument document, Color color)
     : base(document, color)
 {
     m_shape = point;
 }
Esempio n. 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MultiPoint"/> class.
 /// </summary>
 /// <param name="multipoint">A MultiPointShape object read from a shapefile.</param>
 /// <param name="document">The CzmlDocument to write to.</param>
 /// <param name="color">The points's color.</param>
 public MultiPoint(MultiPointShape multipoint, CzmlDocument document, Color color)
     : base(document, color)
 {
     m_shape = multipoint;
 }
Esempio n. 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Polygon"/> class.
 /// </summary>
 /// <param name="polygon">A PolygonShape object read from a shapefile.</param>
 /// <param name="document">The CzmlDocument to write to.</param>
 /// <param name="color">The polygon's color.</param>
 public Polygon(PolygonShape polygon, CzmlDocument document, Color color)
     : base(document, color)
 {
     m_shape = polygon;
     simplifiedRings = new List<ShapePart>();
 }
Esempio n. 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Point"/> class.
 /// </summary>
 /// <param name="point">A PointShape object read from a shapefile.</param>
 /// <param name="document">The CzmlDocument to write to.</param>
 /// <param name="color">The points's color.</param>
 public Point(PointShape point, CzmlDocument document, Color color)
     : base(document, color)
 {
     m_shape = point;
 }
Esempio n. 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MultiPoint"/> class.
 /// </summary>
 /// <param name="multipoint">A MultiPointShape object read from a shapefile.</param>
 /// <param name="document">The CzmlDocument to write to.</param>
 /// <param name="color">The points's color.</param>
 public MultiPoint(MultiPointShape multipoint, CzmlDocument document, Color color)
     : base(document, color)
 {
     m_shape = multipoint;
 }
Esempio n. 16
0
 /// <summary>
 /// Constructs a new multipatch <see cref="CzmlShape"/> from a <see cref="MultiPatchShape"/>.
 /// </summary>
 /// <param name="multiPatch">The shapefile multipatch shape</param>.
 /// <param name="document">The <see cref="CzmlDocument"/> to which the shape's CZML is written.</param>
 /// <param name="color">A color for the shape's visualization.</param>
 public MultiPatch(MultiPatchShape multiPatch, CzmlDocument document, Color color)
     : base(document, color)
 {
     m_shape = multiPatch;
 }
Esempio n. 17
0
 /// <summary>
 /// Constructs a new multipatch <see cref="CzmlShape"/> from a <see cref="MultiPatchShape"/>.
 /// </summary>
 /// <param name="multiPatch">The shapefile multipatch shape</param>.
 /// <param name="document">The <see cref="CzmlDocument"/> to which the shape's CZML is written.</param>
 /// <param name="color">A color for the shape's visualization.</param>
 public MultiPatch(MultiPatchShape multiPatch, CzmlDocument document, Color color)
     : base(document, color)
 {
     m_shape = multiPatch;
 }
Esempio n. 18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Polyline"/> class.
 /// </summary>
 /// <param name="polyline">A PolylineShape object read from a shapefile.</param>
 /// <param name="document">The CzmlDocument to write to.</param>
 /// <param name="color">The polyline's color.</param>
 public Polyline(PolylineShape polyline, CzmlDocument document, Color color)
     : base(document, color)
 {
     m_shape = polyline;
 }
Esempio n. 19
0
 /// <summary>
 /// Constructs a new <see cref="CzmlShape"/>.
 /// </summary>
 /// <param name="document">The <see cref="CzmlDocument"/> to which the shape's CZML is written.</param>
 /// <param name="color">A color for the shape's visualization.</param>
 protected CzmlShape(CzmlDocument document, Color color)
 {
     m_document = document;
     m_color = color;
 }