本文整理汇总了Java中org.osmdroid.views.overlay.FolderOverlay.add方法的典型用法代码示例。如果您正苦于以下问题:Java FolderOverlay.add方法的具体用法?Java FolderOverlay.add怎么用?Java FolderOverlay.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.osmdroid.views.overlay.FolderOverlay
的用法示例。
在下文中一共展示了FolderOverlay.add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildOverlay
import org.osmdroid.views.overlay.FolderOverlay; //导入方法依赖的package包/类
/**
* Build a FolderOverlay, containing (recursively) overlays from all items of this Folder.
* @param map
* @param defaultStyle to apply when an item has no Style defined.
* @param styler to apply
* @param kmlDocument for Styles
* @return the FolderOverlay built
*/
@Override public Overlay buildOverlay(MapView map, Style defaultStyle, Styler styler, KmlDocument kmlDocument){
FolderOverlay folderOverlay = new FolderOverlay();
for (KmlFeature k:mItems){
Overlay overlay = k.buildOverlay(map, defaultStyle, styler, kmlDocument);
if (overlay != null)
folderOverlay.add(overlay);
}
if (styler == null)
folderOverlay.setEnabled(mVisibility);
else
styler.onFeature(folderOverlay, this);
return folderOverlay;
}
示例2: buildOverlay
import org.osmdroid.views.overlay.FolderOverlay; //导入方法依赖的package包/类
/** Build a FolderOverlay containing all overlays from this MultiGeometry items */
@Override public Overlay buildOverlay(MapView map, Style defaultStyle, Styler styler, KmlPlacemark kmlPlacemark,
KmlDocument kmlDocument){
FolderOverlay folderOverlay = new FolderOverlay();
for (KmlGeometry k:mItems){
Overlay overlay = k.buildOverlay(map, defaultStyle, styler, kmlPlacemark, kmlDocument);
folderOverlay.add(overlay);
}
return folderOverlay;
}
示例3: config
import org.osmdroid.views.overlay.FolderOverlay; //导入方法依赖的package包/类
private void config(){
Drawable onlineMarker=getResources().getDrawable(R.mipmap.ic_radiotower_green);
Drawable offlineMarker=getResources().getDrawable(R.mipmap.ic_radiotower_red);
int backgroundColor=Color.parseColor("#ffffff");
ewOverlay=new ItemizedOverlayWithFocus<>(onlineWide,onlineMarker,onlineMarker, backgroundColor,
new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
@Override
public boolean onItemSingleTapUp(final int index, final OverlayItem item) {
//do something
return true;
}
@Override
public boolean onItemLongPress(final int index, final OverlayItem item) {
return false;
}
},getContext());
dwOverlay=new ItemizedOverlayWithFocus<>(offlineWide,offlineMarker,offlineMarker, backgroundColor,
new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
@Override
public boolean onItemSingleTapUp(final int index, final OverlayItem item) {
//do something
return true;
}
@Override
public boolean onItemLongPress(final int index, final OverlayItem item) {
return false;
}
},getContext());
epOverlay=new ItemizedOverlayWithFocus<>(onlinePers,onlineMarker,onlineMarker, backgroundColor,
new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
@Override
public boolean onItemSingleTapUp(final int index, final OverlayItem item) {
//do something
return true;
}
@Override
public boolean onItemLongPress(final int index, final OverlayItem item) {
return false;
}
},getContext());
dpOverlay=new ItemizedOverlayWithFocus<>(offlinePers,offlineMarker,offlineMarker, backgroundColor,
new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
@Override
public boolean onItemSingleTapUp(final int index, final OverlayItem item) {
//do something
return true;
}
@Override
public boolean onItemLongPress(final int index, final OverlayItem item) {
return false;
}
},getContext());
dwOverlay.setEnabled(false);
epOverlay.setEnabled(false);
dpOverlay.setEnabled(false);
ewOverlay.setFocusItemsOnTap(true);
ItemizedOverlayWithFocus[] ovList={ewOverlay,dwOverlay,epOverlay,dpOverlay};
fo = new FolderOverlay();
for(ItemizedOverlayWithFocus t : ovList){
//t.setDescriptionBoxCornerWidth(32);
//t.setDescriptionBoxPadding(6);
//t.setDescriptionMaxWidth(200);
fo.add(t);
}
map.getOverlays().add(fo);
ewOverlay.setFocusItemsOnTap(true);
}
示例4: createOverlay
import org.osmdroid.views.overlay.FolderOverlay; //导入方法依赖的package包/类
/**
* Creates and add an overlay to the map.
* @param places List of places to plot on the map.
* @param markersType Identifier for what icon should be used for markers.
* @param overlayTag Identifier for the overlay to be added on the OverlayManager.
*/
public void createOverlay(List<Place> places, MarkerTypes markersType, OverlayTags overlayTag){
final FolderOverlay poiMarkers = new FolderOverlay();
MapUtils mapUtils = new MapUtils(getContext());
final HashMap<MarkerStatuses, Drawable> markerDrawables = mapUtils.getMarkerDrawable(markersType);
// Creates a marker for each place found
for (int i = 0; i < places.size(); i++) {
Place checkPlace = places.get(i);
if (!mapRegion.contains(checkPlace.getLatitude(),checkPlace.getLongitude()))
places.remove(checkPlace);
final Place rightPlace = places.get(i);
Marker.OnMarkerClickListener onMarkerClickListener = new Marker.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(Marker marker, MapView mapView) {
// Finds the container in which the fragment will be inflated
FrameLayout bottomSheetContainer = getActivity().findViewById(R.id.bottom_sheet_container);
BottomSheetBehavior behavior = BottomSheetBehavior.from(bottomSheetContainer);
behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
// Sets up a PlaceDetailsFragment to show specific information about the selected Place
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
PlaceDetailsFragment placeDetailsFragment = PlaceDetailsFragment.newInstance(rightPlace);
fragmentManager.beginTransaction()
.replace(R.id.bottom_sheet_container,placeDetailsFragment,PlaceDetailsFragment.FRAGMENT_TAG)
.commit();
// Will change the marker to its clicked icon
marker.setIcon(markerDrawables.get(MarkerStatuses.CLICKED));
mapView.postInvalidate();
return true;
}
};
final Marker customMarker = mapUtils
.createCustomMarker(mapView, markerDrawables.get(MarkerStatuses.NOT_CLICKED),
new GeoPoint(rightPlace.getLatitude(), rightPlace.getLongitude()), onMarkerClickListener);
poiMarkers.add(customMarker);
}
mapView.addOverlay(poiMarkers,overlayTag);
btnClearMap.setVisibility(View.VISIBLE);
}