本文整理汇总了Java中com.mapbox.mapboxsdk.annotations.Marker类的典型用法代码示例。如果您正苦于以下问题:Java Marker类的具体用法?Java Marker怎么用?Java Marker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Marker类属于com.mapbox.mapboxsdk.annotations包,在下文中一共展示了Marker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMapReady
import com.mapbox.mapboxsdk.annotations.Marker; //导入依赖的package包/类
@Override
public void onMapReady(MapboxMap mapboxMap) {
this.mapboxMap = mapboxMap;
this.mapboxMap.setOnInfoWindowClickListener(new MapboxMap.OnInfoWindowClickListener() {
@Override
public boolean onInfoWindowClick(@NonNull Marker marker) {
for (Acopio acopio: acopios) {
if (acopio.getNombre().equals(marker.getTitle())) {
Intent intent = new Intent(context, ActivityAcopio.class);
intent.putExtra("acopio", acopio);
startActivity(intent);
break;
}
}
return true;
}
});
getAcopios();
}
示例2: remove
import com.mapbox.mapboxsdk.annotations.Marker; //导入依赖的package包/类
/**
* Removes a markerWithPosition some time in the future.
*
* @param priority whether this operation should have priority.
* @param m the markerWithPosition to remove.
*/
public void remove(boolean priority, Marker m) {
lock.lock();
sendEmptyMessage(BLANK);
if (priority) {
mOnScreenRemoveMarkerTasks.add(m);
} else {
mRemoveMarkerTasks.add(m);
}
lock.unlock();
}
示例3: removeMarker
import com.mapbox.mapboxsdk.annotations.Marker; //导入依赖的package包/类
private void removeMarker(Marker m) {
Cluster<T> cluster = mMarkerToCluster.get(m);
mClusterToMarker.remove(cluster);
mMarkerCache.remove(m);
mMarkerToCluster.remove(m);
mClusterManagerPlugin.getMarkerManager().remove(m);
}
示例4: getInfoWindow
import com.mapbox.mapboxsdk.annotations.Marker; //导入依赖的package包/类
@Override
public View getInfoWindow(Marker marker) {
Collection collection = mAllMarkers.get(marker);
if (collection != null && collection.mInfoWindowAdapter != null) {
return collection.mInfoWindowAdapter.getInfoWindow(marker);
}
return null;
}
示例5: onInfoWindowClick
import com.mapbox.mapboxsdk.annotations.Marker; //导入依赖的package包/类
@Override
public boolean onInfoWindowClick(Marker marker) {
Collection collection = mAllMarkers.get(marker);
if (collection != null && collection.mInfoWindowClickListener != null) {
collection.mInfoWindowClickListener.onInfoWindowClick(marker);
}
return true;
}
示例6: onMarkerClick
import com.mapbox.mapboxsdk.annotations.Marker; //导入依赖的package包/类
@Override
public boolean onMarkerClick(Marker marker) {
Collection collection = mAllMarkers.get(marker);
if (collection != null && collection.mMarkerClickListener != null) {
return collection.mMarkerClickListener.onMarkerClick(marker);
}
return false;
}
示例7: remove
import com.mapbox.mapboxsdk.annotations.Marker; //导入依赖的package包/类
public boolean remove(Marker marker) {
if (mMarkers.remove(marker)) {
mAllMarkers.remove(marker);
marker.remove();
return true;
}
return false;
}
示例8: clear
import com.mapbox.mapboxsdk.annotations.Marker; //导入依赖的package包/类
public void clear() {
for (Marker marker : mMarkers) {
marker.remove();
mAllMarkers.remove(marker);
}
mMarkers.clear();
}
示例9: onInfoWindowClick
import com.mapbox.mapboxsdk.annotations.Marker; //导入依赖的package包/类
@Override
public boolean onInfoWindowClick(@NonNull Marker marker) {
String placeId = mMarkerIdToPlaceId.get(marker.getId());
if (placeId != null && mPlaceClickedListener != null) {
mPlaceClickedListener.onPlaceClicked(placeId);
}
return false;
}
示例10: resizeSurroundingMarkers
import com.mapbox.mapboxsdk.annotations.Marker; //导入依赖的package包/类
private void resizeSurroundingMarkers() {
if (isAdded() && mMap != null && mSurroundingMarkers != null && mSurroundingMarkers.size() > 0) {
int iconSize = calculateMarkerIconSize();
if (iconSize != mLastIconSize) {
Icon circle = Utils.drawableToIcon(getActivity(), R.drawable.ic_marker, iconSize);
for (Marker marker : mSurroundingMarkers) {
marker.setIcon(circle);
}
mLastIconSize = iconSize;
}
}
}
示例11: initializeMap
import com.mapbox.mapboxsdk.annotations.Marker; //导入依赖的package包/类
private void initializeMap() {
mapView.setStyleUrl("asset://mapstyle.json");
mapView.setMyLocationTrackingMode(MyLocationTracking.TRACKING_NONE);
mapView.setLogoVisibility(View.GONE);
mapView.setAttributionVisibility(View.GONE);
mapView.setOnMyLocationChangeListener(new MapView.OnMyLocationChangeListener() {
@Override
public void onMyLocationChange(@Nullable Location location) {
makeUseOfNewLocation(location);
if (!firstLocationLock) {
goToUserLocation();
firstLocationLock = true;
}
}
});
mapView.setOnScrollListener(new MapView.OnScrollListener() {
@Override
public void onScroll() {
fetchNearbyPages();
}
});
mapView.setOnMarkerClickListener(new MapView.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(@NonNull Marker marker) {
NearbyPage page = findNearbyPageFromMarker(marker);
if (page != null) {
PageTitle title = new PageTitle(page.getTitle(), site, page.getThumblUrl());
((PageActivity) getActivity()).showLinkPreview(title, HistoryEntry.SOURCE_NEARBY, page.getLocation());
return true;
} else {
return false;
}
}
});
}
示例12: findNearbyPageFromMarker
import com.mapbox.mapboxsdk.annotations.Marker; //导入依赖的package包/类
@Nullable
private NearbyPage findNearbyPageFromMarker(Marker marker) {
for (NearbyPage page : lastResult.getList()) {
if (page.getTitle().equals(marker.getTitle())) {
return page;
}
}
return null;
}
示例13: zoomOutToFitAllMarkers
import com.mapbox.mapboxsdk.annotations.Marker; //导入依赖的package包/类
protected void zoomOutToFitAllMarkers() {
try {
if (mapboxMap != null) {
Location mCurrentLocation = mapboxMap.getMyLocation();
List<LatLng> lst = new ArrayList<>();
LatLngBounds.Builder builder = new LatLngBounds.Builder();
for (Marker marker : mapboxMap.getMarkers()) {
lst.add(marker.getPosition());
}
if (mCurrentLocation != null)
lst.add(new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude()));
//Add current location to camera bounds
if (lst.size() == 1)
moveCamera(new LatLng(lst.get(0).getLatitude(), lst.get(0).getLongitude()), Constants.ZOOM_TO_SEE_FARTHER_DISTANCE);
else if (lst.size() > 1) {
builder.includes(lst);
LatLngBounds bounds = builder.build();
//If there's only 2 points in the list and the currentlocation is known, that means only one of them is a saved spot
if (mCurrentLocation != null && lst.size() == 2)
mapboxMap.easeCamera(CameraUpdateFactory.newLatLngBounds(bounds, 150), 5000);
else
mapboxMap.easeCamera(CameraUpdateFactory.newLatLngBounds(bounds, 120), 5000);
}
}
} catch (Exception ex) {
Crashlytics.logException(ex);
showErrorAlert(getResources().getString(R.string.general_error_dialog_title), String.format(getResources().getString(R.string.general_error_dialog_message),
"Show all markers failed - " + ex.getMessage()));
}
}
示例14: removePoiMarkerInError
import com.mapbox.mapboxsdk.annotations.Marker; //导入依赖的package包/类
private void removePoiMarkerInError(Long id) {
Marker m = markersPoi.remove(id).getMarker();
if (m != null) {
mapboxMap.removeMarker(m);
}
defaultMap();
}
示例15: removeNoteMarkerInError
import com.mapbox.mapboxsdk.annotations.Marker; //导入依赖的package包/类
private void removeNoteMarkerInError(Long id) {
Marker m = markersNotes.remove(id).getMarker();
if (m != null) {
mapboxMap.removeMarker(m);
}
defaultMap();
}