ItemizedLayer synchronized API, fix #507
This commit is contained in:
parent
e108e6e3d7
commit
e85e056a0c
@ -17,6 +17,7 @@
|
||||
- `Parameters.POLY_SYMBOL = true;`
|
||||
- Map fractional zoom [#487](https://github.com/mapsforge/vtm/issues/487)
|
||||
- Render theme fallback internal resources [#477](https://github.com/mapsforge/vtm/issues/477)
|
||||
- Fix ItemizedLayer synchronization [#507](https://github.com/mapsforge/vtm/issues/507)
|
||||
- Fix FadeStep alpha interpolation [#486](https://github.com/mapsforge/vtm/issues/486)
|
||||
- Fix libGDX flickering [#148](https://github.com/mapsforge/vtm/issues/148) [#149](https://github.com/mapsforge/vtm/issues/149)
|
||||
- JTS (LocationTech) [#484](https://github.com/mapsforge/vtm/issues/484)
|
||||
|
@ -179,7 +179,7 @@ public class ItemizedOverlayWithBubble<Item extends MarkerItem> extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeItem(final Item item) {
|
||||
public synchronized boolean removeItem(final Item item) {
|
||||
boolean result = super.removeItem(item);
|
||||
if (mItemWithBubble == item) {
|
||||
hideBubble();
|
||||
@ -188,7 +188,7 @@ public class ItemizedOverlayWithBubble<Item extends MarkerItem> extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAllItems() {
|
||||
public synchronized void removeAllItems() {
|
||||
super.removeAllItems();
|
||||
hideBubble();
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Copyright 2012 osmdroid authors: Nicolas Gramlich, Theodore Hong, Fred Eisele
|
||||
*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016-2017 devemux86
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2016 Stephan Leuschner
|
||||
* Copyright 2016 Pedinel
|
||||
*
|
||||
@ -81,53 +81,53 @@ public class ItemizedLayer<Item extends MarkerInterface> extends MarkerLayer<Ite
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Item createItem(int index) {
|
||||
protected synchronized Item createItem(int index) {
|
||||
return mItemList.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
public synchronized int size() {
|
||||
return Math.min(mItemList.size(), mDrawnItemsLimit);
|
||||
}
|
||||
|
||||
public boolean addItem(Item item) {
|
||||
public synchronized boolean addItem(Item item) {
|
||||
final boolean result = mItemList.add(item);
|
||||
populate();
|
||||
return result;
|
||||
}
|
||||
|
||||
public void addItem(int location, Item item) {
|
||||
public synchronized void addItem(int location, Item item) {
|
||||
mItemList.add(location, item);
|
||||
}
|
||||
|
||||
public boolean addItems(Collection<Item> items) {
|
||||
public synchronized boolean addItems(Collection<Item> items) {
|
||||
final boolean result = mItemList.addAll(items);
|
||||
populate();
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<Item> getItemList() {
|
||||
public synchronized List<Item> getItemList() {
|
||||
return mItemList;
|
||||
}
|
||||
|
||||
public void removeAllItems() {
|
||||
public synchronized void removeAllItems() {
|
||||
removeAllItems(true);
|
||||
}
|
||||
|
||||
public void removeAllItems(boolean withPopulate) {
|
||||
public synchronized void removeAllItems(boolean withPopulate) {
|
||||
mItemList.clear();
|
||||
if (withPopulate) {
|
||||
populate();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean removeItem(Item item) {
|
||||
public synchronized boolean removeItem(Item item) {
|
||||
final boolean result = mItemList.remove(item);
|
||||
populate();
|
||||
return result;
|
||||
}
|
||||
|
||||
public Item removeItem(int position) {
|
||||
public synchronized Item removeItem(int position) {
|
||||
final Item result = mItemList.remove(position);
|
||||
populate();
|
||||
return result;
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 Stephan Leuschner
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2016-2018 devemux86
|
||||
* Copyright 2017 Longri
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
@ -71,7 +71,7 @@ public abstract class MarkerLayer<Item extends MarkerInterface> extends Layer {
|
||||
* should call this as soon as it has data, before anything else gets
|
||||
* called.
|
||||
*/
|
||||
public final void populate() {
|
||||
public final synchronized void populate() {
|
||||
mMarkerRenderer.populate(size());
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ public abstract class MarkerLayer<Item extends MarkerInterface> extends Layer {
|
||||
*
|
||||
* @param item
|
||||
*/
|
||||
public void setFocus(Item item) {
|
||||
public synchronized void setFocus(Item item) {
|
||||
mFocusedItem = item;
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ public abstract class MarkerLayer<Item extends MarkerInterface> extends Layer {
|
||||
* @return the currently-focused item, or null if no item is currently
|
||||
* focused.
|
||||
*/
|
||||
public Item getFocus() {
|
||||
public synchronized Item getFocus() {
|
||||
return mFocusedItem;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user