private void showTheme(string temp,bool flag)
{
FeatureLayer lyrPnt=MapControl1.Map.Layers[_findLayerName] as FeatureLayer;
lyrPnt.Modifiers.Clear();
RangedTheme thm = new RangedTheme(lyrPnt,temp,"ph",4,DistributionMethod.CustomRanges);
//自定义
double x,y;
x=thm.NumericMin;
y=thm.NumericMax;
lyrPnt.Modifiers.Insert(0,thm);
if(flag==true)
{
//获取设置的最大最小值
if(TextBox1.Text!="")
x=double.Parse(TextBox1.Text);
if(TextBox2.Text!="")
y=double.Parse(TextBox2.Text);
}
thm.Bins[0].Min = x;
thm.Bins[0].Max = x+(y-x)/4;
thm.Bins[1].Min = x+(y-x)/4;
thm.Bins[1].Max = x+(y-x)/2;
thm.Bins[2].Min = x+(y-x)/2;
thm.Bins[2].Max = x+3*(y-x)/4;
thm.Bins[3].Min = x+3*(y-x)/4;
thm.Bins[3].Max = y;
thm.RecomputeBins();
//平均
ThemeLegendFrame frame = LegendFrameFactory.CreateThemeLegendFrame(temp,"pp",thm);
MapControl1.Map.Legends.Clear();
Legend legend = MapControl1.Map.Legends.CreateLegend(new Size(5,5));
legend.Frames.Append(frame);
MapControl1.Map.Adornments.Append(legend);
//MapControl1上显示Legend图例
TextBox1.Text=x.ToString();
TextBox2.Text=y.ToString();
}
此方法函数可以获取两个TextBox中的数值,然后显示两个数值范围之间的主题地图.当flag为flase时候,为默认生成的主题地图,当flag为true时候,为自定义范围的主题地图.