本文整理汇总了Java中com.mapbox.mapboxsdk.annotations.MarkerViewOptions类的典型用法代码示例。如果您正苦于以下问题:Java MarkerViewOptions类的具体用法?Java MarkerViewOptions怎么用?Java MarkerViewOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MarkerViewOptions类属于com.mapbox.mapboxsdk.annotations包,在下文中一共展示了MarkerViewOptions类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setCurrentMarkerPosition
点赞 2
import com.mapbox.mapboxsdk.annotations.MarkerViewOptions; //导入依赖的package包/类
private void setCurrentMarkerPosition(LatLng position) {
if (position != null) {
if (currentMarker == null) {
MarkerViewOptions markerViewOptions = new MarkerViewOptions()
.position(position);
currentMarker = mapboxMap.addMarker(markerViewOptions);
} else {
currentMarker.setPosition(position);
}
}
}
开发者ID:mapbox,
项目名称:mapbox-navigation-android,
代码行数:12,
代码来源:NavigationViewActivity.java
示例2: addMarker
点赞 2
import com.mapbox.mapboxsdk.annotations.MarkerViewOptions; //导入依赖的package包/类
private void addMarker(Acopio acopio, int pos) {
MarkerViewOptions options = new MarkerViewOptions()
.icon(IconFactory.getInstance(this).fromResource(R.mipmap.circle))
.position(new LatLng(acopio.getGeopos().getLat(),
acopio.getGeopos().getLng()))
.title(acopio.getNombre())
.snippet(acopio.getDireccion()+"\n\n"+ getString(R.string.see_more));
options.getMarker().setId(pos);
this.mapboxMap.addMarker(options);
}
开发者ID:faviotorres,
项目名称:AcopioMX,
代码行数:11,
代码来源:ActivityHome.java
示例3: updateMarkerPosition
点赞 2
import com.mapbox.mapboxsdk.annotations.MarkerViewOptions; //导入依赖的package包/类
private void updateMarkerPosition(LatLng position) {
// This method is were we update the marker position once we have new coordinates. First we
// check if this is the first time we are executing this handler, the best way to do this is
// check if marker is null;
if (marker == null) {
// Create the icon for the marker
Icon icon = IconFactory.getInstance(this).fromResource(R.drawable.iss);
// Add the marker to the map using the API's latitude and longitude.
marker = map.addMarker(new MarkerViewOptions()
.position(position)
.anchor(0.5f, 0.5f)
.icon(icon));
// Lastly, animate the camera to the new position so the user
// wont have to search for the marker and then return.
map.animateCamera(CameraUpdateFactory.newLatLngZoom(position, 1), apiCallTime);
return;
}
// Marker rotation is critical only if you want the marker to point in the direction the
// object's moving.
marker.setRotation((float) computeHeading(marker.getPosition(), position));
ValueAnimator markerAnimator = ObjectAnimator.ofObject(marker, "position",
new LatLngEvaluator(), marker.getPosition(), position);
markerAnimator.setDuration(apiCallTime);
markerAnimator.setInterpolator(new LinearInterpolator());
markerAnimator.start();
}
开发者ID:mapbox,
项目名称:mapbox-android-demo,
代码行数:32,
代码来源:SpaceStationLocationActivity.java
示例4: onPostExecute
点赞 2
import com.mapbox.mapboxsdk.annotations.MarkerViewOptions; //导入依赖的package包/类
@Override
protected void onPostExecute(final List<LatLng> points) {
super.onPostExecute(points);
// Make sure our list isn't empty.
if (points.size() > 0) {
LatLng[] pointsArray = points.toArray(new LatLng[points.size()]);
// Draw a polyline showing the route the marker will be taking.
map.addPolyline(new PolylineOptions()
.add(pointsArray)
.color(Color.parseColor("#F13C6E"))
.width(4));
// We are using a custom marker icon.
Icon icon = IconFactory.getInstance(MarkerFollowingRouteActivity.this).fromResource(R.drawable.pink_dot);
// Using a view marker, we place it at the first point in the points list.
final Marker marker = map.addMarker(new MarkerViewOptions()
.position(points.get(count))
.icon(icon)
.anchor(0.5f, 0.5f)
.flat(true));
// Animating the marker requires the use of both the ValueAnimator and a handler.
// The ValueAnimator is used to move the marker between the GeoJSON points, this is
// done linearly. The handler is used to move the marker along the GeoJSON points.
handler = new Handler();
runnable = new Runnable() {
@Override
public void run() {
// Check if we are at the end of the points list, if so we want to stop using
// the handler.
if ((points.size() - 1) > count) {
// Calculating the distance is done between the current point and next.
// This gives us the duration we will need to execute the ValueAnimator.
// Multiplying by ten is done to slow down the marker speed. Adjusting
// this value will result in the marker traversing faster or slower along
// the line
distance = (long) marker.getPosition().distanceTo(points.get(count)) * 10;
// animate the marker from it's current position to the next point in the
// points list.
ValueAnimator markerAnimator = ObjectAnimator.ofObject(marker, "position",
new LatLngEvaluator(), marker.getPosition(), points.get(count));
markerAnimator.setDuration(distance);
markerAnimator.setInterpolator(new LinearInterpolator());
markerAnimator.start();
// This line will make sure the marker appears when it is being animated
// and starts outside the current user view. Without this, the user must
// intentionally execute a gesture before the view marker reappears on
// the map.
map.getMarkerViewManager().update();
// Keeping the current point count we are on.
count++;
// Once we finish we need to repeat the entire process by executing the
// handler again once the ValueAnimator is finished.
handler.postDelayed(this, distance);
}
}
};
handler.post(runnable);
}
}
开发者ID:mapbox,
项目名称:mapbox-android-demo,
代码行数:70,
代码来源:MarkerFollowingRouteActivity.java