${REST_GetFeaturesBySQLParameters_Title}

${REST_GetFeaturesBySQLParameters_Description}

Inheritance: GetFeaturesParametersBase
        private Dictionary<string, string> GetParameters(GetFeaturesBySQLParameters parameters)
        {
            Dictionary<string, string> dictionary = new Dictionary<string, string>();

            dictionary.Add("getFeatureMode", "\"SQL\"");

            if (parameters.DatasetNames != null && parameters.DatasetNames.Count > 0)
            {
                string jsonDatasetNames = "[";
                List<string> list = new List<string>();
                for (int i = 0; i < parameters.DatasetNames.Count; i++)
                {
                    list.Add(string.Format("\"{0}\"", parameters.DatasetNames[i]));
                }
                jsonDatasetNames += string.Join(",", list.ToArray());
                jsonDatasetNames += "]";

                dictionary.Add("datasetNames", jsonDatasetNames);
            }
            if (parameters.MaxFeatures > 0)
            {
                dictionary.Add("maxFeatures", parameters.MaxFeatures.ToString());
            }
            dictionary.Add("queryParameter", FilterParameter.ToJson(parameters.FilterParameter));

            return dictionary;
        }
        /// <summary>${REST_GetFeaturesBySQLService_method_ProcessAsync_D}</summary>
        /// <param name="parameters">${REST_GetFeaturesBySQLService_method_ProcessAsync_param_Parameters}</param>
        /// <param name="state">${REST_GetFeaturesBySQLService_method_ProcessAsync_param_state}</param>
        public async Task<GetFeaturesResult> ProcessAsync(GetFeaturesBySQLParameters parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(ExceptionStrings.ArgumentIsNull);
            }
            if (string.IsNullOrEmpty(this.Url))
            {
                throw new InvalidOperationException(ExceptionStrings.InvalidUrl);
            }

            //base.Url += ".json?returnContent=true";
            base.Url += string.Format(".json?returnContent=true&debug=true&fromIndex={0}&toIndex={1}", parameters.FromIndex, parameters.ToIndex);

            var result = await base.SubmitRequest(base.Url, GetParameters(parameters), true);
            JsonObject jsonObject = JsonObject.Parse(result);
            return GetFeaturesResult.FromJson(jsonObject);
        }
        private async void GetFeaturesBySQLTest_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(MyTextBox.Text) || string.IsNullOrWhiteSpace(MyTextBox.Text))
            {
                await MessageBox.Show("请输入查询条件");
                return;
            }
            GetFeaturesBySQLParameters param = new GetFeaturesBySQLParameters
            {
                DatasetNames = new List<string> { "World:Capitals" },
                FilterParameter = new FilterParameter
                {
                    AttributeFilter = MyTextBox.Text,
                }
            };

            //调用方式1
            try
            {
                GetFeaturesBySQLService ser = new GetFeaturesBySQLService(url);
                var result = await ser.ProcessAsync(param);
                flayer.ClearFeatures();
                if (result.FeatureCount > 0)
                {
                    flayer.AddFeatureSet(result.Features);
                }
                else
                {
                    await MessageBox.Show("查询结果为空");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }