Exemple #1
0
        private void AddRuleButton_Click(object sender, EventArgs e)
        {
            if (m_point != null)
            {
                IPointRule prt = _factory.CreateDefaultPointRule();
                int        idx = m_point.RuleCount;
                conditionList.AddRuleControl(prt, idx).Focus();
                m_point.AddRule(prt);
            }
            else if (m_line != null)
            {
                ILineRule lrt = _factory.CreateDefaultLineRule();
                int       idx = m_line.RuleCount;
                conditionList.AddRuleControl(lrt, idx).Focus();
                m_line.AddRule(lrt);
            }
            else if (m_area != null)
            {
                IAreaRule art = _factory.CreateDefaultAreaRule();
                int       idx = m_area.RuleCount;
                conditionList.AddRuleControl(art, idx).Focus();
                m_area.AddRule(art);
            }
            else if (m_comp != null)
            {
                ICompositeRule cr  = _factory.CreateDefaultCompositeRule();
                int            idx = m_area.RuleCount;
                conditionList.AddRuleControl(cr, idx).Focus();
                m_comp.AddCompositeRule(cr);
            }

            ItemChanged?.Invoke(this, null);
        }
        public override ILabeledRuleModel CloneLabeledRuleModel(ILayerElementFactory factory)
        {
            var clone = factory.CreateDefaultLineRule();

            clone.Filter      = _rule.Filter;
            clone.LegendLabel = _rule.LegendLabel;
            if (_rule.Label != null)
            {
                clone.Label = _rule.Label.Clone();
            }
            if (_rule.Strokes != null && _rule.StrokeCount > 0)
            {
                var strokes = new List <IStroke>();
                foreach (var st in _rule.Strokes)
                {
                    strokes.Add(st.Clone());
                }
                clone.SetStrokes(strokes);
            }
            return(new LineRuleModel(clone, -1));
        }
Exemple #3
0
 private ILineRule CreateLineRule(ILineRule template, ILayerElementFactory factory)
 {
     var lrule = factory.CreateDefaultLineRule();
     foreach (var st in template.Strokes)
     {
         lrule.AddStroke(st.Clone());
     }
     if (template.Label != null)
         lrule.Label = template.Label.Clone();
     return lrule;
 }