示例#1
0
        private sd.ExtendedData ExtendedData(Dictionary <string, string> dicData)
        {
            if (dicData is null)
            {
                return(new sd.ExtendedData());
            }
            var exdata = new sd.ExtendedData();

            foreach (var data in dicData)
            {
                string value = data.Value;
                if (data.Value.Length == 0)
                {
                    value = "Нет данных";
                }
                var dataDoc = new sd.Data
                {
                    Name  = data.Key,
                    Value = value
                };
                exdata.AddData(dataDoc);
            }

            return(exdata);
        }
示例#2
0
        public void AddPoint(Point point, string idStyle, Dictionary <string, string> dicData, sd.Folder folder = null)
        {
            var pointDoc = new sd.Point
            {
                Coordinate = new sb.Vector(point.Lon, point.Lat)
            };

            var exdata = new sd.ExtendedData();

            foreach (var data in dicData)
            {
                var dataDoc = new sd.Data
                {
                    Name  = data.Key,
                    Value = data.Value
                };
                exdata.AddData(dataDoc);
            }

            var placemark = new sd.Placemark
            {
                Name         = point.Name,
                Geometry     = pointDoc,
                StyleUrl     = new Uri($"#{idStyle}"),
                ExtendedData = exdata
            };

            if (folder == null)
            {
                Document.AddFeature(placemark);
            }
            else
            {
                folder.AddFeature(placemark);
            }
        }
 private void GatherDataFields(Data data)
 {
     if (data.Name != null)
     {
         _map[data.Name] = data.Value;
         if (data.DisplayName != null)
         {
             _map[data.Name + DisplayNamePostfix] = data.DisplayName;
             _markup.Add(Tuple.Create(data.DisplayName, data.Value));
         }
         else
         {
             _markup.Add(Tuple.Create(data.Name, data.Value));
         }
     }
 }
 /// <summary>
 /// Adds the specified <see cref="Data"/> to this instance.
 /// </summary>
 /// <param name="data">The <c>Data</c> to add to this instance.</param>
 /// <exception cref="System.ArgumentNullException">data is null.</exception>
 /// <exception cref="System.InvalidOperationException">
 /// data belongs to another <see cref="Element"/>.
 /// </exception>
 public void AddData(Data data)
 {
     this.AddChild(data);
 }