本文整理了Java中com.google.android.gms.maps.model.Marker.setPosition()
方法的一些代码示例,展示了Marker.setPosition()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Marker.setPosition()
方法的具体详情如下:
包路径:com.google.android.gms.maps.model.Marker
类名称:Marker
方法名:setPosition
暂无
代码示例来源:origin: airbnb/AirMapView
@Override public void moveMarker(AirMapMarker<?> marker, LatLng to) {
marker.setLatLng(to);
marker.getMarker().setPosition(to);
}
代码示例来源:origin: googlemaps/android-samples
@Override
public void onStreetViewPanoramaChange(StreetViewPanoramaLocation location) {
if (location != null) {
mMarker.setPosition(location.position);
}
}
代码示例来源:origin: googlemaps/android-samples
public boolean onMarkerMoved(Marker marker) {
if (marker.equals(mCenterMarker)) {
mCircle.setCenter(marker.getPosition());
mRadiusMarker.setPosition(toRadiusLatLng(marker.getPosition(), mRadiusMeters));
return true;
}
if (marker.equals(mRadiusMarker)) {
mRadiusMeters =
toRadiusMeters(mCenterMarker.getPosition(), mRadiusMarker.getPosition());
mCircle.setRadius(mRadiusMeters);
return true;
}
return false;
}
代码示例来源:origin: Phantast/smartnavi
public void setHome() {
Core.startLat = longpressLocation.latitude;
Core.startLon = longpressLocation.longitude;
Core.stepCounter++;
actualMarker[0].setPosition(longpressLocation);
setFollowOn();
// Wichtig für locationer, damit der das berücksichtigen kann
userHasSetByTouch = true;
}
代码示例来源:origin: mg6maciej/android-maps-extensions
public void setPosition(LatLng position) {
if (marker != null) {
marker.setPosition(position);
} else {
markerOptions.position(position);
}
}
代码示例来源:origin: Phantast/smartnavi
public void setDestPosition(LatLng z) {
destMarker.setPosition(z);
destMarker.setVisible(true);
}
代码示例来源:origin: ac-opensource/MarkerBuilder
public void setCenter(LatLng center) {
centerMarker.setPosition(center);
onCenterUpdated(center);
}
代码示例来源:origin: ac-opensource/MarkerBuilder
public void setCenter(LatLng center) {
centerMarker.setPosition(center);
onCenterUpdated(center);
}
代码示例来源:origin: leandroBorgesFerreira/UpdatableMap
@Override
public void run() {
// Calculate progress using interpolator
elapsed = SystemClock.uptimeMillis() - start;
t = elapsed / durationInMs;
v = interpolator.getInterpolation(t);
marker.setPosition(latLngInterpolator.interpolate(v, startPosition, finalPosition));
// Repeat till progress is complete.
if (t < 1) {
// Post again 16ms later.
handler.postDelayed(this, 16);
}
}
});
代码示例来源:origin: nglauber/dominando_android2
@Override
public void onLocationChanged(Location location) {
Log.d("NGVL", "onLocationChanged::BEGIN");
if (mOrigem == null){
mOrigem = new LatLng(location.getLatitude(), location.getLongitude());
}
mMarkerLocalAtual.setPosition(
new LatLng(location.getLatitude(), location.getLongitude()));
Log.d("NGVL", "onLocationChanged::END");
}
@Override
代码示例来源:origin: ac-opensource/MarkerBuilder
/**
* Called after update position of center marker, to update the circle and the radius marker
* @param center
*/
public void onCenterUpdated(LatLng center) {
if(circle != null) circle.setCenter(center);
if(radiusMarker != null) radiusMarker.setPosition(MarkerAreasUtils.toRadiusLatLng(center, radiusMeters));
}
代码示例来源:origin: ac-opensource/MarkerBuilder
/**
* Called after update position of center marker, to update the circle and the radius marker
* @param center
*/
public void onCenterUpdated(LatLng center) {
if(circle != null) circle.setCenter(center);
if(resizerMarker != null) resizerMarker.setPosition(MarkerAreasUtils.toRadiusLatLng(center, radius));
}
代码示例来源:origin: amanjeetsingh150/UberCarAnimation
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
v = valueAnimator.getAnimatedFraction();
double lng = v * latLngs.get(1).longitude + (1 - v)
* latLngs.get(0).longitude;
double lat = v * latLngs.get(1).latitude + (1 - v)
* latLngs.get(0).latitude;
LatLng newPos = new LatLng(lat, lng);
marker.setPosition(newPos);
marker.setAnchor(0.5f, 0.5f);
marker.setRotation(getBearing(latLngs.get(0), newPos));
mMap.animateCamera(CameraUpdateFactory.newCameraPosition
(new CameraPosition.Builder().target(newPos)
.zoom(15.5f).build()));
}
});
代码示例来源:origin: mizutori/AndroidLocationStarterKit
private void drawUserPositionMarker(Location location){
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
if(this.userPositionMarkerBitmapDescriptor == null){
userPositionMarkerBitmapDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.user_position_point);
}
if (userPositionMarker == null) {
userPositionMarker = map.addMarker(new MarkerOptions()
.position(latLng)
.flat(true)
.anchor(0.5f, 0.5f)
.icon(this.userPositionMarkerBitmapDescriptor));
} else {
userPositionMarker.setPosition(latLng);
}
}
代码示例来源:origin: GeoODK/collect
@Override
public void onMapLongClick(LatLng latLng) {
if (mMarker == null) {
mMarkerOption.position(latLng);
mMarker = mMap.addMarker(mMarkerOption);
mShowLocation.setClickable(true);
} else {
mMarker.setPosition(latLng);
}
mLatLng=latLng;
mIsDragged = true;
stopGeolocating();
mMarker.setDraggable(true);
}
代码示例来源:origin: mg6maciej/android-maps-extensions
void refresh() {
int count = markers.size();
if (count == 0) {
removeVirtual();
} else if (count < strategy.getMinMarkersCount()) {
removeVirtual();
for (DelegatingMarker m : markers) {
m.changeVisible(true);
}
} else {
for (DelegatingMarker m : markers) {
m.changeVisible(false);
}
LatLng position = calculateClusterPosition();
if (virtual == null || lastCount != count) {
removeVirtual();
lastCount = count;
virtual = strategy.createMarker(new ArrayList<Marker>(markers), position);
} else {
virtual.setPosition(position);
}
}
}
代码示例来源:origin: bkhezry/MapDrawingTools
private void myLocationMarker(LatLng latLng) {
if (currentMarker != null) {
currentMarker.setPosition(latLng);
} else {
@IdRes int icon = R.drawable.ic_navigation_red_a400_36dp;
BitmapDescriptor bitmap = BitmapDescriptorFactory.fromBitmap(getBitmapFromDrawable(MapsActivity.this, icon));
currentMarker = mMap.addMarker(new MarkerOptions()
.position(latLng)
.icon(bitmap)
.draggable(false));
}
}
代码示例来源:origin: owntracks/android
@Override
public void updateMarker(@Nullable FusedContact contact) {
if (contact == null || !contact.hasLocation() || !isMapReady) {
Timber.v("unable to update marker. null:%s, location:%s, mapReady:%s",contact == null, contact == null || contact.hasLocation(), isMapReady);
return;
}
Timber.v("updating marker for contact: %s", contact.getId());
Marker m = mMarkers.get(contact.getId());
if (m != null) {
m.setPosition(contact.getLatLng());
} else {
m = mMap.addMarker(new MarkerOptions().position(contact.getLatLng()).anchor(0.5f, 0.5f).visible(false));
m.setTag(contact.getId());
mMarkers.put(contact.getId(), m);
}
contactImageProvider.setMarkerAsync(m, contact);
}
代码示例来源:origin: IndoorAtlas/android-sdk-examples
/**
* Callback for receiving locations.
* This is where location updates can be handled by moving markers or the camera.
*/
public void onLocationChanged(IALocation location) {
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
if (mMarker == null) {
if (mMap != null) {
mMarker = mMap.addMarker(new MarkerOptions().position(latLng)
.icon(BitmapDescriptorFactory.defaultMarker(HUE_IABLUE)));
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 17.0f));
}
} else {
mMarker.setPosition(latLng);
}
}
代码示例来源:origin: IndoorAtlas/android-sdk-examples
@Override
public void onMapClick(LatLng point) {
if (mMap != null) {
mWayfindingDestination = new IAWayfindingRequest.Builder()
.withFloor(mFloor)
.withLatitude(point.latitude)
.withLongitude(point.longitude)
.build();
mIALocationManager.requestWayfindingUpdates(mWayfindingDestination, mWayfindingListener);
if (mDestinationMarker == null) {
mDestinationMarker = mMap.addMarker(new MarkerOptions()
.position(point)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE)));
} else {
mDestinationMarker.setPosition(point);
}
Log.d(TAG, "Set destination: (" + mWayfindingDestination.getLatitude() + ", " +
mWayfindingDestination.getLongitude() + "), floor=" +
mWayfindingDestination.getFloor());
}
}
内容来源于网络,如有侵权,请联系作者删除!