${REST_ThemeLabelAlongLine_Title}
${REST_ThemeLabelAlongLine_Description}
//此属性重复,需要与刘宏商量。 //public bool IsLabelRepeated //{ // get; // set; //} internal static string ToJson(ThemeLabelAlongLine themeLabelAlongLine) { string json = ""; List<string> list = new List<string>(); list.Add(string.Format("\"alongLine\":{0}", themeLabelAlongLine.IsAlongLine.ToString().ToLower())); list.Add(string.Format("\"alongLineDirection\":\"{0}\"", themeLabelAlongLine.AlongLineDirection)); list.Add(string.Format("\"angleFixed\":{0}", themeLabelAlongLine.AngleFixed.ToString().ToLower())); list.Add(string.Format("\"repeatedLabelAvoided\":{0}", themeLabelAlongLine.RepeatedLabelAvoided.ToString().ToLower())); list.Add(string.Format("\"labelRepeatInterval\":{0}", themeLabelAlongLine.LabelRepeatInterval.ToString())); list.Add(string.Format("\"repeatIntervalFixed\":{0}", themeLabelAlongLine.RepeatIntervalFixed.ToString().ToLower())); json = string.Join(",", list.ToArray()); return json; }
internal static ThemeLabelAlongLine FromJson(JsonObject json) { if (json != null) return null; ThemeLabelAlongLine alongLine = new ThemeLabelAlongLine(); if (json["alongLineDirection"] != null) { alongLine.AlongLineDirection = (AlongLineDirection)Enum.Parse(typeof(AlongLineDirection), json["alongLineDirection"].GetStringEx(), true); } else { //不处理null的情况 } alongLine.AngleFixed = json["angleFixed"].GetBooleanEx(); alongLine.IsAlongLine = json["alongLine"].GetBooleanEx(); alongLine.LabelRepeatInterval = json["labelRepeatInterval"].GetNumberEx(); alongLine.RepeatedLabelAvoided = json["repeatedLabelAvoided"].GetBooleanEx(); alongLine.RepeatIntervalFixed = json["repeatIntervalFixed"].GetBooleanEx(); return alongLine; }
internal static ThemeLabel FromJson(JsonObject json) { if (json == null) return null; ThemeLabel themeLabel = new ThemeLabel(); ThemeLabelAlongLine alongLine = new ThemeLabelAlongLine(); if (json["alongLineDirection"] != null) { alongLine.AlongLineDirection = (AlongLineDirection)Enum.Parse(typeof(AlongLineDirection), json["alongLineDirection"].GetStringEx(), true); } else { //不处理null的情况 } alongLine.AngleFixed = json["angleFixed"].GetBooleanEx(); alongLine.IsAlongLine = json["alongLine"].GetBooleanEx(); alongLine.LabelRepeatInterval = json["labelRepeatInterval"].GetNumberEx(); alongLine.RepeatedLabelAvoided = json["repeatedLabelAvoided"].GetBooleanEx(); alongLine.RepeatIntervalFixed = json["repeatIntervalFixed"].GetBooleanEx(); themeLabel.AlongLine = alongLine; ThemeLabelBackSetting backSetting = new ThemeLabelBackSetting(); if (json["backStyle"] != null) { backSetting.BackStyle = ServerStyle.FromJson(json["backStyle"].GetObjectEx()); } if (json["labelBackShape"] != null) { backSetting.LabelBackShape = (LabelBackShape)Enum.Parse(typeof(LabelBackShape), json["labelBackShape"].GetStringEx(), true); } else { //不处理null的情况 } themeLabel.BackSetting = backSetting; ThemeFlow flow = new ThemeFlow(); flow.FlowEnabled = json["flowEnabled"].GetBooleanEx(); flow.LeaderLineDisplayed = json["leaderLineDisplayed"].GetBooleanEx(); if (json["leaderLineStyle"] != null) { flow.LeaderLineStyle = ServerStyle.FromJson(json["leaderLineStyle"].GetObjectEx()); } themeLabel.Flow = flow; List<ThemeLabelItem> items = new List<ThemeLabelItem>(); if (json["items"].ValueType != JsonValueType.Null && json["items"].GetArray().Count > 0) { for (int i = 0; i < json["items"].GetArray().Count; i++) { items.Add(ThemeLabelItem.FromJson(json["items"].GetArray()[i].GetObjectEx())); } } themeLabel.Items = items; themeLabel.LabelExpression = json["labelExpression"].GetStringEx(); if (json["labelOverLengthMode"].ValueType != JsonValueType.Null) { themeLabel.LabelOverLengthMode = (LabelOverLengthMode)Enum.Parse(typeof(LabelOverLengthMode), json["labelOverLengthMode"].GetStringEx(), true); } else { //不处理null的情况 } //themeLabel.MatrixCells if (json["matrixCells"].ValueType != JsonValueType.Null) { int rowCount = (json["matrixCells"].GetArray()).Count; int columnCount = ((json["matrixCells"].GetArray())[0].GetArray()).Count; LabelMatrixCell[,] matrixCells = new LabelMatrixCell[columnCount, rowCount]; for (int column = 0; column < (json["matrixCells"].GetArray()).Count; column++) { JsonArray cells = (json["matrixCells"].GetArray())[column].GetArray(); for (int row = 0; row < cells.Count; row++) { if (cells[row].GetObjectEx().ContainsKey("height") && cells[row].GetObjectEx().ContainsKey("pathField") && cells[row].GetObjectEx().ContainsKey("rotation") && cells[row].GetObjectEx().ContainsKey("sizeFixed") && cells[row].GetObjectEx().ContainsKey("width")) { matrixCells[row, column] = (LabelImageCell.FromJson(cells[row].GetObjectEx())); } else if (cells[row].GetObjectEx().ContainsKey("style") && cells[row].GetObjectEx().ContainsKey("symbolIDField")) { matrixCells[row, column] = (LabelSymbolCell.FromJson(cells[row].GetObjectEx())); } else if (cells[row].GetObjectEx().ContainsKey("themeLabel")) { matrixCells[row, column] = (LabelThemeCell.FromJson(cells[row].GetObjectEx()["themeLabel"].GetObjectEx())); } } } themeLabel.MatrixCells = matrixCells; } themeLabel.MaxLabelLength = (int)json["maxLabelLength"].GetNumberEx(); themeLabel.NumericPrecision = (int)json["numericPrecision"].GetNumberEx(); themeLabel.Offset = ThemeOffset.FromJson(json); themeLabel.OverlapAvoided = json["overlapAvoided"].GetBooleanEx(); themeLabel.RangeExpression = json["rangeExpression"].GetStringEx(); themeLabel.SmallGeometryLabeled = json["smallGeometryLabeled"].GetBooleanEx(); themeLabel.Text = ThemeLabelText.FromJson(json); return themeLabel; }