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


Java MarkerOptions.anchor方法代码示例

本文整理汇总了Java中com.google.android.gms.maps.model.MarkerOptions.anchor方法的典型用法代码示例。如果您正苦于以下问题:Java MarkerOptions.anchor方法的具体用法?Java MarkerOptions.anchor怎么用?Java MarkerOptions.anchor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.maps.model.MarkerOptions的用法示例。


在下文中一共展示了MarkerOptions.anchor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addGateway

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
public void addGateway(Packet packet) {
    for (Gateway gateway : packet.getGateways()) {
        double gwLat = gateway.getLatitude();
        double gwLon = gateway.getLongitude();

        if (gwLat != 0 && gwLon != 0) {
            String gatewayId = gateway.getGatewayID();

            if (gatewaysWithMarkers.contains(gatewayId)) {
                //already has a marker for this gateway
            } else {
                MarkerOptions gwoptions = new MarkerOptions();
                gwoptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.gateway_dot));
                gwoptions.position(new LatLng(gwLat, gwLon));
                gwoptions.title(gatewayId);
                //gwoptions.snippet(gatewayId);
                gwoptions.anchor((float) 0.5, (float) 0.5);
                mMap.addMarker(gwoptions);

                gatewaysWithMarkers.add(gatewayId);
            }
        }
    }
}
 
开发者ID:jpmeijers,项目名称:ttnmapper_android_v2,代码行数:25,代码来源:MapsActivity.java

示例2: addLatLngsToMap

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
/**
 * Add a list of LatLngs to the map
 *
 * @param map
 * @param latLngs
 * @return
 */
public static MultiMarker addLatLngsToMap(GoogleMap map, MultiLatLng latLngs) {
    MultiMarker multiMarker = new MultiMarker();
    for (LatLng latLng : latLngs.getLatLngs()) {
        MarkerOptions markerOptions = new MarkerOptions();
        if (latLngs.getMarkerOptions() != null) {
            markerOptions.icon(latLngs.getMarkerOptions().getIcon());
            markerOptions.anchor(latLngs.getMarkerOptions().getAnchorU(),
                    markerOptions.getAnchorV());
            markerOptions.draggable(latLngs.getMarkerOptions()
                    .isDraggable());
        }
        Marker marker = addLatLngToMap(map, latLng, markerOptions);
        multiMarker.add(marker);
    }
    return multiMarker;
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:24,代码来源:GoogleMapShapeConverter.java

示例3: addMeasurementMarker

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
public void addMeasurementMarker(Packet packet) {
    createMarkerBitmaps(); //create markers if they do not exist

    MarkerOptions options = new MarkerOptions();
    double rssi = packet.getMaxRssi();
    if (rssi == 0) {
        options.icon(circleBlack);
    } else if (rssi < -120) {
        options.icon(circleBlue);
    } else if (rssi < -115) {
        options.icon(circleCyan);
    } else if (rssi < -110) {
        options.icon(circleGreen);
    } else if (rssi < -105) {
        options.icon(circleYellow);
    } else if (rssi < -100) {
        options.icon(circleOrange);
    } else {
        options.icon(circleRed);
    }
    options.position(new LatLng(packet.getLatitude(), packet.getLongitude()));
    options.anchor((float) 0.5, (float) 0.5);
    options.title("RSSI: " + packet.getMaxRssi() + "dBm\n" +
            "SNR: " + packet.getMaxSnr() + "dB\n" +
            "Gateways: " + packet.gateways.size());

    mMap.addMarker(options);
    markersOnMap.add(options); //save a list of markers used for auto zooming
}
 
开发者ID:jpmeijers,项目名称:ttnmapper_android_v2,代码行数:30,代码来源:MapsActivity.java

示例4: addPointsToMapAsMarkers

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
/**
 * Add the list of points as markers
 *
 * @param map
 * @param points
 * @param customMarkerOptions
 * @param ignoreIdenticalEnds
 * @return
 */
public List<Marker> addPointsToMapAsMarkers(GoogleMap map,
                                            List<LatLng> points, MarkerOptions customMarkerOptions,
                                            boolean ignoreIdenticalEnds) {

    List<Marker> markers = new ArrayList<Marker>();
    for (int i = 0; i < points.size(); i++) {
        LatLng latLng = points.get(i);

        if (points.size() > 1 && i + 1 == points.size() && ignoreIdenticalEnds) {
            LatLng firstLatLng = points.get(0);
            if (latLng.latitude == firstLatLng.latitude
                    && latLng.longitude == firstLatLng.longitude) {
                break;
            }
        }

        MarkerOptions markerOptions = new MarkerOptions();
        if (customMarkerOptions != null) {
            markerOptions.icon(customMarkerOptions.getIcon());
            markerOptions.anchor(customMarkerOptions.getAnchorU(),
                    customMarkerOptions.getAnchorV());
            markerOptions.draggable(customMarkerOptions.isDraggable());
        }
        Marker marker = addLatLngToMap(map, latLng, markerOptions);
        markers.add(marker);
    }
    return markers;
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:38,代码来源:GoogleMapShapeConverter.java


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