';
+ var marker = new BMapLib.RichMarker(ltext, latLng, {anchor: new BMap.Size(0, 0)});
+ tag && that.toDelterMarkers.push(marker);
+
+ marker.provalue = info;
+ that.openTip[info.uid] = that.opentip(marker);
+ that.map.addOverlay(marker);
+ if(isShow){
+ marker.hide();
+ }
+ return marker;
+ },
+
+ /* 鼠标划到描点事件*/
+ focusmarker_b: function (marker) {
+ var info = marker.provalue;
+ var focusInfoWinFun = function () {
+ var container = $(marker._container), mapDiv = container.find('.mark-icon-box');
+ if (mapDiv.length) {
+ marker.setTop && marker.setTop(true);
+ mapDiv.find('.mark-icon').addClass('mark-icon-h').end().find('.mark-tip').show();
+ // 恢复置顶
+ container.css('zIndex', Math.abs(container.css('zIndex')));
+ var list = $('#list' + info.uid);
+ list.find('a').css('background', '#e8f4ff');
+ }
+ };
+ marker.addEventListener('mouseover', focusInfoWinFun);
+ return focusInfoWinFun;
+ },
+
+ /* 鼠标划过描点事件*/
+ blurmarker_b: function (marker) {
+ var that = this;
+ var info = marker.provalue;
+ var blurInfoWinFun = function () {
+ if (that.isclick != info.uid) {
+ var container = $(marker._container), mapDiv = container.find('.mark-icon-box');
+ if (mapDiv.length) {
+ mapDiv.find('.mark-icon').removeClass('mark-icon-h').end().find('.mark-tip').hide();
+ // 恢复置顶
+ container.css('zIndex', -Math.abs(container.css('zIndex')));
+ var list = $('#list' + info.uid);
+ list.find('a').css('background', '#fff');
+ }
+ }
+ };
+ marker.addEventListener('mouseout', blurInfoWinFun);
+ return blurInfoWinFun;
+ },
+
+ /* maibuilding的hover*/
+ hoverMarker: function (marker, flg) {
+ var that = this;
+ if (!marker._div) {
+ return;
+ }
+ var cName = marker._div.className;
+ var tip_price = $('#tip_price');
+ if (flg) {
+ if (cName.indexOf('qp') > -1) {
+ marker._div.className = 'qp02';
+ }
+ marker._div.parentNode.style.zIndex = 1;
+ if (tip_price.length > 0) {
+ tip_price.css('display', 'inline');
+ }
+ } else {
+ if (that.isclick != marker.provalue.newCode) {
+ marker._div.parentNode.style.zIndex = marker._zindex;
+ if (cName.indexOf('qp') < 0) {
+ return;
+ }
+ if (tip_price) {
+ tip_price.css('display', 'none');
+ }
+ var lclass = 'qp01';
+ var sTc = {0: '04', 1: '01', 2: '05', 3: '03', 4: '01'};
+ if ('undefined' != typeof(marker.provalue.saling) && 'undefined' != typeof(sTc[marker.provalue.saling])) {
+ lclass = 'qp' + sTc[marker.provalue.saling];
+ }
+ marker._div.className = lclass;
+ }
+ }
+ },
+
+ /* 关闭详情窗口*/
+ closeTip: function () {
+ var that = this;
+ $('#maptip').css('visibility', 'hidden');
+ var tip_price = $('#tip_price');
+ if (tip_price) {
+ tip_price.css('display', 'none');
+ }
+ },
+
+ /* 弹出详情窗口****/
+ opentip: function (marker) {
+ var that = this;
+ var map = that.map;
+ var maptipDom = $('#maptip');
+ if (!maptipDom) {
+ return;
+ }
+ var opentheTip = function () {
+ var info = marker.provalue;
+ if (!info) {
+ return;
+ }
+ info.x = info.x || info.baidu_coord_x || info.mapx;
+ info.y = info.y || info.baidu_coord_y || info.mapy;
+ if (that.isclick && that.isclick == info.uid) {
+ that.closeTip();
+ return;
+ }
+ var point0 = new BMap.Point(marker._position.lng, marker._position.lat);
+ that.map.centerAndZoom(point0, 14);
+ };
+ marker.addEventListener('click', opentheTip);
+ return opentheTip;
+ },
+ panMap: function () {
+ var that = this;
+ that.map.setViewport(that.markerBounds);
+ },
+
+ /* 打开餐饮、银行大类信息*/
+ openTypeWrap: function (type) {
+ var that = this;
+ that.createPoints_new(type);
+ },
+
+ /* 重置所有标注-*/
+ reset_all_mark: function (fmaker) {
+ var that = this;
+ if ('undefined' != typeof that.map && 'undefined' != typeof that.house_near_p) {
+ // 设置背景为初始白色
+ $('li[id^=list] a').css('background', '#fff');
+ // 去除描点悬浮蓝色并且隐藏所有悬浮框
+ var map = $('#mapObj');
+ map.find('.mark-icon').removeClass('mark-icon-h').end().find('.mark-tip').hide();
+
+ if (fmaker && !fmaker._div) {
+ var info = fmaker.provalue;
+ var container = $(fmaker._container);
+ container.css('zIndex', Math.abs(container.css('zIndex')));
+ var listNew = $('#list' + info.uid);
+ listNew.find('a').css('background', '#e8f4ff');
+ }
+ }
+ },
+
+ /* 隐藏所有标注*/
+ hidden_all_mark: function () {
+ var that = this;
+ if ('undefined' != typeof that.map && 'undefined' != typeof that.house_near_p) {
+ for (var key in that.house_near_p) {
+ if (that.house_near_p[key].length < 1) {
+ return;
+ }
+ for (var j = 0; j < that.house_near_p[key].length; j++) {
+ var point = that.house_near_p[key][j];
+ point && point.hide();
+ }
+ }
+ }
+ },
+
+ /* 只传入类型的大类标注*/
+ hideOtherPoints: function (type) {
+ var that = this;
+ if ('undefined' == typeof that.map || 'undefined' == typeof that.house_near_p || null == type) {
+ return;
+ }
+ for (var key in that.house_near_p) {
+ if (that.house_near_p[key].length > 0) {
+ for (var j = 0; j < that.house_near_p[key].length; j++) {
+ var point = that.house_near_p[key][j];
+ point && (key == type ? point.show() : point.hide());
+ }
+ }
+ }
+ },
+
+ /* 显示周边楼盘标注*/
+ createPoints_house: function () {
+ var that = this;
+ that.panTo(that.map.citycenter);
+ that.hidden_all_mark();
+ if (that.have_arr['hs'] == 1 && 'undefined' != typeof that.map && 'undefined' != typeof that.house_near_p) {
+ for (var key in that.house_near_p) {
+ if ('hs' != key) {
+ continue;
+ }
+ for (var j = 0; j < that.house_near_p[key].length; j++) {
+ var point = that.house_near_p[key][j];
+ point && point.show();
+ }
+ break;
+ }
+ } else {
+ //that.getNearHouse();
+ }
+ },
+
+ /**
+ * 创建小分类下的标注:若已经创建则显示已经创建的
+ * @param type 分类
+ * @returns null
+ */
+ createPoints_new: function (type) {
+ if (null == type) {
+ return;
+ }
+ type = type.replace(/\s+/g, '');
+ var that = this;
+ that.panTo(that.map.citycenter);
+ that.hideOtherPoints(type);
+ // 若已经存在
+ if (that.have_arr[type] == 1) {
+ //that.hideOtherPoints(type);
+ /* 刷新地图标注*/
+ // that.hideOtherPoints(type);
+
+ /* 显示该分类下所有的内容*/
+ /*var typeList = $('#' + type + '_list');
+ // 记录滚动位置
+ that.topScroll = typeList.parent().scrollTop();
+ typeList.find('li').show();
+ typeList.show().siblings().hide();*/
+ /* 隐藏更多按钮*/
+ $('.mscoputup').show();
+ $('.mscomore').hide();
+ } else {
+ /*if (type == 'hs') {
+ //that.getNearHouse();
+ } else {
+ that.getnear_s(that.have_arr_new[type], that.maxMarker_count, that.view_count, that.limit, that.maxMarker_count);
+ }*/
+ that.getnear_s(type,that.maxMarker_count, that.view_count, that.limit, that.maxMarker_count);
+ }
+ },
+
+ panTo: function(e, a) {
+ e && a && that.map.panTo(new BMap.Point(a, e))
+ },
+ /**
+ * 创建大分类下的标注:若已经创建则显示已经创建的
+ * @param key 大分类
+ * @returns null
+ */
+ createPoints_merge: function (key) {
+ var that = this;
+ that.panTo(that.map.citycenter);
+
+ /* 隐藏地图上所有标注*/
+ that.hidden_all_mark();
+ var mergeArr = that.house_near_merge[key];
+
+ /* 显示标注*/
+ var flag = false, i, j = 0, l;
+ for (i = 0, l = mergeArr.length; i < l; i++) {
+ if (that.have_arr[mergeArr[i]] == 1) {
+ flag = true;
+ break;
+ }
+ }
+
+ /* 显示全部*/
+ if (flag) {
+ if ('undefined' != typeof that.map && 'undefined' != typeof that.house_near_p) {
+ // 显示当前大分类下所有小分类列表
+ var typeList = $('#' + mergeArr[0] + '_list');
+ typeList.show().siblings().show();
+ /* 显示更多按钮 隐藏收起按钮*/
+ $('.mscoputup').hide();
+ $('.mscomore').show();
+ for (var k in that.house_near_p) {
+ if (that.in_array(k, mergeArr)) {
+ for (j = 0; j < that.house_near_p[k].length; j++) {
+ var point = that.house_near_p[k][j];
+ point && (j < that.view_count ? point.show() : point.hide());
+ }
+ }
+ }
+ for (i = 0, l = mergeArr.length; i < l; i++) {
+ var objs = $('#' + mergeArr[i] + '_list').find('li');
+ for (j = that.view_count; j < that.maxMarker_count; j++) {
+ if (null == objs[j]) {
+ break;
+ }
+ $(objs[j]).hide();
+ }
+ }
+ // 滚到展开位置
+ typeList.parent().scrollTop(that.topScroll || 0);
+ }
+ } else {
+ that.init_search_merge(key);
+ }
+ },
+
+ init_search_merge: function (key) {
+ var that = this;
+ var mergeArr = that.house_near_merge[key];
+ for (var i = 0, l = mergeArr.length; i < l; i++) {
+ that.getnear_s(mergeArr[i], that.maxMarker_count, that.view_count, that.limit, that.maxMarker_count, key);
+ }
+ },
+
+ /**
+ * 获取周围信息
+ * @param type 小分类
+ * @param count 需要搜索的最大个数
+ * @param view_count 非展开状态下显示个数
+ * @param limit 搜索距离(m)
+ * @param limit_count 页面上展示最大个数
+ * @param parentType 大分类
+ * @returns null
+ */
+ getnear_s: function (type, count, view_count, limit, limit_count, parentType) {
+ var that = this;
+ /*if (cityy == '' || cityx == '' || null == type) {
+ return;
+ }*/
+ var searchname = that.have_arr_new[type];
+ var onLocalSearch = function (resData) {
+ // 娱乐由于合在了一起所以单独处理
+ //var isFun = that.in_array(type, that.house_near_merge['fun']);
+ /* 判断状态是否正确*/
+ if (localSearch.getStatus() == BMAP_STATUS_SUCCESS) {
+ var resultArr = [];
+ that.focusInfoWinFuns[type] = [];
+ that.blurInfoWinFuns[type] = [];
+ var uidarr = [];
+ var points = []
+ /* 处理百度返回信息*/
+ for (var i = 0; i < resData.getCurrentNumPois(); i++) {
+ var info = resData.getPoi(i);
+ if(info){
+ /* 过滤地铁中的地铁口*/
+ info['address'] = info['address'] ? info['address'] : '';
+ if ('subway' == type && (!that.array_in_array(that.type_tags[type], info.tags) || info['address'].indexOf('线') < 0)) {
+ continue;
+ }
+ /* 计算距离*/
+ info.distance = that.getShortDistance(that.map.citycenter.lng, that.map.citycenter.lat, info.point.lng, info.point.lat);
+ uidarr.push(info.uid);
+ resultArr.push(info);
+ points.push(new BMap.Point(info.point.lng,info.point.lat))
+ }
+ }
+ resData._pois = that.shellSort(resultArr);
+ that.have_arr[type] = 1;
+ // 所有周围娱乐数据加载完毕
+ var allFunIsFinished = that.have_arr['ktv'] && that.have_arr['bar'] && that.have_arr['cinema']
+ && that.have_arr['beauty'] && that.have_arr['cafe'];
+ // 若是娱乐将type设为fun
+ /*if (isFun) {
+ type = 'fun';
+ searchname = '娱乐';
+ that.focusInfoWinFuns[type] = [];
+ that.blurInfoWinFuns[type] = [];
+ that.have_arr[type] = 1;
+ !that.funData && (that.funData = []);
+ that.funData = that.funData.concat(resData._pois);
+ // 若娱乐都检索完毕则可以画点
+ if (allFunIsFinished) {
+ resData._pois = that.shellSort(that.funData);
+ } else {
+ return;
+ }
+ }*/
+ that.house_near_p[type] = [];
+ /*if (!isFun || isFun && allFunIsFinished) {
+ that.getListAndMarker(resData._pois, limit_count, view_count, type, parentType, searchname);
+ }*/
+ that.getListAndMarker(resData._pois, limit_count, view_count, type, parentType, searchname);
+
+ that.map.setViewport(points);
+ } else {
+ // 若没搜索成功娱乐也加标识位,因为娱乐是所有加载完后再描点
+ /*if (isFun) {
+ that.have_arr[type] = 1;
+ if (that.have_arr['ktv'] && that.have_arr['bar'] && that.have_arr['cinema']
+ && that.have_arr['beauty'] && that.have_arr['cafe']) {
+ that.getListAndMarker(that.funData, limit_count, view_count, type, parentType, '娱乐');
+ }
+ }*/
+ }
+ };
+ var localSearch = new BMap.LocalSearch(new BMap.Point(that.lng, that.lat), {onSearchComplete: onLocalSearch});
+ localSearch.setPageCapacity(count);
+ localSearch.searchNearby(searchname, that.map.citycenter, limit);
+ },
+
+ /**
+ * 拼接列表并描点
+ * @param rsData 描点数组
+ * @param limit_count 页面上展示最大个数
+ * @param view_count 非展开状态下显示个数
+ * @param type 小分类
+ * @param mergeType 大分类
+ * @param searchName 小分类列表头
+ * @param isNotVisible 是否需要隐藏
+ * @returns null
+ */
+ getListAndMarker: function (resData, limit_count, view_count, type, mergeType, searchName, isNotVisible) {
+ var that = this;
+ var s = [], l = resData.length;
+ if (l > 0) {
+ s.push('
' + searchName + '
');
+ for (var i = 0; i < l && i < limit_count; i++) {
+ var result = resData[i];
+ var selected = view_count && (i > view_count - 1) ? 'none' : '';
+ if (mergeType) {
+ s.push('