Exemplo n.º 1
0
        /// <summary>
        /// Creates a CZML polygon from given GeoJSON polygon properties
        /// </summary>
        /// <param name="elementName">element name</param>
        /// <param name="elementDescription">element description</param>
        /// <param name="coordinatesList">coordinates list</param>
        /// <returns>CZML polygon object</returns>
        private Czml.Object GetPolygonPlacemark(
            string elementName,
            string elementDescription,
            double[][] coordinatesList)
        {
            var positionList = new Czml.PositionList();

            foreach (var coordinates in coordinatesList)
            {
                Debug.Assert(
                    coordinates.Length == 2,
                    "there always must be 2 coordinate values");

                positionList.Add(
                    latitude: coordinates[1],
                    longitude: coordinates[0],
                    height: null);
            }

            return(new Czml.Object
            {
                Name = elementName,
                Description = elementDescription,
                Polygon = new Czml.Polygon
                {
                    Positions = positionList,
                    Material = Czml.Material.FromSolidColor(this.czmlOptions.PolygonColor),
                    Outline = false,
                    OutlineColor = new Czml.Color(0, 0, 0),
                },
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a CZML polyline from given GeoJSON line string properties
        /// </summary>
        /// <param name="elementName">element name</param>
        /// <param name="elementDescription">element description</param>
        /// <param name="coordinatesList">coordinates list</param>
        /// <returns>CZML polyline object</returns>
        private Czml.Object GetLineStringPolylineObject(
            string elementName,
            string elementDescription,
            double[][] coordinatesList)
        {
            var positionList = new Czml.PositionList();

            foreach (var coordinates in coordinatesList)
            {
                Debug.Assert(
                    coordinates.Length == 2 || coordinates.Length == 3,
                    "there always must be 2 or 3 coordinate values");

                positionList.Add(
                    latitude: coordinates[1],
                    longitude: coordinates[0],
                    height: coordinates.Length == 3 ? coordinates[2] : null);
            }

            return(new Czml.Object
            {
                Name = elementName,
                Description = elementDescription,
                Polyline = new Czml.Polyline
                {
                    Width = this.czmlOptions.LineWidth,
                    Material = Czml.Material.FromSolidColor(this.czmlOptions.LineColor),
                    ClampToGround = true,
                    Positions = positionList,
                },
            });
        }