MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / pointToTF

Method pointToTF

src/common/overlay/ThemeVector.js:360–400  ·  view source on GitHub ↗

* @function FeatureThemeVector.prototype.pointToTF * @description 转换点要素。 * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 Point。

(geometry)

Source from the content-addressed store, hash-verified

358 * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 Point。
359 */
360 pointToTF(geometry) {
361 //参考位置,参考中心为
362 var location = this.location;
363 //geometry 像素坐标
364 var localLX = this.getLocalXY(geometry);
365
366 //赋 style
367 var style = new Object();
368 style.r = 6; //防止漏设此参数,默认 6 像素
369 style = CommonUtil.copyAttributesWithClip(style, this.style);
370 style.x = localLX[0] - location[0];
371 style.y = localLX[1] - location[1];
372
373 //创建图形
374 var shape = new SmicPoint({
375 style: style,
376 clickable: this.isClickAble,
377 hoverable: this.isHoverAble
378 });
379
380 //设置高亮样式
381 if (this.highlightStyle) {
382 shape.highlightStyle = this.highlightStyle;
383 }
384
385 //设置参考中心,指定图形位置
386 shape.refOriginalPosition = location;
387
388 //储存数据 id 属性,用于事件
389 shape.refDataID = this.data.id;
390
391 //储存数据 id 属性,用于事件-多图形同时高亮
392 shape.isHoverByRefDataID = this.isMultiHover;
393
394 //修改一些 shape 可选属性,通常不需要这么做
395 if (this.shapeOptions) {
396 CommonUtil.copyAttributesWithClip(shape, this.shapeOptions);
397 }
398
399 this.shapes.push(shape);
400 }
401
402
403 /**

Callers 1

constructorMethod · 0.95

Calls 2

getLocalXYMethod · 0.95
pushMethod · 0.80

Tested by

no test coverage detected