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

            if (update)
            {
                RuleChanged();
            }
        }
예제 #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);
         }
     }
 }
예제 #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);
         }
     }
 }
예제 #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();
     }
 }
예제 #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();
        }
예제 #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);
        }
예제 #8
0
 public void RemoveRule(MarkupLineRawRule <RegularLineStyle> rule)
 {
     RawRules.Remove(rule);
     RuleChanged();
 }
예제 #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);
     }
 }
예제 #10
0
 public override bool ContainsRule(MarkupLineRawRule rule) => rule != null && rule == Rule;
예제 #11
0
 private void SetRule(MarkupLineRawRule <Style> rule)
 {
     rule.OnRuleChanged = RuleChanged;
     Rule = rule;
 }
예제 #12
0
 public abstract bool ContainsRule(MarkupLineRawRule rule);
예제 #13
0
 public void RemoveRule(MarkupLineRawRule rule)
 {
     RawRules.Remove(rule);
     RuleChanged();
 }
예제 #14
0
 public override bool ContainsRule(MarkupLineRawRule rule) => rule != null && RawRules.Any(r => r == rule);
예제 #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);
     }
 }