Java 类com.google.android.gms.maps.model.BitmapDescriptorFactory 实例源码

项目:AlarmWithL-T    文件:SettingFragment.java   
private void initMap() {

        PlaceAutocompleteFragment autocompleteFragment = new PlaceAutocompleteFragment();
        CustomMapFragment         mapFragment          = new CustomMapFragment();
        autocompleteFragment.setOnPlaceSelectedListener(this);
        mapFragment.setParent(mBinding.scroll);
        mapFragment.getMapAsync(this);

        FragmentManager     manager     = getActivity().getFragmentManager();
        FragmentTransaction transaction = manager.beginTransaction();
        transaction.add(R.id.place_autocomplete_fragment, autocompleteFragment);
        transaction.add(R.id.google_map_fragment, mapFragment);
        transaction.commit();

        mMarkerOptions = new MarkerOptions().icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN));
        mCircleOptions = new CircleOptions().fillColor(Color.argb(97, 93, 185, 139)).strokeColor(Color.argb(200, 93, 185, 139));

    }
项目:BikeLine    文件:NavigationActivity.java   
@Override
public synchronized void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    // Start position marker
    mMap.addMarker(new MarkerOptions().
            position(startCoordinate).
            icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)));
    // end position marker
    mMap.addMarker(new MarkerOptions().
            position(endCoordinate).
            icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)));
    if(objectLocations!=null)
        for(com.nctu.bikeline.Model.Location objLocation:objectLocations){
            mMap.addMarker(new MarkerOptions().position(objLocation.getCoordinate())
                    .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE)));
        }
    // highlight route
    mMap.addPolyline(options);
    // move and zoom camera
    if(gpsService != null)
        updateDirectionOverlay(gpsService.getLocation(), 0, false);
}
项目:ttnmapper_android_v2    文件:MapsActivity.java   
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);
            }
        }
    }
}
项目:ExtraMapUtils    文件:AppUtils.java   
public static void addColorsToMarkers(GeoJsonLayer layer) {
    // Iterate over all the features stored in the layer
    for (GeoJsonFeature feature : layer.getFeatures()) {
        // Check if the magnitude property exists
        if (feature.getProperty("mag") != null && feature.hasProperty("place")) {
            double magnitude = Double.parseDouble(feature.getProperty("mag"));

            // Get the icon for the feature
            BitmapDescriptor pointIcon = BitmapDescriptorFactory
                    .defaultMarker(magnitudeToColor(magnitude));

            // Create a new point style
            GeoJsonPointStyle pointStyle = new GeoJsonPointStyle();

            // Set options for the point style
            pointStyle.setIcon(pointIcon);
            pointStyle.setTitle("Magnitude of " + magnitude);
            pointStyle.setSnippet("Earthquake occured " + feature.getProperty("place"));

            // Assign the point style to the feature
            feature.setPointStyle(pointStyle);
        }
    }
}
项目:civify-app    文件:IssueMarkerClusterRenderer.java   
@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));
}
项目:Moodr    文件:MapsActivity.java   
@Override
public void onLocationChanged(Location location) {
    mLastLocation = location;

    //remove previous current location Marker
    if (marker != null) {
        marker.remove();
    }

    current_Latitude = mLastLocation.getLatitude();
    current_Longitude = mLastLocation.getLongitude();
    marker = mMap.addMarker(new MarkerOptions().position(new LatLng(current_Latitude, current_Longitude))
            .title("My Location").icon(BitmapDescriptorFactory
                    .defaultMarker(BitmapDescriptorFactory.HUE_RED)));
    mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(current_Latitude, current_Longitude), 8));

}
项目:Crimson    文件:PlacesDisplayTask.java   
@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);
        }
    }
项目:HabitUp    文件:MapsActivity.java   
@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));

}
项目:SpaceRace    文件:PathDrawer.java   
public Builder() {

            Bitmap toScale = BitmapFactory.decodeResource(
                    SpaceRace.getAppContext().getResources(),
                    DEFAULT_PIECE_DISPLAYED);
            toScale = Bitmap.createScaledBitmap(toScale,
                    ICON_DIMENSION,
                    ICON_DIMENSION,
                    false);

            BitmapDescriptor defaultIcon = BitmapDescriptorFactory.fromBitmap(toScale);

            this.firstNodeIcon = defaultIcon;
            this.middleNodeIcon = defaultIcon;
            this.lastNodeIcon = defaultIcon;
            this.map = null;
            this.path = null;
        }
项目:WalkGraph    文件:MapFragmentImpl.java   
/**
 * @param graph to use in drawing polyOptions on the graph.
 */

@Override
public void drawGraph(Graph graph) {
    PolylineOptions graphOptions = new PolylineOptions();
    List<Location> locationList = graph.getLocations();

    for (Location location: locationList){
        LatLng currentPosition = new LatLng(location.getLatitude(), location.getLongitude());
        MarkerOptions options = new MarkerOptions();
        options.position(currentPosition)
                .icon(BitmapDescriptorFactory.defaultMarker())
                .title("Position")
                .snippet("Some Position");
        googleMap.addMarker(options);
        graphOptions.add(currentPosition);
    }

    Polyline graphPolygon = googleMap.addPolyline(graphOptions);

    graphPolygon.setGeodesic(true);
    graphPolygon.setColor(Color.DKGRAY);
    graphPolygon.setWidth(20);
}
项目:MuslimMateAndroid    文件:MosquesActivity.java   
@Override
public void onLocationChanged(Location location) {
    if (location.getLatitude() != 0 || location.getLongitude() != 0) {
        setFusedLatitude(location.getLatitude());
        setFusedLongitude(location.getLongitude());
        stopFusedLocation();
        CameraPosition oldPos = googleMap.getCameraPosition();
        CameraPosition pos = CameraPosition.builder(oldPos)
                .target(getPosition())
                .zoom(zoom)
                .build();
        googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(pos));

        Marker marker = googleMap.addMarker(new MarkerOptions()
                .position(getPosition())
                .title("My Location").icon(BitmapDescriptorFactory.fromResource(R.drawable.placeholder)));


        AsyncTask placesAsync = new Places().execute(getPosition());

    }

}
项目:1617PROJ1Bloeddonatie-app    文件:Location.java   
public MarkerOptions getMarker() {
    BitmapDescriptor markerIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_location_red);
    BitmapDescriptor markerIconMobile = BitmapDescriptorFactory.fromResource(R.drawable.ic_location_mobile_red);

    this.marker.position(this.getCoordinates());
    this.marker.title(this.name);
    this.marker.snippet(this.getAddress() + this.getDates());

    if(this.isMobile == null) {
        this.marker.icon(markerIcon);
    } else {
        if(this.isMobile == true) {
            this.marker.icon(markerIconMobile);
        } else {
            this.marker.icon(markerIcon);
        }
    }


    return this.marker;
}
项目:IelloAndroidAdminApp    文件:MappaGoogle.java   
/**
 * Imposta un marker per ogni parcheggio già presente in zona
 */
void settaMarkersGiaPresenti() {
    // rimuovi tutti i markers
    for(Marker m : mMarkerListPresenti)
        m.remove();
    mMarkerListPresenti.clear();

    // aggiungi un marker per ogni posizione
    for (Parcheggio p : ElencoParcheggi.getInstance().getListParcheggi()) {
        LatLng coordParcheggio = p.getCoordinate();

        Marker marker = mMappa.addMarker(new MarkerOptions()
                .position(coordParcheggio)
                .title(p.getIndirizzo())
                .icon(BitmapDescriptorFactory.defaultMarker(138)));

        // Associo al marker un tag che corrisponde al parcheggio in questo modo posso
        // poi eliminarlo direttamente
        marker.setTag(p);

        mMarkerListPresenti.add(marker);
    }
    mMainActivity.modificaTxtMarkerPresenti(ElencoParcheggi.getInstance().getListParcheggi().size());
}
项目:Overkill    文件:MapsActivity2.java   
private void moveToPosition() {
    // add a marker
    LatLng wantToGoTo = start;
    mMap.clear();
    mMap.addMarker(new MarkerOptions().position(wantToGoTo).title(info)
            .icon(BitmapDescriptorFactory.fromResource(R.drawable.personstanding)));

    // create an animation for map while moving to this location
    mMap.animateCamera(CameraUpdateFactory.zoomTo(18), 2000, null);
    CameraPosition cameraPosition = new CameraPosition.Builder()
            .target(wantToGoTo)
            .zoom(18)
            .bearing(90)
            .tilt(30)
            .build();
    mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));

}
项目:Android-Programming-BigNerd    文件:LocatrFragment.java   
private void updateUI() {
    if (mMap == null || mMapImage == null) {
        return;
    }
    Log.d(TAG, "updateUI: ");
    LatLng itemPoint = new LatLng(mMapItem.getLat(), mMapItem.getLon());
    LatLng myPoint = new LatLng(mCurrentLocation.getLatitude(),
            mCurrentLocation.getLongitude());
    BitmapDescriptor itemBitmap = BitmapDescriptorFactory.fromBitmap(mMapImage);
    MarkerOptions itemMarker = new MarkerOptions()
            .position(itemPoint)
            .icon(itemBitmap);
    MarkerOptions myMarker = new MarkerOptions()
            .position(myPoint);
    mMap.clear();
    mMap.addMarker(itemMarker);
    mMap.addMarker(myMarker);
    LatLngBounds bounds = new LatLngBounds.Builder()
            .include(itemPoint)
            .include(myPoint)
            .build();
    int margin = getResources().getDimensionPixelSize(R.dimen.map_inset_margin);
    CameraUpdate update = CameraUpdateFactory.newLatLngBounds(bounds, margin);
    mMap.animateCamera(update);
}
项目:iSPY    文件:ShortestDistance.java   
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"));
    }

}
项目:iSPY    文件:GetNearbyPlacesData.java   
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));
    }
}
项目:YelpQL    文件:BusinessDetailsActivity.java   
private void showPointerOnMap(final double latitude, final double longitude) {
    mvRestaurantLocation.getMapAsync(new OnMapReadyCallback() {
        @Override
        public void onMapReady(GoogleMap googleMap) {
            LatLng latLng = new LatLng(latitude, longitude);
            googleMap.addMarker(new MarkerOptions()
                    .icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_flag))
                    .anchor(0.0f, 1.0f)
                    .position(latLng));
            googleMap.getUiSettings().setMyLocationButtonEnabled(false);
            googleMap.getUiSettings().setZoomControlsEnabled(true);

            // Updates the location and zoom of the MapView
            CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 15);
            googleMap.moveCamera(cameraUpdate);
        }
    });
}
项目:Dispatch    文件:MainActivity.java   
public void PlacePinAndPositionCamera(LatLng addressPosition) {

        MarkerOptions markerOptions = new MarkerOptions();
        markerOptions.position(addressPosition);
        mMap.addMarker(markerOptions
                .title("Crisis Location").icon(BitmapDescriptorFactory
                        .defaultMarker(BitmapDescriptorFactory.HUE_RED)));
        mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(addressPosition, 12));
        LatLngBounds.Builder builder = new LatLngBounds.Builder();

        builder.include(addressPosition);

        LatLngBounds bounds = builder.build();

        int padding = 150; // offset from edges of the map in pixels
        CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, padding);

        mMap.animateCamera(cu);
    }
项目:iosched-reader    文件:MapFragment.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // ANALYTICS SCREEN: View the Map screen
    // Contains: Nothing (Page name is a constant)
    AnalyticsHelper.sendScreenView(SCREEN_LABEL);

    // get DPI
    mDPI = getActivity().getResources().getDisplayMetrics().densityDpi / 160f;

    ICON_ACTIVE = BitmapDescriptorFactory.fromResource(R.drawable.map_marker_selected);
    ICON_NORMAL =
            BitmapDescriptorFactory.fromResource(R.drawable.map_marker_unselected);

    // Get the arguments and restore the highlighted room or displayed floor.
    Bundle data = getArguments();
    if (data != null) {
        mHighlightedRoomId = data.getString(EXTRAS_HIGHLIGHT_ROOM, null);
        mInitialFloor = data.getInt(EXTRAS_ACTIVE_FLOOR, MOSCONE_DEFAULT_LEVEL_INDEX);
    }

    getMapAsync(this);
}
项目:google-maps-clustering    文件:DefaultIconGenerator.java   
@NonNull
private BitmapDescriptor createClusterIcon(int clusterBucket) {
    @SuppressLint("InflateParams")
    TextView clusterIconView = (TextView) LayoutInflater.from(mContext)
            .inflate(R.layout.map_cluster_icon, null);
    clusterIconView.setBackground(createClusterBackground());
    clusterIconView.setTextColor(mIconStyle.getClusterTextColor());
    clusterIconView.setTextSize(TypedValue.COMPLEX_UNIT_PX,
            mIconStyle.getClusterTextSize());

    clusterIconView.setText(getClusterIconText(clusterBucket));

    clusterIconView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
    clusterIconView.layout(0, 0, clusterIconView.getMeasuredWidth(),
            clusterIconView.getMeasuredHeight());

    Bitmap iconBitmap = Bitmap.createBitmap(clusterIconView.getMeasuredWidth(),
            clusterIconView.getMeasuredHeight(), Bitmap.Config.ARGB_8888);

    Canvas canvas = new Canvas(iconBitmap);
    clusterIconView.draw(canvas);

    return BitmapDescriptorFactory.fromBitmap(iconBitmap);
}
项目:mocket_android_demo    文件:MapsActivity.java   
@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);
}
项目:ITagAntiLost    文件:DevicesActivity.java   
private void showMarkers() {
  googleMap.clear();
  Observable
      .fromIterable(currentDevices)
      .subscribe(device -> {
        Location center = GeoHash.fromString(device.getGeoHash()).getCenter();
        Marker marker = googleMap.addMarker(new MarkerOptions()
            .position(new LatLng(center.getLatitude(), center.getLongitude()))
            .icon(BitmapDescriptorFactory.fromResource(R.mipmap.ic_launcher))
            .flat(true)
            .title(device.getName())
            .snippet(device.getAddress())
        );
        Bitmap bitmap = Device.getBitmapImage(device.getImage(), getResources());
        Bitmap bmp = Bitmap.createScaledBitmap(bitmap, markerSize, markerSize, false);
        bitmap.recycle();
        marker.setIcon(BitmapDescriptorFactory.fromBitmap(bmp));
      });
}
项目:AstronomyTourPadova    文件:AtMarker.java   
private BitmapDescriptor bitmapDescriptorFromVector(Context context, int vectorResId) {
    Drawable vectorDrawable = ContextCompat.getDrawable(context, vectorResId);
    vectorDrawable.setBounds(0, 0, vectorDrawable.getIntrinsicWidth(), vectorDrawable.getIntrinsicHeight());
    Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(), vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    vectorDrawable.draw(canvas);
    return BitmapDescriptorFactory.fromBitmap(bitmap);
}
项目:ExtraMapUtils    文件:AppUtils.java   
private static float magnitudeToColor(double magnitude) {
    if (magnitude < 1.0) {
        return BitmapDescriptorFactory.HUE_CYAN;
    } else if (magnitude < 2.5) {
        return BitmapDescriptorFactory.HUE_GREEN;
    } else if (magnitude < 4.5) {
        return BitmapDescriptorFactory.HUE_YELLOW;
    } else {
        return BitmapDescriptorFactory.HUE_RED;
    }
}
项目:routineKeen    文件:MapsActivity.java   
/**
 * Place the markers in the marker array on the map.
 * If there is a range filter selected, then check if the marker is within range of current
 * location.
 */
private void placeMarkers() {
    for (Markers m : toDisplayAL) {
        if ((m.getMarkerId()).equals(UserSingleton.getCurrentUser().getUsername())) {
            mMap.addMarker(new MarkerOptions().position(m.getMarkerLocation())
                    .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED))
                    .title(m.getMarkerTitle()).snippet(m.getMarkerId()));
        } else {
            mMap.addMarker(new MarkerOptions().position(m.getMarkerLocation())
                    .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE))
                    .title(m.getMarkerTitle()).snippet(m.getMarkerId()));
        }
    }
}
项目:RoadLab-Pro    文件:BaseStartMeasurementMapFragment.java   
public void refreshMyLocation(LatLng location) {
    if (myLocation != null) {
        myLocation.setPosition(location);
    } else {
        myLocation = map.addMarker(new MarkerOptions().position(location).
        icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_my_location)));
    }
}
项目:MADBike    文件:IconRendered.java   
@Override
    protected void onBeforeClusterItemRendered(Station item, MarkerOptions markerOptions) {
        markerOptions.icon(BitmapDescriptorFactory.fromBitmap(item.getBitmapMarker()));
//        markerOptions.snippet(item.getAddress());
//        markerOptions.title(item.getName());
        super.onBeforeClusterItemRendered(item, markerOptions);
    }
项目:apps_small    文件:MapsActivity.java   
@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    mMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN);

    // Add a marker in Sydney and move the camera
    LatLng sydney = new LatLng(-34, 151);
    LatLng fairbanks = new LatLng(64, -147);
    mMap.addMarker(new MarkerOptions().position(fairbanks).title("Marker in Alaska")
            .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)));
    mMap.moveCamera(CameraUpdateFactory.newLatLng(fairbanks));
    mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(fairbanks, 5));

}
项目:Pickr    文件:DetailActivity.java   
@Override
public void onMapReady(final GoogleMap googleMap) {
    googleMap.setMyLocationEnabled(true);
    googleMap.getUiSettings().setMyLocationButtonEnabled(true);
    googleMap.getUiSettings().setMapToolbarEnabled(false);
    LatLng latLng = mPointOfInterest.latLng;
    if (latLng != null) {
        googleMap.addMarker(new MarkerOptions().position(latLng)
                .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)));
        googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 16f));
    }
}
项目:VR-One    文件:MapActivity.java   
private void addMarkersToMap() {

        // Uses a custom icon with the info window popping out of the center of the icon
        vrControllerMarker = mMap.addMarker(new MarkerOptions()
                .position(VRCONTROLLERGPS)
                .title("VR Controller")
                .snippet("User ID: 123456")
                .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED))
                .infoWindowAnchor(0.5f, 0.5f));
    }
项目:Viajes    文件:MapFragment.java   
private void setupClusterManager() {
        // reference

        // clustering
        if(mMap!=null) {
            mClusterManager = new ClusterManager<>(getActivity(), mMap);
            mClusterManager.setRenderer(new DefaultClusterRenderer<Hotel>(getActivity(), mMap, mClusterManager) {
                @Override
                protected void onBeforeClusterItemRendered(Hotel item, MarkerOptions markerOptions) {
                    int size = getActivity().getResources().getDimensionPixelSize(R.dimen.fragment_map_marker_size);
                    Bitmap originalBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.markerfield);
                    Bitmap bitmap = BitmapScaler.scaleToFill(originalBitmap, size, size);
                    if(originalBitmap!=bitmap){
                        originalBitmap.recycle();
                    }

                    BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(bitmap);
                    markerOptions.title(item.getName());
                    markerOptions.icon(bitmapDescriptor);
                    markerOptions.snippet(""+item.getPrice());

                    super.onBeforeClusterItemRendered(item, markerOptions);
                }
            });
            mClusterManager.setOnClusterItemInfoWindowClickListener(new ClusterManager.OnClusterItemInfoWindowClickListener<Hotel>() {
                @Override
                public void onClusterItemInfoWindowClick(Hotel i)
                {
                    getActivity().finish();
//                    Toast.makeText(getActivity(), "Action", Toast.LENGTH_SHORT).show();
                }
            });
//            mMap.setOnCameraMoveCanceledListener(m);
            //setOnCameraChangeListener(mClusterManager);
            mMap.setOnInfoWindowClickListener(mClusterManager);
            renderView();
        }
    }
项目:GogoNew    文件:MapsActivity.java   
private void showMyLocationMarker() {

                String str = "My Location";
//                Log.e(TAG, "mCurrentLocation="+mCurrentLocation);
                if (null != mCurrentLocation) {

                        mCurrentPosition = new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude());
                        Geocoder geocoder = new Geocoder(getApplicationContext());

                        try {
                                List<android.location.Address> addressList = geocoder.getFromLocation(mCurrentLocation.getLatitude(),
                                        mCurrentLocation.getLongitude(), 1);
                                str = "";
                                if (addressList.get(0).getSubLocality() != null) {
                                        str = addressList.get(0).getSubLocality()+",";
                                }
                                str += addressList.get(0).getLocality();
//                                Log.d(TAG, "GEOCODER STARTED.");
                        } catch (IOException e) {
                                e.printStackTrace();
//                                Log.e(TAG, "GEOCODER DIDN'T WORK.");
                        }

                        if (myLocationMarker != null) {
                                myLocationMarker.remove();
                        }
                        myLocationMarker = mMap.addMarker(new MarkerOptions()
                                .position(new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude()))
                                .title(str));
                        myLocationMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.start_blue));
                        //                        mMap.animateCamera(CameraUpdateFactory.newLatLng(
//                                new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude())));

        }

}
项目:GogoNew    文件:MapsActivity.java   
private void showMyLocationMarker() {

                String str = "My Location";
//                Log.e(TAG, "mCurrentLocation="+mCurrentLocation);
                if (null != mCurrentLocation) {

                        mCurrentPosition = new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude());
                        Geocoder geocoder = new Geocoder(getApplicationContext());

                        try {
                                List<android.location.Address> addressList = geocoder.getFromLocation(mCurrentLocation.getLatitude(),
                                        mCurrentLocation.getLongitude(), 1);
                                str = "";
                                if (addressList.get(0).getSubLocality() != null) {
                                        str = addressList.get(0).getSubLocality()+",";
                                }
                                str += addressList.get(0).getLocality();
//                                Log.d(TAG, "GEOCODER STARTED.");
                        } catch (IOException e) {
                                e.printStackTrace();
//                                Log.e(TAG, "GEOCODER DIDN'T WORK.");
                        }

                        if (myLocationMarker != null) {
                                myLocationMarker.remove();
                        }
                        myLocationMarker = mMap.addMarker(new MarkerOptions()
                                .position(new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude()))
                                .title(str));
                        myLocationMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.start_blue));
                        //                        mMap.animateCamera(CameraUpdateFactory.newLatLng(
//                                new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude())));

        }

}
项目:VennTracker    文件:Circles.java   
private static void setIntersection(Context context, GoogleMap gMap, LatLng latLng) {
    Marker marker = gMap.addMarker(new MarkerOptions().position(latLng).icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_arrow)));
    mIntersectingToClear.add(marker);
    DatabaseHelper myDb = DatabaseHelper.getInstance(context);
    myDb.saveIntersections(mIntersecting);
    myDb.close();
}
项目:VennTracker    文件:SpawnLocation.java   
public static void setSpawnPoint(final Context context, final GoogleMap googleMap, final LatLng latLng){
    Marker marker = googleMap.addMarker(new MarkerOptions()
            .position(latLng));
    marker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
    mSpawnPoints.add(marker);
    // Put location into the database as 2 doubles with type Spawn Location.
    DatabaseHelper myDb = DatabaseHelper.getInstance(context);
    myDb.addLocation("Spawn Location", latLng.latitude, latLng.longitude, "No Description");
    myDb.close();
}
项目:VennTracker    文件:SpawnLocation.java   
private static void showSpawnLocations(GoogleMap googleMap, LatLng latLng, String description, String time) {
    Marker marker = googleMap.addMarker(new MarkerOptions().position(latLng));
    marker.setSnippet(description);
    marker.setTag(time + "");
    marker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
    mSpawnPoints.add(marker);
    if (marker.getTag() != "") {
        mSpawnPointTimes.add(marker);
    }
}
项目:SpaceRace    文件:PiecePicker.java   
@NonNull
public static BitmapDescriptor getPiece(@NonNull PieceShape shape, int id) {

    Bitmap toScale = BitmapFactory.decodeResource(SpaceRace.getAppContext().getResources(), id);
    toScale = Bitmap.createScaledBitmap(toScale, shape.getWidth(), shape.getLength(), false);

    return BitmapDescriptorFactory.fromBitmap(toScale);
}
项目:MuslimMateAndroid    文件:MapFragment.java   
@Override
public boolean onMyLocationButtonClick() {
    mapView.clear();
    Marker mark = mapView.addMarker(new MarkerOptions().position(getMyLocationtLatLng()).draggable(true).icon(BitmapDescriptorFactory.fromResource(R.drawable.placeholder)));
    onMarkerDragEnd(mark);
    return true;
}
项目:RoadLab-Pro    文件:MeasurementsGoogleMapHelper.java   
private void addBump(Context context, GoogleMap map, BumpModel item, boolean addCache) {
    LatLng location = new LatLng(item.getLatitude(), item.getLongitude());
    if (bumpIcon == null) {
        bumpIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_map_bump_red);
    }
    Marker marker = map.addMarker(new MarkerOptions()
            .position(location)
            .icon(bumpIcon)
            .anchor(0.5f, 0.5f)
            .title(item.getName())
            .snippet(item.getDescription()));
    if (addCache && markersCache != null) {
        markersCache.put(marker, item);
    }
}