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


Java MarkerOptions.title方法代码示例

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


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

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

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

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

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

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

示例6: onMapReady

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
    //Inicializo el mapa
    MapsInitializer.initialize(getContext());
    mMap = googleMap;

    //Si tengo proyectos los muestro en el mapa
    if (proyecto.getCoordenadas().compareTo("") != 0) {
        String[] coordenadas = proyecto.getCoordenadas().split(",");
        double lat = Double.parseDouble(coordenadas[0]);
        double lon = Double.parseDouble(coordenadas[1]);
        posicionProyecto = new LatLng(lat, lon);
        MarkerOptions markerOptions = new MarkerOptions();
        markerOptions.title(proyecto.getNombre());
        //Pongo la descripción en el infowindow solo con 10 caracteres
        if (proyecto.getDescripcion().length() > 50)
            markerOptions.snippet(proyecto.getDescripcion().substring(0, 50));
        else
            markerOptions.snippet(proyecto.getDescripcion());
        markerOptions.position(posicionProyecto);
        mMap.addMarker(markerOptions);
    }

    // Movemos la camara a la posicion del usuario
    if (miPosicion != null)
        mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(miPosicion, 3));

}
 
开发者ID:nen155,项目名称:TFG-SmartU-La-red-social,代码行数:29,代码来源:FragmentMapaProyecto.java

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

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

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

示例10: markLocation

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
/**
 * Marks location on map
 * @param coordinates coordinates of the location to mark on the map
 * @return true if location has been successfully marked, false otherwise
 */
public boolean markLocation(LatLng coordinates, double accuracy){
    if(accuracy>200)
        accuracy = 200;
    MapLayout.accuracy = (int)accuracy;
    try {
        if (mGoogleMap != null) {
            if (mLocationMarker == null) {
                MarkerOptions markerOptions = getLocationMarkerOptionsStrategy().getNormalMarkerOptions();
                markerOptions.position(coordinates);
                markerOptions.flat(true);
                markerOptions.title(TITLE_LOCATION_MARKER);
                markerOptions.zIndex(LOCATION_MARKER_INDEX);
                mLocationMarker = addMarkerToGoogleMap(markerOptions);
                initLocationAccuracyMarker(coordinates,MapLayout.accuracy);
            } else if (mLocationMarker.getPosition() !=null
                    && mLocationMarker.getPosition().latitude != coordinates.latitude
                    && mLocationMarker.getPosition().longitude != coordinates.longitude) {
                initLocationAccuracyMarker(coordinates,MapLayout.accuracy);
                animateLocationMarker(coordinates);
            }
            location = coordinates;
        }
        return true;
    } catch (NullPointerException npe) {
        npe.printStackTrace();
        return false;
    }
}
 
开发者ID:Ubudu,项目名称:GoogleMapsLayout-Android,代码行数:34,代码来源:MapLayout.java

示例11: addMarker

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
/**
 * Adds a marker to the map
 *
 * @param marker marker to be added
 *
 * @return true if marker has been successfully added, false otherwise
 */
public Marker addMarker(com.ubudu.gmaps.model.Marker marker){
    if(marker.getLocation()==null)
        return null;
    if(marker.getTitle()==null)
        marker.setTitle("");
    MarkerOptions markerOptions = marker.getMarkerOptionsStrategy().getNormalMarkerOptions();
    markerOptions.position(marker.getLocation());
    markerOptions.title(marker.getTitle());
    Marker customMarker = addMarkerToGoogleMap(markerOptions);
    if(customMarker!=null)
        customMarkersMap.put(marker,customMarker);
    return customMarker;
}
 
开发者ID:Ubudu,项目名称:GoogleMapsLayout-Android,代码行数:21,代码来源:MapLayout.java

示例12: onConnected

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onConnected(Bundle bundle) {
  if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
    ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
    requestPermission();
    return;
  }
  Location mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
  if (mLastLocation != null) {
    latLng = new LatLng(mLastLocation.getLatitude(), mLastLocation.getLongitude());
    mMocketClient.pushLatLngToServer(latLng);

    MarkerOptions markerOptions = new MarkerOptions();
    markerOptions.position(latLng);
    markerOptions.title("Current Position");
    markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
    currLocationMarker = mGoogleMap.addMarker(markerOptions);
  }

  LocationRequest mLocationRequest = new LocationRequest();
  mLocationRequest.setInterval(5000); //5 seconds
  mLocationRequest.setFastestInterval(3000); //3 seconds
  mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
  mLocationRequest.setSmallestDisplacement(0.1F); //1/10 meter

  LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
}
 
开发者ID:Nishant-Pathak,项目名称:mocket_android_demo,代码行数:28,代码来源:MapsActivity.java

示例13: onLocationChanged

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


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

        LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
        Data data = new Data();
        data.setCurrentLocation(latLng);
        Log.e("Location", String.valueOf(location.getAccuracy()));
        data.setAltitude(location.getAltitude());

        //Place current location marker
        if (toSetMarker) {

            MarkerOptions markerOptions = new MarkerOptions();
            markerOptions.position(latLng);
            markerOptions.title("Current Position");
            markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_ROSE));
            mCurrLocationMarker = mMap.addMarker(markerOptions);
            markerPoints.add(latLng);


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


//        //stop location updates
//        if (mGoogleApiClient != null) {
//            LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
//        }

    }
 
开发者ID:GeekyShiva,项目名称:Self-Driving-Car,代码行数:40,代码来源:MapsActivity.java

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

示例15: createMarker

import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@NonNull
private MarkerOptions createMarker(PollutionStation station) {
    MarkerOptions marker = new MarkerOptions();
    marker.position(new LatLng(station.getLatitude(), station.getLongitude()));
    double noValue = 0.0;
    String noText = "";
    double oValue = 0.0;
    String oText = "";
    double pm10Value = 0.0;
    String pm10Text = "";
    double soValue = 0.0;
    String soText = "";
    double coValue = 0.0;
    String coText = "";
    String bodyText = "";
    for (int i = 0; i < station.getMetrics().length; i++) {
        if (station.getMetrics()[i].getFormula().equalsIgnoreCase("NO₂")) {
            noValue = station.getMetrics()[i].getValues()[0];
            noText = station.getMetrics()[i].getFormula() + ": " + noValue + " " + station.getMetrics()[i].getUnit();
            bodyText = formatBody(noText, bodyText);
        }
        if (station.getMetrics()[i].getFormula().equalsIgnoreCase("O₃")) {
            oValue = station.getMetrics()[i].getValues()[0];
            oText = station.getMetrics()[i].getFormula() + ": " + oValue + " " + station.getMetrics()[i].getUnit();
            bodyText = formatBody(oText, bodyText);
        }
        if (station.getMetrics()[i].getFormula().equalsIgnoreCase("PM10")) {
            pm10Value = station.getMetrics()[i].getValues()[0];
            pm10Text = station.getMetrics()[i].getFormula() + ": " + pm10Value + " " + station.getMetrics()[i].getUnit();
            bodyText = formatBody(pm10Text, bodyText);
        }
        if (station.getMetrics()[i].getFormula().equalsIgnoreCase("SO₂")) {
            soValue = station.getMetrics()[i].getValues()[0];
            soText = station.getMetrics()[i].getFormula() + ": " + soValue + " " + station.getMetrics()[i].getUnit();
            bodyText = formatBody(soText, bodyText);
        }
        if (station.getMetrics()[i].getFormula().equalsIgnoreCase("CO")) {
            coValue = station.getMetrics()[i].getValues()[0];
            coText = station.getMetrics()[i].getFormula() + ": " + coValue + " " + station.getMetrics()[i].getUnit();
            bodyText = formatBody(coText, bodyText);
        }
    }
    int level = 0;
    if (pm10Value <= 50.0 && soValue <= 175.0 && noValue <= 100.0 && coValue <= 5.0 && oValue <= 90.0) {
        marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.art_1));
        level = 1;
    } else if ((pm10Value > 50.0 && pm10Value < 90.0) || (soValue > 175.0 && soValue < 350.0) || (noValue > 100.0 && noValue < 200.0) || (coValue > 5.0 && coValue < 10.0) || (oValue > 90.0 && oValue < 180.0)) {
        marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.art_2));
        level = 2;
    } else if ((pm10Value > 90.0 && pm10Value < 150.0) || (soValue > 355.0 && soValue < 525.0) || (noValue > 200.0 && noValue < 300.0) || (coValue > 10.0 && coValue < 15.0) || (oValue > 180.0 && oValue < 240.0)) {
        marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.art_3));
        level = 3;
    } else if (pm10Value >= 150.0 || soValue >= 525.0 || noValue >= 300.0 || coValue >= 15.0 || oValue >= 240.0) {
        marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.art_4));
        level = 4;
    }
    Gson gson = new Gson();
    marker.title(gson.toJson(new DataPollution(station.getName(), bodyText, level)));
    return marker;
}
 
开发者ID:Mun0n,项目名称:MADBike,代码行数:61,代码来源:AirQualityFragment.java


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