static LineCapExtension() { _defaultStyle = new LineCaps.FlatCap(); // first register the old deprecated Gdi styles _deprecatedGdiStyles = new System.Collections.Generic.SortedDictionary<string, LineCapExtension>(); foreach (LineCap cap in Enum.GetValues(typeof(LineCap))) { switch (cap) { case LineCap.AnchorMask: case LineCap.Flat: case LineCap.NoAnchor: _deprecatedGdiStyles.Add(Enum.GetName(typeof(LineCap), cap), _defaultStyle); break; case LineCap.Square: _deprecatedGdiStyles.Add(Enum.GetName(typeof(LineCap), cap), new LineCaps.SquareFLineCap(0, 1)); break; case LineCap.Round: _deprecatedGdiStyles.Add(Enum.GetName(typeof(LineCap), cap), new LineCaps.CircleFLineCap(0, 1)); break; case LineCap.Triangle: _deprecatedGdiStyles.Add(Enum.GetName(typeof(LineCap), cap), new LineCaps.DiamondFLineCap(0, 1)); break; case LineCap.ArrowAnchor: _deprecatedGdiStyles.Add(Enum.GetName(typeof(LineCap), cap), new LineCaps.ArrowF10LineCap(0, 2)); break; case LineCap.SquareAnchor: _deprecatedGdiStyles.Add(Enum.GetName(typeof(LineCap), cap), new LineCaps.SquareFLineCap(0, 1.5)); break; case LineCap.RoundAnchor: _deprecatedGdiStyles.Add(Enum.GetName(typeof(LineCap), cap), new LineCaps.CircleFLineCap(0, 2)); break; case LineCap.DiamondAnchor: _deprecatedGdiStyles.Add(Enum.GetName(typeof(LineCap), cap), new LineCaps.DiamondFLineCap(0, 2)); break; } } // now the other linecaps _registeredStyles = new System.Collections.Generic.SortedDictionary<string, LineCapExtension>(); var types = Altaxo.Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(LineCapExtension)); foreach (var t in types) { var ex = (LineCapExtension)Activator.CreateInstance(t); _registeredStyles.Add(ex.Name, ex); } // now sort them by name List<string> nameList = new List<string>(_registeredStyles.Keys); nameList.Remove(_defaultStyle.Name); nameList.Sort(); nameList.Insert(0, _defaultStyle.Name); _registeredStylesSortedByName = new List<LineCapExtension>(nameList.Select(x => _registeredStyles[x])); }
static LineCapExtension() { _defaultStyle = new LineCaps.FlatCap(); // first register the old deprecated Gdi styles _deprecatedGdiStyles = new System.Collections.Generic.SortedDictionary <string, LineCapExtension>(); foreach (LineCap cap in Enum.GetValues(typeof(LineCap))) { switch (cap) { case LineCap.AnchorMask: case LineCap.Flat: case LineCap.NoAnchor: _deprecatedGdiStyles.Add(Enum.GetName(typeof(LineCap), cap), _defaultStyle); break; case LineCap.Square: _deprecatedGdiStyles.Add(Enum.GetName(typeof(LineCap), cap), new LineCaps.SquareFLineCap(0, 1)); break; case LineCap.Round: _deprecatedGdiStyles.Add(Enum.GetName(typeof(LineCap), cap), new LineCaps.CircleFLineCap(0, 1)); break; case LineCap.Triangle: _deprecatedGdiStyles.Add(Enum.GetName(typeof(LineCap), cap), new LineCaps.DiamondFLineCap(0, 1)); break; case LineCap.ArrowAnchor: _deprecatedGdiStyles.Add(Enum.GetName(typeof(LineCap), cap), new LineCaps.ArrowF10LineCap(0, 2)); break; case LineCap.SquareAnchor: _deprecatedGdiStyles.Add(Enum.GetName(typeof(LineCap), cap), new LineCaps.SquareFLineCap(0, 1.5)); break; case LineCap.RoundAnchor: _deprecatedGdiStyles.Add(Enum.GetName(typeof(LineCap), cap), new LineCaps.CircleFLineCap(0, 2)); break; case LineCap.DiamondAnchor: _deprecatedGdiStyles.Add(Enum.GetName(typeof(LineCap), cap), new LineCaps.DiamondFLineCap(0, 2)); break; } } // now the other linecaps _registeredStyles = new System.Collections.Generic.SortedDictionary <string, LineCapExtension>(); var types = Altaxo.Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(LineCapExtension)); foreach (var t in types) { var ex = (LineCapExtension)Activator.CreateInstance(t); _registeredStyles.Add(ex.Name, ex); } // now sort them by name var nameList = new List <string>(_registeredStyles.Keys); nameList.Remove(_defaultStyle.Name); nameList.Sort(); nameList.Insert(0, _defaultStyle.Name); _registeredStylesSortedByName = new List <LineCapExtension>(nameList.Select(x => _registeredStyles[x])); }