예제 #1
0
        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);
                }
            }
        }
예제 #2
0
        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();
        }
예제 #3
0
 public void AddFiller(MarkupFiller filler)
 {
     FillersList.Add(filler);
     filler.RecalculateDashes();
     NeedRecalculateBatches = true;
 }