
function ciy_chart_bank1_c2(opdata) {
    this.func = ['bank_c2'];
    this.lastdata = {};
    this.resize = function () {
    }
    this.showpopup = function (html, pos) {
        if (thos.popup)
            thos.popup.remove();
        var oset = $5(opdata.container).offset();
        thos.popup = $5('<div class="popup-box"><div class="box">' + html + '</div><div class="line"></div><div class="rlc"></div></div>');
        thos.popup.css({ top: pos.y - oset.top, left: pos.x - oset.left, opacity: 1 });
        opdata.container.append(thos.popup);
        return thos.popup;
        //showfarm(data.entity.ciydata);
    }
    this.hidepopup = function () {
        if (thos.popup) {
            thos.popup.css({ opacity: 0 });
            setTimeout(function () {
                console.log('timeout remove');
                thos.popup.remove();
                thos.popup = null;
            }, 500);
        }
    }
    this.setdata = function (funame, data) {
        if (!data)
            return;
        this.lastdata[funame] = data;
        if (thos.ce)
            return;
        thos.ce = new ciyearth();
        var mapset = { wmts_source: 4, wmts_style: 2, setin: 2, setop: 1 };
        mapset.domid = $5('#map1', opdata.container)[0];
        mapset.personheight = 1.8;
        mapset.flys = mapset.flys || [];
        thos.ce.init(mapset);
        thos.ce.viewer.scene.screenSpaceCameraController._zoomFactor = 1;
        var positions = [];
        for (var i in data.bplants) {
            var dat = data.bplants[i];
            if (dat.lat > -0.001 && dat.lat < 0.001)
                continue;
            dat.img = '/ud/bill/map' + dat.cmcode + '.png';
            dat.width = 20;
            dat.height = 27;
            var marker = thos.ce.addmarker(dat);
            marker.ciydata = dat;
            positions.push(marker.position._value);
        }
        thos.ce.viewer.camera.flyToBoundingSphere(new Cesium.BoundingSphere.fromPoints(positions), { duration: 1, offset: new Cesium.HeadingPitchRange(0, -1.57, 0) });

        thos.ce.ciyevent = function (type, act, data, data2) {
            if (type == 'map') {
                if (act == 'movestart') {
                    console.log('movestart');
                    thos.hidepopup();
                }
            } else if (type == 'entity') {
                if (act == 'leftclick' && data.entity) {
                    console.log(data);
                    var mas = data.entity.ciydata;
                    var html = '<div><div style="min-width: 12em;line-height: 1em;padding-right: 0.5em;color: #ffffff;">';
                    html += '<div class="showfmr" data-id="' + mas.id + '" style="font-size: 1.2em;font-weight: bold;padding: 0.5em;cursor: pointer;">' + mas.name + '</div>';
                    if (mas.lxrname)
                        html += '<div style="font-size:0.9em;padding-left:0.5em;line-height: 2.5em;">联系人：' + mas.lxrname + '</div>';
                    html += '<a class="close" style="font-size: 1.5em;position: absolute;top: 0.2em;right: 0.2em;">×</a>';
                    html += '</div></div>';
                    var pdom = thos.showpopup(html, data.event.position);
                    pdom.on('click', '.close', function () {
                        thos.hidepopup();
                    });
                    pdom.on('click', '.showfmr', function () {
                        thos.hidepopup();
                        showfarm(data.entity.ciydata);
                    });
                }
            }
        };
    }
    this.distory = function (data) {
        thos.ce.destroy();
        thos.ce = null;
    }


    var thos = this;
    var map;
    this.ce = null;
    this.resize();
    opdata.container.append('<div class="brimg brimg34" style="padding:2px;"><div id="map1" style="height:100%;"></div></div>');
    if (urlp.dev)
        return;

}