public void FromXml(string version, XElement config, Dictionary <ObjectId, ObjectId> map = null) { if (VersionComparer.Instance.Compare(version, "1.2") < 0) { map = VersionMigration.Befor1_2(this, map); } foreach (var pointConfig in config.Elements(MarkupPoint.XmlName)) { MarkupPoint.FromXml(pointConfig, this, map); } var toInit = new Dictionary <MarkupLine, XElement>(); foreach (var lineConfig in config.Elements(MarkupLine.XmlName)) { if (MarkupLine.FromXml(lineConfig, this, map, out MarkupLine line)) { LinesDictionary[line.Id] = line; toInit[line] = lineConfig; } } foreach (var pair in toInit) { pair.Key.FromXml(pair.Value, map); } foreach (var fillerConfig in config.Elements(MarkupFiller.XmlName)) { if (MarkupFiller.FromXml(fillerConfig, this, map, out MarkupFiller filler)) { FillersList.Add(filler); } } }
public void FromXml(Version version, XElement config, Dictionary <ObjectId, ObjectId> map = null) { if (version < new Version("1.2")) { map = VersionMigration.Befor1_2(this, map); } foreach (var pointConfig in config.Elements(MarkupPoint.XmlName)) { MarkupPoint.FromXml(pointConfig, this, map); } var toInit = new Dictionary <MarkupLine, XElement>(); foreach (var lineConfig in config.Elements(MarkupLine.XmlName)) { if (MarkupLine.FromXml(lineConfig, this, map, out MarkupLine line)) { LinesDictionary[line.Id] = line; toInit[line] = lineConfig; } } foreach (var pair in toInit) { pair.Key.FromXml(pair.Value, map); } foreach (var fillerConfig in config.Elements(MarkupFiller.XmlName)) { if (MarkupFiller.FromXml(fillerConfig, this, map, out MarkupFiller filler)) { FillersList.Add(filler); } } foreach (var crosswalkConfig in config.Elements(MarkupCrosswalk.XmlName)) { if (MarkupCrosswalk.FromXml(crosswalkConfig, this, map, out MarkupCrosswalk crosswalk)) { CrosswalksDictionary[crosswalk.Line] = crosswalk; } } Update(); }
public void AddFiller(MarkupFiller filler) { FillersList.Add(filler); filler.RecalculateDashes(); NeedRecalculateBatches = true; }