Beispiel #1
0
        public Symbol FindSymbol(double value)                                //分级渲染。根据该属性值寻找对应的符号
        {
            Symbol output = new PointSymbol(1, System.Drawing.Color.Red, 3f); //同前赋值一个默认的符号

            if (Symbols.Count() - BreakPoints.Count() == 1)                   //确保不会溢出
            {
                if (value <= BreakPoints[0])                                  //第一个
                {
                    return(Symbols[0]);
                }
                else if (value >= BreakPoints.Last())//最后一个
                {
                    return(Symbols.Last());
                }
                else//中间的
                {
                    for (int i = 1; i < BreakPoints.Count(); i++)
                    {
                        if (value <= BreakPoints[i] && value > BreakPoints[i - 1])
                        {
                            output = Symbols[i];
                        }
                    }
                    return(output);
                }
            }
            else
            {
                throw new IndexOutOfRangeException("分级渲染数据错误:断裂点 != 样式数目 - 1");
            }
        }