1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
| var map, layer, host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090", url = host + "/iserver/services/map-world/rest/maps/World"; var features = [ new SuperMap.Feature.Vector( new SuperMap.Geometry.Point(120,0),//设置第一个位置 { FEATUREID:"point1",//设置为点的id TIME:0//设置第一个时间 } ), new SuperMap.Feature.Vector( new SuperMap.Geometry.Point(110,0),//设置第二个位置 { FEATUREID:"point1", TIME:1 } ), new SuperMap.Feature.Vector( new SuperMap.Geometry.Point(120,0),//设置第二个位置 { FEATUREID:"point2", TIME:0 } ), new SuperMap.Feature.Vector( new SuperMap.Geometry.Point(130,2),//设置第二个位置 { FEATUREID:"point2", TIME:1 } ) ]; var animatorVector = new SuperMap.Layer.AnimatorVector("layer", {},{ speed:0.01, startTime:0,//设置开始时间为0时刻 endTime:1//设置结束时间为1时刻 }); //初始化地图 map = new SuperMap.Map("map", { controls: [ new SuperMap.Control.Navigation(), new SuperMap.Control.Zoom()] }); map.addControl(new SuperMap.Control.MousePosition()); //初始化图层 layer = new SuperMap.Layer.TiledDynamicRESTLayer("World", url, null, {maxResolution: "auto"}); //监听图层信息加载完成事件 layer.events.on({"layerInitialized": addLayer}); function addLayer() { map.addLayer(layer); map.addLayers([animatorVector]); //显示地图范围 map.setCenter(new SuperMap.LonLat(120, 0), 0); animatorVector.addFeatures(features); animatorVector.animator.start(); animatorVector.animator.setSpeed(animatorVector.animator.getSpeed() * 0.7); }
|