示例#1
0
 // 获取地质年代的中文名。
 public static string GetChineseName(this GeoChron geoChron)
 {
     if (geoChron.Type == GeoChronType.MaBP)
     {
         return($"{geoChron.MaBP} Ma");
     }
     else if (geoChron.Type == GeoChronType.CEYear)
     {
         return(geoChron.CEYear < 0 ? $"BC {-geoChron.CEYear}" : $"AD {geoChron.CEYear}");
     }
     else
     {
         if (_EnumValueToNameTable.TryGetValue(geoChron.GetHashCode(), out string chineseName))
         {
             return(chineseName);
         }
         else
         {
             throw new ArgumentException();
         }
     }
 }
示例#2
0
        // 获取分类阶元的主题颜色。
        public static ColorX GetThemeColor(this GeoChron geoChron)
        {
            if (geoChron is null)
            {
                throw new ArgumentNullException();
            }

            //

            if (geoChron.Type == GeoChronType.Age)
            {
                geoChron = geoChron.Superior;
            }

            if (_EnumValueToColorTable.TryGetValue(geoChron.GetHashCode(), out ColorX color))
            {
                return(color);
            }
            else
            {
                return(Color.Black);
            }
        }