APP 개발 - 지도에 정보 그리기 로드

1704 단어
// services 
$scope.getBorderNode = function () {
var nodes = [];
var n = [];
Home.getBorderNode().then(function (resData) {
for (var k = 0; k < resData.value.length; k++) {
n.push(resData.value[k]);
}
  // linq.js
nodes = n.groupBy(g => g.childId);
for (var i = 0; i < nodes.length; i++) {
var node = nodes[i];
$scope.showBorder(node);
}
});
};
//
$scope.showBorder = function (nodes) {
var a = [];
if (nodes[0].borderType === '3') {
//
for (var i = 0; i < nodes.length; i++) {
a.push([nodes[i].lng, nodes[i].lat]);
}
var polygon = new AMap.Polygon({
path: a,
strokeColor: '#FF33FF',
strokeWeight: 6,
strokeOpacity: 0.2,
fillOpacity: 0.4,
fillColor: '#1791fc',
zIndex: 50,
});
$scope.map.add(polygon);
// $scope.map.setFitView([polygon]);
}
//
if (nodes[0].borderType === '2') {
for (var i = 0; i < nodes.length; i++) {
var circle = new AMap.Circle({
center: [nodes[i].lng, nodes[i].lat],
radius: nodes[i].radius, //
borderWeight: 3,
strokeColor: '#FF33FF',
strokeOpacity: 1,
strokeWeight: 6,
fillOpacity: 0.4,
strokeStyle: 'dashed',
strokeDasharray: [10, 10],
fillColor: '#1791fc',
zIndex: 50,
});
   $scop.map.add(circle); 
}
}
};
, 。

좋은 웹페이지 즐겨찾기