|
- var arr = {} , aMap ,lin = [];
- apiready = function(){
- aMap = api.require('aMap');
- getLocation();
- aMap.open({
- rect: {
- x: 0,
- y: 0,
- w: 'auto',
- h: 'auto'
- },
- showUserLocation: true,
- showsAccuracyRing:false,
- zoomLevel: 20,
- center: arr,
- fixedOn: api.frameName,
- fixed: true
- });
- time();
- }
- function time(){
- setTimeout(function(){
- onli();
- time();
- },500)
- }
- function getLocation(){
- aMap.getLocation(function(ret, err) {
- if (ret.status) {
- arr.lon = ret.lon,
- arr.lat = ret.lat
- }
- });
- }
- function onli(){
- getLocation();
- lin.push(arr)
- aMap.setCenter({
- coords: arr,
- animation: false
- });
- aMap.addLine({
- id: 1,
- styles: {
- type: 'arrow',
- borderColor: '#FF0000',
- borderWidth: 3,
- lineDash: true,
- strokeImg: ''
- },
- points: lin
- });
- console.log(JSON.stringify(lin));
- //上传的代码不清晰再传一次
- }
复制代码 |
|