Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        private void AddRule(MarkupLineRawRule <RegularLineStyle> rule, bool update = true)
        {
            rule.OnRuleChanged = RuleChanged;
            RawRules.Add(rule);

            if (update)
            {
                RuleChanged();
            }
        }
Ejemplo n.º 3
0
 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);
         }
     }
 }
Ejemplo n.º 4
0
 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);
         }
     }
 }
Ejemplo n.º 5
0
 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();
     }
 }
Ejemplo n.º 6
0
        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();
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
 public void RemoveRule(MarkupLineRawRule <RegularLineStyle> rule)
 {
     RawRules.Remove(rule);
     RuleChanged();
 }
Ejemplo n.º 9
0
 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);
     }
 }
Ejemplo n.º 10
0
 public override bool ContainsRule(MarkupLineRawRule rule) => rule != null && rule == Rule;
Ejemplo n.º 11
0
 private void SetRule(MarkupLineRawRule <Style> rule)
 {
     rule.OnRuleChanged = RuleChanged;
     Rule = rule;
 }
Ejemplo n.º 12
0
 public abstract bool ContainsRule(MarkupLineRawRule rule);
Ejemplo n.º 13
0
 public void RemoveRule(MarkupLineRawRule rule)
 {
     RawRules.Remove(rule);
     RuleChanged();
 }
Ejemplo n.º 14
0
 public override bool ContainsRule(MarkupLineRawRule rule) => rule != null && RawRules.Any(r => r == rule);
Ejemplo n.º 15
0
 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);
     }
 }