public virtual XElement ToXml(ServiceSettings settings) { return null; }
public override XElement ToXml(ServiceSettings settings) { var el = new XElement(XmlNodeId); el.SetAttributeValue("Description", Description); el.SetAttributeValue("CanEdit", CanEdit); el.SetAttributeValue("CanCreate", CanCreate); el.SetAttributeValue("SyncDelay", SyncDelay); el.SetAttributeValue("ShareOnline", ShareOnline); el.SetAttributeValue("TabBarVisible", TabBarVisible); el.SetAttributeValue("MinResolution", MinResolution); el.SetAttributeValue("MaxResolution", MaxResolution); el.SetAttributeValue("FilterLocation", FilterLocation); el.SetAttributeValue("SelectionMode", SelectionMode); el.SetAttributeValue("AutoStart", AutoStart); el.SetAttributeValue("BackupInterval", BackupInterval); if (!string.IsNullOrEmpty(LayerOrder)) el.SetAttributeValue("LayerOrder", LayerOrder); if (ShowAnalysis) el.SetAttributeValue("ShowAnalysis", ShowAnalysis); if (ShowTimeline) el.SetAttributeValue("ShowTimeline", ShowTimeline); if (!SublayersVisible) el.SetAttributeValue("SublayersVisible", SublayersVisible); if (OpenTab) el.SetAttributeValue("OpenTab", OpenTab); if (!string.IsNullOrEmpty(Icon)) el.SetAttributeValue("Icon", Icon); var myLabels = new XElement("Labels"); foreach (var l in Labels) { myLabels.Add(new XElement(l.Key) { Value = l.Value }); } el.Add(myLabels); return el; }
public XElement ToXmlBase(ServiceSettings settings) { var res = new XElement(XmlNodeId); res.SetAttributeValue("Id", Id); if (Style != null) res.Add(Style.ToXml(settings)); // TODO REVIEW PoiStyle ignores these settings. if (!String.IsNullOrEmpty(ContentId)) res.SetAttributeValue("PoiId", ContentId); if (!String.IsNullOrEmpty(PoiTypeId)) res.SetAttributeValue("PoiTypeId", PoiTypeId); if (!String.IsNullOrEmpty(UserId)) res.SetAttributeValue("UserId", UserId); if (Priority != 2) res.SetAttributeValue("Priority", Priority); res.SetAttributeValue("Date", DateLong); if (UpdatedLong != 0) res.SetAttributeValue("Updated", UpdatedLong); if (!String.IsNullOrEmpty(Layer)) res.SetAttributeValue("Layer", Layer); if (MaxItems.HasValue) res.SetAttributeValue("MaxItems", MaxItems.Value); if (!IsVisibleInMenu) res.SetAttributeValue("IsVisibleInMenu", IsVisibleInMenu); if (!String.IsNullOrEmpty(WktText)) res.Add(new XElement("WKT") { Value = WktText }); if (!Orientation.IsZero()) res.SetAttributeValue("Orientation", Orientation); if (HasKeywords) { res.Add(Keywords.ToXml()); } if (Labels != null && Labels.Any()) { var lab = new XElement("Labels"); foreach (var l in Labels) { var k = l.Key.Replace(':', '-').Replace(' ', '_').Replace('/', '-').Trim(); if (String.IsNullOrEmpty(k)) continue; // Make sure keys do not start with numbers or have % signs or quotes. k = k.Replace("%", LabelPercentSubst); k = k.Replace("'", LabelQuoteSubst); if (Regex.IsMatch(k, @"^\d+") || k.StartsWith("%")) { k = LabelNumPrefix + k; } var lc = new XElement(k) { Value = l.Value?.RemoveInvalidCharacters() ?? ""}; lab.Add(lc); } res.Add(lab); } if (AllMedia.Any()) { var media = new XElement("AllMedia"); foreach (var m in AllMedia) media.Add(m.ToXml()); res.Add(media); } if (MetaInfo != null) { if (PoiType == null || PoiType.MetaInfo != MetaInfo) { var mid = new XElement("MetaInfoData"); foreach (var mi in MetaInfo) mid.Add(mi.ToXml()); res.Add(mid); } } if (Position != null) { var pos = new XElement("Position"); // TODO Remember other Position attributes. pos.SetAttributeValue(Position.LONG_LABEL, Position.Longitude); pos.SetAttributeValue(Position.LAT_LABEL, Position.Latitude); pos.SetAttributeValue(Position.ALT_LABEL, Position.Altitude); res.Add(pos); } if (Models != null) { var xm = new XElement("Models"); foreach (var m in Models) { xm.Add(m.ToXml()); } res.Add(xm); } if (Points == null || !Points.Any()) return res; var sb = new StringBuilder(); foreach (var point in Points) { sb.Append(String.Format(CultureInfo.InvariantCulture, "{0:0.0000000},{1:0.0000000} ", point.X, point.Y)); } var pe = new XElement("Points") { Value = sb.ToString().Trim() }; res.Add(pe); return res; }
public override XElement ToXml(ServiceSettings settings) { var res = ToXmlBase(settings); if (!string.IsNullOrEmpty(ContentId)) res.SetAttributeValue("EventId", ContentId); if (!string.IsNullOrEmpty(PoiTypeId)) res.SetAttributeValue("EventTypeId", PoiTypeId); if (!string.IsNullOrEmpty(Icon)) res.SetAttributeValue("Icon",Icon); if (PoiId!=Guid.Empty) res.SetAttributeValue("PoiId", PoiId); return res; }
public override XElement ToXml(ServiceSettings settings) { var res = ToXmlBase(settings); if (!Enabled) res.SetAttributeValue("Enabled", false); return res; }
public XElement ToXml(ServiceSettings service) { return ToXml(); }
public override XElement ToXml(ServiceSettings settings) { var res = ToXmlBase(settings); res.SetAttributeValue("Title",Title); res.SetAttributeValue("TaskId",TaskId ?? string.Empty); res.SetAttributeValue("State",State); res.SetElementValue("Description",Description); //var res = new XElement(XmlNode, // new XAttribute("Id", Id), // new XAttribute("Title", Title), // new XAttribute("TaskId", TaskId ?? string.Empty), // new XAttribute("State", State), // new XElement("Description", Description), // new XElement("Labels", // from label in Labels select new XElement(label.Key, label.Value)), // new XElement("AllMedia", // from media in AllMedia select new XElement("Media", // new XAttribute("Title", media.Title), // new XAttribute("Id", media.Id)))); //res.SetAttributeValue("Id", Id); //res.SetAttributeValue("Title", Title); //res.SetAttributeValue("TaskId", TaskId); //res.SetAttributeValue("State",State); //res.SetElementValue("Description", Description); //var labels = res.Element() return res; }