private void SetItemInternal(IVectorScaleRange parent, object item) { m_parent = parent; m_point = item as IPointVectorStyle; m_line = item as ILineVectorStyle; m_area = item as IAreaVectorStyle; m_comp = item as ICompositeTypeStyle; this.Controls.Clear(); try { this.Visible = false; this.SuspendLayout(); if (m_point != null) { int idx = 0; foreach (IPointRule prt in m_point.Rules) { AddRuleControl(prt, idx); idx++; } } else if (m_line != null) { int idx = 0; foreach (ILineRule lrt in m_line.Rules) { AddRuleControl(lrt, idx); idx++; } } else if (m_area != null) { int idx = 0; foreach (IAreaRule art in m_area.Rules) { AddRuleControl(art, idx); idx++; } } else if (m_comp != null) { int idx = 0; foreach (ICompositeRule comp in m_comp.CompositeRule) { AddRuleControl(comp, idx); idx++; } } } finally { this.ResumeLayout(); this.Visible = true; } }
/// <summary> /// Removes all rules from a composite style /// </summary> /// <param name="style"></param> public static void RemoveAllRules(this ICompositeTypeStyle style) { Check.NotNull(style, "style"); //NOXLATE var remove = new List <ICompositeRule>(); foreach (var r in style.CompositeRule) { remove.Add(r); } foreach (var r in remove) { style.RemoveCompositeRule(r); } }
private void SetItemInternal(IVectorScaleRange parent, object item) { m_parent = parent; m_point = item as IPointVectorStyle; m_line = item as ILineVectorStyle; m_area = item as IAreaVectorStyle; m_comp = item as ICompositeTypeStyle; var ar2 = m_area as IAreaVectorStyle2; var pt2 = m_point as IPointVectorStyle2; var ln2 = m_line as ILineVectorStyle2; var cm2 = m_comp as ICompositeTypeStyle2; //Check if we're working with a 1.3.0 schema ShowInLegend.Enabled = (ar2 != null || pt2 != null || ln2 != null || cm2 != null); btnExplodeTheme.Enabled = (m_comp == null); }
private void GenerateCompositeThemeRules(List<RuleItem> rules, ICompositeTypeStyle col) { if (!chkUseFirstRuleAsTemplate.Checked || col.RuleCount == 0) { MessageBox.Show(Strings.CompositeThemeRequiresFirstRuleAsTemplate); return; } //TODO: Composite styles for lines probably don't have fill colors, as such theme rule generation //probably won't work for line styles atm FillColorSource? source = null; string fillAlpha = ""; ICompositeRule template = null; if (chkUseFirstRuleAsTemplate.Checked && col.RuleCount > 0) { template = col.GetRuleAt(0); if (template.CompositeSymbolization != null) { IdentifyColorSource(template, ref source, ref fillAlpha); } } if (OverwriteRules.Checked) { col.RemoveAllRules(); } foreach (RuleItem entry in rules) { var r = (template != null) ? CreateCompositeRule(template, _factory) : _factory.CreateDefaultCompositeRule(); Debug.WriteLine("Made rule {0}", r.GetHashCode()); r.Filter = entry.Filter; r.LegendLabel = entry.Label; if (r.CompositeSymbolization != null) { SetColorForCompositeRule(source, fillAlpha, entry, r); } col.AddCompositeRule(r); } }
private void ReSyncBindingListToRules(IVectorStyle style) { if (style != null) { switch (style.StyleType) { case StyleType.Point: { IPointVectorStyle pts = style as IPointVectorStyle; pts.RemoveAllRules(); for (int i = 0; i < _rules.Count; i++) { ILabeledRuleModel rule = (ILabeledRuleModel)_rules[i]; IPointRule pr = (IPointRule)rule.UnwrapRule(); pts.AddRule(pr); rule.SetIndex(i); } } break; case StyleType.Line: { ILineVectorStyle lts = style as ILineVectorStyle; lts.RemoveAllRules(); for (int i = 0; i < _rules.Count; i++) { ILabeledRuleModel rule = (ILabeledRuleModel)_rules[i]; ILineRule lr = (ILineRule)rule.UnwrapRule(); lts.AddRule(lr); rule.SetIndex(i); } } break; case StyleType.Area: { IAreaVectorStyle ats = style as IAreaVectorStyle; ats.RemoveAllRules(); for (int i = 0; i < _rules.Count; i++) { ILabeledRuleModel rule = (ILabeledRuleModel)_rules[i]; IAreaRule ar = (IAreaRule)rule.UnwrapRule(); ats.AddRule(ar); rule.SetIndex(i); } } break; case StyleType.Composite: { ICompositeTypeStyle cts = style as ICompositeTypeStyle; cts.RemoveAllRules(); for (int i = 0; i < _rules.Count; i++) { IRuleModel rule = (IRuleModel)_rules[i]; ICompositeRule cr = (ICompositeRule)rule.UnwrapRule(); cts.AddCompositeRule(cr); rule.SetIndex(i); } } break; } } }
public void SetItem(IVectorScaleRange parent, ICompositeTypeStyle comp) { SetItemInternal(parent, comp); }
public void SetItem(IVectorScaleRange parent, ICompositeTypeStyle comp) { SetItemInternal(parent, comp); conditionList.SetItem(parent, comp); }