我有一个Xamarin Android地图(VS2019)和一些经/纬度点。我想做的就是给地图放大(或缩小),给定一组设置边界框的坐标。
我有下面的这段代码,似乎什么也没做。我已经阅读了所有建议使用它的文档,但是没有用。我已经检查并正确设置了边界框坐标,但地图没有执行任何操作。
根据调用LayOut
的文档,应该对其进行更新,但是它什么也不做,没有错误,只是什么也没有。
我如何实现这一目标,我们将不胜感激。
MyMap.Layout(GetBounds(points));
private Rectangle GetBounds(List<Point> points)
{
var minx = (from x in points select x.X).Min();
var maxx = (from x in points select x.X).Max();
var miny = (from x in points select x.Y).Min();
var maxy = (from x in points select x.Y).Max();
Rectangle rectangle = new Rectangle(minx, miny, maxx - minx, maxy - miny);
return rectangle;
}
答案 0 :(得分:0)
这就是我所做的
我在需要边界的地方创建了一个矩形
npm config set ignore-scripts true
然后我得到了矩形位置
Rectangle rectangle = GetBounds(points);
...然后得到矩形的中心点
Position p1 = new Position(rectangle.X, rectangle.Y);
Position p2 = new Position((rectangle.X + rectangle.Width), (rectangle.Y + rectangle.Height));
然后使用该数据调用了double x = rectangle.X + (rectangle.Width / 2);
double y = rectangle.Y + (rectangle.Height / 2);
,
.MoveToRegion