提交 eeb3c823 编写于 作者: K kener

代码规范

添加地图数据忽略jshint检查
上级 6740cac7
src/util/mapData/china/*
src/util/mapData/rawData/china/*
\ No newline at end of file
......@@ -611,7 +611,6 @@ define(function(require) {
/**
* 构造函数默认执行的初始化方法,也用于创建实例后动态修改
* @param {Object} newZr
* @param {Object} newSeries
* @param {Object} newComponent
*/
......@@ -647,7 +646,6 @@ define(function(require) {
var serie;
var seriesIndex;
var dataIndex;
var categoryAxis;
for (var i = self.shapeList.length - 1; i >= 0; i--) {
seriesIndex = ecData.get(self.shapeList[i], 'seriesIndex');
if (aniMap[seriesIndex] && !aniMap[seriesIndex][3]) {
......@@ -663,7 +661,7 @@ define(function(require) {
zr.delShape(self.shapeList[i].id);
continue;
}
else if (!aniMap[seriesIndex][2] && dataIndex == 0) {
else if (!aniMap[seriesIndex][2] && dataIndex === 0) {
// 队尾加入删除头部
zr.delShape(self.shapeList[i].id);
continue;
......
......@@ -370,7 +370,6 @@ define(function(require) {
/**
* 构造函数默认执行的初始化方法,也用于创建实例后动态修改
* @param {Object} newZr
* @param {Object} newSeries
* @param {Object} newComponent
*/
......@@ -402,11 +401,9 @@ define(function(require) {
var x;
var dx;
var y;
var dy;
var serie;
var seriesIndex;
var dataIndex;
var categoryAxis;
for (var i = 0, l = self.shapeList.length; i < l; i++) {
seriesIndex = self.shapeList[i]._seriesIndex;
if (aniMap[seriesIndex] && !aniMap[seriesIndex][3]) {
......@@ -421,7 +418,7 @@ define(function(require) {
zr.delShape(self.shapeList[i].id);
continue;
}
else if (!aniMap[seriesIndex][2] && dataIndex == 0) {
else if (!aniMap[seriesIndex][2] && dataIndex === 0) {
// 队尾加入删除头部
zr.delShape(self.shapeList[i].id);
continue;
......
......@@ -703,7 +703,6 @@ define(function(require) {
/**
* 构造函数默认执行的初始化方法,也用于创建实例后动态修改
* @param {Object} newZr
* @param {Object} newSeries
* @param {Object} newComponent
*/
......@@ -736,7 +735,6 @@ define(function(require) {
var dx;
var y;
var dy;
var serie;
var seriesIndex;
var pointList;
var isHorizontal; // 是否横向布局, isHorizontal;
......@@ -806,7 +804,7 @@ define(function(require) {
continue;
}
else if (!aniMap[seriesIndex][2]
&& self.shapeList[i]._dataIndex == 0
&& self.shapeList[i]._dataIndex === 0
) {
// 队尾加入删除头部
zr.delShape(self.shapeList[i].id);
......
......@@ -150,7 +150,7 @@ define(function(require) {
}
zr.refresh();
}
}
};
}
/**
......@@ -842,7 +842,6 @@ define(function(require) {
/**
* 构造函数默认执行的初始化方法,也用于创建实例后动态修改
* @param {Object} newZr
* @param {Object} newSeries
* @param {Object} newComponent
*/
......
......@@ -640,7 +640,6 @@ define(function(require) {
/**
* 构造函数默认执行的初始化方法,也用于创建实例后动态修改
* @param {Object} newZr
* @param {Object} newSeries
* @param {Object} newComponent
*/
......@@ -838,8 +837,8 @@ define(function(require) {
.when(
400,
{
xStart :targeSector.style.xStart,
yStart :targeSector.style.yStart,
xStart:targeSector.style.xStart,
yStart:targeSector.style.yStart,
xEnd : targeSector.style.xEnd,
yEnd : targeSector.style.yEnd
}
......
此差异已折叠。
......@@ -896,7 +896,7 @@ define(function(require) {
legendDataIdx = zrUtil.indexOf(
_optionBackup.legend.data,
data.name
)
);
legendDataIdx != -1
&& (
_optionRestore.legend.data.splice(
......@@ -905,7 +905,7 @@ define(function(require) {
_optionBackup.legend.data.splice(
legendDataIdx, 1
)
)
);
}
_selectedMap[additionData] = true;
}
......
......@@ -21,17 +21,17 @@ define(function(require) {
for (var c = 0; c < coordinates.length; c++) {
var coordinate = coordinates[c];
if (feature.geometry.type === "Polygon") {
if (feature.geometry.type === 'Polygon') {
coordinates[c] = decodePolygon(
coordinate,
feature.geometry.encodeOffsets[c]
encodeOffsets[c]
);
} else if (feature.geometry.type === "MultiPolygon") {
} else if (feature.geometry.type === 'MultiPolygon') {
for (var c2 = 0; c2 < coordinate.length; c2++) {
var polygon = coordinate[c2];
coordinate[c2] = decodePolygon(
polygon,
feature.geometry.encodeOffsets[c][c2]
encodeOffsets[c][c2]
);
}
}
......@@ -48,7 +48,7 @@ define(function(require) {
var prevY = encodeOffsets[1];
for (var i = 0; i < coordinate.length; i+=2) {
var x = coordinate.charCodeAt(i) - 64
var x = coordinate.charCodeAt(i) - 64;
var y = coordinate.charCodeAt(i+1) - 64;
// ZigZag decoding
x = (x >> 1) ^ (-(x & 1));
......
// https://docs.google.com/presentation/d/1XgKaFEgPIzF2psVgY62-KnylV81gsjCWu999h4QtaOE/
var fs = require("fs");
var requirejs = require("requirejs");
var glob = require("glob");
//docs.google.com/presentation/d/1XgKaFEgPIzF2psVgY62-KnylV81gsjCWu999h4QtaOE/
var fs = require('fs');
var requirejs = require('requirejs');
var glob = require('glob');
glob("china/*.js", {}, function(er, files) {
glob('china/*.js', {}, function(er, files) {
files.forEach(function(file) {
if (file.indexOf('_unicode') >=0 ) {
return;
}
var output = "../" + file;
var output = '../' + file;
requirejs([file], function(json){
// Meta tag
json.UTF8Encoding = true;
......@@ -17,27 +17,33 @@ glob("china/*.js", {}, function(er, files) {
features.forEach(function(feature){
var encodeOffsets = feature.geometry.encodeOffsets = [];
var coordinates = feature.geometry.coordinates;
if (feature.geometry.type === "Polygon") {
if (feature.geometry.type === 'Polygon') {
coordinates.forEach(function(coordinate, idx){
coordinates[idx] = encodePolygon(coordinate, encodeOffsets[idx] = []);
coordinates[idx] = encodePolygon(
coordinate, encodeOffsets[idx] = []
);
});
} else if(feature.geometry.type === "MultiPolygon") {
} else if(feature.geometry.type === 'MultiPolygon') {
coordinates.forEach(function(polygon, idx1){
encodeOffsets[idx1] = [];
polygon.forEach(function(coordinate, idx2) {
coordinates[idx1][idx2] = encodePolygon(coordinate, encodeOffsets[idx1][idx2] = []);
})
coordinates[idx1][idx2] = encodePolygon(
coordinate, encodeOffsets[idx1][idx2] = []
);
});
});
}
});
fs.writeFileSync(output, addAMDWrapper(JSON.stringify(json)), "utf8");
fs.writeFileSync(
output, addAMDWrapper(JSON.stringify(json)), 'utf8'
);
});
});
});
function encodePolygon(coordinate, encodeOffsets) {
var result = "";
var result = '';
var prevX = quantize(coordinate[0][0]);
var prevY = quantize(coordinate[0][1]);
......@@ -58,15 +64,15 @@ function encodePolygon(coordinate, encodeOffsets) {
}
function addAMDWrapper(jsonStr) {
return ["define(function() {",
" return " + jsonStr + ";",
"});"].join("\n");
return ['define(function() {',
' return ' + jsonStr + ';',
'});'].join('\n');
}
function encode(val, prev){
// Quantization
val = quantize(val);
var tmp = val;
// var tmp = val;
// Delta
val = val - prev;
// ZigZag
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册