* @function FeatureThemeVector.prototype.multiPointToTF * @description 转多点要素。 * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiPoint。
(geometry)
| 244 | * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiPoint。 |
| 245 | */ |
| 246 | multiPointToTF(geometry) { |
| 247 | /* //-- 不抽稀 |
| 248 | var components = geometry.components; |
| 249 | |
| 250 | for(var i = 0; i < components.length; i++){ |
| 251 | var components_i = components[i]; |
| 252 | this.pointToTF(components_i); |
| 253 | } |
| 254 | */ |
| 255 | |
| 256 | var components = geometry.components; |
| 257 | |
| 258 | //节点像素坐标 |
| 259 | var localLX = []; |
| 260 | //参考位置,参考中心为 |
| 261 | var refLocal = []; |
| 262 | var location = this.location; |
| 263 | var pointList = []; |
| 264 | |
| 265 | //节点抽稀距离 |
| 266 | var nCPx = this.nodesClipPixel; |
| 267 | |
| 268 | for (var i = 0; i < components.length; i++) { |
| 269 | var components_i = components[i]; |
| 270 | refLocal = []; |
| 271 | localLX = this.getLocalXY(components_i); |
| 272 | |
| 273 | refLocal[0] = localLX[0] - location[0]; |
| 274 | refLocal[1] = localLX[1] - location[1]; |
| 275 | |
| 276 | //抽稀 |
| 277 | if (pointList.length > 0) { |
| 278 | var lastLocalXY = pointList[pointList.length - 1]; |
| 279 | if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) { |
| 280 | continue; |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | //使用参考点 |
| 285 | pointList.push(refLocal); |
| 286 | |
| 287 | //赋 style |
| 288 | var style = new Object(); |
| 289 | style.r = 6; //防止漏设此参数,默认 6 像素 |
| 290 | style = CommonUtil.copyAttributesWithClip(style, this.style); |
| 291 | style.x = refLocal[0]; |
| 292 | style.y = refLocal[1]; |
| 293 | |
| 294 | //创建图形 |
| 295 | var shape = new SmicPoint({ |
| 296 | style: style, |
| 297 | clickable: this.isClickAble, |
| 298 | hoverable: this.isHoverAble |
| 299 | }); |
| 300 | |
| 301 | //设置高亮样式 |
| 302 | if (this.highlightStyle) { |
| 303 | shape.highlightStyle = this.highlightStyle; |
no test coverage detected