package com.xt.hb.server
{
	import com.esri.ags.FeatureSet;
	import com.esri.ags.Graphic;
	
	import mx.controls.Alert;
	import mx.rpc.AsyncResponder;
	
	
	public class QueryAction
	{
		public function QueryAction()
		{
		}
		
		private var layerid:String = null;
		
		private var eventType:String;
		
		private var RETURN_DATA_NUMBER:int = 500;
		
		public function queryLayer(layerId:String,eventFlag:String,
								   where:String = null,isExpectCount:Boolean = false):void
		{
//			queryTask.url="http://192.168.57.74:8399/arcgis/rest/services/hbaq/MapServer/1/";
			//queryTask.query.text=qText.text;
			//queryTask.query.where="STATE_NAME like '%"+qText.text+"%'";
			//设置查询语句
//			query.where="1=1";
			//查询结果是否返回Geometry
//			query.returnGeometry=true;
//			query.spatialRelationship="esriSpatialRelEnvelopeIntersects";
			//设置要查询的字段
//			var fields:Array=new Array();
//			fields.push("OBJECTID");
//			fields.push("STATE_NAME");
//			fields.push("POP2000");
//			queryTask.query.outFields=fields; 
			//进行查询成功调用onResult方法，错误失败调用onFault
//			queryTask.execute(query,new AsyncResponder(onResult,onFault))
		}
		
		//查询成功活进行高亮显示已经数据Grid显示
		private function onResult(featureSet:FeatureSet,token:Object = null):void
		{
			var resultlist:Array=new Array();
			for each(var griphic:Graphic in featureSet.features)
			{
				trace(griphic);
//				myGraphicsLayer.add(griphic);
//				resultlist.push({"ID":griphic.attributes.OBJECTID,"STATE_NAME":griphic.attributes.STATE_NAME})
			}
		}
		
		//查询失败提示
		private function onFault(info:Object, token:Object = null ):void
		{
			//Alert.show(info.toString());
			Alert.show("输入的查询语句不正确！");
		}
	}
}