當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。