${IS6_GetResourceParameters_Title}

${IS6_GetResourceParameters_Description}

Наследование: ParametersBase
        /// <summary>${IS6_GetResourceService_method_ProcessAsync_D}</summary>
        /// <param name="parameters">${IS6_GetResourceService_method_ProcessAsync_param_parameters}</param>
        /// <param name="state">${IS6_GetResourceService_method_ProcessAsync_param_state}</param>
        public void ProcessAsync(GetResourceParameters parameters, object state)
        {
            if (parameters == null)
            {
                //TODO:资源
                throw new ArgumentNullException(ExceptionStrings.ArgumentIsNull);
                //throw new ArgumentNullException("MeasureParameters is Null");
            }
            if (string.IsNullOrEmpty(this.Url))
            {
                //TODO:资源
                throw new InvalidOperationException(ExceptionStrings.InvalidUrl);
                //throw new InvalidOperationException("Url is not set");
            }

            p = parameters;
            istheme = parameters.ResourceParam.IsTheme;

            base.SubmitRequest(base.Url + "/common.ashx?", GetParameters(parameters),
                new EventHandler<RequestEventArgs>(request_Completed), state, false);
        }
Пример #2
0
        private ResourceType ProcessResourceType(GetResourceParameters param, int i, List<ServerLayer> s, out bool isCustom)
        {
            isCustom = false;
            if (s[i].ServerLayerType == ServerLayerType.Point)
            {
                return ResourceType.SymbolLib;
            }
            else if (s[i].ServerLayerType == ServerLayerType.Line || s[i].ServerLayerType == ServerLayerType.Network)
            {
                return ResourceType.LineStyleLib;
            }
            else if (s[i].ServerLayerType == ServerLayerType.Polygon)
            {
                return ResourceType.FillStyleLib;
            }
            else if (s[i].ServerLayerType == ServerLayerType.Text)
            {
                isCustom = true;
            }

            return param.ResourceParam.ResourceType;
        }
Пример #3
0
        private void AddLegendItems(List<ServerLayer> sls)
        {
            if (sls != null && sls.Count > 0)
            {
                gRoot.Visibility = Visibility.Visible;

                for (int i = 0; i < sls.Count; i++)
                {
                    layerCount = sls.Count;

                    GetResourceParameters param = new GetResourceParameters();
                    param.ResourceParam = new ResourceParam();
                    //判断ResourceType的类型;
                    bool isCustomed;
                    param.ResourceParam.ResourceType = ProcessResourceType(param, i, sls, out isCustomed);
                    //这个属性就是为了图例控件开的;
                    //目的是让图标和图层名对应起来;
                    param.ResourceParam.LayerName = sls[i].Name;
                    layersName = sls[i].Name;

                    //如果这里是自定义类型就不发出请求了;
                    if (!isCustomed)
                    {
                        param.MapName = mapName;
                        param.ResourceParam.Style = sls[i].Style;
                        param.ResourceParam.Height = IconSize;
                        param.ResourceParam.Width = IconSize;
                        param.ResourceParam.ImageFormat = ImageFormat.PNG;
                        GetResourceService ser = new GetResourceService(url);
                        ser.ProcessAsync(param);
                        ser.ProcessCompleted += new EventHandler<GetResourceEventArgs>(ser_ProcessCompleted);

                        if (sls[i].ThemeUnique != null)  //当有专题图时应该将其中显示;
                        {
                            for (int j = 0; j < sls[i].ThemeUnique.Displays.Count; j++)
                            {
                                GetResourceParameters pitems = new GetResourceParameters()
                                {
                                    MapName = mapName,
                                    ResourceParam = new ResourceParam()
                                    {
                                        Height = IconSize,
                                        Width = IconSize,
                                        ImageFormat = ImageFormat.PNG,
                                        LayerName = sls[i].ThemeUnique.ItemCaptions[j],
                                        ResourceType = param.ResourceParam.ResourceType,
                                        Style = sls[i].ThemeUnique.Displays[j],
                                        IsTheme = true,
                                    }
                                };
                                GetResourceService grs = new GetResourceService(url);
                                grs.ProcessAsync(pitems);
                                grs.ProcessCompleted += new EventHandler<GetResourceEventArgs>(ser_ProcessCompleted);
                            }
                        }
                        else if (sls[i].ThemeRange != null)
                        {
                            for (int k = 0; k < sls[i].ThemeRange.BreakValues.Count; k++)
                            {
                                GetResourceParameters pRItems = new GetResourceParameters()
                                {
                                    MapName = mapName,
                                    ResourceParam = new ResourceParam()
                                    {
                                        Height = IconSize,
                                        Width = IconSize,
                                        ImageFormat = ImageFormat.PNG,
                                        IsTheme = true,
                                        ResourceType = param.ResourceParam.ResourceType,
                                        Style = sls[i].ThemeRange.Displays[k],
                                        LayerName = sls[i].ThemeRange.BreakValues[k].ToString()
                                    }
                                };
                                GetResourceService grs = new GetResourceService(url);
                                grs.ProcessAsync(pRItems);
                                grs.ProcessCompleted += new EventHandler<GetResourceEventArgs>(ser_ProcessCompleted);
                            }
                        }
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(ImageUrl))
                        {
                            throw new ArgumentNullException(exInfo2);
                        }

                        if (layersName.Contains("@"))
                        {
                            layersName = layersName.Remove(layersName.IndexOf("@"));
                        }

                        AddImageAndName(ImageUrl, UriKind.Relative, layersName, false);

                    }
                }
            }
        }
        private Dictionary<string, string> GetParameters(GetResourceParameters parameters)
        {
            Dictionary<string, string> dictionary = new Dictionary<string, string>();

            string method = "GetResource";
            dictionary.Add("map", parameters.MapName);
            dictionary.Add("method", method);
            dictionary.Add("resourceParam", ResourceParam.ToJson(parameters.ResourceParam));

            return dictionary;
        }
 /// <summary>${IS6_GetResourceService_method_ProcessAsync_D}</summary>
 /// <overloads>${IS6_GetResourceService_method_ProcessAsync_overloads_D}</overloads>
 /// <param name="parameters">${IS6_GetResourceService_method_ProcessAsync_param_parameters}</param>
 public void ProcessAsync(GetResourceParameters parameters)
 {
     ProcessAsync(parameters, null);
 }