var rb = new rightBottomDatlog();
|
var lineWidth = 0;
|
var leftNUmber = 0;
|
var messageLefWidth = 5;
|
var checkPoint = 0;
|
sgworld = window.external.createSgworld();
|
var arr = [];
|
var rturl = "";
|
$(function () {
|
//var tableName = decodeURI(getUrlParam("Type"));
|
//$.ajax({
|
// url: "../../Ashx/Secondcommon.ashx",
|
// type: "post",
|
// data: { Action: "GetTime", Table: tableName },
|
// dataType: "json",
|
// async: true,
|
// success: function (result) {
|
// $.each(result, function (index, value) {
|
// arr.push(value.Year);
|
// });
|
// if (arr.length > 0) {
|
// sgworld.ProjectTree.SetVisibility("",false);
|
// window.external.createPmDialogDock("右下", url + "chart/chartDL.html?MaxTime=" + arr[arr.length - 1] + "&title=" + getUrlParam("title"), rb.width, rb.height, rb.top, rb.left, rb.bottom, rb.right);
|
// window.external.InvokeScript("右上", "GetYX", arr[arr.length - 1]);
|
// //let ThisId = sgworld.ProjectTree.FindItem(localStorage.getItem("pathName") + "\\" + arr[arr.length - 1]);
|
// //sgworld.ProjectTree.SetVisibility(ThisId,true);
|
// }
|
// if (arr.length <= 1) {
|
// //关闭当前时间轴
|
// setTimeout(function () {
|
// window.external.closeDialog("左下");
|
// }, 100)
|
|
// return false;
|
// } else {
|
// //文本赋值
|
// $(".tname").empty();
|
// $(".tname").append(decodeURI(getUrlParam("title")));
|
// $(".tyear").empty();
|
// $(".tyear").append("(" + (checkPoint + 1) + "/" + arr.length + ")" + arr[arr.length-1] + "年");
|
// checkPoint = arr.length - 1;
|
init();
|
|
// }
|
// }
|
//});
|
|
})
|
|
function init() {
|
arr = [2014,2019,2020];
|
let ThisId = sgworld.ProjectTree.FindItem("专题数据\\地质矿产专题遥感解译产品\\矿山地质环境产品\\格尔木索拉吉尔铜矿\\2020");
|
|
if (ThisId != "") {
|
sgworld.ProjectTree.SetVisibility(ThisId, true);
|
sgworld.Navigate.FlyTo(ThisId);
|
};
|
|
checkPoint = arr.length - 1;
|
|
//如果数组为空
|
if (arr.length == 0) {
|
//关闭时间轴弹窗
|
return false;
|
}
|
|
var w = document.getElementById('line').clientWidth;
|
lineWidth = ((w - (w * 0.25)) / arr.length);
|
var timeZlineHTml = "";
|
var mmessageHtml = "";
|
for (var m = 0; m < arr.length; m++) {
|
timeZlineHTml += '<div class="eline" style="margin-left:' + m * lineWidth +
|
'px;width:' + lineWidth + 'px" ></div><div class="point" data-year="' + arr[m] + '" style="margin-left:' + (m + 1) *
|
lineWidth + 'px"></div>';
|
mmessageHtml += '<div class="pmessage" style="margin-left:' + ((m + 1) * lineWidth - messageLefWidth) + 'px">' + arr[
|
m] +
|
'</div>';
|
|
}
|
if (arr.length > 0) {
|
timeZlineHTml += '<div class="eline" style="margin-left:' + (arr.length * lineWidth) +
|
'px"></div>';
|
}
|
$(".timeZline").empty();
|
$(".timeZline").append(timeZlineHTml + '<div class="eline" style="margin-left:' + m * lineWidth + 'px;width:' + lineWidth + 'px" >)</div>');
|
$(".mmessage").empty();
|
$(".mmessage").append(mmessageHtml);
|
|
|
$(".timeZline").find(".point").eq(checkPoint).append("<img src='img/zhou.png' />");
|
DivClick();
|
leftNUmber = -checkPoint * lineWidth;
|
console.log("initNUmber:" + leftNUmber);
|
//判断div长度是否能容纳时间轴的长度
|
var divWidth = $(".line").width();
|
if (divWidth >= arr.length * lineWidth) {
|
return;
|
} else {
|
|
$(".timeZline").css("margin-left", "" + leftNUmber + "px");
|
$(".mmessage").css("margin-left", "" + leftNUmber - messageLefWidth + "px");
|
}
|
//设置轴的宽度
|
$(".eline").width(lineWidth);
|
}
|
|
|
function DivClick() {
|
var year = "";
|
$(".pre").click(function () {
|
Pre();
|
});
|
|
$(".next").click(function () {
|
Next();
|
});
|
|
//$(".bf").click(function() {
|
// bf();
|
//});
|
|
//点击差号
|
//$(".tclose").click(function () {
|
// window.external.closeDialog("左下");
|
//});
|
|
//上一步
|
function Pre() {
|
//如果定时器在运行,清除定时器
|
if (setTime != null) {
|
window.clearInterval(setTime);
|
$(".bf").attr("src", "./img/bf.png");
|
if (checkPoint > 0) {
|
checkPoint--;
|
}
|
setTime = null;
|
|
}
|
$(".tyear").empty();
|
bfstate = false;
|
|
|
if (checkPoint == 0) {
|
year = $(".timeZline").find(".point").eq(checkPoint).attr("data-year");
|
$(".tyear").append("(" + (checkPoint + 1) + "/" + arr.length + ")" + year + "年");
|
return false;
|
} else {
|
$(".point").empty();
|
$(".timeZline").find(".point").eq(checkPoint - 1).append("<img src='img/zhou.png' />");
|
year = $(".timeZline").find(".point").eq(checkPoint - 1).attr("data-year");
|
$(".tyear").append("(" + checkPoint + "/" + arr.length + ")" + year + "年");
|
checkPoint = checkPoint - 1;
|
}
|
|
|
let ThisId = sgworld.ProjectTree.FindItem("专题数据\\地质矿产专题遥感解译产品\\矿山地质环境产品\\格尔木索拉吉尔铜矿");
|
sgworld.ProjectTree.SetVisibility(ThisId, false);
|
let ThisId1 = sgworld.ProjectTree.FindItem("专题数据\\地质矿产专题遥感解译产品\\矿山地质环境产品\\格尔木索拉吉尔铜矿\\" + year);
|
sgworld.ProjectTree.SetVisibility(ThisId1, true);
|
|
var divWidth = $(".line").width();
|
if (divWidth >= arr.length * lineWidth) {
|
return false;
|
} else {
|
if (leftNUmber == 0 | leftNUmber > 0) {
|
return false;
|
} else {
|
$(".timeZline").css("margin-left", "" + (leftNUmber + lineWidth) + "px");
|
$(".mmessage").css("margin-left", "" + (leftNUmber + lineWidth - messageLefWidth) + "px");
|
leftNUmber = leftNUmber + lineWidth;
|
}
|
}
|
|
}
|
|
//下一步
|
function Next() {
|
if (setTime != null) {
|
window.clearInterval(setTime);
|
$(".bf").attr("src", "./img/bf.png");
|
if (checkPoint > 0) {
|
checkPoint--;
|
}
|
setTime = null;
|
}
|
bfstate = false;
|
|
$(".point").empty();
|
$(".tyear").empty();
|
if ((checkPoint + 1) >= (arr.length - 1)) {
|
$(".timeZline").find(".point").eq(arr.length - 1).append("<img src='img/zhou.png' />");
|
checkPoint = arr.length - 1;
|
year = $(".timeZline").find(".point").eq(arr.length - 1).attr("data-year");
|
|
$(".tyear").append("(" + arr.length + "/" + arr.length + ")" + year + "年");
|
} else {
|
$(".timeZline").find(".point").eq(checkPoint + 1).append("<img src='img/zhou.png' />");
|
checkPoint = checkPoint + 1;
|
year = $(".timeZline").find(".point").eq(checkPoint).attr("data-year");
|
|
$(".tyear").append("(" + (checkPoint + 1) + "/" + arr.length + ")" + year + "年");
|
}
|
|
let ThisId = sgworld.ProjectTree.FindItem("专题数据\\地质矿产专题遥感解译产品\\矿山地质环境产品\\格尔木索拉吉尔铜矿");
|
sgworld.ProjectTree.SetVisibility(ThisId, false);
|
let ThisId1 = sgworld.ProjectTree.FindItem("专题数据\\地质矿产专题遥感解译产品\\矿山地质环境产品\\格尔木索拉吉尔铜矿\\" + year);
|
sgworld.ProjectTree.SetVisibility(ThisId1, true);
|
|
|
var divWidth = $(".line").width();
|
if (divWidth >= arr.length * lineWidth) {
|
return false;
|
} else {
|
if ((Math.abs(leftNUmber) + $(".timeZline").width()) >= arr.length * (lineWidth)) {
|
return false;
|
} else {
|
$(".timeZline").css("margin-left", "" + (leftNUmber - lineWidth) + "px");
|
$(".mmessage").css("margin-left", "" + (leftNUmber - lineWidth - messageLefWidth) + "px");
|
leftNUmber = leftNUmber - lineWidth;
|
}
|
}
|
|
}
|
|
var bfstate = false;
|
var setTime = null;
|
|
function bf() {
|
if (bfstate == false) {
|
//图标发生改变
|
$(".bf").attr("src", "./img/zt.png");
|
leftNUmber = lineWidth;
|
checkPoint = 0;
|
setTime = setInterval(function () {
|
var temNumber = 0;
|
$(".point").empty();
|
$(".tyear").empty();
|
if (checkPoint > (arr.length - 1)) {
|
checkPoint = 0;
|
}
|
$(".timeZline").find(".point").eq(checkPoint).append("<img src='img/zhou.png' />");
|
year = $(".timeZline").find(".point").eq(checkPoint).attr("data-year");
|
$(".tyear").append("(" + (checkPoint + 1) + "/" + arr.length + ")" + year + "年");
|
|
if ((Math.abs(leftNUmber) + $(".timeZline").width()) >= arr.length * (lineWidth)) {
|
//alert("1:" + leftNUmber);
|
leftNUmber = lineWidth;
|
$(".timeZline").css("margin-left", "" + (leftNUmber - lineWidth) + "px");
|
$(".mmessage").css("margin-left", "" + (leftNUmber - lineWidth - messageLefWidth) + "px");
|
//temNumber = lineWidth;
|
|
} else {
|
// alert("2:" + leftNUmber);
|
$(".timeZline").css("margin-left", "" + (leftNUmber - lineWidth) + "px");
|
$(".mmessage").css("margin-left", "" + (leftNUmber - lineWidth - messageLefWidth) + "px");
|
temNumber = leftNUmber - lineWidth;
|
}
|
//window.external.closeDialog("右下");
|
// window.external.createPmDialogDock("右下", url + "chart/chartDLTD.html?MaxTime=" + year, rb.width, rb.height, rb.top, rb.left, rb.bottom, rb.right);
|
//localStorage.setItem("CheckPointYear", year);
|
//sgworld.ProjectTree.SetVisibility("", false);
|
//sgworld.ProjectTree.SetVisibility(sgworld.ProjectTree.FindItem(rturl + "\\" + year), true);
|
leftNUmber = temNumber;
|
checkPoint++;
|
}, 3000);
|
bfstate = true;
|
} else {
|
$(".bf").attr("src", "./img/bf.png");
|
if (setTime != null) {
|
window.clearInterval(setTime);
|
if (checkPoint > 0) {
|
checkPoint--;
|
}
|
setTime = null;
|
}
|
bfstate = false;
|
}
|
|
}
|
|
|
}
|