if (Yonlink.Export == true) {
$("#exportPoint").show();
$("#exportPoint").unbind().click(function () {
var _txt = "";
var pointIndex = [];
if (queryResult) {
for (var n = 0; n < queryResult.length; n++) {
pointStr = queryResult[n].geometry.rings[0];
pointIndex[n] = pointStr.length;
var indexNum = 0;
for (let k = 0; k < pointIndex.length - 1; k++) {
indexNum += pointIndex[k];
}
for (var m = 0; m < pointStr.length; m++) {
var xStr = pointStr[m][0].toFixed(4);
var yStr = pointStr[m][1].toFixed(4);
if (n > 1) {
_txt += indexNum + m + 1 + "," + "0," + yStr + "," + xStr + ",0";
_txt += "<br>";
} else if (n == 1) {
_txt += pointIndex[0] + m + 1 + "," + "0," + yStr + "," + xStr + ",0";
_txt += "<br>";
} else {
_txt += m + 1 + "," + "0," + yStr + "," + xStr + ",0";
_txt += "<br>";
}
}
}
var isIE = !!window.ActiveXObject || "ActiveXObject" in window;
if (isIE) {
var strHTML = _txt
var winSave = window.open();
winSave.document.open("text", "utf-8");
winSave.document.write(strHTML);
winSave.document.execCommand("SaveAs", true, "coordinate.txt");
winSave.close();
} else {
var elHtml = _txt;
var mimeType = 'text/plain';
$('#createInvote').attr('href', 'data:' + mimeType + ';charset=utf-8,' + encodeURIComponent(elHtml));
document.getElementById('createInvote').click();
}
}
})
}
网友评论