public static Style CreateDefaultStyle(SymbolStyleType providerType) { switch (providerType) { case SymbolStyleType.Point_Simple: var point = new PointStyle(); point.CustomPointStyles.Add(PointStyles.City4); return(point); case SymbolStyleType.Point_Font: return(new FontPointStyle()); case SymbolStyleType.Point_Custom: return(new SymbolPointStyle()); case SymbolStyleType.Area_Area: return(new AreaStyle()); case SymbolStyleType.Line_Line: return(new LineStyle()); case SymbolStyleType.None: default: return(null); } }
private static T CreateNormalStyle <T>(Style oldStyle, SymbolStyleType symbolStyleType = SymbolStyleType.None, Func <SymbolStyleType, T> creatDefaultCallback = null, Action <T> settingCallback = null) where T : Style, new() { if (oldStyle == null || oldStyle.GetType() != typeof(T)) { T instance = new T(); if (creatDefaultCallback != null) { instance = creatDefaultCallback(symbolStyleType); } if (settingCallback != null) { settingCallback(instance); } return(instance); } else { return((T)oldStyle); } }