private void RemoveLine(MarkupLine line) { foreach (var intersect in GetExistIntersects(line).ToArray()) { if (intersect.Pair.GetOther(line) is MarkupRegularLine regularLine) { regularLine.RemoveRules(line); } LineIntersects.Remove(intersect.Pair); } foreach (var filler in GetLineFillers(line).ToArray()) { FillersList.Remove(filler); } if (CrosswalksDictionary.ContainsKey(line)) { CrosswalksDictionary.Remove(line); } else { foreach (var crosswalk in GetLinesIsBorder(line)) { crosswalk.RemoveBorder(line); } } LinesDictionary.Remove(line.PointPair.Hash); }
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 Clear() { LinesDictionary.Clear(); FillersList.Clear(); RecalculateDashes(); }
private void RemoveLine(MarkupLine line) { foreach (var intersect in GetExistIntersects(line).ToArray()) { intersect.Pair.GetOther(line).RemoveRules(line); LineIntersects.Remove(intersect.Pair); } foreach (var filler in GetLineFillers(line).ToArray()) { FillersList.Remove(filler); } LinesDictionary.Remove(line.PointPair.Hash); }
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 RemoveFiller(MarkupFiller filler) { FillersList.Remove(filler); NeedRecalculateBatches = true; }
public void AddFiller(MarkupFiller filler) { FillersList.Add(filler); filler.RecalculateDashes(); NeedRecalculateBatches = true; }
public IEnumerable <MarkupFiller> GetPointFillers(MarkupPoint point) => FillersList.Where(f => f.ContainsPoint(point));
public IEnumerable <MarkupFiller> GetLineFillers(MarkupLine line) => FillersList.Where(f => f.ContainsLine(line));