cccreator / GIS

Gis releated
1 stars 0 forks source link

获取鼠标点击位置,dojo.js显示弹窗,js Accumulation #3

Open cccreator opened 6 years ago

cccreator commented 6 years ago
function onMouseBusInfoSz(e) {
    if (dojo.byId("stationTextSz") != null) { //如果存在对应id的div
        dojo.byId("gis_Map").removeChild(dojo.byId("stationTextSz")); //删除div
    }
    var carNo = e.graphic.attributes.carno;
    map.setMapCursor("pointer"); //手型鼠标样式,默认是default
    var scrPt = map.toScreen(e.graphic.geometry); //鼠标所指对象的屏幕坐标
    xPositionForCancel = e.pageX;//记录点击车辆时屏幕坐标x
    yPositionForCancel = e.pageY;//记录点击车辆时屏幕坐标y
    //新样式
    /*var stationSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, 9,
        new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,
            new dojo.Color(mapConfig.stationCircleColorSZ), mapConfig.stationCircleWidthSZ),
        new dojo.Color(mapConfig.stationCenterColorSZ));*/
    var busSymbolSz = new esri.symbol.PictureMarkerSymbol(mapConfig.busszcomprehenshow, mapConfig.compreshowwidthsz, mapConfig.compreshowheightsz);
    //设置新样式
    e.graphic.setSymbol(busSymbolSz);
    var textDivSz = dojo.doc.createElement("div");
    var screenLeft;
    var screenTop;
    if(markClickCount == 1){
        screenLeft = "848px";
        screenTop = "330px";
    }else{
        screenLeft = scrPt.x - mapConfig.mouseTextCtrl1 + "px";
        screenTop = scrPt.y - mapConfig.mouseTextCtrl2 + "px";
    }

    dojo.attr(textDivSz, {"id": "stationTextSz"}); //设置div的id
    dojo.style(textDivSz, {
        "left": screenLeft,
        "top": screenTop,
        "position": "absolute",
        "z-index": 8,
        // "background": mapConfig.mouseTextBackground,
        "font-size": mapConfig.mouseTextFontsize,
    });

    $.ajax({
        type: "POST",
        url: getWebRootPath() + '/firstLook/comprehensiveInfoHomePageNewSZ/getFlightInfo',
        data: {"carNo":carNo},
        dataType: "json",
        success: function (data) {

            $.ajax({
                type: "POST",
                url: getWebRootPath() + '/firstLook/comprehensiveInfoHomePageNewSZ/getPayByCard',
                data:{"carNo":carNo},
                dataType: "json",
                success: function (obj) {
                    var passengerFlow =  obj[0].passengerFlow;
                    //控制展示什么样式的信息

                    textDivSz.innerHTML = "<div style='width:290px;height:143px;background: rgba(16,61,99, 0.8);line-height:28px;'>"+
                        "<div style='width:100%;height:45px;border: 1px solid #006cc7;background-color: #0354a6'>"+
                        "<div style='color:#ffffff;width:50%;height:100%;float:left;text-indent:10px;line-height:45px;font-size:20px'>"+
                        "今日客流量"+
                        "</div>"+
                        "<div style='width:50%;height:100%;float:left;line-height:45px;font-size:25px;color:#ffaa31'>"+
                        +passengerFlow+
                        "&nbsp;<span style='color:#ffffff;font-size:16px'>人次</span>"+
                        "</div>"+
                        "</div>"+
                        "<div style='width:100%;height:30px;border: 1px solid #006cc7;text-align:center;color:#32f3ff'>"+
                        "<div style='width:33%;height:100%;float:left;border-right: 1px solid #006cc7;'>"+

                        "</div>"+
                        "<div style='width:33%;height:100%;float:left;border-right: 1px solid #006cc7;'>"+
                        "计划"+
                        "</div>"+
                        "<div style='width:33%;height:100%;float:left '>"+
                        "实际"+
                        "</div>"+
                        "</div>"+
                        "<div style='width:100%;height:30px;border: 1px solid #006cc7;text-align:center'>"+
                        "<div style='width:33%;height:100%;float:left;border-right: 1px solid #006cc7;color:#32f3ff'>"+
                        "发车时间"+
                        "</div>"+
                        "<div style='width:33%;height:100%;float:left;border-right: 1px solid #006cc7;color:#ffffff'>"+
                        /*"10:00"*/data.leaveTime +
                    "</div>"+
                    "<div style='width:33%;height:100%;float:left;color:#ffffff'>"+
                        /*"10:05"*/data.planLeaveTime+
                    "</div>"+
                    "</div>"+
                    "<div style='width:100%;height:30px;border: 1px solid #006cc7;;text-align:center'>"+
                        "<div style='width:33%;height:100%;float:left;border-right: 1px solid #006cc7;color:#32f3ff'>"+
                        "到达时间"+
                        "</div>"+
                        "<div style='width:33%;height:100%;float:left;border-right: 1px solid #006cc7;color:#ffffff'>"+
                        /*"11:20"*/data.planArriveTime+
                    "</div>"+
                    "<div style='width:33%;height:100%;float:left ;color:#ffffff'>"+
                        "暂未到达"+
                        "</div>"+
                        "</div>"+

                        "</div>";
                }
            });
        }
    });
    dojo.byId("gis_Map").appendChild(textDivSz);
}
cccreator commented 6 years ago
cccreator commented 6 years ago
cccreator commented 6 years ago
cccreator commented 6 years ago