@{
ViewBag.Title = "GIS地图";
Layout = null;
} @model HFSoft.Plat.UIWeb.Models.MapShowDataVO <style>
body, html, #allmap { width: %;height: %;overflow: hidden;margin: ;} table {width: %;border-collapse: collapse; border: 1px #b8b8bf solid; }
table tr td{ border: 1px #b8b8bf solid;height:22px;}
table tr th{ border: 1px #b8b8bf solid; height:22px;line-height:22px;text-align:center;font-weight:normal;}
.tabPanel {width:480px;height:280px;}
.tabPanel ul {height: 30px;border-bottom: 1px solid #aaa;}
.tabPanel ul li {list-style-type:none;float: left;margin: 2px ;border: 1px solid #aaa;height: 29px;line-height: 30px;width:80px;text-align: center;cursor:pointer;
text-shadow: 1px #fff;border-radius: 4px 4px ;box-shadow: inset 1px rgba(, , , 0.5);background: #ddd;background: -moz-linear-gradient(top, #eee, #ddd);
background: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#ddd));
}
.tabPanel .hit {border-bottom: 1px solid #fff;cursor: pointer;color: black;text-shadow: 1px #fff;
background: #fff;
background: -webkit-gradient(linear, left top, left bottom, from(#e1e1e1), to(#fff));
background: -moz-linear-gradient(top, #e1e1e1, #fff);
}
.pane {border: 0px solid #aaa;border-top: ;min-height: 100px; background-color: #fff;display: none;}
.pane p {padding:0px;}
</style> <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=@(Model.MapBaseInfoItem.ApiAk)"></script> <div class="easyui-layout" style="width: 100%; height: 100%;">
<div id="allmap" style="fit:fill"></div>
</div>
<script type="text/javascript">
var v_ZoomLevel = "@(Model.MapBaseInfoItem.ZoomLevel.ToString())";
var v_CityName = "@(Model.MapBaseInfoItem.CityName)";
var v_Lng = "@(Model.MapBaseInfoItem.Longitude)";
var v_Lat = "@(Model.MapBaseInfoItem.Latitude)";
var v_StationID = "@ViewBag.StationID"; // 百度地图API功能
var map = new BMap.Map("allmap");// 创建Map实例
map.centerAndZoom(new BMap.Point(v_Lng, v_Lat), v_ZoomLevel); // 初始化地图,设置中心点坐标和地图级别 // 初始化地图,设置中心点坐标和地图级别
var top_left_navigation = new BMap.NavigationControl(); //左上角,添加默认缩放平移控件
map.addControl(top_left_navigation);
map.addControl(new BMap.MapTypeControl()); //添加地图类型控件
map.setCurrentCity(v_CityName); // 设置地图显示的城市 此项是必须设置的
map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放 //从后台将要显示的数据变到JSON变量中
var viewMapModel = {
id: ,
StationData: [
@if (Model != null)
{
var List = Model.StationList;
for (int i = ; i < List.Count; i++)
{
var item = List[i];
if (i != List.Count - )
{
@:{ StationID: '@item.StationID', StationName: '@item.StationName', Longitude: '@item.Longitude', Latitude: '@item.Latitude', ReservoirName: '@item.ReservoirName', LinkMan: '@item.Linkman', MobilePhone: '@item.MobilePhone', Addresses: '@item.Addresses', Remark: '@item.Remark' },
}
else
{
@:{ StationID: '@item.StationID', StationName: '@item.StationName', Longitude: '@item.Longitude', Latitude: '@item.Latitude', ReservoirName: '@item.ReservoirName', LinkMan: '@item.Linkman', MobilePhone: '@item.MobilePhone', Addresses: '@item.Addresses', Remark: '@item.Remark' }
}
}
}
],
GateData: [
@if (Model != null)
{
var GateList = Model.GateList;
for (int i = ; i < GateList.Count; i++)
{
var item = GateList[i];
if (i != GateList.Count - )
{
@:{},
}
else
{
@:{}
}
}
}
]
}; var markers = [];
var stationItem = null; $(document).ready(function () {
pointMapSite();
if (markers.length > ) {
for (var j = ; j < markers.length; j++) {
showInfo(markers[j], stationItem);
break;
}
}
}); function pointMapSite() {
if (viewMapModel != null && viewMapModel.StationData.length > ) { for (var i = ; i < viewMapModel.StationData.length; i++) {
var stationid = viewMapModel.StationData[i].StationID;
var stationname = viewMapModel.StationData[i].StationName;
var Longitude = viewMapModel.StationData[i].Longitude;
var Latitude = viewMapModel.StationData[i].Latitude; var mkr = new BMap.Marker(new BMap.Point(Longitude, Latitude)); map.addOverlay(mkr); if (v_StationID == stationid) {
markers.push(mkr);
stationItem = viewMapModel.StationData[i];
} //给标注点添加点击事件。使用立即执行函数和闭包
(function () {
var StationModel = viewMapModel.StationData[i];
mkr.addEventListener("click", function () {
showInfo(this, StationModel);
});
})();
}
}
} function showInfo(thisMaker, item) {
var sContent = '<div class="tabPanel">'
+ '<ul>'
+ '<li id="tab1" class="hit" onclick=\'javascript:showTab(1);\'></li>'
+ '<li id="tab2" onclick=\'javascript:showTab(2);\'></li>'
+ '<li id="tab3" onclick=\'javascript:showTab(3);\'></li>'
+ '</ul>'
+ '<div class="panes">'
+ '<div class="pane" style="display:block;"><p>'
+ '<table>'
+ '<tr>'
+ '<td style="text-align:right;padding:5px;width:80px;">:</td>'
+ '<td>' + item.StationName + '</td>'
+ '<td rowspan="5" style="width:100px;">'
+ '<img src="/Content/images/noimage.png" style="width:160px;height:160px;" />'
+ '</td>'
+ '</tr>'
+ '<tr>'
+ '<td style="text-align:right;padding:5px;">:</td>'
+ '<td>' + item.ReservoirName + '</td>'
+ '</tr>'
+ '<tr> '
+ '<td style="text-align:right;padding:5px;">:</td>'
+ '<td>' + item.LinkMan + '</td>'
+ '</tr>'
+ '<tr>'
+ '<td style="text-align:right;padding:5px;">:</td>'
+ '<td>' + item.MobilePhone + '</td>'
+ '</tr> '
+ '<tr>'
+ '<td style="text-align:right;padding:5px;">:</td>'
+ '<td>' + item.Addresses + '</td> '
+ '</tr>'
+ '<tr>'
+ '<td style="text-align:right;padding:5px;">:</td>'
+ '<td colspan="2">' + item.Remark + '</td>'
+ '</tr>'
+ '</table>'
+ '</p></div>'
+ '<div class="pane"><p>2</p></div>'
+ '<div class="pane"><p>3</p></div>'
+ '</div>'
+ '</div>'; var infoWindow = new BMap.InfoWindow(sContent); // 创建信息窗口对象
thisMaker.openInfoWindow(infoWindow); //图片加载完毕重绘infowindow
} function showTab(id) {
$('#tab' + id).addClass('hit').siblings().removeClass('hit');
$('.panes>div:eq(' + (id - ) + ')').show().siblings().hide();
}

自定义tab在地图进行分页显示的更多相关文章

  1. 百度地图JavaScript API自定义覆盖物、自定义信息窗口增删时的显示问题

    项目中,需求:在百度地图上实时画出车辆,并能点击车辆弹出信息框查看实时信息. 实现:通过不停的画覆盖物并删除掉.点击覆盖物时弹出信息窗口. 问题:删除掉覆盖物后信息窗也删除掉了.因为信息窗是建立在覆盖 ...

  2. 《ASP.NET1200例》<asp:DataList>分页显示图片

    aspx页面代码 <asp:DataList ID="dlPhoto" runat="server" Height="137px" W ...

  3. day70 cookie & session 前后端交互分页显示

    本文转载自qimi博客,cnblog.liwenzhou.com 概要: 我们的cookie是保存在浏览器中的键值对 为什么要有cookie? 我们在访问浏览器的时候,千万个人访问同一个页面,我们只要 ...

  4. TabLayout自定义tab,实现多样导航栏

    代码地址如下:http://www.demodashi.com/demo/14660.html 前言 之前有讲过TabLayout的一些知识, TabLayout实现顶部导航(一) TabLayout ...

  5. [网页游戏开发]容器的使用及自定义Tab,RadioGroup,List,ViewStack

    Morn里面,容器和其他普通组件不同,无需皮肤,所以也不能从组件树种拖动创建(Tab,RadioGroup例外),只能转换而来 Morn的容器组件主要有Box,Container,Panel,Tab, ...

  6. flask 前端 分页 显示

    # flask 前端 分页 显示 1.分页原理 web查询大量数据并显示时有有三种方式: 从数据库中查询全部,在view/客户端筛选/分页:不能应对记录大多的情况,一般不使用: 分页查询,每次在数据库 ...

  7. day81:luffy:课程分类页面&课程信息页面&指定分类显示课程信息&分页显示课程信息

    目录 1.构建课程前端初始页面 2.course后端的准备工作 3.后端实现课程分类列表接口 4.前端发送请求-获取课程分类信息 5.后端实现课程列表信息的接口 6.前端显示列表课程信息 7.按照指定 ...

  8. 微信小程序自定义tab,多层tab嵌套实现

    小程序最近是越来越火了-- 做小程序有一段时间了,总结一下项目中遇到的问题及解决办法吧. 项目中有个多 tab 嵌套的需求,进入程序主界面下面有两个 tab,进入A模块后,A模块最底下又有多个tab, ...

  9. C#关于分页显示

    ---<PS:本人菜鸟,大手子还请高台贵手> 以下是我今天在做分页时所遇到的一个分页显示问题,使用拼写SQL的方式写的,同类型可参考哦~ ------------------------- ...

随机推荐

  1. 笔记《Hbase 权威指南》

    为什么要用Hbase- Hbase的诞生是因为现有的关系型数据库已经无法在硬件上满足疯狂增长的数据了,而且因为需要实时的数据提取Memcached也无法满足- Hbase适合于无结构或半结构化数据,适 ...

  2. Tomcat and solr 环境配置

    Tomcat and solr tomcat 安装 下载安装tomcat8.0 http://tomcat.apache.org/download-80.cgi wget http://apache. ...

  3. Promising Linking

    Future/Promise 执行逻辑 scala Future 有几个要点,第一个是 tryAwait 需要借助 CowndownLatch 实现,第二个是可以在 Promise 挂载回调函数 首先 ...

  4. pentaho saiku 安装全过程

    公司希望也开发一套多维分析系统,以解决运营/产品无休止的需求和技术人力不足的矛盾! 一.开发选型: 一.BIRT:易用性差,所以没再使用 二.JasperReport+ireport:文档收费,不支持 ...

  5. LintCode-- Remove Linked List Elements

    Remove all elements from a linked list of integers that have valueval. 样例 Given 1->2->3->3- ...

  6. ASP.NET MVC 4 Web编程

    http://spu.jd.com/11309606.html 第1章 入门第2章 控制器第3章 视图第4章 模型第5章 表单和HTML辅助方法第6章 数据注解和验证第7章 成员资格.授权和安全性第8 ...

  7. Inkpad绘图原理浅析

    本文新版本已转移到开源中国,欢迎前往指导. Inkpad是一款非常优秀的iPad矢量绘图软件,保管你一看见就忘不了.我的感觉是“一览众山小”.“相见甚晚”,以至于我写的TouchVG就是“小巫见大巫” ...

  8. 谷歌正式发布Google APIs Client Library for .NET

    好消息,特大好消息! 英文原文:Google API library for .NET paves the way for Google services on Windows phone 本月 17 ...

  9. 模拟Jquery选择器

    目前实现的功能有以下几点: 1.$("#adom"); // 返回id为adom的DOM对象 2.$("a"); // 返回一个a标签的数组 3.$(" ...

  10. ruby -- 进阶学习(十六)ckeditor去除“浏览服务器”按钮

     FROM:http://blog.163.com/zjc_8886/blog/static/2408175201011222590967/ 实现方法: 由于ckeditor中的"上传图片& ...