private void ReSyncRulesToBindingList(IVectorStyle style)
        {
            _rules.Clear();
            if (style != null)
            {
                switch (style.StyleType)
                {
                case StyleType.Point:
                {
                    for (int i = 0; i < style.RuleCount; i++)
                    {
                        IPointRule pr = (IPointRule)style.GetRuleAt(i);
                        _rules.Add(new PointRuleModel(pr, i));
                    }
                }
                break;

                case StyleType.Line:
                {
                    for (int i = 0; i < style.RuleCount; i++)
                    {
                        ILineRule lr = (ILineRule)style.GetRuleAt(i);
                        _rules.Add(new LineRuleModel(lr, i));
                    }
                }
                break;

                case StyleType.Area:
                {
                    for (int i = 0; i < style.RuleCount; i++)
                    {
                        IAreaRule ar = (IAreaRule)style.GetRuleAt(i);
                        _rules.Add(new AreaRuleModel(ar, i));
                    }
                }
                break;

                case StyleType.Composite:
                {
                    for (int i = 0; i < style.RuleCount; i++)
                    {
                        ICompositeRule cr = (ICompositeRule)style.GetRuleAt(i);
                        _rules.Add(new CompositeRuleModel(cr, i));
                    }
                }
                break;
                }
            }
            else
            {
                _rules.Clear();
            }
        }
Exemple #2
0
 private void GeneratePreviews()
 {
     lstLayerNameExamples.Items.Clear();
     if (IsValidToPreview())
     {
         string layerPrefix = txtLayerPrefix.Text;
         int    rules       = Math.Min(3, _style.RuleCount);
         string scaleRange  = Utility.GetScaleRangeStr(_parentRange);
         for (int i = 0; i < rules; i++)
         {
             var    rule = _style.GetRuleAt(i);
             string name = Utility.GenerateLayerName(txtLayerNameFormat.Text, layerPrefix, scaleRange, i, rule);
             lstLayerNameExamples.Items.Add(name);
         }
         EvaluateStates();
     }
     else
     {
         lstLayerNameExamples.Items.Add(Strings.InvalidLayerNameFormat);
         EvaluateStates();
     }
 }