public MarkupLineRawRule AddRule(LineStyle lineStyle, bool empty = true, bool update = true) { var newRule = new MarkupLineRawRule(this, lineStyle, empty ? null : new EnterPointEdge(Start), empty ? null : new EnterPointEdge(End)); AddRule(newRule, update); return(newRule); }
private void AddRule(MarkupLineRawRule <RegularLineStyle> rule, bool update = true) { rule.OnRuleChanged = RuleChanged; RawRules.Add(rule); if (update) { RuleChanged(); } }
public void FromXml(XElement config, Dictionary <ObjectId, ObjectId> map) { foreach (var ruleConfig in config.Elements(MarkupLineRawRule.XmlName)) { if (MarkupLineRawRule.FromXml(ruleConfig, this, map, out MarkupLineRawRule rule)) { AddRule(rule, false); } } }
public override void FromXml(XElement config, Dictionary <ObjectId, ObjectId> map) { foreach (var ruleConfig in config.Elements(MarkupLineRawRule <RegularLineStyle> .XmlName)) { if (MarkupLineRawRule <RegularLineStyle> .FromXml(ruleConfig, this, map, out MarkupLineRawRule <RegularLineStyle> rule)) { AddRule(rule, false); } } }
protected MarkupStraightLine(Markup markup, MarkupPointPair pointPair, StyleType styleType) : base(markup, pointPair, false) { if (Visible) { var style = GetDefaultStyle(styleType); var rule = new MarkupLineRawRule <Style>(this, style, new EnterPointEdge(Start), new EnterPointEdge(End)); SetRule(rule); } Update(true); if (Visible) { RecalculateStyleData(); } }
public void RecalculateDashes() { var rules = MarkupLineRawRule.GetRules(RawRules); var dashes = new List <MarkupStyleDash>(); foreach (var rule in rules) { var trajectoryPart = Trajectory.Cut(rule.Start, rule.End); var ruleDashes = rule.LineStyle.Calculate(trajectoryPart).ToArray(); dashes.AddRange(ruleDashes); } Dashes = dashes.ToArray(); }
protected override IEnumerable <MarkupStyleDash> GetDashes() { var rules = MarkupLineRawRule <RegularLineStyle> .GetRules(RawRules); var dashes = new List <MarkupStyleDash>(); foreach (var rule in rules) { var trajectoryPart = LineTrajectory.Cut(rule.Start, rule.End); var ruleDashes = rule.LineStyle.Calculate(this, trajectoryPart).ToArray(); dashes.AddRange(ruleDashes); } return(dashes); }
public void RemoveRule(MarkupLineRawRule <RegularLineStyle> rule) { RawRules.Remove(rule); RuleChanged(); }
public override void FromXml(XElement config, ObjectsMap map, bool invert) { if (config.Element(MarkupLineRawRule <Style> .XmlName) is XElement ruleConfig && MarkupLineRawRule <Style> .FromXml(ruleConfig, this, map, invert, out MarkupLineRawRule <Style> rule)) { SetRule(rule); } }
public override bool ContainsRule(MarkupLineRawRule rule) => rule != null && rule == Rule;
private void SetRule(MarkupLineRawRule <Style> rule) { rule.OnRuleChanged = RuleChanged; Rule = rule; }
public abstract bool ContainsRule(MarkupLineRawRule rule);
public void RemoveRule(MarkupLineRawRule rule) { RawRules.Remove(rule); RuleChanged(); }
public override bool ContainsRule(MarkupLineRawRule rule) => rule != null && RawRules.Any(r => r == rule);
public override void FromXml(XElement config, Dictionary <ObjectId, ObjectId> map) { if (config.Element(MarkupLineRawRule <Style> .XmlName) is XElement ruleConfig && MarkupLineRawRule <Style> .FromXml(ruleConfig, this, map, out MarkupLineRawRule <Style> rule)) { SetRule(rule); } }