简体   繁体   English

缩放时保留多边形的屏幕尺寸

[英]Retaining the screen-size of a polygon when zooming

I have a function that plots a polygon centered over a certain location. 我有一个函数,可绘制以某个位置为中心的多边形。 I noticed that when a user zooms, the size of the polygon stays geographically the same, meaning it changes screenwise (ie zooming out displays a larger portion of the map, while the polygon occupies a small portion of the map). 我注意到,当用户缩放时,多边形的大小在地理上保持不变,这意味着它在屏幕上进行了更改(即缩小显示了地图的较大部分,而多边形则占据了地图的一小部分)。

One could say that I position the polygon with respect to geographical measurements but I wish to size it with respect to screen ditto. 可以说我是根据地理测量来定位多边形的,但是我希望相对于屏幕同上来调整其大小

How can I do that? 我怎样才能做到这一点?

I suppose I could find out the size of the viewer or screen and check that against boundaries of the map and so on. 我想我可以找出查看器或屏幕的大小,并对照地图边界进行检查,依此类推。 However, that sounds like a tedious approach and I trust that there's functionality in the API that does all that for me, likely much faster and more reliably. 但是,这听起来很乏味,我相信API中的功能可以为我完成所有这些工作,而且速度可能更快,更可靠。

Since polygons are tied to locations you will need to just draw an image on the screen instead. 由于多边形与位置相关,因此您只需要在屏幕上绘制图像即可。 (Unless you like to inflict pain upon yourself and recalculate all the polygon locations when the zoom changes). (除非缩放时要使自己痛苦并重新计算所有多边形位置)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM