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

项目: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));

    }
项目: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);
}
项目:iSPY    文件: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) {
    googleMap.clear();
    GoToMap = googleMap;
    Intent i = getIntent();
    ArrayList<LatLng> list1 = i.getParcelableArrayListExtra("key1");
    ArrayList<String> list2 = i.getStringArrayListExtra("key2");
    ArrayList<String> list3 = i.getStringArrayListExtra("key3");

    LatLng latLng = new LatLng(0, 0);
    int j = list1.size();
    j=j-1;
    while (j!=-1)
    {
        if(list1.get(j)!=latLng)
        {   Log.i(list1.get(j).toString(),list1.get(j).toString());
            GoToMap.addMarker(new MarkerOptions().position(list1.get(j)).draggable(true).title(list3.get(j).replace(',','.')+" Battery Power "+list2.get(j)));
            GoToMap.moveCamera(CameraUpdateFactory.newLatLng(list1.get(j)));
        }
        j--;
    }
    // Add a marker in Sydney and move the camera
}
项目: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)));
    }
项目:LifeSaver    文件: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;


        // Add a marker in Sydney and move the camera
Log.e("zzzz"+MainActivity.mylocationa, ""+MainActivity.myLocationb);
        LatLng sydney = new LatLng(MainActivity.lat,MainActivity.longi);
        mMap.addMarker(new MarkerOptions().position(sydney).title("Marker at your location"));
        mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney,16));
        Toast.makeText(getApplicationContext(),"At the height of "+MainActivity.diffelevation+" metres",Toast.LENGTH_LONG).show();
         }
项目:android-ponewheel    文件:RideDetailActivity.java   
private void addDragListenerMarkerMaker(LineChart speedChart) {
    speedChart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() {
        @Override
        public void onValueSelected(Entry entry, Highlight h) {
            Long entryX = (long) entry.getX();
            if (timeLocationMap.containsKey(entryX)) {
                clearAllMarkersFromMap();
                LatLng latLng = timeLocationMap.get(entryX);
                mapMarkers.add(googleMap.addMarker(new MarkerOptions().position(latLng)));
            }
        }

        @Override
        public void onNothingSelected() {
            clearAllMarkersFromMap();
        }
    });
}
项目:Crimson    文件:SearchClinics.java   
@Override
public void onLocationChanged(Location location) {

    currentLatitude = location.getLatitude();
    currentLongitude = location.getLongitude();

    //Toast.makeText(this, currentLatitude + " WORKS " + currentLongitude + "", Toast.LENGTH_LONG).show();

    LatLng latLng = new LatLng(currentLatitude, currentLongitude);
    googleMap.addMarker(new MarkerOptions().position(latLng));
    googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 15));
    googleMap.animateCamera(CameraUpdateFactory.zoomIn());
    googleMap.animateCamera(CameraUpdateFactory.zoomTo(15), 2000, null);

    getNearByClinics(currentLongitude, currentLatitude);

}
项目: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);
    }
项目: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));
}
项目: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);
        }
    }
项目: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));

}
项目: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);
        }
    });
}
项目:bikedeboa-android    文件:MapActivity.java   
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    if (requestCode == PLACE_AUTOCOMPLETE_REQUEST_CODE) {
        if (resultCode == RESULT_OK) {
            // Move camera to that place and add normal marker
            Place place = PlaceAutocomplete.getPlace(this, data);
            this.googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(place.getLatLng(), 17), 1000, null);
            this.googleMap.addMarker(new MarkerOptions().position(place.getLatLng()));
            // Set text on "edit text"
            binding.placeSearch.setText(place.getName());
        } else if (resultCode == PlaceAutocomplete.RESULT_ERROR) {
            Status status = PlaceAutocomplete.getStatus(this, data);
            Log.w(TAG, status.getStatusMessage());
        } else if (resultCode == RESULT_CANCELED) {
            // The user canceled the operation -- clear text
            binding.placeSearch.setText("");
        }
    }
}
项目: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));
}
项目:SpaceRace    文件:PathDrawer.java   
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);
    }
项目: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());

    }

}
项目:mobile-app-dev-book    文件:TripMapFragment.java   
private void refreshMarkers() {
//        if (allMarkers.size() == allTrips.size()) return;
        LatLngBounds.Builder boundBuilder = new LatLngBounds.Builder();
        allMarkers.clear();
        gMap.clear();
        for (Trip t : allTrips) {
            DateTime begDate = DateTime.parse(t.getStartDate());
            DateTime endDate = DateTime.parse(t.getEndDate());
            LatLng thisLoc = new LatLng(t.getLat(), t.getLng());
            Marker m = gMap.addMarker(
                    new MarkerOptions().position(thisLoc).title(t.getName())
                            .snippet(formatDate(begDate, endDate)));
            m.setTag(t);
            allMarkers.add(m);
            boundBuilder.include(thisLoc);
        }
        if (allMarkers.size() > 0) {
            int screenWidth = getResources().getDisplayMetrics().widthPixels;
            int screenHeight = getResources().getDisplayMetrics().heightPixels;
            LatLngBounds bound = boundBuilder.build();
            CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngBounds(bound,
                    screenWidth, screenHeight, 56);
            gMap.animateCamera(cameraUpdate);
        }
    }
项目:AppGoogleMaps    文件:MainActivity.java   
public void onMapActions() {
    googleMap.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() {
        @Override
        public void onMapLongClick(LatLng latLng) {
            if (markers.isEmpty()) {
                markers.add(googleMap.addMarker(new MarkerOptions().position(latLng).title("Origin")));
            } else if (markers.size() == 1) {
                markers.add(googleMap.addMarker(new MarkerOptions().position(latLng).title("Destination")));
                sendRequest(markers.get(0).getPosition(), markers.get(1).getPosition());
            } else {
                markers.get(1).setTitle("Origin");
                markers.get(0).remove(); //Remove marker from the map
                markers.remove(0); //Remove marker from the list
                markers.add(googleMap.addMarker(new MarkerOptions().position(latLng).title("Destination")));
                sendRequest(markers.get(0).getPosition(), markers.get(1).getPosition());
            }
        }
    });
}
项目:BonAppetit_Android-Project    文件:MapsActivity.java   
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
    final String placeId=dataSnapshot.getKey();
    if(placeId!=null)
    {
        Places.GeoDataApi
                .getPlaceById(mGoogleApiClient,placeId)
                .setResultCallback(new ResultCallback<PlaceBuffer>() {
                    @Override
                    public void onResult(@NonNull PlaceBuffer places) {
                        LatLng location=places.get(0).getLatLng();
                        //CharSequence userName=places.get(1).getName();

                        //Toast.makeText(getApplicationContext(),"reached onChildAdded",Toast.LENGTH_SHORT).show();
                        addPointToView(location);
                        mMap.addMarker(new MarkerOptions()
                                .position(location));
                        //Toast.makeText(getApplicationContext(),"place added",Toast.LENGTH_SHORT).show();
                        places.release();
                    }
                });
    }

}
项目:GoogleMapsLayout-Android    文件:MapLayout.java   
private void initLocationAccuracyMarker(LatLng coordinates, int accuracy) {
    if(accuracy>0) {
        MarkerOptions locationAccuracyMarkerOptions = getLocationAccuracyMarkerOptionsStrategy().getNormalMarkerOptions();
        locationAccuracyMarkerOptions
                .position(coordinates)
                .anchor(locationAccuracyMarkerOptionsStrategy.getNormalMarkerOptions().getAnchorU(),locationAccuracyMarkerOptionsStrategy.getNormalMarkerOptions().getAnchorV())
                .title(TITLE_LOCATION_MARKER)
                .flat(true);
        if(mLocationAccuracyMarker==null)
            mLocationAccuracyMarker = addMarkerToGoogleMap(locationAccuracyMarkerOptions);
        else {
            mLocationAccuracyMarker.setIcon(getLocationAccuracyMarkerOptionsStrategy().getNormalMarkerOptions().getIcon());
        }

    } else
        mLocationAccuracyMarker = null;
}
项目:hyperrail-for-android    文件:StationActivity.java   
@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;

    // Add a marker in Sydney, Australia, and move the camera.
    LatLng stationLocation = new LatLng(mStation.getLatitude(), mStation.getLongitude());
    mMap.addMarker(new MarkerOptions().position(stationLocation).title(mStation.getLocalizedName()));
    mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(stationLocation, 15));
    mMap.setBuildingsEnabled(true);
    mMap.setTrafficEnabled(false);
    mMap.setMinZoomPreference(10);
    mMap.setMaxZoomPreference(18);
    mMap.setLatLngBoundsForCameraTarget(new LatLngBounds(stationLocation,stationLocation));
    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) {
        mMap.setMyLocationEnabled(true);
    }
}
项目: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);
}
项目: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
                }
            });
}
项目:FordOpenXCHackathon    文件:MainActivity.java   
@Override
public void onMapReady(GoogleMap googleMap) {
    if (map != null) {
        map.clear();
    }

    if (latitude > 0 && longitude > 0) {

        map = googleMap;
        LatLng area = new LatLng(latitude, longitude);

        map.addMarker(new MarkerOptions().position(area)
                .title("Araç Konumu"));
        map.setMaxZoomPreference(15f);
        map.moveCamera(CameraUpdateFactory.newLatLng(area));
        map.moveCamera(CameraUpdateFactory.zoomBy(1));
    }

}
项目: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"));
    }

}
项目:AstronomyTourPadova    文件:AtMarker.java   
private Marker drawOnMap(Integer pointId){
        //Bitmap btmp = BitmapFactory.decodeResource(activityContext.getResources(), icons.get(getPos()));
        // Bitmap resizedBitmap = getMarker(pointId, activityContext);

        Marker marker = map.addMarker(new MarkerOptions()
                //.title(getPos() + " | " + getName())
                .title(getName())
                .snippet(getTitle())
                .position(coordinates)
                .anchor((float)0.5, (float)0.5)
                .infoWindowAnchor((float)0.5, (float)0.2)
                //.icon(BitmapDescriptorFactory.fromBitmap(btmp)));
//                .icon(BitmapDescriptorFactory.fromBitmap(resizedBitmap)));
                .icon(bitmapDescriptorFromVector(activityContext, getMarker(pointId, activityContext))));
        // Storing the Point ID
        marker.setTag(getIdPoint().toString());

        return marker;
    }
项目:projectindoorapp    文件:MapActivity.java   
public void addPositionToTrack(Position position) {
    LatLng location = new LatLng(position.getLatitude(), position.getLongitude());
    if (currentPosition != null) {
        currentPosition.remove();
    }
    currentPosition = mMap.addMarker(new MarkerOptions()
            .position(location)
            .icon(BitmapDescriptorFactory.fromResource(R.drawable.walking)));
    List<LatLng> points = this.userTrack.getPoints();
    points.add(location);
    this.userTrack.setPoints(points);
}
项目:TFG-SmartU-La-red-social    文件:FragmentMapaProyecto.java   
@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));

}
项目:GoogleMapsLayout-Android    文件:MapLayout.java   
/**
 * 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;
    }
}
项目: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()))));
}
项目:NavAR    文件:MapsActivity.java   
@Override
public void onMapLongClick(LatLng latLng) {

    mMap.clear();

    RevMarker=mMap.addMarker(new MarkerOptions().position(latLng));
    Toast.makeText(this, latLng.latitude+" "+latLng.longitude, Toast.LENGTH_SHORT).show();
    Rev_Geocode_Call(latLng);
}
项目:Android-Wear-Projects    文件:MapsActivity.java   
private void addMarker(Memory memory) {
    Marker marker = mMap.addMarker(new MarkerOptions()
            .draggable(true)
            .position(new LatLng(memory.latitude, memory.longitude)));

    mMemories.put(marker.getId(), memory);
}
项目:apps_small    文件: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;

    // 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));
}
项目:Expert-Android-Programming    文件:BrowseNearbyActivity.java   
@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;

    // Add a marker in Sydney, Australia, 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));
}
项目: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));

}
项目: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));
    }
项目:custode    文件:SummaryActivity.java   
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    ArrayList<MarkerOptions> savedMarkers = savedInstanceState.getParcelableArrayList("markers");
    if (savedMarkers != null)
        for (MarkerOptions marker : savedMarkers)
            addMarker(marker);
}
项目:PeSanKita-android    文件:SignalMapView.java   
public ListenableFuture<Bitmap> display(final SignalPlace place) {
  final SettableFuture<Bitmap> future = new SettableFuture<>();

  this.mapView.onCreate(null);
  this.mapView.onResume();

  this.mapView.setVisibility(View.VISIBLE);
  this.imageView.setVisibility(View.GONE);

  this.mapView.getMapAsync(new OnMapReadyCallback() {
    @Override
    public void onMapReady(final GoogleMap googleMap) {
      googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(place.getLatLong(), 13));
      googleMap.addMarker(new MarkerOptions().position(place.getLatLong()));
      googleMap.setBuildingsEnabled(true);
      googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
      googleMap.getUiSettings().setAllGesturesEnabled(false);
      googleMap.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {
        @Override
        public void onMapLoaded() {
          googleMap.snapshot(new GoogleMap.SnapshotReadyCallback() {
            @Override
            public void onSnapshotReady(Bitmap bitmap) {
              future.set(bitmap);
              imageView.setImageBitmap(bitmap);
              imageView.setVisibility(View.VISIBLE);
              mapView.setVisibility(View.GONE);
              mapView.onPause();
              mapView.onDestroy();
            }
          });
        }
      });
    }
  });

  this.textView.setText(place.getDescription());

  return future;
}
项目:Bartout    文件:SearchActivity.java   
private void searchPlaces(Location loc) {
    AsyncTask<Location, Void, Void> types = new AsyncTask<Location, Void, Void>() {
        private List<Place> places = new ArrayList<Place>();

        @Override
        protected Void doInBackground(Location... params) {
            try {
                GooglePlaces client = new GooglePlaces(getString(R.string.google_places_api_key));
                Location myPosition = params[0];
                places = client.getNearbyPlacesRankedByDistance(myPosition.getLatitude(), myPosition.getLongitude(), Param.name("types").value(SearchActivity.this.filter));
            } catch (Exception ex) {
                Logger.getAnonymousLogger().log(new LogRecord(Level.ALL, "No Internet"));
            }
            return null;
        }

        protected void onPostExecute(Void result) {
            for (Place place : places) {
                if (!SearchActivity.this.places.containsValue(place)) {
                    MarkerOptions markerOptions = new MarkerOptions();
                    markerOptions.title(place.getName().toString())
                            .position(new LatLng(place.getLatitude(), place.getLongitude()));
                    if(place.getTypes().contains(getString(R.string.search_filter_atm_name)) || place.getTypes().contains(getString(R.string.search_filter_bank_name))) {
                        markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_money_pin));
                    }else {
                        markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_action_beer_pin));
                    }
                    SearchActivity.this.places.put(markerOptions.getPosition(), place);
                    map.addMarker(markerOptions);
                }
            }
        }
    }.execute(loc);

}