Angularjs 要使用圆半径调整的角度ng贴图立根
我正在使用ngMaps的角度。 我已经创建了一个地图,包括一个形状(圆),可以根据半径值进行调整 是否可以设置要调整的地图边界以包括整个圆 以下是我的看法:Angularjs 要使用圆半径调整的角度ng贴图立根,angularjs,maps,geometry,ng-map,setbounds,Angularjs,Maps,Geometry,Ng Map,Setbounds,我正在使用ngMaps的角度。 我已经创建了一个地图,包括一个形状(圆),可以根据半径值进行调整 是否可以设置要调整的地图边界以包括整个圆 以下是我的看法: <ng-map class="bu-map" default-style="false" scrollwheel="false" style="margin: 0 -15px" data-ng-style="
<ng-map class="bu-map"
default-style="false"
scrollwheel="false"
style="margin: 0 -15px"
data-ng-style="{'height': appCtrl.windowHeight - 81 + 'px'}"
map-type-control="false"
>
<shape id="circle"
name="circle"
centered="true"
stroke-color='#FF0000'
stroke-opacity="0.8"
stroke-weight="1"
center="{{listCtrl.queryBounds.centerPoint}}"
radius="{{listCtrl.queryBounds.radius}}"
editable="false"></shape>
</ng-map>
在这种情况下,可以调整searchQuery.radius,它会调整在地图上绘制的圆,但有时它对地图来说太大,缩放也不会调整
我对setZoom进行了计算,但setZoom值的多样性不足以完美地包含圆
这在挫折中是可能的吗
谢谢 这里有一个本地方式。在圆圈上找到4个科迪纳山脉(名称:东、西、北、南) UPD:按照上面的方法,通过google.maps.geometry.spheremic.computeOffset()我们可以找到四个点的坐标 方式2:
NgMap.getMap().then((map) => {
map.fitBounds(map.shapes[0].getBounds()); // fit the zoom to the circle.
}
注意:通过这种方式,您必须确定map.shapes中的哪个形状是圆元素
NgMap.getMap().then((map) => {
let bounds = new google.maps.LatLngBounds();
bounds.extend(east);
bounds.extend(west);
bounds.extend(north);
bounds.extend(south);
map.fitBounds(bounds); // fit the zoom to show all the four cordinates
map.setCenter(bounfd.getCenter()); // set the circle to the map center.
}
NgMap.getMap().then((map) => {
map.fitBounds(map.shapes[0].getBounds()); // fit the zoom to the circle.
}