${iServerJava6R_GetFeaturesByGeometryParameters_Title}

${iServerJava6R_GetFeaturesByGeometryParameters_Description}

상속: GetFeaturesParametersBase
 //对目标地物进行查询
 private void queryFeature(SuperMap.Web.Core.Geometry geo)
 {
     GetFeaturesByGeometryParameters param = new GetFeaturesByGeometryParameters
     {
         DatasetNames = new string[] { "Jingjin:Landuse_R" },
         SpatialQueryMode = SpatialQueryMode.INTERSECT,
         Geometry = geo,
     };
     GetFeaturesByGeometryService query = new GetFeaturesByGeometryService(url1);
     query.ProcessAsync(param);
     query.ProcessCompleted += new EventHandler<GetFeaturesEventArgs>(query_ProcessCompleted);
     query.Failed += new EventHandler<ServiceFailedEventArgs>(query_Failed);
 }
        /// <summary>${iServerJava6R_GetFeaturesByGeometryService_method_ProcessAsync_D}</summary>
        /// <param name="parameters">${iServerJava6R_GetFeaturesByGeometryService_method_ProcessAsync_param_Parameters}</param>
        /// <param name="state">${iServerJava6R_GetFeaturesByGeometryService_method_ProcessAsync_param_state}</param>
        public void ProcessAsync(GetFeaturesByGeometryParameters parameters, object state)
        {
            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(System.Globalization.CultureInfo.InvariantCulture, ".json?returnContent=true&debug=true&fromIndex={0}&toIndex={1}", parameters.FromIndex, parameters.ToIndex);

            base.SubmitRequest(base.Url, GetParameters(parameters), new EventHandler<RequestEventArgs>(request_Completed), state, true);
        }
        void DrawCompleted(object sender , DrawEventArgs e)
        {
            if (e.Geometry == null)
            {
                return;
            }

            GetFeaturesByGeometryParameters param = new GetFeaturesByGeometryParameters
            {
                DatasetNames = new List<string> { "World:Countries" } ,
                SpatialQueryMode = SuperMap.Web.iServerJava6R.SpatialQueryMode.INTERSECT ,
                Geometry = e.Geometry
            };

            GetFeaturesByGeometryService service = new GetFeaturesByGeometryService(url);
            service.ProcessCompleted += new EventHandler<GetFeaturesEventArgs>(service_ProcessCompleted);
            service.ProcessAsync(param);
        }
        private Dictionary<string, string> GetParameters(GetFeaturesByGeometryParameters parameters)
        {
            Dictionary<string, string> dictionary = new Dictionary<string, string>();

            if (string.IsNullOrEmpty(parameters.AttributeFilter))
            {
                dictionary.Add("getFeatureMode", "\"SPATIAL\"");
            }
            else
            {
                dictionary.Add("getFeatureMode", "\"SPATIAL_ATTRIBUTEFILTER\"");
                dictionary.Add("attributeFilter", parameters.AttributeFilter);
            }
            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);
            }
            else
            {
                throw new ArgumentNullException(ExceptionStrings.ArgumentIsNull);
            }
            dictionary.Add("spatialQueryMode", parameters.SpatialQueryMode.ToString().ToUpper());

            if (parameters.Geometry != null)
            {
                dictionary.Add("geometry", ServerGeometry.ToJson(Bridge.ToServerGeometry(parameters.Geometry)));
            }
            else
            {
                throw new ArgumentNullException(ExceptionStrings.ArgumentIsNull);
            }

            if (parameters.Fields != null && parameters.Fields.Count > 0)
            {
                FilterParameter fp = new FilterParameter();
                fp.Fields = parameters.Fields;
                dictionary.Add("queryParameter", FilterParameter.ToJson(fp));
            }
            return dictionary;
        }
 /// <summary>${iServerJava6R_GetFeaturesByGeometryService_method_ProcessAsync_D}</summary>
 /// <overloads>${iServerJava6R_GetFeaturesByGeometryService_method_ProcessAsync_overloads_D}</overloads>
 public void ProcessAsync(GetFeaturesByGeometryParameters parameters)
 {
     ProcessAsync(parameters, null);
 }
        private void QueryFeatures_Click(object sender, RoutedEventArgs e)
        {
            //GetFeaturesByIDsParameters param = new GetFeaturesByIDsParameters
            //{
            //    DatasetNames = new string[] { "World:Capital", "World:World" },
            //    IDs = new int[] { 2, 3, 5 },
            //    Fields = new string[] { "SmID" },
            //    FromIndex = 1,
            //    ToIndex = 10
            //};

            //GetFeaturesByIDsService queryFeaturesService = new GetFeaturesByIDsService(dataqueryurl);
            //queryFeaturesService.ProcessAsync(param);
            //queryFeaturesService.Failed += this.Failed;
            //queryFeaturesService.ProcessCompleted += new EventHandler<GetFeaturesEventArgs>(queryFeaturesService_ProcessCompleted);

            GetFeaturesByGeometryParameters geoParam = new GetFeaturesByGeometryParameters
            {
                Geometry = new GeoPoint(42, 21.5),
                DatasetNames = new string[] { "World:Capital", "World:World" },
                SpatialQueryMode = SpatialQueryMode.DISJOINT,
                FromIndex = 0,
                ToIndex = 10
            };
            GetFeaturesByGeometryService queryFeaturesService = new GetFeaturesByGeometryService(dataqueryurl);
            queryFeaturesService.ProcessAsync(geoParam);
            queryFeaturesService.Failed += this.Failed;
            queryFeaturesService.ProcessCompleted += new EventHandler<GetFeaturesEventArgs>(queryFeaturesService_ProcessCompleted);

            //GetFeaturesBySQLParameters sqlParam = new GetFeaturesBySQLParameters
            //{
            //    DatasetNames = new string[] { "World:Capital", "World:World" },
            //    FilterParameter = new FilterParameter
            //    {
            //        Name = "World@World",
            //        AttributeFilter = "SmID=42",
            //        Fields = new string[] { "SmID" },
            //    }
            //};
            //GetFeaturesBySQLService queryFeaturesService = new GetFeaturesBySQLService(dataqueryurl);
            //queryFeaturesService.ProcessAsync(sqlParam);
            //queryFeaturesService.Failed += this.Failed;
            //queryFeaturesService.ProcessCompleted += new EventHandler<GetFeaturesEventArgs>(queryFeaturesService_ProcessCompleted);

            //GetFeaturesByBufferParameters bufferParam = new GetFeaturesByBufferParameters
            //{
            //    DatasetNames = new string[] { "World:Capital", "World:World" },
            //    Geometry = new GeoPoint(42, 21.5),
            //    BufferDistance = 10,
            //    //AttributeFilter = "SmID<10"
            //};
            //GetFeaturesByBufferService queryFeaturesService = new GetFeaturesByBufferService(dataqueryurl);
            //queryFeaturesService.ProcessAsync(bufferParam);
            //queryFeaturesService.Failed += this.Failed;
            //queryFeaturesService.ProcessCompleted += new EventHandler<GetFeaturesEventArgs>(queryFeaturesService_ProcessCompleted);
        }