diff --git a/src/app/key-unit/basicinfo-look/basicinfo.component.ts b/src/app/key-unit/basicinfo-look/basicinfo.component.ts index 0278bc0..5b202a1 100644 --- a/src/app/key-unit/basicinfo-look/basicinfo.component.ts +++ b/src/app/key-unit/basicinfo-look/basicinfo.component.ts @@ -153,7 +153,27 @@ export class BasicinfoLookComponent implements OnInit { }); - if (this.isMapLabel) {//如果已经标注单位坐标 + if(this.isMapLabel){//如果已经标注单位坐标 + // console.log('已标注单位位置') + this.map.setCenter([this.unitinfo.location.x,this.unitinfo.location.y]); + this.oldPositionMarker = new AMap.Marker({ + position: [this.unitinfo.location.x,this.unitinfo.location.y], + content: this.newPositionMarkerContent, + offset: new AMap.Pixel(-15, -18) + }) + // 将 markers 添加到地图 + this.map.add(this.oldPositionMarker); + }else{ + // console.log('未标注单位位置') + this.map.setCity('株洲市'); + } + } + markerPosition2 + //点击位置按钮 + setPosition(){ + this.isGisTopBox = false + this.isGisTopBoxTwo = true + if(this.isMapLabel){//如果已经标注单位坐标 // console.log('已标注单位位置') this.map.setCenter([this.unitinfo.location.x, this.unitinfo.location.y]); this.oldPositionMarker = new AMap.Marker({ diff --git a/src/app/key-unit/basicinfo/basicinfo.component.ts b/src/app/key-unit/basicinfo/basicinfo.component.ts index 97b224e..48357ef 100644 --- a/src/app/key-unit/basicinfo/basicinfo.component.ts +++ b/src/app/key-unit/basicinfo/basicinfo.component.ts @@ -192,20 +192,20 @@ export class BasicinfoComponent implements OnInit { }); - if (this.isMapLabel) {//如果已经标注单位坐标 - // console.log('已标注单位位置') - this.map.setCenter([this.unitinfo.location.x, this.unitinfo.location.y]); - this.oldPositionMarker = new AMap.Marker({ - position: [this.unitinfo.location.x, this.unitinfo.location.y], - content: this.newPositionMarkerContent, - offset: new AMap.Pixel(-34, -36) - }) - // 将 markers 添加到地图 - this.map.add(this.oldPositionMarker); - } else { - // console.log('未标注单位位置') - this.map.setCity('上海'); - } + if(this.isMapLabel){//如果已经标注单位坐标 + // console.log('已标注单位位置') + this.map.setCenter([this.unitinfo.location.x,this.unitinfo.location.y]); + this.oldPositionMarker = new AMap.Marker({ + position: [this.unitinfo.location.x,this.unitinfo.location.y], + content: this.newPositionMarkerContent, + offset: new AMap.Pixel(-15, -18) + }) + // 将 markers 添加到地图 + this.map.add(this.oldPositionMarker); + }else{ + // console.log('未标注单位位置') + this.map.setCity('株洲市'); + } } markerPosition2 //点击位置按钮