"点查" onclick="SMISActionStart('MapControl1','POINTQUERY');"
"框查" onclick="SMISActionStart('MapControl1','RECTQUERY');"
"圆查" onclick="SMISActionStart('MapControl1','CIRCLEQUERY');"
"多边形查" onclick="SMISActionStart('MapControl1','POLYGONQUERY');"
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
//引用的空间
using SuperMap.IS.Utility;
using SuperMap.IS.WebControls;
namespace test
{
/// <summary>
/// WebForm1 的摘要说明。
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected SuperMap.IS.WebControls.MapControl MapControl1;
protected SuperMap.IS.WebControls.ToolbarControl ToolbarControl1;
protected SuperMap.IS.WebControls.ViewEntireToolControl ViewEntireToolControl1;
protected SuperMap.IS.WebControls.QuickZoomInToolControl QuickZoomInToolControl1;
protected SuperMap.IS.WebControls.QuickZoomOutToolControl QuickZoomOutToolControl1;
protected SuperMap.IS.WebControls.PanToolControl PanToolControl1;
protected SuperMap.IS.WebControls.ZoomInToolControl ZoomInToolControl1;
protected SuperMap.IS.WebControls.ZoomOutToolControl ZoomOutToolControl1;
protected SuperMap.IS.WebControls.ViewPreviousToolControl ViewPreviousToolControl1;
protected SuperMap.IS.WebControls.ViewNextToolControl ViewNextToolControl1;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected SuperMap.IS.WebControls.OverviewControl OverviewControl1;
protected SuperMap.IS.WebControls.LayerControl LayerControl1;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Button Button1;
private void Page_Load(object sender, System.EventArgs e)
{
this.MapControl1.ClearHighLight();
if(!Page.IsPostBack)
{
this.TextBox1.Text="伪皇宫";
}
// 在此处放置用户代码以初始化页面
}
Web 窗体设计器生成的代码
private void Button1_Click(object sender, System.EventArgs e)
{
QueryParam q=new QueryParam();// 定义一个New查询参数设置对象queryParam,查询参数设置,包括查询
// 的图层、 查询条件语句以及返回的字段等, 然后根据查询参数进行SQL查询
q.IsAllLayer=false;// 设置是否查询地图中所有的图层信息,如果该值设置为false,则需要对每一个
// 待查询的图层分别进行查询条件的设置
q.Layers=new QueryLayer[1];
q.Layers[0]=new QueryLayer(); // 设置查询图层的对象
q.Layers[0].Name="Park@changchun";//“图层@地图”
q.Layers[0].ReturnFields=new string[2]; // 设置查询结果中需要返回那些属性字段
q.Layers[0].ReturnFields[0]="SMID";
q.Layers[0].ReturnFields[1]="name";
q.Layers[0].WhereClause="name like '*"+this.TextBox1.Text.ToString()+"*'";
ResultSet rs=this.MapControl1.QueryBySQL(q);
DataSet ds=rs.ToDataSet();
this.DataGrid1.DataSource=ds;
this.DataGrid1.DataBind();
}
//查询前触发
private void MapControl1_Querying(object sender, SuperMap.IS.WebControls.EventArguments.QueryingEventArgs e)
{
e.Params.HasGeometry=false; //是否查询空间数据。
// True,表示要取空间数据; False ,表示不取空间数据
e.Params.IsAllLayer=false;
e.Params.Highlight=true;
e.Params.Layers=new QueryLayer[1];
e.Params.Layers[0]=new QueryLayer();
e.Params.Layers[0].Name="Park@changchun";
e.Params.Layers[0].ReturnFields=new string[2];
e.Params.Layers[0].ReturnFields[0]="SMID";
e.Params.Layers[0].ReturnFields[1]="name";
}
//查询后返回数据
private void MapControl1_QueryCompleted(object sender, SuperMap.IS.WebControls.EventArguments.QueryCompletedEventArgs e)
{
ResultSet rs=new ResultSet();
rs.Recordsets=e.Recordsets;
DataSet ds=rs.ToDataSet();
this.DataGrid1.DataSource=ds;
this.DataGrid1.DataBind();
}
}
}



浙公网安备 33010602011771号