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

项目:today-menu-android    文件:RestaurantsMapFragment.java   
private void setMarkers(GoogleMap map, List<Restaurant> restaurants) {
    if (map == null) {
        return;
    }
    map.clear();
    MarkerOptions options = new MarkerOptions().position(
            new LatLng(Prefs.LastLatitude.getDouble(), Prefs.LastLongitude.getDouble()))
            .icon(BitmapDescriptorFactory.fromResource(R.drawable.current_location));
    map.addMarker(options);
    for (Restaurant restaurant : restaurants) {
        MarkerOptions markerOptions = new MarkerOptions().position(
                new LatLng(restaurant.mLatitude, restaurant.mLongitude))
                .title(restaurant.mName)
                .icon(BitmapDescriptorFactory.fromResource(R.drawable.restaurant_pin));
        Marker marker = map.addMarker(markerOptions);
        marker.setTag(restaurant);
    }
    mMap.setOnInfoWindowClickListener(mInfoWindowClickListener);
}
项目:iosched-reader    文件:MapFragment.java   
@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    mMap.setIndoorEnabled(true);
    mMap.setMyLocationEnabled(false);
    mMap.setOnMarkerClickListener(this);
    mMap.setOnIndoorStateChangeListener(this);
    mMap.setOnMapClickListener(this);
    UiSettings mapUiSettings = mMap.getUiSettings();
    mapUiSettings.setZoomControlsEnabled(false);
    mapUiSettings.setMapToolbarEnabled(false);

    // load all markers
    LoaderManager lm = getLoaderManager();
    lm.initLoader(TOKEN_LOADER_MARKERS, null, mMarkerLoader).forceLoad();

    // load the tile overlays
    lm.initLoader(TOKEN_LOADER_TILES, null, mTileLoader).forceLoad();

    setupMap(true);
}
项目:TrackIn-Android-Application    文件:cordmap.java   
@Override
    public void onMapReady(GoogleMap googleMap) {
        mMap = googleMap;
//        mMap.setOnMapClickListener(this);
        Bundle bundle = getIntent().getExtras();

        double r_long=bundle.getDouble("lattitude");
        double r_lat=bundle.getDouble("longitude");
        // Add a marker in Sydney and move the camera
        LatLng mark = new LatLng(r_lat, r_long);
        CircleOptions circleoptions=new CircleOptions().strokeWidth(2).strokeColor(Color.BLUE).fillColor(Color.parseColor("#500084d3"));
        mMap.addMarker(new MarkerOptions().position(mark).title(getAddress(mark)));
        mMap.moveCamera(CameraUpdateFactory.newLatLng(mark));
        Circle circle=mMap.addCircle(circleoptions.center(mark).radius(5000.0));
        mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(circleoptions.getCenter(),getZoomLevel(circle)));
    }
项目:holla    文件:MapLookActivity.java   
/**
 * Manipulates the map once available.
 * This callback is triggered when the map is ready to be used.
 * This is where we can add markers or lines, add listeners or move the camera. In this case,
 * we just add a marker near Sydney, Australia.
 * If Google Play services is not installed on the device, the user will be prompted to install
 * it inside the SupportMapFragment. This method will only be triggered once the user has
 * installed Google Play services and returned to the app.
 */
@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;

    Toast.makeText(getApplicationContext(), "MAP READY", Toast.LENGTH_SHORT).show();
    Log.e("MAP", "Map Ready");

    // Add a marker at Polytechnic
    LatLng poly = new LatLng(45.504628, -73.614675);
    mMap.addMarker(new MarkerOptions().position(poly).title("Marker at Polytechnique"));
    mMap.moveCamera(CameraUpdateFactory.newLatLng(poly));
    mMap.moveCamera(CameraUpdateFactory.zoomTo(mMap.getMaxZoomLevel()));

    //Enable Current Location Button
    mMap.setOnMyLocationButtonClickListener(this);
    enableMyLocation();
}
项目:GoogleMapsApp    文件:MapsActivity.java   
@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);

    //Initialize Google Play Services
    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        if (ContextCompat.checkSelfPermission(this,
                Manifest.permission.ACCESS_FINE_LOCATION)
                == PackageManager.PERMISSION_GRANTED) {
            buildGoogleApiClient();
            mMap.setMyLocationEnabled(true);
        }
    } else {
        buildGoogleApiClient();
        mMap.setMyLocationEnabled(true);
    }
}
项目:Protestr    文件:CreateEventActivity.java   
@Override
public void moveMapCamera(final LatLng latLng) {
    if (latLng.latitude == 0 && latLng.longitude == 0)
        return;
    final CameraPosition cameraPosition = new CameraPosition.Builder()
            .target(latLng)
            .zoom(12f)
            .build();
    googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition),
            new GoogleMap.CancelableCallback() {
                @Override
                public void onFinish() {
                    googleMap.clear();
                    latitude = latLng.latitude;
                    longitude = latLng.longitude;
                    googleMap.addMarker(new MarkerOptions().position(latLng));
                }

                @Override
                public void onCancel() {
                    // ignored
                }
            });
}
项目:RoadLab-Pro    文件:BaseStartMeasurementMapFragment.java   
protected void initMap(GoogleMap map) {
    goToLocation = true;
    firstLocationRefresh = true;
    if (map != null) {
        MapsInitializer.initialize(getActivity());
        RAApplication.getInstance().getGpsDetector().setGpsMapListener(new GPSDetector.GpsMapListener() {
            @Override
            public void onGpsMapListener(final Location location) {
                ActivityUtil.runOnMainThread(new Runnable() {
                    @Override
                    public void run() {
                        if (refreshMyLocation) {
                            setCurrentLocation(location);
                        }
                    }
                });
            }
        });
        clearMap();
        LatLng loc = new LatLng(Constants.LATITUDE_BELARUS, Constants.LONGITUDE_BELARUS);
        map.moveCamera(CameraUpdateFactory.newLatLngZoom(loc, Constants.DEFAULT_CAMERA_ZOOM));
        refreshMyLocation(loc);
        initMapData();
    }
}
项目:RoadLab-Pro    文件:BaseMapFragment.java   
protected void initMap(GoogleMap map) {
    goToLocation = true;
    firstLocationRefresh = true;
    if (map != null) {
        MapsInitializer.initialize(getActivity());
        RAApplication.getInstance().getGpsDetector().setGpsMapListener(new GPSDetector.GpsMapListener() {
            @Override
            public void onGpsMapListener(final Location location) {
                ActivityUtil.runOnMainThread(new Runnable() {
                    @Override
                    public void run() {
                        if (refreshMyLocation) {
                            setCurrentLocation(location);
                        }
                    }
                });
            }
        });
        clearMap();
        LatLng loc = new LatLng(Constants.LATITUDE_BELARUS, Constants.LONGITUDE_BELARUS);
        map.moveCamera(CameraUpdateFactory.newLatLngZoom(loc, Constants.DEFAULT_CAMERA_ZOOM));
        refreshMyLocation(loc);
        initMapData();
    }
}
项目:MuslimMateAndroid    文件:MosquesActivity.java   
@Override
public void onMapReady(GoogleMap googleMap) {
    this.googleMap = googleMap;
    this.googleMap.setOnMapClickListener(this);
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        // TODO: Consider calling
        //    ActivityCompat#requestPermissions
        // here to request the missing permissions, and then overriding
        //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
        //                                          int[] grantResults)
        // to handle the case where the user grants the permission. See the documentation
        // for ActivityCompat#requestPermissions for more details.
        return;
    }
    this.googleMap.setMyLocationEnabled(true);
    this.googleMap.setOnMyLocationButtonClickListener(this);

}
项目:RoadLab-Pro    文件:MeasurementsGoogleMapHelper.java   
private void addTag(Context context, GoogleMap map, TagModel item, boolean addCache) {
    LatLng location = new LatLng(item.getLatitude(), item.getLongitude());
    BitmapDescriptor tagIcon = getTagIcon(item.getRoadCondition());
    Marker marker = map.addMarker(new MarkerOptions()
            .position(location)
            .icon(tagIcon)
            .anchor(0.5f, 0.5f)
            .title(item.getName())
            .snippet(item.getDescription()));
    if (addCache && markersCache != null) {
        markersCache.put(marker, item);
    }
}
项目:Daejeon-People    文件:MapView.java   
@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    mUiSettings = mMap.getUiSettings();
    mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
        @Override
        public void onMapClick(LatLng latLng) {
            select.setVisibility(View.VISIBLE);
            Log.d("latLng", latLng.latitude+" "+latLng.longitude);
            mMap.addMarker(new MarkerOptions()
                    .position(latLng));
        }
    });

    LatLng sydney = new LatLng(36.338193, 127.393331);
    mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
    if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
            == PackageManager.PERMISSION_GRANTED) {
        mMap.setMyLocationEnabled(true);
    } else {
        // Show rationale and request permission.
        ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, MY_PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION);
        Toast.makeText(getApplicationContext(), "위치정보제공동의가 필요합니다.", Toast.LENGTH_SHORT).show();
    }
    mUiSettings.setZoomControlsEnabled(true);
}
项目:GoogleMapsApp    文件:MapsActivity.java   
@Override
public void onLocationChanged(Location location) {
    mLastLocation = location;
    if (mCurrLocationMarker != null) {
        mCurrLocationMarker.remove();
    }
    map = new HashMap<String, String>();
    map.put("LocationID", "0");
    map.put("Latitude", Double.toString(location.getLatitude()));
    map.put("Longitude", Double.toString(location.getLongitude()));
    map.put("LocationName", "Current Position");

    locations.add(map);

    Latitude = Double.parseDouble(locations.get(0).get("Latitude"));
    Longitude = Double.parseDouble(locations.get(0).get("Longitude"));
    LatLng coordinate = new LatLng(Latitude, Longitude);
    mMap.setMapType(com.google.android.gms.maps.GoogleMap.MAP_TYPE_HYBRID);
    mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(coordinate, 12));
    if (mGoogleApiClient != null) {
        LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
    }
}
项目:FiveMinsMore    文件:MapsActivity.java   
/**
 * Manipulates the map once available.
 * This callback is triggered when the map is ready to be used.
 */
@Override
public void onMapReady(GoogleMap map) {
    mMap = map;
    mMapsManager = new MapsManager(this, map);
    mGpxManager = new GpxManager(this);

    // Check whether this app could get location
    if (checkLocationPermission())
        map.setMyLocationEnabled(true);
    else
        askPermission();

    // Set the boundaries of Taiwan
    MapUtils.setTaiwanBoundaries(map);

    // 設定相機位置
    if (lastCameraPosition == null)
        map.moveCamera(CameraUpdateFactory.newLatLngZoom(TAIWAN_CENTER, STARTING_ZOOM));
    else
        map.moveCamera(CameraUpdateFactory.newCameraPosition(lastCameraPosition));
    mMapsManager.onCameraMove();

    // 開啟上次的GPX檔案
    if (!mGpxFileList.isEmpty()) {
        for (String filePath : mGpxFileList) {
            File file = new File(filePath);
            mGpxManager.addGpxFile(file, mMapsManager);
        }
        mGpxManager.refreshDialog();
    }

    // TODO blue dot beam to indicate user direction
}
项目:Nimbus    文件:MapActivity.java   
@Override
public void onMapReady(GoogleMap googleMap) {
    map_available=true;
    map=googleMap;

    map.moveCamera(CameraUpdateFactory.newCameraPosition(hamirpur));
    map.setMapType(GoogleMap.MAP_TYPE_HYBRID);

    map.addMarker(audi);
    map.addMarker(nescafe);
    map.addMarker(park);
    map.addMarker(juice);
    map.addMarker(ground);
    map.addMarker(oat);
    map.addMarker(sbi);
    map.addMarker(ekta);
    map.addMarker(h4);
    map.addMarker(pgh);
    map.addMarker(kbh);
    map.addMarker(g1);

}
项目:geopackage-android-map    文件:GoogleMapShapeConverter.java   
/**
 * Add a MultiPolylineOptions to the map as markers
 *
 * @param shapeMarkers
 * @param map
 * @param multiPolyline
 * @param polylineMarkerOptions
 * @param globalPolylineOptions
 * @return
 */
public MultiPolylineMarkers addMultiPolylineToMapAsMarkers(
        GoogleMapShapeMarkers shapeMarkers, GoogleMap map,
        MultiPolylineOptions multiPolyline,
        MarkerOptions polylineMarkerOptions,
        PolylineOptions globalPolylineOptions) {
    MultiPolylineMarkers polylines = new MultiPolylineMarkers();
    for (PolylineOptions polylineOptions : multiPolyline
            .getPolylineOptions()) {
        PolylineMarkers polylineMarker = addPolylineToMapAsMarkers(map,
                polylineOptions, polylineMarkerOptions,
                globalPolylineOptions);
        shapeMarkers.add(polylineMarker);
        polylines.add(polylineMarker);
    }
    return polylines;
}
项目:wheretomeet-android    文件:MapsActivity.java   
/**
 * Manipulates the map once available.
 * This callback is triggered when the map is ready to be used.
 * This is where we can add markers or lines, add listeners or move the camera. In this case,
 * we just add a marker near Sydney, Australia.
 * If Google Play services is not installed on the device, the user will be prompted to install
 * it inside the SupportMapFragment. This method will only be triggered once the user has
 * installed Google Play services and returned to the app.
 */

@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;

    storePlace(getIntent().getExtras().getString("place"));
    flocationx=getIntent().getDoubleArrayExtra("locationx");
    flocationy=getIntent().getDoubleArrayExtra("locationy");
    fname=getIntent().getStringArrayListExtra("name");
    mylat=getIntent().getExtras().getDouble("mylat");
    mylog=getIntent().getExtras().getDouble("mylog");

    LatLng place = new LatLng(locationx , locationy);
    mMap.addMarker(new MarkerOptions().position(place).title(name).icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory.decodeResource(getResources(),R.mipmap.marker))));
    mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(place,14));

    for(int i=0;i<fname.size();i++) {
        mMap.addMarker(new MarkerOptions().position(new LatLng(flocationy[i], flocationx[i])).title(fname.get(i)));
    }
    mMap.addMarker(new MarkerOptions().position(new LatLng(mylat, mylog)).title("ME"));
}
项目:android-googlemaps    文件:MapFragment.java   
@Override
public void onMapReady(GoogleMap googleMap) {
    gMap =googleMap;
    // Add a marker in Sydney and move the camera
    LatLng sucre = new LatLng(-19.040179078634807, -65.25621296313443);

    MarkerOptions marker = new MarkerOptions()
            .position(sucre)
            .title("Bienvenidos a la CCBOL2017")
            .draggable(true);

    gMap.addMarker(marker);

    CameraPosition camera = new CameraPosition.Builder()
            .target(sucre)
            .zoom(18)  //limite ->21
            .bearing(0) // 0 - 365
            .tilt(45) // limite ->90
            .build();

    gMap.animateCamera(CameraUpdateFactory.newCameraPosition(camera));
}
项目:AndiCar    文件:GPSTrackMap.java   
private void setUpMap() {
    if (!loadTrackFiles) {
        return;
    }

    if (!loadTrackAndBounds()) {
        Utils.showNotReportableErrorDialog(this, getString(R.string.gen_error), mErrMsg);
        return;
    }

    mMap.addPolyline(mTrackLine).setWidth(trackLineWidth);
    mMap.setOnCameraChangeListener(new GoogleMap.OnCameraChangeListener() {
        @Override
        public void onCameraChange(CameraPosition arg0) {
            // Move camera.
            mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(mTrackBoundBuilder.build(), 100));
            // Remove listener to prevent position reset on camera move.
            mMap.setOnCameraChangeListener(null);
        }
    });
}
项目:MyFlightbookAndroid    文件:ActFlightMap.java   
private void autoZoom() {
    GoogleMap gm = getMap();
    if (gm == null)
        return;

    if (m_llb == null) {
        Location l = MFBLocation.LastSeenLoc();
        if (l != null)
            gm.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(l.getLatitude(), l.getLongitude()), ZOOM_LEVEL_AREA));
    } else {
        double height = Math.abs(m_llb.northeast.latitude - m_llb.southwest.latitude);
        double width = Math.abs(m_llb.northeast.longitude - m_llb.southwest.longitude);

        gm.moveCamera(CameraUpdateFactory.newLatLngBounds(m_llb, 20));
        if (height < 0.001 || width < 0.001)
            gm.moveCamera(CameraUpdateFactory.zoomTo((m_rgapRoute != null && m_rgapRoute.length == 1) ? ZOOM_LEVEL_AIRPORT : ZOOM_LEVEL_AREA));
    }
}
项目:techstar-org    文件:ProjectDetaikActivity.java   
public void setUpMap() {

        googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {

            return;
        }
        googleMap.setMyLocationEnabled(true);
        googleMap.setTrafficEnabled(true);
        googleMap.setIndoorEnabled(true);
        googleMap.setBuildingsEnabled(true);
        googleMap.getUiSettings().setZoomControlsEnabled(true);
    }
项目:Taxi-App-Android-XML    文件:MyTrip.java   
@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;

    boolean success = googleMap.setMapStyle(new MapStyleOptions(getResources()
            .getString(R.string.style_json)));

    if (!success) {
        Log.e("Style", "Style parsing failed.");
    }
    LatLng jakarta = new LatLng(-6.232812, 106.820933);
    mMap.addMarker(new MarkerOptions().position(jakarta).icon(BitmapDescriptorFactory.fromBitmap(getBitmapFromView("Set Pickup Location", R.drawable.dot_pickup))));
    mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(jakarta, 15f));
}
项目:traffic-report-android    文件:MainActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    // Change the map type
    if (id == R.id.settings_normal) {
        mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
    }
    else if(id == R.id.settings_terrain){
        mMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
    }
    else if(id==R.id.settings_satelite){
        mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
    }
    return super.onOptionsItemSelected(item);
}
项目:nongbeer-mvp-android-demo    文件:MapActivity.java   
@Override
public void onMapReady( GoogleMap googleMap ){
    map = googleMap;
    if( isLocationEnable() ){
        Location location = getLastKnownLocation();
        if( location != null ){
            double latitude = location.getLatitude();
            double longitude = location.getLongitude();
            LatLng current = new LatLng( latitude, longitude );
            map.moveCamera( CameraUpdateFactory.newLatLngZoom( current, DEFAULT_ZOOM ) );
        }
    }
    setupMap();
}
项目:oma-riista-android    文件:MapViewer.java   
@Override
public void onMapReady(GoogleMap map) {
    if (mStartLocation != null) {
        setInitialLocation(mStartLocation);
    }

    // Only show gps state indicator when creating new entry.
    if (mNewItem) {
        mMapView.setShowInfoWindow(true);
        mMapView.setShowAccuracy(true);
    } else {
        mMapView.setShowInfoWindow(false);
        mMapView.setShowAccuracy(true);
    }
}
项目:study-buddy    文件:MapFragment.java   
/**
 * Manipulates the map once available.
 * This callback is triggered when the map is ready to be used.
 * This is where we can add markers or lines, add listeners or move the camera. In this case,
 * we just add a marker near Sydney, Australia.
 * If Google Play services is not installed on the device, the user will be prompted to install
 * it inside the SupportMapFragment. This method will only be triggered once the user has
 * installed Google Play services and returned to the app.
 */
@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;

    // Add a marker in Sydney and move the camera
    LatLng sydney = new LatLng(-34, 151);
    mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
    mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
项目:UbiBike-client    文件:DisplayRoute.java   
public void updateMap(GoogleMap map, LatLng marker)
{
    GeoJsonLayer x = new GeoJsonLayer(map,new JSONObject());

    GeoJsonPoint point = new GeoJsonPoint(marker);
    GeoJsonFeature feature = new GeoJsonFeature(point,"marker",null,null);
    x.addFeature(feature);

    x.addLayerToMap();
}
项目:UbiBike-client    文件:MapsActivity.java   
/**
 * Manipulates the map once available.
 * This callback is triggered when the map is ready to be used.
 * This is where we can add markers or lines, add listeners or move the camera.
 * If Google Play services is not installed on the device, the user will be prompted to install
 * it inside the SupportMapFragment. This method will only be triggered once the user has
 * installed Google Play services and returned to the app.
 */
@Override
public void onMapReady(GoogleMap googleMap) {
    GoogleMap mMap = googleMap;
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)
    {
        return;
    }
    mMap.setMyLocationEnabled(true);

    map = googleMap;
}
项目:AlarmWithL-T    文件:SettingFragment.java   
@Override
public void onMapReady(GoogleMap googleMap) {
    mGoogleMap = googleMap;
    mGoogleMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
        @Override
        public void onMapClick(LatLng latLng) {
            mTargetLocation = latLng;
            makeMarker(null);
        }
    });
}
项目:Habitizer    文件:MapController.java   
/**
 * Last step, we initialize the map
 * @param fctx
 * @param loc
 */
public static void initMap(final Activity fctx, final Location loc) {
    MapFragment mapFragment = (MapFragment) fctx.getFragmentManager().findFragmentById(R.id
            .map);
    mapFragment.getMapAsync(new OnMapReadyCallback() {
        @Override
        public void onMapReady(GoogleMap googleMap) {
            gmap = googleMap;
            myOnMapReady(fctx, googleMap, loc);
        }
    });
}
项目:google-maps-clustering    文件:MapsActivity.java   
@Override
public void onMapReady(final GoogleMap googleMap) {
    googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {
        @Override
        public void onMapLoaded() {
            googleMap.animateCamera(CameraUpdateFactory.newLatLngBounds(NETHERLANDS, 0));
        }
    });

    ClusterManager<SampleClusterItem> clusterManager = new ClusterManager<>(this, googleMap);
    clusterManager.setCallbacks(new ClusterManager.Callbacks<SampleClusterItem>() {
        @Override
        public boolean onClusterClick(@NonNull Cluster<SampleClusterItem> cluster) {
            Log.d(TAG, "onClusterClick");
            return false;
        }

        @Override
        public boolean onClusterItemClick(@NonNull SampleClusterItem clusterItem) {
            Log.d(TAG, "onClusterItemClick");
            return false;
        }
    });
    googleMap.setOnCameraIdleListener(clusterManager);

    List<SampleClusterItem> clusterItems = new ArrayList<>();
    for (int i = 0; i < 20000; i++) {
        clusterItems.add(new SampleClusterItem(
                RandomLocationGenerator.generate(NETHERLANDS)));
    }
    clusterManager.setItems(clusterItems);
}
项目:ExtraMapUtils    文件:MapUtils.java   
private static void boundMap(final boolean isListView, final LatLngBounds.Builder builder, final GoogleMap googleMap) {
    LatLngBounds bounds = builder.build();
    googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 50));
    float zoom = googleMap.getCameraPosition().zoom;
    if (isListView)
        googleMap.moveCamera(CameraUpdateFactory.zoomTo(zoom - 1f));
}
项目:Runnest    文件:ChallengeSenderFragment.java   
/**
 * Called when the GoogleMap is ready. Initialize a MapHandler.
 *
 * @param googleMap     The GoogleMap.
 */
@Override
public void onMapReady(GoogleMap googleMap) {
    // Argument check is delegated to superclass method
    super.onMapReady(googleMap);
    startRun();
}
项目:piast-trail    文件:PlaceDetailsActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.place_details);
    mContext = this;
    mResources = getResources();

    mMapFragment = (SupportMapFragment)
            getSupportFragmentManager().findFragmentById(R.id.place_map);

    mMapFragment.getMapAsync(new OnMapReadyCallback() {
        @Override
        public void onMapReady(GoogleMap map) {
            mMap = map;
            updateUI();
        }
    });

    mPlaceId = getIntent().getIntExtra(EXTRA_PLACE_POSITION, -1);
    final VisitableGenerator generator = VisitableGenerator.get(this);
    mPlace = generator.getPlace(mPlaceId);
    mLocation = new Location("");
    mLocation.set(mPlace.getLocation());

    mPlaceImageViewFull = (ImageView) findViewById(R.id.place_image_full);
    mPlaceCaption = (TextView) findViewById(R.id.place_caption_full);
    mWebView = (WebView) findViewById(R.id.web_view);
    mBackupEmptyView = (TextView) findViewById(R.id.place_backup_empty_view);
    mIndicator = (ProgressBar) findViewById(R.id.indicator);
    mVisitedCheckBox = (CheckBox) findViewById(R.id.visited_check_box);

    mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
    mProgressBar.setMax(100);

    mWebView.setWebChromeClient(new WebChromeClient() {

        @Override
        public void onProgressChanged(WebView webView, int newProgress) {
            if (newProgress == 100) {
                mProgressBar.setVisibility(View.GONE);
            } else {
                mProgressBar.setVisibility(View.VISIBLE);
                mProgressBar.setProgress(newProgress);
            }
        }
    });
    mWebView.setWebViewClient(new WebViewClient());
    mWebView.loadUrl(mPlace.getWikiUrl());

    Bitmap bitmap = PictureUtils.decodeBitmapFromResource(getResources(),
            mPlace.getImgResourceId(), 400, 400);

    mPlaceImageViewFull.setImageBitmap(bitmap);
    mPlaceCaption.setText(mPlace.getPlaceNameResId());
    this.getSupportActionBar().setTitle(mPlace.getPlaceNameResId());

    mVisitedCheckBox.setChecked(mPlace.isVisited());
    mVisitedCheckBox.setOnCheckedChangeListener(
            new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton view, boolean isChecked) {
            mPlace.setVisited(isChecked);
        }
    });

    mConnManager = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);

    NetworkInfo activeNetwork = mConnManager.getActiveNetworkInfo();
    boolean isConnected = activeNetwork != null && activeNetwork.isConnected();

    if (!isConnected) {
        mIndicator.setVisibility(View.INVISIBLE);
        mBackupEmptyView.setText(R.string.empty_placeholder);
    }
}
项目:hypertrack-live-android    文件:Home.java   
@Override
public void onCameraIdleCallback(HyperTrackMapFragment hyperTrackMapFragment, GoogleMap map) {
    float zoom = map.getCameraPosition().zoom;
    float roundZoom = (float) ((5 * (Math.round(zoom * 10 / 5))) / 10.0);
    if (roundZoom == (int) roundZoom) {
        circleRadius = (int) (10 * Math.pow(2, 20 - roundZoom));
    } else {
        circleRadius = (int) (10 * Math.pow(2, (20 - (int) roundZoom)));
        circleRadius -= circleRadius / 4;
    }
    if (circle != null) {
        startPulse(true);
    }
}
项目:RoadLab-Pro    文件:BaseMapFragment.java   
/**
 * The method initializes Google map.
 *
 * @param bundle @see {@link GoogleMap}
 * @return instance {@link GoogleMap}
 * @see {@link GoogleMap}
 */
public void initializeGoogleMap(final Bundle bundle) {
    mapView = (MapView) getView().findViewById(R.id.fr_road_issue_mapview);
    mapView.onCreate(bundle);
    mapView.getMapAsync(new OnMapReadyCallback() {
        @Override
        public void onMapReady(GoogleMap googleMap) {
            map = googleMap;
            initMap(googleMap);
        }
    });
}
项目:quake-alert-android-app    文件:MapsActivity.java   
public void updateUi(final ArrayList<Quake> quakeArrayList) {
    Log.i("ArrayList", String.valueOf(quakeArrayList.size()));
    for (int i = 0; i < quakeArrayList.size(); i++) {

        mGoogleMap.addMarker(new MarkerOptions()
                .position(new LatLng(quakeArrayList.get(i).getLongitude(), quakeArrayList.get(i).getLatitude()))
                .snippet(quakeArrayList.get(i).getLocation())
                .title("Magnitude - " + String.valueOf(quakeArrayList.get(i).getMagnitude()))
                .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)
                ));

        mGoogleMap.setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() {
            @Override
            public void onInfoWindowClick(Marker marker) {
                int id = getMarkerIndex(marker.getId());

                Intent intent = new Intent(MapsActivity.this, QuakeDetailsActivity.class);
                intent.putExtra("title", quakeArrayList.get(id).getTitle());
                intent.putExtra("mag", quakeArrayList.get(id).getMagnitude());
                intent.putExtra("date", quakeArrayList.get(id).getDate());
                intent.putExtra("latitude", quakeArrayList.get(id).getLatitude());
                intent.putExtra("longitude", quakeArrayList.get(id).getLongitude());
                intent.putExtra("depth", quakeArrayList.get(id).getDepth());
                intent.putExtra("felt", quakeArrayList.get(id).getFelt());
                startActivity(intent);
            }
        });
    }

}
项目:CRT    文件:Notification.java   
@Override
public void onMapReady(GoogleMap googleMap) {
    map = googleMap;

    //crt list
    crt[0] = new crtLocation(36.796043,10.176679 ,"Rue de Angleterre, Tunis");
    crt[1] = new crtLocation(36.811240,10.168087 ,"DNSP, Rue du Fort, Tunis");
    crt[2] = new crtLocation(36.768390,10.231351 ,"Centre National de Formation des volontaires");
    crt[3] = new crtLocation(36.765738,10.249805 ,"Comité Local megrine");
    crt[4] = new crtLocation(36.857147,10.188060 ,"Croissant Rouge Tunisien");
    crt[5] = new crtLocation(35.857905,10.598179 ,"comité local Hammam Sousse");
    crt[6] = new crtLocation(34.731843,10.759640,"Rue El Arbi Zarrouk, Sfax");
    crt[7] = new crtLocation(33.504106,11.088150 ,"Mouensa, Zarzis ");
    crt[8] = new crtLocation(36.441899,10.729911 ," Comité Regional De Nabeul");
    crt[9] = new crtLocation( 35.829321,10.638072 ,"Comité Local de Sousse");
    crt[10] = new crtLocation(33.137021,11.220034 ,"Comité Local Benguerdane");
    LatLngBounds.Builder builder = new LatLngBounds.Builder();
    for (int i = 0;i<11;i++) {
         marker = map.addMarker(new MarkerOptions()
                .position(new LatLng(crt[i].getX(), crt[i].getY()))
                .title("Croissant Rouge Tunisien")
                .snippet(crt[i].getAdresse()));
        builder.include(marker.getPosition());
    }




    LatLngBounds bounds = builder.build();
    int padding = 0; // offset from edges of the map in pixels
    CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, padding);
    googleMap.animateCamera(cu);
}
项目:proto-collecte    文件:MainActivity.java   
@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    if (!hasPermissions()) {
        return;
    }

    initMap();
    setUpCluster();

}
项目:MADBike    文件:AirQualityFragment.java   
@Override
public void onMapReady(GoogleMap googleMap) {
    this.map = googleMap;
    map.setInfoWindowAdapter(new PollutionAdapter(getActivity()));
    map.getUiSettings().setMapToolbarEnabled(false);
    map.getUiSettings().setZoomControlsEnabled(true);
    map.getUiSettings().setMyLocationButtonEnabled(true);
    map.moveCamera(CameraUpdateFactory.newLatLngZoom(madrid, 11.5f));
}
项目:MADBike    文件:FavoriteActivity.java   
@Override
public void onMapReady(GoogleMap googleMap) {
    this.map = googleMap;
    map.getUiSettings().setMapToolbarEnabled(false);
    map.getUiSettings().setZoomControlsEnabled(true);
    map.getUiSettings().setMyLocationButtonEnabled(true);
    map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(Double.parseDouble(station.getLatitude()), Double.parseDouble(station.getLongitude())), 15f));
    map.getUiSettings().setScrollGesturesEnabled(false);
    map.addMarker(new MarkerOptions().position(new LatLng(Double.parseDouble(station.getLatitude()), Double.parseDouble(station.getLongitude()))));
}