${IS6_ThemeLable_Title}

${IS6_ThemeLable_Description}

Inheritance: Theme
コード例 #1
0
        //对1994年人口字段制作标签专题图
        private void commit_Click(object sender, RoutedEventArgs e)
        {
            ThemeLabel label = new ThemeLabel()
            {
                Caption = "标签专题图",
                Expression = "Country",
                Display = new ServerTextStyle()
                {
                    FontHeight = 5,
                    FontWidth = 0,
                    Color = new ServerColor(100, 100, 220),
                    FontName = "微软雅黑" ,
                },
                AutoAvoidOverlapped = true,
            };

            ThemeParameters parameters = new ThemeParameters()
            {
                MapName = "World",
                Theme = label,
                LayerNames = layerNames,
                ThemeLayer = "World@world"
            };

            ThemeService service = new ThemeService("http://localhost/IS/AjaxDemo");
            service.ProcessAsync(parameters);
            service.Failed += new EventHandler<ServiceFailedEventArgs>(service_Failed);
            service.ProcessCompleted += new EventHandler<ThemeEventArgs>(service_ProcessCompleted);
        }
コード例 #2
0
        //制作满足条件国家的人口密度专题图,并显示国家标签
        private void commit_Click(object sender, RoutedEventArgs e)
        {
            //标签专题图
            ThemeLabel label = new ThemeLabel()
            {
                Caption = "标签专题图",
                Expression = "Country",
                Display = new ServerTextStyle()
                {
                    FontHeight = 10,
                    FontWidth = 0,
                    Color = new ServerColor(0, 0, 0),
                    FontName = "微软雅黑"
                },
                Filter = "SmID > 220",
            };

            ThemeDotDensity dotDensity = new ThemeDotDensity()
            {
                Caption = "点密度专题图",
                Expression = "Pop_1994",
                DotStyle = new ServerStyle()
                {
                    SymbolSize = 20,
                    SymbolStyle = 1,
                },
                DotValue = 11281396.89000,
                Filter = "SmID > 220",
            };

            CompositeParam composite = new CompositeParam()
            {
                ThemeLayer = "World@world",
                Themes = new List<Theme> { label, dotDensity },
            };

            CompositeThemeParameters parameters = new CompositeThemeParameters()
            {
                LayerNames = layerNames,
                MapName = "World",
                ParamList = new List<CompositeParam>(){composite},
            };

            //与服务器交互
            CompositeThemeService service = new CompositeThemeService("http://localhost/IS/AjaxDemo");
            service.ProcessAsync(parameters);
            service.Failed += new EventHandler<ServiceFailedEventArgs>(service_Failed);
            service.ProcessCompleted += new EventHandler<ThemeEventArgs>(service_ProcessCompleted);
        }
コード例 #3
0
        internal static string ToJson(ThemeLabel param)
        {
            if (param == null)
            {
                return null;
            }
            string json = "{";
            List<string> list = new List<string>();

            list.Add(string.Format("\"alongLine\":{0}", param.AlongLine.ToString().ToLower()));
            if (null != param.Display)
            {
                list.Add(string.Format("\"display\":{0}", ServerTextStyle.ToJson(param.Display)));
            }
            else
            {
                list.Add("\"display\":null");
            }
            list.Add(string.Format("\"enableFlow\":{0}", param.EnableFlow.ToString().ToLower()));

            if (!string.IsNullOrEmpty(param.Expression))
            {
                list.Add(string.Format("\"expression\":\"{0}\"", param.Expression));
            }

            list.Add(string.Format("\"fixedAngle\":{0}", param.FixedAngle.ToString().ToLower()));
            list.Add(string.Format("\"onTop\":{0}", param.OnTop.ToString().ToLower()));
            list.Add(string.Format("\"ignoreSmallObject\":{0}", param.IgnoreSmallObject.ToString().ToLower()));
            list.Add(string.Format("\"singleLineCharCount\":{0}", param.SingleLineCharCount));
            list.Add(string.Format("\"textControlMode\":{0}", (int)param.TextControlMode));
            list.Add(string.Format("\"fixedRepeatLength\":{0}", param.FixedRepeatLength.ToString().ToLower()));
            list.Add(string.Format("\"repeatLength\":{0}", param.RepeatLength));
            list.Add(string.Format("\"textSpacing\":{0}", param.TextSpacing));

            if (!string.IsNullOrEmpty(param.NumericFormat))
            {
                list.Add(string.Format("\"numericFormat\":\"{0}\"", param.NumericFormat));
            }
            else
            {
                list.Add("\"numericFormat\":\"\"");
            }

            list.Add(string.Format("\"backShape\":{0}", (int)param.BackShape));
            //这个属性只有Json中有,文档中没有体现,所以先不开出来;
            list.Add("\"backType\":0");

            if (param.BackStyle != null)
            {
                list.Add(string.Format("\"backStyle\":{0}", ServerStyle.ToJson(param.BackStyle)));
            }
            else
            {
                list.Add("\"backStyle\":null");
            }

            list.Add(string.Format("\"maxObjectCount\":{0}", param.MaxObjectCount));
            list.Add(string.Format("\"lineDirection\":{0}", (int)param.LineDirection));

            if (!string.IsNullOrEmpty(param.OffsetXExpression))
            {
                list.Add(string.Format("\"offsetXExpression\":\"{0}\"", param.OffsetXExpression));
            }
            else
            {
                list.Add("\"offsetXExpression\":\"\"");
            }

            if (!string.IsNullOrEmpty(param.OffsetYExpression))
            {
                list.Add(string.Format("\"offsetYExpression\":\"{0}\"", param.OffsetYExpression));
            }
            else
            {
                list.Add("\"offsetYExpression\":\"\"");
            }
            list.Add(string.Format("\"offsetFixed\":{0}", param.OffsetFixed.ToString().ToLower()));
            list.Add(string.Format("\"autoAvoidOverlapped\":{0}", param.AutoAvoidOverlapped.ToString().ToLower()));

            if (param.AutoAvoidPriority != null)
            {
                list.Add(string.Format("\"autoAvoidPriority\":{0}", LabelAvoidPriority.ToJson(param.AutoAvoidPriority)));
            }
            else
            {
                list.Add("\"autoAvoidPriority\":{}");
            }

            list.Add(string.Format("\"onTopPriority\":{0}", param.OnTopPriority));

            json += string.Join(",", list.ToArray());
            json += ",";
            json += Theme.AddList(param);
            json += "}";

            return json;
        }
コード例 #4
0
        /// <summary>${IS6_ThemeLable_method_FromJson_D}</summary>
        /// <returns>${IS6_ThemeLable_method_FromJson_return}</returns>
        /// <param name="jsonObject">${IS6_ThemeLable_method_FromJson_param_jsonObject}</param>
        public static ThemeLabel FromJson(JsonObject jsonObject)
        {
            if (jsonObject == null)
            {
                return null;
            }
            ThemeLabel result = new ThemeLabel
            {
                Expression = (string)jsonObject["expression"],
                Display = ServerTextStyle.FromJson((JsonObject)jsonObject["display"]),
                AlongLine = (bool)jsonObject["alongLine"],
                EnableFlow = (bool)jsonObject["enableFlow"],
                FixedAngle = (bool)jsonObject["fixedAngle"],
                OnTop = (bool)jsonObject["onTop"],
                IgnoreSmallObject = (bool)jsonObject["ignoreSmallObject"],
                SingleLineCharCount = (int)jsonObject["singleLineCharCount"],
                TextControlMode = (TextControlMode)(int)jsonObject["textControlMode"],
                FixedRepeatLength = (bool)jsonObject["fixedRepeatLength"],
                RepeatLength = (int)jsonObject["repeatLength"],
                TextSpacing = (double)jsonObject["textSpacing"],
                NumericFormat = (string)jsonObject["numericFormat"],
                BackShape = (TextBackShape)(int)jsonObject["backShape"],
                BackStyle = ServerStyle.FromJson((JsonObject)jsonObject["backStyle"]),
                MaxObjectCount = (int)jsonObject["maxObjectCount"],
                LineDirection = (LabelLineDirection)(int)jsonObject["lineDirection"],
                AutoAvoidOverlapped = (bool)jsonObject["autoAvoidOverlapped"],
                OffsetFixed = (bool)jsonObject["offsetFixed"],
                OnTopPriority = (int)jsonObject["onTopPriority"],
                OffsetXExpression = (string)jsonObject["offsetXExpression"],
                OffsetYExpression = (string)jsonObject["offsetYExpression"],
                AutoAvoidPriority = LabelAvoidPriority.FromJson((JsonObject)jsonObject["autoAvoidPriority"]),

                Caption = (string)jsonObject["caption"],
                Filter = (string)jsonObject["filter"],
                MaxScale = (double)jsonObject["maxScale"],
                MinScale = (double)jsonObject["minScale"],
                ForeignDataParam = ForeignDataParam.FromJson((JsonObject)jsonObject["foreignDataParam"])

            };

            return result;
        }