Как нарисовать несколько кругов на карте в Android - PullRequest
1 голос
/ 08 апреля 2020

Я пытаюсь нарисовать несколько кругов, используя CircleOptions на карте Google, когда я пытаюсь с одним кружком, он работает отлично, но когда я пытаюсь со списком координат, он показывает только маркеры там, а не рисовать круги на карте

-> установить данные в модели

  TestCircleModel testCircleModel = new TestCircleModel(22.9734, 78.6569, "15");
    myTestCircleList.add(testCircleModel);

    TestCircleModel testCircleModel2 = new TestCircleModel(22.2587, 71.1924, "17");
    myTestCircleList.add(testCircleModel2);

    TestCircleModel testCircleModel3 = new TestCircleModel(15.2993, 74.1240, "22");
    myTestCircleList.add(testCircleModel3);

    for (TestCircleModel myModel : myTestCircleList) {
        showCircle(myModel.getLat(), myModel.getLang(), myModel.getDigit());
    }

-> метод рисования круга

private void showCircle(double lat, double lang, String digit) {
    CircleOptions circleOptions = new CircleOptions();
    LatLng seattle = new LatLng(lat, lang);
    circleOptions.center(seattle);
    circleOptions.radius(500);
    circleOptions.fillColor(Color.BLUE);
    circleOptions.strokeColor(Color.RED);
    circleOptions.strokeWidth(4);
    seattle = new LatLng(lat, lang);
    mMap.addMarker(new MarkerOptions().position(seattle).title(digit));
    mMap.addCircle(circleOptions);
}
...