本文整理汇总了Java中org.osmdroid.views.overlay.ItemizedIconOverlay类的典型用法代码示例。如果您正苦于以下问题:Java ItemizedIconOverlay类的具体用法?Java ItemizedIconOverlay怎么用?Java ItemizedIconOverlay使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ItemizedIconOverlay类属于org.osmdroid.views.overlay包,在下文中一共展示了ItemizedIconOverlay类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateUserPosition
import org.osmdroid.views.overlay.ItemizedIconOverlay; //导入依赖的package包/类
private void updateUserPosition(boolean moveToCenter) {
if (isDetached()) return;
if (mMyLocationOverlayItem != null) {
mMapView.getOverlays().remove(mMyLocationOverlayItem);
}
if (mLastUserPosition != null) {
final List<MyLocationOverlayItem> mMyLocationOverlayItemArray = new ArrayList<>();
MyLocationOverlayItem object =
new MyLocationOverlayItem(new GeoPoint(mLastUserPosition.getLatitude(), mLastUserPosition.getLongitude()),
getResources(),
R.string.title_map_my_location,
R.drawable.image_my_location);
mMyLocationOverlayItemArray.add(object);
mMyLocationOverlayItem =
new ItemizedIconOverlay<>(mMyLocationOverlayItemArray,
onUserItemGestureListener,
getDefaultResourceProxyImpl());
mMapView.getOverlays().add(mMyLocationOverlayItem);
if (moveToCenter) mMapView.setCenter(mLastUserPosition);
updateDistanceToTarget();
updateFindRouteButtonState();
}
}
示例2: run
import org.osmdroid.views.overlay.ItemizedIconOverlay; //导入依赖的package包/类
public void run()
{
try {
JSONArray jr3 = Utils.getJSON("https://applications002.brest-metropole.fr/WIPOD01/Transport.svc/getGeolocatedVehiclesPosition?format=json&route_id=" + product + "&trip_headsign=" + terminus.replace(" ", "%20"));
Resources res = getResources();
overlayItemArray.clear();
mMap.getOverlays().clear();
mMap.invalidate();
for (int i = 0; i < jr3.length(); i++) {
JSONObject object = (JSONObject) jr3.getJSONObject(i);
OverlayItem overlayItem = new OverlayItem("0, 0", "0, 0", new GeoPoint(Double.valueOf(object.getString("Lat")), Double.valueOf(object.getDouble("Lon"))));
overlayItem.setMarker(res.getDrawable(R.drawable.icone_bus));
overlayItemArray.add(overlayItem);
}
ItemizedIconOverlay<OverlayItem> anotherItemizedIconOverlay = new ItemizedIconOverlay<OverlayItem>(getActivity(), overlayItemArray, null);
mMap.getOverlays().add(roadOverlay);
mMap.getOverlays().add(anotherItemizedIconOverlay);
} catch (Exception ex) { ex.getMessage(); }
mHandler.postDelayed(m_Runnable, 60000);
}
示例3: showDealersOnMap
import org.osmdroid.views.overlay.ItemizedIconOverlay; //导入依赖的package包/类
private void showDealersOnMap(DealersList aDealersList) {
Log.i(LOGTAG, "Showing dealers on map");
if (aDealersList == null) {
return;
}
List<Dealer> tmpDealers = aDealersList.getDealers();
if (tmpDealers == null) {
return;
}
ArrayList<OverlayItem> tmpMarkers = new ArrayList<OverlayItem>();
for (Dealer tmpDealer : tmpDealers) {
tmpMarkers.add(new OverlayItem(tmpDealer.getName(), "Test", new GeoPoint(tmpDealer.getLatitude(), tmpDealer.getLongitude())));
}
// TODO insert tap action
ItemizedIconOverlay<OverlayItem> tmpDealerOverlay = new ItemizedIconOverlay<OverlayItem>(tmpMarkers, null, resourceProxy);
mMap.getOverlays().add(tmpDealerOverlay);
}
示例4: onCreateView
import org.osmdroid.views.overlay.ItemizedIconOverlay; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mMapView = new MapView(inflater.getContext());
mMapView.setTileSource(UiUtils.GOOGLE_MAPS_TILE);
mMapView.setMultiTouchControls(true);
mOverlayItemList = new ArrayList<>();
mLocationOverlay = new ItemizedIconOverlay<>(getContext(), mOverlayItemList, null);
mMapView.getOverlays().add(mLocationOverlay);
return mMapView;
}
示例5: onPostExecute
import org.osmdroid.views.overlay.ItemizedIconOverlay; //导入依赖的package包/类
protected void onPostExecute(String results) {
if (results != null) {
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd")
.create();
responseWs = gson.fromJson(results, ResponseWs.class);
if (responseWs != null) {
for (Restaurant restaurant : responseWs.getRestaurants()) {
OverlayItem item = new OverlayItem(""
+ restaurant.getId(), restaurant.getName(),
restaurant.getAddress(), new GeoPoint(
restaurant.getLatitude(),
restaurant.getLongitude()));
Drawable icon;
switch (restaurant.getRate()) {
case "V":
icon = context.getResources().getDrawable(
R.drawable.b_marker);
break;
case "R":
icon = context.getResources().getDrawable(
R.drawable.r_marker);
break;
default:
continue;
}
item.setMarker(icon);
overlayItemArray.add(item);
}
ItemizedIconOverlay<OverlayItem> anotherItemizedIconOverlay = new ItemizedIconOverlay<OverlayItem>(
context, overlayItemArray, myOnItemGestureListener);
myOpenMapView.getOverlays().add(anotherItemizedIconOverlay);
myOpenMapView.invalidate();
}
}
}
示例6: MyItemizedIconOverlay
import org.osmdroid.views.overlay.ItemizedIconOverlay; //导入依赖的package包/类
public MyItemizedIconOverlay(
List<OverlayItem> pList,
org.osmdroid.views.overlay.ItemizedIconOverlay.OnItemGestureListener<OverlayItem> pOnItemGestureListener,
ResourceProxy pResourceProxy) {
super(pList, pOnItemGestureListener, pResourceProxy);
// TODO Auto-generated constructor stub
}
示例7: onPostExecute
import org.osmdroid.views.overlay.ItemizedIconOverlay; //导入依赖的package包/类
protected void onPostExecute(String results) {
if (results != null) {
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd")
.create();
responseWs = gson.fromJson(results, ResponseWs.class);
if (responseWs != null) {
for (Restaurant restaurant : responseWs.getRestaurants()) {
OverlayItem item = new OverlayItem(""
+ restaurant.getId(), restaurant.getName(),
restaurant.getAddress(), new GeoPoint(
restaurant.getLatitude(),
restaurant.getLongitude()));
Drawable icon;
switch (restaurant.getRate()) {
case "V":
icon = context.getResources().getDrawable(
R.drawable.b_marker);
break;
case "R":
icon = context.getResources().getDrawable(
R.drawable.r_marker);
break;
default:
continue;
}
item.setMarker(icon);
anotherOverlayItemArray.add(item);
}
ItemizedIconOverlay<OverlayItem> anotherItemizedIconOverlay = new ItemizedIconOverlay<OverlayItem>(
context, anotherOverlayItemArray,
myOnItemGestureListener);
myOpenMapView.getOverlays().add(anotherItemizedIconOverlay);
myOpenMapView.invalidate();
}
}
}
示例8: createOneMap
import org.osmdroid.views.overlay.ItemizedIconOverlay; //导入依赖的package包/类
/**
* Create one IndoorMap and trigger the download tasks that it needs.
*
* @param icon the icon for the fingerprints in the overlays.
* @return the new IndoorMap
*/
private IndoorMap createOneMap(final Drawable icon) {
final ItemizedIconOverlay<FingerprintItem> levelOverlay =
new ItemizedIconOverlay<FingerprintItem>(new ArrayList<FingerprintItem>(),
icon,
this,
new DefaultResourceProxyImpl(activity));
final IndoorMap map = new IndoorMap(levelOverlay);
return map;
}
示例9: createFingerprintOverlay
import org.osmdroid.views.overlay.ItemizedIconOverlay; //导入依赖的package包/类
/**
* Create the overlay that displays the fingerprints, or rather, NOT displays any fingerprints.
* Overwrite this method if you want your FingerprintManager to actually draw fingerprint-icons!
*
* @param activity the activity, used for the context that the DefaultResourceProxyImpl of the overlay needs.
* @param icon the Drawable that will be used for the icons - if any are drawn.
* @return the new, invisible ItemizedIconOverlay
*/
protected ItemizedIconOverlay<FingerprintItem> createFingerprintOverlay(final Activity activity,
final Drawable icon) {
return new ItemizedIconOverlay<FingerprintItem>(new ArrayList<FingerprintItem>(),
icon,
this,
new DefaultResourceProxyImpl(activity)) {
@Override
protected void onDrawItem(final ISafeCanvas canvas, final FingerprintItem item,
final Point curScreenCoords, final float aMapOrientation) {
// Don't draw... this is the base-package, and only the admin-app needs these icons.
}
};
}
示例10: testThatUpdateItemAddsItemToTheOverlay
import org.osmdroid.views.overlay.ItemizedIconOverlay; //导入依赖的package包/类
@Test
public void testThatUpdateItemAddsItemToTheOverlay() {
ItemizedIconOverlay<UserPositionItem> overlay = spy(userPositionManager.overlay);
userPositionManager.overlay = overlay;
List<UserPositionItem> items = new ArrayList<UserPositionItem>();
items.add(item);
userPositionManager.updateItems(items);
verify(overlay, times(1)).removeAllItems();
verify(overlay, times(1)).addItems(any(List.class)); // TODO: really check the contents!
}
示例11: testThatDisablePositionRemovesAllItemsFromTheOverlay
import org.osmdroid.views.overlay.ItemizedIconOverlay; //导入依赖的package包/类
@Test
public void testThatDisablePositionRemovesAllItemsFromTheOverlay() {
ItemizedIconOverlay<UserPositionItem> overlay = spy(userPositionManager.overlay);
userPositionManager.overlay = overlay;
userPositionManager.disablePosition();
verify(overlay, times(1)).removeAllItems();
}
示例12: createProductOverlay
import org.osmdroid.views.overlay.ItemizedIconOverlay; //导入依赖的package包/类
private void createProductOverlay() {
final Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.poi);
final Drawable icon = new BitmapDrawable(getResources(), bm);
productOverlay = new ItemizedIconOverlay<ProductItem>(
new ArrayList<ProductItem>(),
icon,
this,
new DefaultResourceProxyImpl(this)) {
};
}
示例13: setPopup
import org.osmdroid.views.overlay.ItemizedIconOverlay; //导入依赖的package包/类
private void setPopup(MapView mapv, ParkingSpot spot, GeoPoint point){
final MapView map = mapv;
if(popupOverlay != null) {
map.getOverlays().remove(popupOverlay);
}
OverlayItem popup = new OverlayItem(spot.name(), spot.state(), point);
String val;
switch (spot.state()){
case "closed":
val = getString(R.string.closed);
break;
case "nodata":
val = getString(R.string.nodata);
break;
default:
val = String.valueOf(spot.free()) + " " + getString(R.string.of) + " " + String.valueOf(spot.count());
break;
}
SlotPopup marker = new SlotPopup(spot.name(), val, this);
popup.setMarker(marker.getBitmapDrawable());
ArrayList<OverlayItem> popupList = new ArrayList<>();
popupList.add(popup);
popupOverlay = new ItemizedIconOverlay<>(this, popupList, new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
@Override
public boolean onItemSingleTapUp(int index, OverlayItem item) {
map.getOverlays().remove(popupOverlay);
return false;
}
@Override
public boolean onItemLongPress(int index, OverlayItem item) {
return false;
}
});
map.getOverlays().add(popupOverlay);
}
示例14: MyItemizedIconOverlay
import org.osmdroid.views.overlay.ItemizedIconOverlay; //导入依赖的package包/类
public MyItemizedIconOverlay(
List<OverlayItem> pList,
org.osmdroid.views.overlay.ItemizedIconOverlay.OnItemGestureListener<OverlayItem> pOnItemGestureListener,
ResourceProxy pResourceProxy) {
super(pList, pOnItemGestureListener, pResourceProxy);
}
示例15: addMarker
import org.osmdroid.views.overlay.ItemizedIconOverlay; //导入依赖的package包/类
@Override
public void addMarker(final Marker aMarker) {
if (mItemizedOverlay == null) {
// XXX this is a bit cumbersome. Maybe we should just do a simple ItemizedIconOverlay with null listener
mItemizedOverlay = new ItemizedOverlayWithFocus<OverlayItem>(new ArrayList<OverlayItem>(), new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
@Override
public boolean onItemSingleTapUp(final int index, final OverlayItem item) {
return false;
}
@Override
public boolean onItemLongPress(final int index, final OverlayItem item) {
return false;
}
},this.mMapView.getContext());
mItemizedOverlay.setFocusItemsOnTap(true);
mMapView.getOverlays().add(mItemizedOverlay);
}
final OverlayItem item = new OverlayItem(aMarker.title, aMarker.snippet, new GeoPoint(aMarker.latitude, aMarker.longitude));
if (aMarker.bitmap != null) {
item.setMarker(new BitmapDrawable(mMapView.getResources(), aMarker.bitmap));
} else {
if (aMarker.icon != 0) {
item.setMarker(mMapView.getResources().getDrawable(aMarker.icon));
}
}
if (aMarker.anchor == Marker.Anchor.CENTER) {
item.setMarkerHotspot(OverlayItem.HotspotPlace.CENTER);
}
mItemizedOverlay.addItem(item);
}