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


Java MarkerOptions.icon方法代码示例

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


在下文中一共展示了MarkerOptions.icon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: onBeforeClusterRendered

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
protected void onBeforeClusterRendered(Cluster<IssueMarker> cluster, MarkerOptions options) {
    super.onBeforeClusterRendered(cluster, options);
    // Cluster customization
    Context context = mMap.getContext();
    int clusterSize = cluster.getSize();
    String clusterIconRes = "cluster1";
    for (int i = 0; i < CLUSTER_THRESHOLDS.length; i++) {
        int threshold = CLUSTER_THRESHOLDS[i];
        if (clusterSize >= threshold) clusterIconRes = "cluster" + (i + 2);
    }
    mClusterIconGenerator.setBackground(getClusterIcon(context, clusterIconRes));
    mClusterIconGenerator.setTextAppearance(R.style.ClusterIconText);
    Bitmap sizeIcon = mClusterIconGenerator.makeIcon(String.valueOf(clusterSize));
    options.icon(BitmapDescriptorFactory.fromBitmap(sizeIcon));
}
 
开发者ID:ArnauBlanch,项目名称:civify-app,代码行数:17,代码来源:IssueMarkerClusterRenderer.java

示例3: onLocationChanged

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onLocationChanged(Location location)
{
    mLastLocation = location;
    if (mCurrLocationMarker != null) {
        mCurrLocationMarker.remove();
    }

    //Place current location marker
    LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
    MarkerOptions markerOptions = new MarkerOptions();
    markerOptions.position(latLng);
    markerOptions.title("Current Position");
    markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
    mCurrLocationMarker = mGoogleMap.addMarker(markerOptions);

    //move map camera
    mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng,11));

}
 
开发者ID:CMPUT301F17T29,项目名称:HabitUp,代码行数:21,代码来源:MapsActivity.java

示例4: drawNext

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
public Marker drawNext() {

        MarkerOptions options = new MarkerOptions();

        if (isFirstPop) {

            options.position(path.getFirst().getStart());
            options.icon(firstNodeIcon);
            isFirstPop = false;
        } else {
            last = path.pop();
            options.position(last.getEnd());

            if (path.size() == 0) {
                options.icon(lastNodeIcon);
            } else {
                options.icon(middleNodeIcon);
            }
        }

        return map.addMarker(options);
    }
 
开发者ID:Augugrumi,项目名称:SpaceRace,代码行数:23,代码来源:PathDrawer.java

示例5: ShowNearbyPlaces

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
private void ShowNearbyPlaces(List<HashMap<String, String>> nearbyPlacesList) {
    for (int i = 0; i < nearbyPlacesList.size(); i++) {
        Log.d("onPostExecute","Entered into showing locations");
        MarkerOptions markerOptions = new MarkerOptions();
        HashMap<String, String> googlePlace = nearbyPlacesList.get(i);
        double lat = Double.parseDouble(googlePlace.get("lat"));
        double lng = Double.parseDouble(googlePlace.get("lng"));
        String placeName = googlePlace.get("place_name");
        String vicinity = googlePlace.get("vicinity");
        LatLng latLng = new LatLng(lat, lng);
        markerOptions.position(latLng);
        markerOptions.title(placeName + " : " + vicinity);
        mMap.addMarker(markerOptions);
        markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED));
        //move map camera
        mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
        mMap.animateCamera(CameraUpdateFactory.zoomTo(11));
    }
}
 
开发者ID:LewisVo,项目名称:Overkill,代码行数:20,代码来源:GetNearbyPlacesData.java

示例6: createMarker

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
private void createMarker(LatLng latLng, int position){
    MarkerOptions mOptions = new MarkerOptions().position(latLng);
    if(position == 1){
        Log.i("position1",latLng.toString());
        mOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
        addCameraToMap(latLng);
        mMap.addMarker(mOptions.title("My Location"));
    }
    else{
        Log.i("position2",latLng.toString());
        mOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_YELLOW));
        addCameraToMap(latLng);
        mMap.addMarker(mOptions.title("Tracked User's Location"));
    }

}
 
开发者ID:ayushghd,项目名称:iSPY,代码行数:17,代码来源:ShortestDistance.java

示例7: onLocationChanged

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onLocationChanged(Location location) {

  //place marker at current position
  //mGoogleMap.clear();
  if (currLocationMarker != null) {
    currLocationMarker.remove();
  }
  latLng = new LatLng(location.getLatitude(), location.getLongitude());
  MarkerOptions markerOptions = new MarkerOptions();
  markerOptions.position(latLng);
  markerOptions.title(getString(R.string.current_position));
  markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
  currLocationMarker = mGoogleMap.addMarker(markerOptions);

  //zoom to current position:
  CameraPosition cameraPosition = new CameraPosition.Builder()
    .target(latLng).zoom(14).build();

  mGoogleMap.animateCamera(CameraUpdateFactory
    .newCameraPosition(cameraPosition));

  mMocketClient.pushLatLngToServer(latLng);
}
 
开发者ID:Nishant-Pathak,项目名称:mocket_android_demo,代码行数:25,代码来源:MapsActivity.java

示例8: onPostExecute

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
protected void onPostExecute(List<HashMap<String, String>> list) {
    googleMap.clear();

        for (int i = 0; i < list.size(); i++) {
            MarkerOptions markerOptions = new MarkerOptions();
            HashMap<String, String> googlePlace = list.get(i);
            double lat = Double.parseDouble(googlePlace.get("lat"));
            double lng = Double.parseDouble(googlePlace.get("lng"));
            String placeName = googlePlace.get("place_name");
            //String vicinity = googlePlace.get("vicinity");
            LatLng latLng = new LatLng(lat, lng);
            markerOptions.position(latLng);
            markerOptions.title(placeName);
            markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.custom_marker));
            googleMap.addMarker(markerOptions);
        }
    }
 
开发者ID:webianks,项目名称:Crimson,代码行数:19,代码来源:PlacesDisplayTask.java

示例9: onBeforeClusterItemRendered

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
protected void onBeforeClusterItemRendered(CustomMarker item, MarkerOptions markerOptions) {
    // Set the info window to show their name.
    TextView tv = (TextView) mActivity.getLayoutInflater().inflate(R.layout.view_cluster_item, null);
    tv.setText(item.getTitle());
    mIconGenerator.setContentView(tv);
    Bitmap icon = mIconGenerator.makeIcon();
    markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon));
}
 
开发者ID:typebrook,项目名称:FiveMinsMore,代码行数:10,代码来源:CustomRenderer.java

示例10: onLocationChanged

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onLocationChanged(Location location) {
    Log.d("onLocationChanged", "entered");

    mLastLocation = location;
    if (mCurrLocationMarker != null) {
        mCurrLocationMarker.remove();
    }

    //Place current location marker
    latitude = location.getLatitude();
    longitude = location.getLongitude();
    LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
    MarkerOptions markerOptions = new MarkerOptions();
    markerOptions.position(latLng);
    markerOptions.title("Current Position");
    markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
    mCurrLocationMarker = mMap.addMarker(markerOptions);

    //move map camera
    mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
    mMap.animateCamera(CameraUpdateFactory.zoomTo(18));

    Log.d("onLocationChanged", String.format("latitude:%.3f longitude:%.3f",latitude,longitude));

    //stop location updates
    if (mGoogleApiClient != null) {
        LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
        Log.d("onLocationChanged", "Removing Location Updates");
    }
    Log.d("onLocationChanged", "Exit");

}
 
开发者ID:LewisVo,项目名称:Overkill,代码行数:34,代码来源:ViewNearbyPlaces.java

示例11: onLocationChanged

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onLocationChanged(Location location) {
    Log.d("onLocationChanged", "entered");

    mLastLocation = location;
    if (mCurrLocationMarker != null) {
        mCurrLocationMarker.remove();
    }

    //Place current location marker
    latitude = location.getLatitude();
    longitude = location.getLongitude();
    LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
    MarkerOptions markerOptions = new MarkerOptions();
    markerOptions.position(latLng);
    markerOptions.title("Current Position");
    markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
    mCurrLocationMarker = mMap.addMarker(markerOptions);

    //move map camera
    mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
    mMap.animateCamera(CameraUpdateFactory.zoomTo(11));
    Toast.makeText(MapsActivity2.this,"Your Current Location", Toast.LENGTH_LONG).show();

    Log.d("onLocationChanged", String.format("latitude:%.3f longitude:%.3f",latitude,longitude));

    //stop location updates
    if (mGoogleApiClient != null) {
        LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
        Log.d("onLocationChanged", "Removing Location Updates");
    }
    Log.d("onLocationChanged", "Exit");

}
 
开发者ID:ayushghd,项目名称:iSPY,代码行数:35,代码来源:MapsActivity2.java

示例12: onLocationChanged

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onLocationChanged(Location location) {
    Log.d("onLocationChanged", "entered");

    mLastLocation = location;
    if (mCurrLocationMarker != null) {
        mCurrLocationMarker.remove();
    }

    //Place current location marker
    latitude = location.getLatitude();
    longitude = location.getLongitude();
    LatLng latLng = new LatLng(latitude1, longitude1);
    MarkerOptions markerOptions = new MarkerOptions();
    markerOptions.position(latLng);
    markerOptions.title("Current Position");
    markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
    mCurrLocationMarker = mMap.addMarker(markerOptions);

    //move map camera
    mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
    mMap.animateCamera(CameraUpdateFactory.zoomTo(11));
    Toast.makeText(MapsActivity3.this,"Your Current Location", Toast.LENGTH_LONG).show();

    Log.d("onLocationChanged", String.format("latitude:%.3f longitude:%.3f",latitude,longitude));

    //stop location updates
    if (mGoogleApiClient != null) {
        LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
        Log.d("onLocationChanged", "Removing Location Updates");
    }
    Log.d("onLocationChanged", "Exit");

}
 
开发者ID:ayushghd,项目名称:iSPY,代码行数:35,代码来源:MapsActivity3.java

示例13: 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

示例14: onBeforeClusterItemRendered

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
protected void onBeforeClusterItemRendered(MyItem item, MarkerOptions markerOptions) {

  //  markerOptions.icon(item.getMise_service());
  //  markerOptions.snippet(item.getSnippet());
    //  markerOptions.title(item.getMise_service().get(0));
      markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_action_antenne));
      super.onBeforeClusterItemRendered(item, markerOptions);
}
 
开发者ID:ANFR-France,项目名称:proto-collecte,代码行数:10,代码来源:OwnRendring.java

示例15: refreshZone

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
/**
 * Refreshes the polygon and  label marker of the given zone according to zone's appearance options.
 *
 * @param zone zone object
 */
private void refreshZone(Zone zone) {
    Pair<Marker,Polygon> markerAndPolygon = zoneVsMarkerAndPolygonMap.get(zone);
    ZoneOptions zoneOptions = zone.getOptions();
    //update polygon
    Polygon p = markerAndPolygon.second;
    PolygonOptions polygonOptions = zoneOptions.getPolygonOptions();
    p.setStrokeColor(polygonOptions.getStrokeColor());
    p.setStrokeWidth(polygonOptions.getStrokeWidth());
    p.setFillColor(polygonOptions.getFillColor());
    p.setGeodesic(polygonOptions.isGeodesic());
    p.setHoles(polygonOptions.getHoles());
    p.setVisible(polygonOptions.isVisible());
    p.setZIndex(polygonOptions.getZIndex());
    p.setClickable(polygonOptions.isClickable());

    Log.i(TAG,"updated polygon id: "+p.getId());

    //update label marker
    Marker m = markerAndPolygon.first;
    ZoneLabelOptions zoneLabelOptions = zoneOptions.getZoneLabelOptions();
    MarkerOptions mO = zoneLabelOptions.getLabelMarkerOptions();

    if(zoneLabelOptions.isDisplayLabel())
        mO.icon(BitmapDescriptorFactory.fromBitmap(getLabelBitmap(zone.getName(),zoneLabelOptions)));

    m.setIcon(mO.getIcon());
    m.setZIndex(mO.getZIndex());
    m.setVisible(mO.isVisible());
    m.setAlpha(mO.getAlpha());
    m.setAnchor(mO.getAnchorV(),mO.getAnchorU());
    m.setDraggable(mO.isDraggable());
    m.setFlat(mO.isFlat());
    m.setInfoWindowAnchor(mO.getInfoWindowAnchorV(),mO.getInfoWindowAnchorU());
    m.setRotation(mO.getRotation());
    m.setSnippet(mO.getSnippet());
    m.setTitle(zone.getName());
}
 
开发者ID:Ubudu,项目名称:GoogleMapsLayout-Android,代码行数:43,代码来源:MapLayout.java


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