этот вопрос должен быть довольно простым, но я не смог понять его.
Я хочу собрать все объекты VELatLong, перебирая список полигонов в JavaScript, чтобы использовать метод SetMapView ().
До сих пор я мог делать только с 2 полигонами, и мой код выглядит так:
var points = [];
// Getting the points for first polygon
map.AddShape(shapeOne);
points = shape.GetPoints();
// Getting the points for second polygon and Concatenating "points" with "pointsTwo".
map.AddShape(shapeTwo);
pointsTwo = shape.GetPoints();
points.concat(pointsTwo);
map.SetMapView(points);
Но я хотел бы помочь, как я могу сделать то же самое, перебирая список полигонов?
Мой итерационный код работает нормально, выглядит так:
function btnPolygons_Click()
{
$.post
(
"/Search/GetPolygons",
null,
function (items) {
$.each
(
items,
function (i, polygonItem) {
var wktShape = polygonItem.PolygonWKT
// Create a VEShape from the WKT representation
var shape = VirtualEarthWKT.ShapeFromWKT(wktShape);
// Add VEShape to Map
map.AddShape(shape);
}
);
},
"json"
);
}
Можете ли вы сказать мне, что добавить к моему коду итерации, чтобы собрать все объекты VELatLong, повторяющиеся в списке полигонов?