当前位置: 首页>>代码示例>>Java>>正文


Java Marker.getPosition方法代码示例

本文整理汇总了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;
}
 
开发者ID:gabriel-silva,项目名称:MapaDeIgarassuAdmin,代码行数:22,代码来源:GoogleInfoWindowAdapter.java

示例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();
}
 
开发者ID:kav0rka,项目名称:VennTracker,代码行数:8,代码来源:SpawnLocation.java

示例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));
}
 
开发者ID:typebrook,项目名称:FiveMinsMore,代码行数:8,代码来源:MapsManager.java

示例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();
}
 
开发者ID:ayushghd,项目名称:iSPY,代码行数:10,代码来源:MyLocation.java

示例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);
            }
        }
    });
}
 
开发者ID:mremondi,项目名称:Hyke,代码行数:28,代码来源:NearMeFragment.java

示例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);
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:36,代码来源:GoogleMapShapeMarkers.java

示例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);
}
 
开发者ID:kav0rka,项目名称:VennTracker,代码行数:7,代码来源:SpawnLocation.java

示例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);
}
 
开发者ID:kav0rka,项目名称:VennTracker,代码行数:7,代码来源:SpawnLocation.java

示例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();
}
 
开发者ID:typebrook,项目名称:FiveMinsMore,代码行数:5,代码来源:DetailDialog.java

示例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);
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:52,代码来源:GoogleMapShapeMarkers.java


注:本文中的com.google.android.gms.maps.model.Marker.getPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。