MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / assembleShapes

Method assembleShapes

src/common/overlay/Point.js:78–168  ·  view source on GitHub ↗

* @function FeatureThemePoint.prototype.Point.assembleShapes * @description 装配图形(扩展接口)。

()

Source from the content-addressed store, hash-verified

76 * @description 装配图形(扩展接口)。
77 */
78 assembleShapes() {
79 // 图表配置对象
80 var sets = this.setting;
81
82 // 默认数据视图框
83 if (!sets.dataViewBoxParameter) {
84 if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
85 sets.dataViewBoxParameter = [45, 15, 15, 15];
86 } else {
87 sets.dataViewBoxParameter = [5, 5, 5, 5];
88 }
89 }
90
91 // 重要步骤:初始化参数
92 if (!this.initBaseParameter()) {
93 return;
94 }
95
96 var dvb = this.dataViewBox;
97
98 // 值域
99 var codomain = this.DVBCodomain;
100 // 重要步骤:定义图表 FeatureThemeBar 数据视图框中单位值的含义
101 this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
102 var uv = this.DVBUnitValue;
103 var fv = this.dataValues;
104
105 // 获取 x 轴上的图形信息
106 var xShapeInfo = this.calculateXShapeInfo();
107 if (!xShapeInfo) {
108 return;
109 }
110 // 折线每个节点的 x 位置
111 var xsLoc = xShapeInfo.xPositions;
112
113 // 背景框,默认启用
114 if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
115 // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
116 this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
117 }
118
119 // 点状图必须使用坐标轴
120 this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
121
122 var xPx; // 图形点 x 坐标
123 var yPx; // 图形点 y 坐标
124 for (var i = 0, len = fv.length; i < len; i++) {
125 // 数据溢出值域检查
126 if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
127 //isDataEffective = false;
128 return null;
129 }
130
131 xPx = xsLoc[i];
132 yPx = dvb[1] - (fv[i] - codomain[0]) / uv;
133
134 // 图形点参数对象
135 var poiSP = new FeaturePoint(xPx, yPx);

Callers

nothing calls this directly

Calls 8

calculateXShapeInfoMethod · 0.95
pushMethod · 0.80
BackgroundMethod · 0.80
GraphAxisMethod · 0.80
ShapeStyleToolMethod · 0.80
createShapeMethod · 0.80
initBaseParameterMethod · 0.45

Tested by

no test coverage detected