Example #1
0
        /// <summary>
        /// 类型编号2中,用于替换{fwt}
        /// </summary>
        /// <param name="modelText"></param>
        /// <param name="missionInfo"></param>
        /// <returns></returns>
        public static string WaveFWT(string modelText, MissionInfo missionInfo)
        {
            //替换海浪预报数据{fwt}
            var forecastList = ReshapeWave(missionInfo);
            int i            = 0;

            try
            {
                foreach (var temp in forecastList)
                {
                    //按规则将浪高转换为适宜海上游览\较适宜海上游览\不适宜海上游览
                    float  h = float.Parse(temp);
                    string s = "";
                    if (h <= 1)
                    {
                        s = "适宜海上游览";
                    }
                    if (h > 1 & h <= 1.8)
                    {
                        s = "较适宜海上游览";
                    }
                    if (h > 1.8)
                    {
                        s = "不适宜海上游览";
                    }
                    modelText = ForecastReplace.Replace(modelText, "{fwt}", s);
                    i++;
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            return(modelText);
        }
Example #2
0
        /// <summary>
        /// 类型编号4.用于海浪-旅游全球类型的{fwqq}
        /// </summary>
        /// <param name="modelText"></param>
        /// <param name="missionInfo"></param>
        /// <returns></returns>
        public static string WaveFWQQ(string modelText, MissionInfo missionInfo)
        {
            //替换海浪预报数据{fwqq}
            var forecastList = ReshapeWave(missionInfo);
            int i            = 0;

            try
            {
                foreach (var temp in forecastList)
                {
                    //按规则将浪高转换为轻浪、中浪、大浪等
                    float  h = float.Parse(temp);
                    string s = "";
                    if (h < 0.1)
                    {
                        s = "微浪";
                    }
                    if (h >= 0.1 & h < 0.5)
                    {
                        s = "小浪";
                    }
                    if (h >= 0.5 & h < 1.25)
                    {
                        s = "轻浪";
                    }
                    if (h >= 1.25 & h < 2.5)
                    {
                        s = "中浪";
                    }
                    if (h >= 2.5 & h < 4)
                    {
                        s = "大浪";
                    }
                    if (h >= 4 & h < 6)
                    {
                        s = "巨浪";
                    }
                    if (h >= 6 & h < 9)
                    {
                        s = "狂浪";
                    }
                    if (h >= 9 & h < 14)
                    {
                        s = "狂涛";
                    }
                    if (h >= 14)
                    {
                        s = "怒涛";
                    }
                    modelText = ForecastReplace.Replace(modelText, "{fwqq}", s);
                    i++;
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            return(modelText);
        }
Example #3
0
        /// <summary>
        /// 类型编号1.用于替换只有{fw}的模板
        /// </summary>
        public static string WaveFW(string modelText, MissionInfo missionInfo)
        {
            //替换海浪预报数据{fw}
            var forecastList = ReshapeWave(missionInfo);
            int i            = 0;

            try
            {
                foreach (var temp in forecastList)
                {
                    modelText = ForecastReplace.Replace(modelText, "{fw}", temp);
                    i++;
                }
            }catch (Exception e)
            {
                throw e;
            }
            return(modelText);
        }