SuperMap IClient for Ajax之图例

首先显示图例用的CSS以及Div布局代码为:

      #legendContainer{
            right:30px;
                top:100px;
                width:248px !important;
                width:250px;
                height:398px !important;
                height:400px;
                position:absolute;
                border:1px solid #6FAFF1;
                z-index:99;
                background-color:#6FAFF1;
                cursor:default;
            }
            #legendCaption {
                height:20px;
                text-align:left;
                vertical-align:middle;
                left:10px;
                top:5px;
                position:relative;
                color:White;
                font-family:"Microsoft YaHei";
                font-size:16px;
            }
            #legendContent {
                width:232px !important;
                width:234px;
                height:362px !important;
                height:364px;
                background-color:White;
                border:1px solid White;
                margin:7px;
                overflow:auto;
            }
	//这里是地图控件放置位置
<div id="legendContainer">
            <div id="legendCaption">
                <span>图例</span>
            </div>
            <div id="legendContent">
            </div>
 </div>

  其中Javascript部分为:

		var container = $get('legendContent');
		var legend = new SuperMap.Web.Controls.Legend({'id':'legend','isShowOnlyVisibleLayer':false,'layers':[layer],'container':container});
		map.addControls([legend]);

  

posted @ 2013-03-08 16:34  xiaohaidepoli  阅读(323)  评论(0编辑  收藏  举报