本文整理汇总了Java中com.google.android.gms.maps.model.Marker.getPosition方法的典型用法代码示例。如果您正苦于以下问题:Java Marker.getPosition方法的具体用法?Java Marker.getPosition怎么用?Java Marker.getPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.maps.model.Marker
的用法示例。
在下文中一共展示了Marker.getPosition方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInfoContents
import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
/**
* Método de Pop-up de cada marker
* @param marker
* @return markerView
*/
@Override
public View getInfoContents(Marker marker) {
TextView tvLocality = (TextView) this.markerView.findViewById(R.id.tv_locality);
TextView tvLat = (TextView) this.markerView.findViewById(R.id.tv_lat);
TextView tvLng = (TextView) this.markerView.findViewById(R.id.tv_lng);
TextView tvSnippet = (TextView) this.markerView.findViewById(R.id.tv_snippet);
LatLng location = marker.getPosition();
tvLocality.setText(marker.getTitle());
tvLat.setText("Latitude: " + location.latitude);
tvLng.setText("Longitude: " + location.longitude);
tvSnippet.setText(marker.getTitle());
return this.markerView;
}
示例2: removeSpawnPointFromDb
import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
private static void removeSpawnPointFromDb(Context context, Marker marker) {
DatabaseHelper myDb = DatabaseHelper.getInstance(context);
double latitude = marker.getPosition().latitude;;
double longitude = marker.getPosition().longitude;;
myDb.removeSpawnLocation(latitude, longitude);
myDb.close();
}
示例3: onMarkerDragEnd
import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
@Override
public void onMarkerDragEnd(Marker marker) {
LatLng latLng = marker.getPosition();
marker.setSnippet(ProjFuncs.latLng2DString(latLng, false));
marker.showInfoWindow();
mMaps.get(MAP_CODE_MAIN).animateCamera(CameraUpdateFactory.newLatLng(latLng));
}
示例4: onMarkerDragEnd
import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
@Override
public void onMarkerDragEnd(Marker marker) {
//Getting the coordinates
latitude = marker.getPosition().latitude;
longitude = marker.getPosition().longitude;
//Moving the map
moveMap();
}
示例5: animateFriendMarker
import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
public void animateFriendMarker(String uid, GeoLocation location){
final double lat = location.latitude;
final double lng = location.longitude;
final Handler handler = new Handler();
final long start = SystemClock.uptimeMillis();
final long DURATION_MS = 3000;
final Interpolator interpolator = new AccelerateDecelerateInterpolator();
final Marker marker = markerUserIdHashMap.get(uid);
final LatLng startPosition = marker.getPosition();
handler.post(new Runnable() {
@Override
public void run() {
float elapsed = SystemClock.uptimeMillis() - start;
float t = elapsed/DURATION_MS;
float v = interpolator.getInterpolation(t);
double currentLat = (lat - startPosition.latitude) * v + startPosition.latitude;
double currentLng = (lng - startPosition.longitude) * v + startPosition.longitude;
marker.setPosition(new LatLng(currentLat, currentLng));
// if animation is not finished yet, repeat
if (t < 1) {
handler.postDelayed(this, 16);
}
}
});
}
示例6: addMarkerAsPolygon
import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
/**
* Polygon add a marker in the list of markers to where it is closest to the
* the surrounding points
*
* @param marker
* @param markers
*/
public static void addMarkerAsPolygon(Marker marker, List<Marker> markers) {
LatLng position = marker.getPosition();
int insertLocation = markers.size();
if (markers.size() > 2) {
double[] distances = new double[markers.size()];
insertLocation = 0;
distances[0] = SphericalUtil.computeDistanceBetween(position,
markers.get(0).getPosition());
for (int i = 1; i < markers.size(); i++) {
distances[i] = SphericalUtil.computeDistanceBetween(position,
markers.get(i).getPosition());
if (distances[i] < distances[insertLocation]) {
insertLocation = i;
}
}
int beforeLocation = insertLocation > 0 ? insertLocation - 1
: distances.length - 1;
int afterLocation = insertLocation < distances.length - 1 ? insertLocation + 1
: 0;
if (distances[beforeLocation] > distances[afterLocation]) {
insertLocation = afterLocation;
}
}
markers.add(insertLocation, marker);
}
示例7: addDescriptionToDb
import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
public static void addDescriptionToDb(Context context, Marker marker, String description) {
DatabaseHelper myDb = DatabaseHelper.getInstance(context);
double latitude = marker.getPosition().latitude;
double longitude = marker.getPosition().longitude;
myDb.addDescription("'Spawn Location'", latitude, longitude, description);
}
示例8: getMarkerDescription
import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
public static String getMarkerDescription(Context context, Marker marker) {
DatabaseHelper myDb = DatabaseHelper.getInstance(context);
double latitude = marker.getPosition().latitude;
double longitude = marker.getPosition().longitude;
return myDb.getDescription("'Spawn Location'", latitude, longitude);
}
示例9: setArgs
import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
public void setArgs(Context context, Marker marker) {
this.mTitle = marker.getTitle();
this.mLatLng = marker.getPosition();
}
示例10: addMarkerAsPolyline
import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
/**
* Polyline add a marker in the list of markers to where it is closest to
* the the surrounding points
*
* @param marker
* @param markers
*/
public static void addMarkerAsPolyline(Marker marker, List<Marker> markers) {
LatLng position = marker.getPosition();
int insertLocation = markers.size();
if (markers.size() > 1) {
double[] distances = new double[markers.size()];
insertLocation = 0;
distances[0] = SphericalUtil.computeDistanceBetween(position,
markers.get(0).getPosition());
for (int i = 1; i < markers.size(); i++) {
distances[i] = SphericalUtil.computeDistanceBetween(position,
markers.get(i).getPosition());
if (distances[i] < distances[insertLocation]) {
insertLocation = i;
}
}
Integer beforeLocation = insertLocation > 0 ? insertLocation - 1
: null;
Integer afterLocation = insertLocation < distances.length - 1 ? insertLocation + 1
: null;
if (beforeLocation != null && afterLocation != null) {
if (distances[beforeLocation] > distances[afterLocation]) {
insertLocation = afterLocation;
}
} else if (beforeLocation != null) {
if (distances[beforeLocation] >= SphericalUtil
.computeDistanceBetween(markers.get(beforeLocation)
.getPosition(), markers.get(insertLocation)
.getPosition())) {
insertLocation++;
}
} else {
if (distances[afterLocation] < SphericalUtil
.computeDistanceBetween(markers.get(afterLocation)
.getPosition(), markers.get(insertLocation)
.getPosition())) {
insertLocation++;
}
}
}
markers.add(insertLocation, marker);
}