你的位置:首页 > Java教程

[Java教程]supermap iclient for js 标签专题图(服务端)


<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>简单标签专题图(服务端)</title>
<style type="text/css">
body{
margin: 0;
overflow: hidden;
background: #fff;
}
#map{
position: relative;
height: 510px;
border:1px solid #3473b7;
}

#toolbar {
position: relative;
padding-top: 5px;
padding-bottom: 10px;
}
</style>
<link href='./css/bootstrap.min.css' rel='stylesheet' />
<link href='./css/bootstrap-responsive.min.css' rel='stylesheet' />
<script src='./libs/SuperMap.Include.js'></script>
<script type="text/javascript">
var map, local, baseLayer, layersID, themeLayer,
url="http://localhost:8090/iserver/services/map-yh/rest/maps/world";
//url="http://192.168.15.133:8090/iserver/services/map-yh/rest/maps/world";
function init(){
map = new SuperMap.Map("map",{controls: [
new SuperMap.Control.LayerSwitcher(),
new SuperMap.Control.ScaleLine(),
new SuperMap.Control.Zoom(),
new SuperMap.Control.Navigation({
dragPanOptions: {
enableKinetic: true
}
})]
});
baseLayer = new SuperMap.Layer.TiledDynamicRESTLayer("world", url, {transparent: true, cacheEnabled: false}, {maxResolution:"auto"});
baseLayer.events.on({"layerInitialized":addLayer});
}
function addLayer() {
map.addLayer(baseLayer);
map.setCenter(new SuperMap.LonLat(0.0,-3.19), 0);
map.allOverlays = true;
}

//添加标签专题图
function addThemeLabel() {
removeTheme();
var themeService = new SuperMap.REST.ThemeService(url, {eventListeners:{"processCompleted": themeCompleted, "processFailed": themeFailed}}),

//创建矩阵标签专题图
themeLabel = new SuperMap.REST.ThemeLabel({
labelExpression: "CAPITAL_CH",
numericPrecision: 2,
overlapAvoided: true
}),
themeParameters = new SuperMap.REST.ThemeParameters({
themes: [themeLabel],
datasetNames: ["Capital"],
dataSourceNames: ["ORCL"]

});
themeService.processAsync(themeParameters);
}
function themeCompleted(themeEventArgs) {
if(themeEventArgs.result.resourceInfo.id) {
themeLayer = new SuperMap.Layer.TiledDynamicRESTLayer("各国首都标签专题图", url, {cacheEnabled:false,transparent: true,overlapDisplayed:true,layersID: themeEventArgs.result.resourceInfo.id}, {"maxResolution":"auto"});
themeLayer.events.on({"layerInitialized":addThemelayer});
}
}
function addThemelayer() {
map.addLayer(themeLayer);
}

function themeFailed(serviceFailedEventArgs) {
//doMapAlert("",serviceFailedEventArgs.error.errorMsg,true);
alert(serviceFailedEventArgs.error.errorMsg);
}
//清除专题图
function removeTheme() {
if (map.layers.length > 1) {
map.removeLayer(themeLayer, true);
}
}
</script>
</head>
<body onload="init()">
<div id="toolbar">
<input type="button" value="创建专题图" onclick="addThemeLabel()" />
<input type="button" value="移除专题图" onclick="removeTheme()" />
</div>
<div id="map"></div>
</body>
</html>

注:得到的结果图如下:




深圳旅游景点排行榜深圳旅游哪里好玩呢深圳免费旅游景点大全深圳市周边旅游景点深圳旅游哪家旅行社好玩转楚河汉街全攻略 那琴半岛地质海洋公园酒店住宿多少钱?台山海洋公园酒店怎么样? 游逛楚河汉街 体验现代“清明上河图” 四川完美赏花手册 请在花海中吻我 中山逍遥谷一日游?五桂山逍遥谷怎么走? 中山逍遥谷学生票多少钱?五桂山逍遥谷学生门票价格? 中山逍遥谷简介?五桂山逍遥谷介绍? 五桂山逍遥谷烧烤价格?逍遥谷门票多少钱? 丽江有什么特色美食?丽江有哪些好吃的? 气象台发暴雨蓝色预警9省区市有大到暴雨 安徽天柱山有什么美食? 盘点世界最发达国家:挪威居榜首 美国仅仅第三名 文昌到椰子大观园有直达车吗?文昌到椰子大观园旅游线路? 文昌椰子大观园自驾游攻略?海口到椰子大观园多少公里? 红旗镇荷塘印象荷花开了吗?海口红旗镇荷塘印象荷花什么时候开? 海口红旗镇荷花印象好玩吗?红旗镇荷花印象门票价格? Q65110A8994 Datasheet Q65110A8994 Datasheet Q65110A9000 Datasheet Q65110A9000 Datasheet Q65110A9001 Datasheet Q65110A9001 Datasheet 广州大学城旅游攻略 广州大学城旅游攻略 广州大学城旅游攻略 今年过年几号 今年过年几号 今年过年几号 宝安汽车站订票电话 宝安汽车站订票电话 宝安汽车站订票电话