Skip to content

Refs issue #83 #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Refs issue #83 #91

wants to merge 2 commits into from

Conversation

d-tarasov
Copy link

Как выяснилось при тапе по OverlayItem'у при показе Balloon'а большую роль играет метод, наследованный от java.lang.Comparable compareTo, который в примерах не реализован. Он определяет последовательность в которой будут отрисованы видимые на экране элементы, setPriority в данном случае роли не играет.

Возможно имеет смысл реализовать compareTo по умолчанию внутри Overlay и OverlayItem, подобным образом, чтобы при использовании дефолтного приоритета получить ожидаемое поведение:

    @Override
    public int compareTo(Object object) {
        int thisPriority = getPriority();
        int itemPriority = ((OverlayItem) object).getPriority();

        if (thisPriority < itemPriority) {
            return -1;
        } else if (thisPriority == itemPriority) {
            return 0;
        } else {
            return 1;
        }
    } 

А так же исключить однотипную реализацию данного метода из кода примеров

@d-tarasov
Copy link
Author

Как вариант из compareTo балунов всегда можно возвращать 1, что гарантирует, что они всегда будут отображаться на самом верху вне зависимости от расстановки приоритетов

@mksaint13
Copy link
Member

compareTo реализован и там и там, но с дополнительной логикой

@d-tarasov
Copy link
Author

@mksaint13 что это за логика? Можно ее где-нибудь описать в документации или в вики?

@mussa-ibragimov
Copy link

Спасибо за решение. На дворе 2017, прикручиваем яндекс карты :(

@Kavo102
Copy link

Kavo102 commented Apr 28, 2017

Спасибо! Все работает!!!!!!
Внизу полигоны (Paint.Style.FILL), сверху линии (Paint.Style.STROKE), еще выше точки, типа BalloonItem

public class Overlay2 extends Overlay
{
public Overlay2(MapController mapController)
{
super(mapController);
}

@Override
public int compareTo(Object object)
{
    int thisPriority;
    int itemPriority;
    int kodz;

    thisPriority = this.getPriority();
    itemPriority = ((Overlay) object).getPriority();
    kodz = 0;
    if      (thisPriority < itemPriority) {  kodz = -1; }
    else if (thisPriority > itemPriority) {  kodz =  1; }
    return kodz;
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants