123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- var gis = gis || {};
- gis.anchored = function() {
-
- };
- gis.anchored.popup = function(lonlat,data){
- //alert(JSON.stringify(data));
- //alert(gis.anchored.tohtml(data));
- /*
- data={popupBorder:"1px solid #A5AAB4",width:320,height:155,title:"专题",
- style:["width:30%","text-align:center;"],
- data:[['港口名称','南京港'],['港区个数','2'],['锚地个数','2'],['作业区个数','16']]};
- */
- var chicken=$('#chicken');
- chicken.remove();
-
- data=gis.anchored.portinfo({portName:'南京港',portNumber:2,anchorageNumber:2,chanceNumber:16})
- var popup = new SuperMap.Popup.Anchored(
- "chicken",
- lonlat,
- new SuperMap.Size(data.width,data.height),
- gis.anchored.tohtml(data),
- null,
- true,
- null
- );
- popup.setBorder(data.popupBorder||"1px solid #A5AAB4");
- //popup.updateSize();
- //chicken_contentDiv
- popup.extdataheight=data.height;
-
- return popup;
- }
- gis.anchored.popupHtml = function(lonlat,data,toHtml){
- var chicken=$('#chicken');
- chicken.remove();
-
- var popup = new SuperMap.Popup.Anchored(
- "chicken",
- lonlat,
- new SuperMap.Size(data.width,data.height),
- toHtml,
- null,
- true,
- null
- );
- popup.setBorder(data.popupBorder||"1px solid #A5AAB4");
- //popup.updateSize();
- //chicken_contentDiv
- popup.extdataheight=data.height;
-
- return popup;
- }
- gis.anchored.addPopup = function(map,popup){
- map.addPopup(popup);
- //$('#chicken_close').css("display","none");
- var contentDiv=$('#chicken_contentDiv');
- //alert($('#chicken_GroupDiv').width());
- contentDiv.css("overflow","visible");
- //contentDiv.css("position","absolute");
- //contentDiv.css("border","1px solid #A5AAB4");
- contentDiv.css("width",$('#chicken_GroupDiv').width());//alert(contentDiv.width());
- //alert(contentDiv.width()+"**"+$('#chicken_GroupDiv').width());
-
-
- var tableDiv=$('.tabledivClass');
- //alert($('.titleClass').height());
- //tableDiv.css("height",tableDiv.height());
- tableDiv.css("height",popup.extdataheight-26);
- //tableDiv.css("width",contentDiv.width());
- /*
- if($.support&&$.support.leadingWhitespace&&contentDiv.width()==$('#chicken_GroupDiv').width()){
- contentDiv.css("width",$('#chicken_GroupDiv').width()-12);
- //tableDiv.css("height",tableDiv.height()-26);
- }
- */
-
- $('.smPopupCloseBox').css("top",2);
- $('.smPopupCloseBox').css("right",3);
-
- $.each($(".altrowstable"), function(i,val){
- gis.anchored.tableBeautify.call(this,"#fff","#F5F5F5","#FFFFCC")
- });
- }
- gis.anchored.tableBeautify = function(oddColor,evenColor,ouseoverColor){
- //alert(this);return;
- if(this){
- //var tr=this.getElementsByTagName("tr");
- for(var i=0;i<this.rows.length;i++){
- var temptr=this.rows[i];
- if(i%2==0){
- temptr.style.backgroundColor=oddColor;
- /*
- if(i==0){
- continue;
- }
- */
- //鼠标离开
- temptr.onmouseout=function(){
- this.style.backgroundColor=oddColor;
- }
- }else{
- temptr.style.backgroundColor=evenColor;
- //鼠标离开
- temptr.onmouseout=function(){
- this.style.backgroundColor=evenColor;
- }
- }
- //鼠标进入
- temptr.onmouseover=function(){
- //alert(this.style.backgroundColor+"-->"+ouseoverColor);
- this.style.backgroundColor=ouseoverColor;
- }
-
- /*
- temptr.onclick=function(){
- //alert(this.sectionRowIndex);
- }
- */
- var tagName_td=temptr.getElementsByTagName("td");
- if(tagName_td){
- var presentColsAmount=temptr.getElementsByTagName("td").length;
- if(presentColsAmount&&presentColsAmount>=4){
- for(var cc=1;cc<presentColsAmount;cc++){
- //alert(tagName_td[cc]);
- //$(tagName_td[cc]).css("color","red");
- $(tagName_td[cc]).css("border-left","1px solid #A5AAB4");
- }
- }
- }
-
- }
- }
- }
- gis.anchored.tohtml = function(data){
- //alert(JSON.stringify(data));
- //$("<div id='popupWin'></div>").addClass("popupWindow").appendTo($("#result"));
- var html=new Array();
- var nvlval='';
- if(data){
- if(data.title){
-
- html.push("<div class='titleClass'>");
- html.push(data.title);
- html.push("</div>");
- }
-
- if(data.data){
- //html.push("<div class='tableClass' style='width: 335px; height: 115px; position: relative;border:1px solid #A5AAB4;overflow:auto;'>");
- html.push("<div class='tabledivClass'>");
- //html.push(data.title);html.push("<br>");
- html.push("<table class='altrowstable'>");
- for(var i=0;i<data.data.length;i++){
- var o=data.data[i];
-
- html.push("<tr>");
- for(var j=0;j<o.length;j++){
- html.push("<td style='"+(data.style[j]||nvlval)+"'>");
- html.push(o[j]);
- html.push("</td>");
- }
- html.push("</tr>");
- }
- html.push("</table>");
- html.push("</div>");
- }
-
-
- }
- //alert(html.join(""));
- return html.join("");
- }
- gis.anchored.portinfo = function(data){
- var obj={popupBorder:"1px solid #A5AAB4",width:320,height:152,title:"港口信息",
- style:["width:30%","text-align:center;"],
- data:[['港口名称',data.portName],['港区个数',data.portNumber],['锚地个数',data.anchorageNumber],['作业区个数',data.chanceNumber]]};
-
-
- return obj;
- }
- gis.anchored.nvlinfo = function(data){
- var obj={popupBorder:"1px solid #A5AAB4",width:320,height:155,title:data.poptitle,
- style:["width:30%","text-align:center;"],
- data:[['名称',data.portName]]};
-
-
- return obj;
- }
- $(document).ready(function() {
-
- });
|