如何确定标记是否在circle数组内?

时间:2018-12-10 02:45:21

标签: javascript leaflet

目前我在确定标记是否在圆数组内时遇到问题。我提供的代码仅设法知道一到两个圆的标记,而其余的则不知道。有谁知道是什么原因造成的?

创建圆的代码

import { advanceBy, advanceTo, clear } from 'jest-date-mock';

test('usage', () => {
  advanceTo(new Date(2018, 5, 27, 0, 0, 0)); // reset to date time.

  const now = Date.now();

  advanceBy(3000); // advance time 3 seconds
  expect(+new Date() - now).toBe(3000);

  advanceBy(-1000); // advance time -1 second
  expect(+new Date() - now).toBe(2000);

  clear();
  Date.now(); // will got current timestamp
});

中的代码确定标记是否在圆形数组内

$.ajax({
        type: "GET",
        url: 'http://localhost:59927//api//Values//FlagingDevice(WithoutParameters)',
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        success: function (data, status, xhr) {
            for (var i = 0; i < data.Table.length; i++) {
                circle[i] = L.circle([data.Table[i].Latitude, data.Table[i].Longitude], 50, { color: '#FFFFFF', opacity: 0.5, fillColor: 'white', fillOpacity: .3 }).addTo(map);
            }
        },
        error: function (xhr) {
            alert(xhr.responseText);
        }
    }); 

0 个答案:

没有答案