* @function Grid.prototype.fromJson * @description 将服务端 JSON 对象转换成当前客户端对象。 * @param {Object} jsonObject - 要转换的 JSON 对象。
(jsonObject)
| 154 | * @param {Object} jsonObject - 要转换的 JSON 对象。 |
| 155 | */ |
| 156 | fromJson(jsonObject) { |
| 157 | super.fromJson(jsonObject); |
| 158 | if (this.specialColor) { |
| 159 | this.specialColor = new ServerColor(this.specialColor.red, |
| 160 | this.specialColor.green, |
| 161 | this.specialColor.blue); |
| 162 | } |
| 163 | if (this.colors) { |
| 164 | var colors = [], |
| 165 | color; |
| 166 | for (var i in this.colors) { |
| 167 | color = this.colors[i]; |
| 168 | colors.push(new ServerColor(color.red, color.green, color.blue)); |
| 169 | } |
| 170 | this.colors = colors; |
| 171 | } |
| 172 | if (this.dashStyle) { |
| 173 | this.dashStyle = new ServerStyle(this.dashStyle); |
| 174 | } |
| 175 | if (this.solidStyle) { |
| 176 | this.solidStyle = new ServerStyle(this.solidStyle); |
| 177 | } |
| 178 | if (this.colorDictionary) { |
| 179 | var colorDics = [], |
| 180 | colorDic; |
| 181 | for (var key in this.colorDictionary) { |
| 182 | colorDic = this.colorDictionary[key]; |
| 183 | colorDics.push(new ColorDictionary({elevation: key, color: colorDic})); |
| 184 | } |
| 185 | this.colorDictionarys = colorDics; |
| 186 | } |
| 187 | delete this.colorDictionary; |
| 188 | } |
| 189 | |
| 190 | /** |
| 191 | * @function Grid.prototype.toServerJSONObject |
no test coverage detected