快捷搜索:

Silverlight客户端实现区域像元统计以及地形剖面图

一、本文实现的功能

1.1 要素查询功能

根据要素属性,查询出响应的要素

1.2 栅格数据的像元统计

例如输入一个几何图形(点,线,面)可以谋略出该图像范围内栅格数据的像元信息,如:像元最大年夜值,最小值,以及匀称值等,详细如下图所示:

1.3 绘制地形剖面图

该功能和官网的这个例子差不多:

http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#SurfaceProfile

(不知道为什么,我这里查看不了这里例子)

效果如下图所示:

二、应用到的数据和常识

2.1舆图数据

本例的地形高程数据来自于国际科学数据办事平台,下载网址:

http://datamirror.csdb.cn/index.jsp

本例的各区县要素数据来自于国家根基地舆信息中间,下载网址:

http://nfgis.nsdi.gov.cn/nfgis/chinese/c_xz.htm

上面的舆图是我自己在ArcMap中制作的一张舆图,外加了一点地形阴影效果,这是在ArcMap中的图层列表

各县面要素图层

着末经由过程以上数据获得了本文应用的底图。在查询部分中,实际上查询的便是各区县的面要素,可经由过程输入曲线的夷易近称或编号来查询出相对应的县,然后再经由过程调研像元统计的GP办事对象,即可实现像元统计,获得对应区县范围内像元的最大年夜值,最小值等信息,实际上这里的值也便是对应区县的海拔(准确度由下载的高程数据所抉择),着末的舆图:

2.2 应用到如下的常识:

2.2.1 要素的属性查询

2.2.2 GP办事的调用

2.2.3 经由过程开源的Silverlight图表控件:OxyPlot

以上前两部分内容都在之前的博文中讲过,以是不是本文的重点。关于OxyPlot图表控件也很简单,这里不会过多的解释阐明。官网有很好的赞助文档。

三、实现历程

3.1 查询(要素属性查询和空间查询)

可参考之前的文章:

http://www.fengfly.com/plus/view-211930-1.html

3.2 根据查询获得的面要素,谋略出面要素对应区域内的像元信息。

3.2.1宣布像元统计的GP办事

这里主要用到的便是GP办事。下面是本文的GP办事模型:

此中ZoneFiled便是统计字段,InputFeature为输入的要素,ZonalRaster为统计的删格数据

提醒:在10.1中可以将栅格数据作为输入参数。在10.0中弗成以,假如您是10.0版本的,那么这里你只能在建模的时刻指定栅格数据,然后去掉落设置为模型参数。在10.1中假如你有可数的几个不合栅格数据,那么你可以将其添加到ArcMap中,在宣布GP办事的时刻,会提示你从列表选择照样自定义栅格数据,这个时刻你可以选择从列表选择。然后你可以将ArcMap中的删格数据图层添加到选择列表中,着末在Web端调用的时刻,你只必要输入栅格数据列表中对付栅格数据的名称即可,例如本文的列表如下:

这里可以看出只有一个栅格数据选项:hunandata。

3.2.2Web端调用GP办事

调用GP办事的历程之前的博文也有讲到,可参考这里:

http://www.fengfly.com/plus/view-210914-1.html

下面是本文的调用代码:

private void AccessGPService(FeatureSet featureset)

{List gppara = new List();

//输入GP办事的参数gppara.Add(new GPString("ZoneFiled", "OBJECTID"));

gppara.Add(new GPFeatureRecordSetLayer("InputFeature", featureset));gppara.Add(new GPString("ZonalRaster", "hunandata"));

_geoprocessor.SubmitJobAsync(gppara);}

private void _geoprocessor_JobCompleted(object sender, JobInfoEventArgs e)

{HttpWebRequest.RegisterPrefix("http://", System.Net.Browser.WebRequestCreator.ClientHttp);

Geoprocessor gp = sender as Geoprocessor;//哀求GP办事的结果

gp.GetResultDataAsync(e.JobInfo.JobId, "ResultTable");}

private void _geoprocessor_GetResultDataCompleted(object sender, GPParameterEventArgs e)

{MyDataGrid.ItemsSource = null;

GPRecordSet gpr = e.Parameter as GPRecordSet;if (gpr.FeatureSet != null)

{for (int i = 0; i

{for (int j = 2; j

{//这里本文有个Bug,便是当FeatureDataGrid绑定到GraphicsLayer后,

//假如改动GrapicsLayer的属性(增添或者删除)会报错,以下代码不能经由过程,以是这里选择了先改动再绑定Liststring> keyList = gpr.FeatureSet.Features[i].Attributes.Keys.ToListstring>();

Listobject> valueList = gpr.FeatureSet.Features[i].Attributes.Values.ToList();graphicsLayer.Graphics[i].Attributes.Add(keyList[j], valueList[j]);

}}

//在此绑定DataGrid,不然会呈现非常MyDataGrid.GraphicsLayer = graphicsLayer;

MyDataGrid.Visibility = Visibility.Visible;//绘制地形图

if (createPlot == true){

CreatePlot();TerrainBorder.Visibility = Visibility.Visible;

}featureSet.Features.Clear();

}//等待历程

BusyRectangle.Visibility = Visibility.Collapsed;busyIndicator.IsBusy = false;

}

private void _geoprocessor_Failed(object sender, TaskFailedEventArgs e){

MessageBox.Show(e.Error.ToString());}

以上是调用GP办事的代码,这里有个Bug。

着末的统计结果如下所示:

3.2.3 Web客户端绘制地形图

这里借助的是开源的图表控件:OxyPlot。感到绘制图表很强大年夜,而且开源啊。

绘制地形剖面图的功能大年夜致上的历程如下:

首先在舆图上绘制一条线,然后中分这条线,例如一百份,然后获得这一百个点的像元统计值(着末的值便是海拔值,这里数据的准确度和供给的高程数据经度有关,高程数据经度越高,结果也就越准确),获得一百个点的高程数据之后,就经由过程OxyPlot绘图了。

详细代码:

a.OxyPlot绘图

声明一个PlotModel,PlotModel代表绘制图表的类型。

PlotModel plotModel = null;

着末的MainPage.cs代码:

using System;

using System.Collections.Generic; using System.Linq;

using System.Net; using System.Windows;

using System.Windows.Controls; using System.Windows.Documents;

using System.Windows.Input; using System.Windows.Media;

using System.Windows.Media.Animation; using System.Windows.Shapes;

using ESRI.ArcGIS.Client.Symbols; using ESRI.ArcGIS.Client.Geometry;

using ESRI.ArcGIS.Client.Tasks; using ESRI.ArcGIS.Client;

using System.Text.RegularExpressions; using OxyPlot.Silverlight;

using OxyPlot; namespace QueryAndStatisticDemo

{public partial class MainPage : UserControl

{//用于查询的Task

QueryTask queryTask = new QueryTask();//声明一个Draw,用于绘制查询的区域,进行空间查询

Draw myDraw;//绘制的Geomotry

ESRI.ArcGIS.Client.Geometry.Geometry drawGeometry;//查询SQL字符串

string QueryString;//选择查询结果中的Graphic

Graphic selectedGraphic;//地舆处置惩罚办事

Geoprocessor _geoprocessor = null;//输入要素集

FeatureSet featureSet = new FeatureSet();GraphicsLayer graphicsLayer;

PlotModel plotModel = null;//Interval

AreaSeries areaSeries1;double interval;

bool createPlot = false;

public MainPage(){

InitializeComponent();plotModel = new PlotModel("地形剖面图");

var linearAxis1 = new LinearAxis(AxisPosition.Bottom) { IsZoomEnabled=false,Title="间隔"};plotModel.Axes.Add(linearAxis1);

var linearAxis2 = new LinearAxis(AxisPosition.Left) { IsZoomEnabled=false,Title="海拔"};plotModel.Axes.Add(linearAxis2);

areaSeries1 = new AreaSeries{

Fill=OxyColors.DarkOrange,DataFieldX="间隔",

DataFieldY="最高海拔",DataFieldX2 = "间隔",

DataFieldY2 = "最低海拔",Color=OxyColors.Red,

StrokeThickness=0,MarkerFill=OxyColors.Transparent,

};

graphicsLayer = map1.Layers["QueryResultLayer"] as GraphicsLayer;

queryTask.Url = "http://qzj-pc:6080/arcgis/rest/services/Provinces_Map/HunanMap/MapServer/3";queryTask.AutoNormalize = true;

//很紧张,否则呈现查询成功和掉败交替呈现的征象queryTask.DisableClientCaching = true;

queryTask.ExecuteCompleted += new EventHandler(queryTask_ExecuteCompleted);queryTask.Failed += new EventHandler(queryTask_Failed);

_geoprocessor = new Geoprocessor("http://qzj-pc:6080/arcgis/rest/services/RasterStatisticServer/GPServer/DemStatisticsRaster");

_geoprocessor.JobCompleted += new EventHandler(_geoprocessor_JobCompleted);_geoprocessor.Failed += new EventHandler(_geoprocessor_Failed);

_geoprocessor.GetResultDataCompleted += new EventHandler(_geoprocessor_GetResultDataCompleted);

myDraw = new Draw(map1);myDraw.DrawMode = DrawMode.Polygon;

myDraw.IsEnabled = false;myDraw.FillSymbol = new SimpleFillSymbol()

{BorderBrush = new SolidColorBrush(Colors.Black),

BorderThickness = 3,Fill = new SolidColorBrush(Colors.Red),

};myDraw.LineSymbol = new LineSymbol()

{Color=new SolidColorBrush(Colors.Red),

Width=3};

myDraw.DrawComplete += new EventHandler(myDraw_DrawComplete);

QueryTypeCombox.ItemsSource = AttributeString.GraphicAttributesEnNameString;}

private void myDraw_DrawComplete(object sender, DrawEventArgs e)

{graphicsLayer.Graphics.Clear();

drawGeometry = e.Geometry;

myDraw.IsEnabled = false;

if (drawGeometry is ESRI.ArcGIS.Client.Geometry.Polyline){

CreatPoint((ESRI.ArcGIS.Client.Geometry.Polyline)drawGeometry,100);BusyRectangle.Visibility = Visibility.Visible;

busyIndicator.IsBusy = true;AccessGPService(featureSet);

}else

{StartQueryBySpatial(e.Geometry);

}

}

private void ExpressionButton_Click(object sender, RoutedEventArgs e){

string pattern = @"^[0-9]*$";

Button button = sender as Button;Match m = Regex.Match(button.Content.ToString(), pattern);

if (m.Success)ExpressionTextBox.Text = string.Format("{0}{1}", ExpressionTextBox.Text, button.Content);

elseExpressionTextBox.Text = string.Format("{0} {1} ", ExpressionTextBox.Text, button.Content);

}

private void ExpressionQueryButton_Click(object sender, RoutedEventArgs e){

CreatQueryString();StartQueryBySQL(QueryString);

}

private void SpatialQueryButton_Click(object sender, RoutedEventArgs e){

ExpressionTextBox.Text = "";myDraw.DrawMode = DrawMode.Polygon;

myDraw.IsEnabled = true;}

private void FiledsCombox_SelectionChanged(object sender, SelectionChangedEventArgs e)

{ComboBox comb = sender as ComboBox;

if (comb.SelectedIndex != -1){

int index = comb.SelectedIndex;ExpressionTextBox.Text = string.Format("{0}{1}", ExpressionTextBox.Text, comb.SelectedItem.ToString());

}comb.SelectedIndex = -1;

}

private void ExpressionTextBox_KeyDown(object sender, System.Windows.Input.KeyEventArgs e){

// 按了回车键就向办事端发送数据if (e.Key == Key.Enter)

{CreatQueryString();

StartQueryBySQL(QueryString);}

}

private void QoutButton_Click(object sender, RoutedEventArgs e){

Button button = sender as Button;ExpressionTextBox.Text = string.Format("{0}{1}", ExpressionTextBox.Text, button.Content);

}

private void NoButton_Click(object sender, RoutedEventArgs e){

Button button = sender as Button;ExpressionTextBox.Text = string.Format("{0} {1}", ExpressionTextBox.Text, button.Content);

}

private void ClearGraphicsButton_Click(object sender, RoutedEventArgs e){

graphicsLayer.Graphics.Clear();}

private void GraphicsLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs e)

{if (selectedGraphic != null)

{selectedGraphic.UnSelect();

selectedGraphic.Symbol = new SimpleFillSymbol(){

BorderBrush = new SolidColorBrush(Colors.Red),BorderThickness = 2,

Fill = new SolidColorBrush(Colors.Green)};

}

e.Graphic.Select();e.Graphic.Symbol = new SimpleFillSymbol()

{Fill=new SolidColorBrush(Colors.Red),

BorderBrush = new SolidColorBrush(Colors.Yellow),BorderThickness=3

};if (e.Graphic.Selected&&MyDataGrid.GraphicsLayer!=null)

MyDataGrid.ScrollIntoView(e.Graphic, null);selectedGraphic = e.Graphic;

}

#region 查询掉败几完成事故private void queryTask_ExecuteCompleted(object sender, QueryEventArgs e)

{

graphicsLayer.ClearGraphics();

if (e.FeatureSet.Features.Count > 0){

foreach (Graphic resultFeature in e.FeatureSet.Features){

if (drawGeometry != null){

//查询结果落在绘制的多边形之内if (resultFeature.Geometry.Extent.XMax

resultFeature.Geometry.Extent.XMin > drawGeometry.Extent.XMin &&resultFeature.Geometry.Extent.YMax

resultFeature.Geometry.Extent.YMin > drawGeometry.Extent.YMin){

resultFeature.Symbol = new SimpleFillSymbol(){

BorderBrush = new SolidColorBrush(Colors.Red),BorderThickness = 2,

Fill = new SolidColorBrush(Colors.Green)};

featureSet.Features.Add(resultFeature);graphicsLayer.Graphics.Add(resultFeature);

}}

else{

resultFeature.Symbol = new SimpleFillSymbol(){

BorderBrush = new SolidColorBrush(Colors.Red),BorderThickness = 2,

Fill = new SolidColorBrush(Colors.Green)};

featureSet.Features.Add(resultFeature);graphicsLayer.Graphics.Add(resultFeature);

}}

if (graphicsLayer.Graphics.CountMessageBox.Show("没有查询到目标要素!");

}else

{MessageBox.Show("没有查询到目标要素!");

}drawGeometry = null;

}

private void queryTask_Failed(object sender, TaskFailedEventArgs e){

MessageBox.Show("Query failed: " + e.Error);}

#endregion

#region 查询自定义措施

////// 前提查询

//////

查询SQL语句

private void StartQueryBySQL(string sqlString){

queryTask.CancelAsync();if (ExpressionTextBox.Text == "")

return;Query query = new Query();

query.ReturnGeometry = true;query.OutFields.AddRange(new string[] { "NAME99", "ADCODE99" });

query.Where = sqlString;query.OutSpatialReference = map1.SpatialReference;

queryTask.ExecuteAsync(query);}

////// 空间查询

//////

几何图形

private void StartQueryBySpatial(ESRI.ArcGIS.Client.Geometry.Geometry geometry){

queryTask.CancelAsync();Query query = new Query();

query.ReturnGeometry = true;query.OutFields.AddRange(new string[] { "NAME99", "ADCODE99" });

query.Geometry = geometry;query.SpatialRelationship = SpatialRelationship.esriSpatialRelContains;

query.OutSpatialReference = map1.SpatialReference;queryTask.ExecuteAsync(query);

}

////// 构造查询Where前提的SQL语句

///private void CreatQueryString()

{if (QueryTypeCombox.SelectedIndex == 0)

QueryString =string.Format("NAME99 = '{0}'",ExpressionTextBox.Text);else if (QueryTypeCombox.SelectedIndex == 1)

QueryString = string.Format("ADCODE99 = '{0}'",ExpressionTextBox.Text);else

return;}

#endregion

# region 调用GP办事进行栅格像元统计private void StatisticButton_Click(object sender, RoutedEventArgs e)

{if (featureSet.Features.Count

return;BusyRectangle.Visibility = Visibility.Visible;

busyIndicator.IsBusy = true;AccessGPService(featureSet);

}

private void AccessGPService(FeatureSet featureset){

List gppara = new List();//输入GP办事的参数

gppara.Add(new GPString("ZoneFiled", "OBJECTID"));gppara.Add(new GPFeatureRecordSetLayer("InputFeature", featureset));

gppara.Add(new GPString("ZonalRaster", "hunandata"));_geoprocessor.SubmitJobAsync(gppara);

}

private void _geoprocessor_JobCompleted(object sender, JobInfoEventArgs e){

HttpWebRequest.RegisterPrefix("http://", System.Net.Browser.WebRequestCreator.ClientHttp);Geoprocessor gp = sender as Geoprocessor;

//哀求GP办事的结果gp.GetResultDataAsync(e.JobInfo.JobId, "ResultTable");

}

private void _geoprocessor_GetResultDataCompleted(object sender, GPParameterEventArgs e){

MyDataGrid.ItemsSource = null;GPRecordSet gpr = e.Parameter as GPRecordSet;

if (gpr.FeatureSet != null){

for (int i = 0; i{

for (int j = 2; j{

//这里本文有个Bug,便是当FeatureDataGrid绑定到GraphicsLayer后,//假如改动GrapicsLayer的属性(增添或者删除)会报错,以下代码不能经由过程,以是这里选择了先改动再绑定

Liststring> keyList = gpr.FeatureSet.Features[i].Attributes.Keys.ToListstring>();Listobject> valueList = gpr.FeatureSet.Features[i].Attributes.Values.ToList();

graphicsLayer.Graphics[i].Attributes.Add(keyList[j], valueList[j]);}

}//在此绑定DataGrid,不然会呈现非常

MyDataGrid.GraphicsLayer = graphicsLayer;MyDataGrid.Visibility = Visibility.Visible;

//绘制地形图if (createPlot == true)

{CreatePlot();

TerrainBorder.Visibility = Visibility.Visible;}

featureSet.Features.Clear();}

//等待历程BusyRectangle.Visibility = Visibility.Collapsed;

busyIndicator.IsBusy = false;}

private void _geoprocessor_Failed(object sender, TaskFailedEventArgs e)

{MessageBox.Show(e.Error.ToString());

}

#endregion

private void terrainButton_Click(object sender, RoutedEventArgs e)

{myDraw.DrawMode = DrawMode.Polyline;

TerrainBorder.Visibility = Visibility.Collapsed;myDraw.IsEnabled = true;

createPlot = true;}

private void CreatPoint(ESRI.ArcGIS.Client.Geometry.Polyline polyline,int count)

{//默认沿直线构造一百个点

double xStep = (polyline.Paths[0][1].X - polyline.Paths[0][0].X) / count;double yStep = (polyline.Paths[0][1].Y - polyline.Paths[0][0].Y) / count;

interval = Math.Sqrt(xStep * xStep + yStep * yStep);//清空FeatureSet便于之后的GP办事调用

if (featureSet.Features.Count > 0){

featureSet.Features.Clear();}

for (int i = 0; i{

MapPoint mp = new MapPoint(polyline.Paths[0][0].X + i*xStep, polyline.Paths[0][0].Y + i*yStep);mp.SpatialReference = map1.SpatialReference;

Graphic gPoint = new Graphic(){

Symbol = new SimpleMarkerSymbol(){

Color=new SolidColorBrush(Colors.Blue),Size=8,

Style=SimpleMarkerSymbol.SimpleMarkerStyle.Circle},

Geometry=mp,};

featureSet.Features.Add(gPoint);graphicsLayer.Graphics.Add(gPoint);

}}

private void CreatePlot()

{areaSeries1.Points.Clear();

areaSeries1.Points2.Clear();plotModel.Series.Clear();

for (int i = 0; i

{areaSeries1.Points.Add(new DataPoint(interval * i, Convert.ToDouble(graphicsLayer.Graphics[i].Attributes["MAX"])));

areaSeries1.Points2.Add(new DataPoint(interval * i, 0));}

plotModel.Series.Add(areaSeries1);areaSeries1.Title = "海拔";

Myplot.Model = plotModel;createPlot = false;

}

private void Button_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e){

// TODO: Add event handler implementation here.BusyButton.Content = "取消";

}

private void Button_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e){

// TODO: Add event handler implementation here.BusyButton.Content = "正在谋略...";

}

private void BusyButton_Click(object sender, System.Windows.RoutedEventArgs e){

// TODO: Add event handler implementation here.BusyRectangle.Visibility = Visibility.Collapsed;

busyIndicator.IsBusy = false;}

} }

着末的MainPage.xaml代码:

UserControl

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

xmlns:oxy="clr-namespace:OxyPlot.Silverlight;assembly=OxyPlot.Silverlight"xmlns:esri="http://schemas.esri.com/arcgis/client/2009" xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" x:Class="QueryAndStatisticDemo.MainPage"

mc:Ignorable="d"d:DesignHeight="760" d:DesignWidth="960"

>

Grid x:Name="LayoutRoot">Grid.Background>

LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">GradientStop Color="#FF65C0A5" Offset="0"/>

GradientStop Color="#FF1E1E1F" Offset="1"/>GradientStop Color="#FF22555C" Offset="0.428"/>

GradientStop Color="#FF596EA1" Offset="0.681"/>LinearGradientBrush>

Grid.Background>Grid.RowDefinitions>

RowDefinition Height="120"/>RowDefinition Height="*"/>

Grid.RowDefinitions>

esri:Map x:Name="map1" WrapAround="True" VerticalContentAlignment="Stretch" Grid.RowSpan="2" Margin="0">esri:Map.Layers>

esri:LayerCollection>esri:ArcGISDynamicMapServiceLayer Url="http://qzj-pc:6080/arcgis/rest/services/Provinces_Map/HunanMap/MapServer" />

esri:GraphicsLayer ID="QueryResultLayer" Opacity="0.8" MouseLeftButtonDown="GraphicsLayer_MouseLeftButtonDown"/>esri:LayerCollection>

esri:Map.Layers>esri:Map>

Border BorderBrush="Black" BorderThickness="1" Margin="8" CornerRadius="5" Background="#7F94BCE0">Grid>

StackPanel Orientation="Horizontal" HorizontalAlignment="Center">StackPanel VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,10,0">

StackPanel Orientation="Horizontal" HorizontalAlignment="Left">Button x:Name="MorethanButton1" Content="1" Height="23" Width="48" Click="ExpressionButton_Click" />

Button x:Name="LessthanButton2" Content="2" HorizontalAlignment="Left" Height="23" Width="48" Click="ExpressionButton_Click" />Button x:Name="EqualButton1" Content="3" Height="23" Width="43" Click="ExpressionButton_Click" />

StackPanel>StackPanel Orientation="Horizontal" HorizontalAlignment="Left">

Button x:Name="MoreOrEButton1" Content="4" HorizontalAlignment="Left" Height="23" Width="48" Click="ExpressionButton_Click" />Button x:Name="LessOrEqualButton1" Content="5" HorizontalAlignment="Left" Height="23" Width="48" Click="ExpressionButton_Click" />

Button x:Name="LessAndMoreButton1" Content="6" Height="23" Width="43" HorizontalAlignment="Left" Click="ExpressionButton_Click" />StackPanel>

StackPanel Orientation="Horizontal" HorizontalAlignment="Left">Button x:Name="LikeButton1" Content="7" HorizontalAlignment="Left" Height="23" Width="48" Click="ExpressionButton_Click" />

Button x:Name="AndButton1" Content="8" HorizontalAlignment="Left" Height="23" Width="48" Click="ExpressionButton_Click" />Button x:Name="OrButton1" Content="9" Height="23" Width="43" Click="ExpressionButton_Click" />

StackPanel>StackPanel Orientation="Horizontal" HorizontalAlignment="Left">

Button x:Name="NotButton1" Content="0" HorizontalAlignment="Left" Height="23" Width="48" Click="ExpressionButton_Click" />Button x:Name="QoutButton" Content="'" HorizontalAlignment="Left" Height="23" Width="48" ToolTipService.ToolTip="单引号" Click="QoutButton_Click" />

Button x:Name="NoButton" Content="!" Height="23" Width="43" ToolTipService.ToolTip="非运算" Click="NoButton_Click" />StackPanel>

StackPanel>StackPanel VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0">

StackPanel Orientation="Horizontal" Margin="0,10,0,0">TextBlockTextWrapping="Wrap" Text="查询前提:" Height="18" Margin="20,0,0,0" FontSize="14" FontWeight="Bold" Foreground="Red"/>

ComboBox x:Name="QueryTypeCombox" Height="23" Width="130" SelectedIndex="0" Margin="0,0,10,0"/>TextBox x:Name="ExpressionTextBox" TextWrapping="Wrap" Height="27" Margin="0,5,0,0" Width="150" KeyDown="ExpressionTextBox_KeyDown"/>

StackPanel>StackPanel Orientation="Horizontal" Margin="0,10,0,0">

Button x:Name="ExpressionQueryButton" Content="前提查询" Height="30" Width="70" Margin="20,0,0,0" Click="ExpressionQueryButton_Click"/>Button x:Name="SpatialQueryButton" Content="空间查询" Height="30" Width="70" Click="SpatialQueryButton_Click" Margin="10,0,0,0" />

Button Content="绘制地形图" Height="30" x:Name="terrainButton" Width="75" Margin="20,0,0,0" Click="terrainButton_Click"/>StackPanel>

StackPanel>StackPanel VerticalAlignment="Center" HorizontalAlignment="Left" Margin="20,0,20,0">

Button Width="135" Height="23" x:Name="StatisticButton" Content="地形统计" Margin="0,5,0,0" Click="StatisticButton_Click" />Button x:Name="ClearExpressionButton" Content="清空查询语句" Height="23" Width="135" Click="SpatialQueryButton_Click"Margin="0,10,0,0" />

Button Width="135" Height="23" x:Name="ClearGraphicsButton" Content="清空图层" Margin="0,10,0,0" Click="ClearGraphicsButton_Click" />StackPanel>

StackPanel>Grid>

Border>

esri:FeatureDataGrid x:Name="MyDataGrid" HorizontalAlignment="Right" Margin="0,0,20,20" VerticalAlignment="Bottom"

Map="{Binding ElementName=map1}"Width="400" Height="200"

Grid.Column="0" Grid.Row="1"SelectionMode="Single" VerticalGridLinesBrush="#FF31D8D8" HorizontalGridLinesBrush="#FF31B1B1" RowBackground="#AA3C8A99" Visibility="Collapsed" >esri:FeatureDataGrid.Effect>

DropShadowEffect/>esri:FeatureDataGrid.Effect>

esri:FeatureDataGrid.Background>LinearGradientBrush EndPoint="0.894,0.85" StartPoint="-0.076,-0.033">

GradientStop Color="#FF56585E"/>GradientStop Color="#FF1B8D85" Offset="1"/>

LinearGradientBrush>esri:FeatureDataGrid.Background>

esri:FeatureDataGrid>

Border BorderThickness="1" Grid.Row="1" Height="260" HorizontalAlignment="Left" Margin="20" x:Name="TerrainBorder" VerticalAlignment="Bottom" Width="400" CornerRadius="10" Visibility="Collapsed">Border.Effect>

DropShadowEffect/>Border.Effect>

oxy:Plot x:Name="Myplot" Foreground="#FFE9E5E5" >oxy:Plot.Effect>

DropShadowEffect/>oxy:Plot.Effect>

oxy:Plot.Background>LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">

GradientStop Color="#FF0F4549" Offset="0"/>GradientStop Color="#B266AABA" Offset="1"/>

GradientStop Color="#DA8F9EA1" Offset="0.471"/>LinearGradientBrush>

oxy:Plot.Background>oxy:Plot>

Border>Rectangle x:Name="BusyRectangle" Fill="#FF454552" Stroke="Black" Grid.RowSpan="2" Opacity="0.5" Visibility="Collapsed"/>

toolkit:BusyIndicator x:Name="busyIndicator" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" IsBusy="False">toolkit:BusyIndicator.BusyContent>

Grid>Button x:Name="BusyButton" Height="23" Width="199" Content="正在谋略..." MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave" Padding="3" Click="BusyButton_Click"/>

Grid>toolkit:BusyIndicator.BusyContent>

toolkit:BusyIndicator>Grid>

UserControl>

终极的效果:

按县区名称查询双峰县,结果如下图所示:

正在统计双峰县的像元信息

统计结果如下图所示:

您可能还会对下面的文章感兴趣: