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

Method assembleShapes

src/common/overlay/Line.js:81–196  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

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

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