Java 类com.google.android.gms.maps.model.Marker 实例源码
项目: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));
});
}
项目:MADBike
文件:BubbleAdapter.java
@Override
public View getInfoContents(Marker marker) {
Gson gson = new Gson();
Station station = gson.fromJson(marker.getTitle(), Station.class);
titleTextView = (TextView) customView.findViewById(R.id.nameTextView);
addressTextView = (TextView) customView.findViewById(R.id.streetTextView);
totalTextView = (TextView) customView.findViewById(R.id.totalTextView);
freeTextView = (TextView) customView.findViewById(R.id.freeTextView);
engagedTextView = (TextView) customView.findViewById(R.id.engagedTextView);
if (station != null) {
titleTextView.setText(station.getNumberStation() + " " + station.getNombre());
addressTextView.setText(station.getAddress());
totalTextView.setText(activity.getString(R.string.bases) + "\n" + Integer.parseInt(station.getNumberBases()));
freeTextView.setText(activity.getString(R.string.bases_free) + "\n" + Integer.parseInt(station.getBasesFree()));
engagedTextView.setText(activity.getString(R.string.bases_engaged) + "\n" + Integer.parseInt(station.getBikeEngaged()));
return customView;
} else {
return null;
}
}
项目:civify-app
文件:CivifyMapTest.java
@Test
public void testIssueMarkerAdded() throws MapNotLoadedException {
Issue issueMock = getIssueMock();
Marker markerMock = getMarkerMock();
assertThat(mMap.isMapLoaded(), is(false));
assertThat(mMap.getMarkers(), is(nullValue()));
try {
mMap.addIssueMarker(issueMock);
fail("Trying to addItem issue when map is not present!");
} catch (MapNotLoadedException ignore) {}
mMap.onMapReady(mGoogleMap);
when(mMap.isMapReady()).thenReturn(true);
mMap.addIssueMarker(issueMock);
assertThat(mMap.isMapLoaded(), is(true));
assertThat(mMap.getMarkers(), is(not(nullValue())));
IssueMarker marker = mMap.getMarkers().get(ISSUE_MOCK_ID.toUpperCase());
marker.render(markerMock, mock(ClusterManager.class));
assertThat(marker, is(instanceOf(IssueMarker.class)));
assertThat(marker.getIssue(), is(sameInstance(issueMock)));
assertThat(marker.getPosition(), is(markerMock.getPosition()));
assertThat(marker.isRendered(), is(true));
assertThat(markerMock.isVisible(), is(true));
}
项目: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());
}
项目:VennTracker
文件:SpawnLocation.java
public static void removeSpawnPoint(final Context context, final Marker marker) {
//Put up the Yes/No message box
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder
.setTitle("Remove Pokemon spawn marker?")
.setMessage("Are you sure?")
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//Yes button clicked, do something
marker.remove();
mSpawnPoints.remove(marker);
removeSpawnPointFromDb(context, marker);
}
})
.setNegativeButton("No", null) //Do nothing on no
.show();
}
项目:MapaDeIgarassu
文件:GoogleInfoWindowAdapter.java
/**
* Método de Pop-up de cada marker
* @param marker
* @return markerView
*/
@Override
public View getInfoContents(Marker marker) {
TextView tvLocality = (TextView) this.markerView.findViewById(R.id.tv_locality);
TextView tvLat = (TextView) this.markerView.findViewById(R.id.tv_lat);
TextView tvLng = (TextView) this.markerView.findViewById(R.id.tv_lng);
TextView tvSnippet = (TextView) this.markerView.findViewById(R.id.tv_snippet);
LatLng location = marker.getPosition();
tvLocality.setText(marker.getTitle());
tvLat.setText("Latitude: " + location.latitude);
tvLng.setText("Longitude: " + location.longitude);
tvSnippet.setText(marker.getTitle());
return this.markerView;
}
项目:google-maps-clustering
文件:ClusterRenderer.java
@Override
public boolean onMarkerClick(Marker marker) {
Object markerTag = marker.getTag();
if (markerTag instanceof Cluster) {
//noinspection unchecked
Cluster<T> cluster = (Cluster<T>) marker.getTag();
//noinspection ConstantConditions
List<T> clusterItems = cluster.getItems();
if (mCallbacks != null) {
if (clusterItems.size() > 1) {
return mCallbacks.onClusterClick(cluster);
} else {
return mCallbacks.onClusterItemClick(clusterItems.get(0));
}
}
}
return false;
}
项目: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);
}
项目:Android-Wear-Projects
文件:MapsActivity.java
@Override
public void onInfoWindowClick(final Marker marker) {
final Memory memory = mMemories.get(marker.getId());
String[] actions = {"Delete"};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(memory.city+", "+memory.country)
.setItems(actions, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == 0){
marker.remove();
mDataSource.deleteMemory(memory);
}
}
});
builder.create().show();
}
项目:open-rmbt
文件:RMBTMapFragment.java
@Override
public View getInfoContents(Marker marker)
{
if (balloon == null)
return null;
if (balloonMarker == null || ! balloonMarker.equals(marker))
return null;
// final FrameLayout view = new FrameLayout(getActivity());
final RMBTBalloonOverlayView bv = new RMBTBalloonOverlayView(getActivity());
final View view = bv.setupView(getActivity(), null);
bv.setBalloonData(balloon, null);
// view.addView(bv);
return view;
}
项目:GoogleMapsLayout-Android
文件:MapLayout.java
/**
* Removes the given marker from the map layout
*
* @param marker marker to remove
* @return true if marker has been removed, false if it has not been found
*/
public boolean removeMarker(Marker marker) {
synchronized (customMarkersMap) {
if (customMarkersMap.containsValue(marker)){
Iterator<com.ubudu.gmaps.model.Marker> iterator = customMarkersMap.keySet().iterator();
while(iterator.hasNext()) {
com.ubudu.gmaps.model.Marker m = iterator.next();
Marker googleMarker = customMarkersMap.get(m);
if(googleMarker.equals(marker)) {
googleMarker.remove();
iterator.remove();
return true;
}
}
}
}
return false;
}
项目:GoogleMapsLayout-Android
文件:MapLayout.java
/**
*
* @param tags tags to look for
* @return markers matching the given tag
*/
private Map<com.ubudu.gmaps.model.Marker, Marker> getMarkersWithTags(List<String> tags){
Map<com.ubudu.gmaps.model.Marker, Marker> result = new HashMap<>();
synchronized (customMarkersMap) {
for (com.ubudu.gmaps.model.Marker marker : customMarkersMap.keySet()) {
boolean markerMatchesTags = true;
for (String tag : tags) {
if (!marker.getTags().contains(tag)) {
markerMatchesTags = false;
break;
}
}
if (markerMatchesTags)
result.put(marker, customMarkersMap.get(marker));
}
}
return result;
}
项目:iosched-reader
文件:MapFragment.java
/**
* Change the visibility of all Markers and TileOverlays for a floor.
*/
private void setFloorElementsVisible(int floor, boolean visible) {
// Overlays
final TileOverlay overlay = mTileOverlays.get(floor);
if (overlay != null) {
overlay.setVisible(visible);
}
// Markers
final ArrayList<Marker> markers = mMarkersFloor.get(floor);
if (markers != null) {
for (Marker m : markers) {
m.setVisible(visible);
}
}
}
项目:share-location
文件:MapFragment.java
private Marker setMarker(User userData, LatLng currentUserLocation) {
Marker marker;
if (userData.getMapPhoto() != null) { // Set photo as icon if it's present
Bitmap bitmap = PhotoFixer.makeCircle(userData.getMapPhoto());
marker = googleMap.addMarker(new MarkerOptions()
.position(currentUserLocation)
.anchor(0.5f, 0.5f)
.icon(BitmapDescriptorFactory.fromBitmap(bitmap)));
} else { // Set default photo if it's not present
marker = googleMap.addMarker(new MarkerOptions().position(currentUserLocation)
.anchor(0.5f, 0.5f)
.icon(BitmapDescriptorFactory.fromBitmap(Bitmap.createScaledBitmap(
BitmapFactory.decodeResource(getContext().getResources(),
R.mipmap.anonymous_user), 100, 100, false))));
}
return marker;
}
项目:MapaDeIgarassuAdmin
文件:HomeActivity.java
@Override
public void onMapReady(GoogleMap googleMap) {
GoogleMapsModel.setMap(googleMap);
/*Verificação de tipos de mapa*/
if (Constants.MAP_TYPE_HYBRID == SharedPreferencesUtil.getTypeMaps(this)) {
GoogleMapsModel.getMap().setMapType(Constants.MAP_TYPE_HYBRID);
} else {
GoogleMapsModel.getMap().setMapType(Constants.MAP_TYPE_NORMAL);
}
invokeAddMarkerMapOther.onAddMarkerFirebase(); //adicionando os marcados diretamente do firebase
GoogleMapsModel.getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(Constants.CENTER_LOCATION, 16)); /*Centro do mapa*/
/*Botões de Zoom*/
GoogleMapsModel.getMap().getUiSettings().setZoomControlsEnabled(true);
infoWindow();
/*Listener de cada marker*/
GoogleMapsModel.getMap().setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() {
@Override
public void onInfoWindowClick(Marker marker) {
DataBaseUtil dataBaseUtil = new DataBaseUtil(context); /*Instância da base de dados local*/
String name = marker.getTitle();
LocationModel locationModel = dataBaseUtil.getLocation(name);
if (name.equals(locationModel.getName())) {
AlertDialogMessage alertDialogMessage = new AlertDialogMessage();
alertDialogMessage.alertDialogMarker(context, locationModel.getId(),
locationModel.getName(), locationModel.getAddress(),
locationModel.getDescription(), locationModel.getLatitude(), locationModel.getLongitude());
}
}
});
}
项目: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);
}
});
}
}
项目:Hyke
文件:NearMeFragment.java
public void animateFriendMarker(String uid, GeoLocation location){
final double lat = location.latitude;
final double lng = location.longitude;
final Handler handler = new Handler();
final long start = SystemClock.uptimeMillis();
final long DURATION_MS = 3000;
final Interpolator interpolator = new AccelerateDecelerateInterpolator();
final Marker marker = markerUserIdHashMap.get(uid);
final LatLng startPosition = marker.getPosition();
handler.post(new Runnable() {
@Override
public void run() {
float elapsed = SystemClock.uptimeMillis() - start;
float t = elapsed/DURATION_MS;
float v = interpolator.getInterpolation(t);
double currentLat = (lat - startPosition.latitude) * v + startPosition.latitude;
double currentLng = (lng - startPosition.longitude) * v + startPosition.longitude;
marker.setPosition(new LatLng(currentLat, currentLng));
// if animation is not finished yet, repeat
if (t < 1) {
handler.postDelayed(this, 16);
}
}
});
}
项目:IelloAndroidApp
文件:MappaMain.java
/**
* distingue i marker riferiti ai parcheggi dal marker riferito alla posizione dell'utente.
*/
private boolean isParcheggio(Marker markerDaTestare) {
for(Marker markerDaLista : mListMarker) {
if (markerDaTestare.equals(markerDaLista))
return true;
}
return false;
}
项目:Addy-Android
文件:MapsActivity.java
private void createMarker(String acode, LatLng location, double latitude, double longitude) {
Marker mMarker = null;
if (acode!= null) {
mMap.setOnMarkerClickListener(this);
mMap.addMarker(new MarkerOptions().position(new LatLng(latitude,longitude)).anchor(0.5f, 0.5f).title(acode));
//mMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.pegman));
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(new LatLng(latitude,longitude), 10);
mMap.animateCamera(cameraUpdate);
}
}
项目:Companion-For-PUBG-Android
文件:BoatAction.java
@Override
protected void onToggleAction() {
if (shouldShow()) {
for (final LatLng latLng : this.boatSpawns) {
final MarkerOptions markerOptions = createMarkerOptions();
markerOptions.position(latLng);
this.boatMarkers.add(this.mapController.addMarker(markerOptions));
}
} else {
for (final Marker marker : this.boatMarkers) {
marker.remove();
}
this.boatMarkers.clear();
}
}
项目:Companion-For-PUBG-Android
文件:VehicleAction.java
@Override
protected void onToggleAction() {
if (shouldShow()) {
for (final LatLng latLng : this.vehicleSpawns) {
final MarkerOptions markerOptions = createMarkerOptions();
markerOptions.position(latLng);
this.vehicleMarkers.add(this.mapController.addMarker(markerOptions));
}
} else {
for (final Marker marker : this.vehicleMarkers) {
marker.remove();
}
this.vehicleMarkers.clear();
}
}
项目:proto-collecte
文件:MainActivity.java
private void drawMesures(List<MesureContract.Mesure> mesures) {
for (MesureContract.Mesure mesure : mesures) {
Marker marker = mMap.addMarker(new MarkerOptions()
.icon(Colors.bitmapForDbm(mesure.getTmDbm(), mesure.getGpsSnr()))
.anchor(0.5f, 0.5f)
.title(
"TM : " + (mesure.getTmDbm() == null ? "-" : mesure.getTmDbm()) + " dBm ; " +
"GPS : " + (mesure.getGpsSnr() == null ? "-" : mesure.getGpsSnr())
)
.position(buildLatLng(mesure.getLatitude(), mesure.getLongitude())));
mMarkers.add(marker);
}
}
项目:FireHelper
文件:MapsActivityCurrentPlace.java
/**
* Manipulates the map when it's available.
* This callback is triggered when the map is ready to be used.
*/
@Override
public void onMapReady(GoogleMap map) {
mMap = map;
// Use a custom info window adapter to handle multiple lines of text in the
// info window contents.
mMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {
@Override
// Return null here, so that getInfoContents() is called next.
public View getInfoWindow(Marker arg0) {
return null;
}
@Override
public View getInfoContents(Marker marker) {
// Inflate the layouts for the info window, title and snippet.
View infoWindow = getLayoutInflater().inflate(R.layout.custom_info_contents,
(FrameLayout)findViewById(R.id.map), false);
TextView title = ((TextView) infoWindow.findViewById(R.id.title));
title.setText(marker.getTitle());
TextView snippet = ((TextView) infoWindow.findViewById(R.id.snippet));
snippet.setText(marker.getSnippet());
return infoWindow;
}
});
// Turn on the My Location layer and the related control on the map.
updateLocationUI();
// Get the current location of the device and set the position of the map.
getDeviceLocation();
}
项目:Geoclick
文件:MapViewFragment.java
/** Called when the user clicks a marker. */
@Override
public boolean onMarkerClick(final Marker marker) {
// Retrieve the data from the marker.
// Return false to indicate that we have not consumed the event and that we wish
// for the default behavior to occur (which is for the camera to move such that the
// marker is centered and for the marker's info window to open, if it has one).
return false;
}
项目:AstronomyTourPadova
文件:GmapFragment.java
@Override
public void onInfoWindowClick(Marker marker) {
Log.d(TAG, "onInfoWindowClick()");
String pointId = (String) marker.getTag();
if(pointId != null) {
Intent intent = new Intent(getActivity(), ShowPointActivity.class);
Bundle dataBundle = new Bundle();
dataBundle.putString("POINT_ID", pointId);
intent.putExtras(dataBundle);
startActivity(intent);
}
}
项目:Farmacias
文件:MapTabPresenter.java
private void removeMarkerFromMap(PharmacyObjectMap pharmacy) {
Marker marker = getKeyFromValue(pharmacy);
if (marker != null) {
marker.remove();
}
}
项目:Farmacias
文件:MapTabPresenter.java
public void zoomAnimateLevelToFitMarkers(int padding) {
LatLngBounds.Builder b = new LatLngBounds.Builder();
Iterator<Map.Entry> iter = mMarkersHashMap.entrySet().iterator();
int markerCounter = 0;
while (iter.hasNext()) {
markerCounter++;
Map.Entry mEntry = (Map.Entry) iter.next();
Marker key = (Marker) mEntry.getKey();
PharmacyObjectMap c = (PharmacyObjectMap) mMarkersHashMap.get(key);
LatLng ll = new LatLng(c.getLat(), c.getLon());
b.include(ll);
}
LatLngBounds bounds = b.build();
mCameraUpdate = new CustomCameraUpdate();
if (markerCounter == 1) {
// mCameraUpdate.setmCameraUpdate(CameraUpdateFactory.newLatLng(new LatLng(mLocation.getLatitude(),
// mLocation.getLongitude())));
mCameraUpdate.setmCameraUpdate(CameraUpdateFactory.newLatLngBounds(bounds, padding));
mCameraUpdate.setNoResultsPosition(true);
// mCameraUpdate = CameraUpdateFactory.newLatLngBounds(bounds, 600,600,25);
// mCameraUpdate = CameraUpdateFactory.newLatLngZoom(new LatLng(mLocation.getLatitude(),
// mLocation.getLongitude()),15);
} else {
mCameraUpdate.setmCameraUpdate(CameraUpdateFactory.newLatLngBounds(bounds, padding));
mCameraUpdate.setNoResultsPosition(false);
}
}
项目:VennTracker
文件:Circles.java
public static void clearPolygons(Context context) {
// Remove all polygons from map
for (Polygon polygon : mPolygonsToClear) {
polygon.remove();
}
for (Circle circle : mPolygonsRedToClear) {
circle.remove();
}
for (Marker marker : mIntersectingToClear) {
marker.remove();
}
mIntersecting.clear();
mIntersectingToClear.clear();
mPolygonsRedToClear.clear();
mPolygonsRed.clear();
// Clear ArrayList holding polygons
mPolygonsToClear.clear();
// Clear ArrayList holding polygon point LatLng objects
mPolygonPointsGreen.clear();
DatabaseHelper myDb = DatabaseHelper.getInstance(context);
// Clear ArrayList containing hole LatLng objects
mHoles.clear();
// Reset transparency on all markers
SpawnLocation.markerResetTransparency();
// Remove from database
myDb.removeAllHoles();
myDb.removePolygons();
myDb.removeCircles();
myDb.removeIntersections();
myDb.close();
}
项目:GoogleMapsLayout-Android
文件:MapLayout.java
/**
* Note: To remove all markers put empty 'new MarkerSearchPattern()' as argument.
*
* @param searchPattern pattern
* @return number of removed markers that were found according to the given search pattern
*/
public int removeMarkers(MarkerSearchPattern searchPattern) {
if (searchPattern.getTags().size() == 0 && searchPattern.getTitle().equals(""))
return removeAllMarkers();
int removedCount = 0;
synchronized (customMarkersMap) {
for (com.ubudu.gmaps.model.Marker marker : customMarkersMap.keySet()) {
boolean matchingTags = true;
if (searchPattern.getTags().size() > 0) {
for (String tag : searchPattern.getTags()) {
if (!marker.getTags().contains(tag)) {
matchingTags = false;
break;
}
}
}
boolean matchingTitle = true;
if (!searchPattern.getTitle().equals("")) {
if (!marker.getTitle().startsWith(searchPattern.getTitle()))
matchingTitle = false;
}
if (matchingTitle && matchingTags) {
customMarkersMap.get(marker).remove();
customMarkersMap.remove(marker);
removedCount++;
}
}
}
return removedCount;
}
项目:VennTracker
文件:SpawnLocation.java
public static void markerResetTransparency() {
for (Marker marker : mSpawnPoints) {
marker.setAlpha(1.0f);
}
mSpawnPointsInCircle.clear();
mSpawnPointsNotInCircle.clear();
}
项目:geopackage-android-map
文件:PolylineMarkers.java
/**
* {@inheritDoc}
*/
@Override
public void delete(Marker marker) {
if (markers.remove(marker)) {
marker.remove();
update();
}
}
项目:IelloAndroidApp
文件:MappaMain.java
/**
* Evidenzia nella mappa un marker, e centra la mappa su di esso.
*/
private void muoviEseleziona(Marker marker) {
muoviCamera(marker.getPosition());
// deseleziona quello precedente
deselezionaMarker();
// seleziona l'attuale
mMarkerSelezionato = marker;
mMarkerSelezionato.setIcon(BitmapDescriptorFactory.defaultMarker(60));
}
项目:bikedeboa-android
文件:MapActivity.java
@Override
public boolean onMarkerClick(Marker marker) {
// TODO markers' hitboxes are not working properly, they are too big
// If user has added a marker through place search, it's tag should be null
if (marker.getTag() != null) {
int rackId = (int) marker.getTag();
launchDetailActivity(rackId);
}
// Return false if we want the camera to move to the marker and an info window to appear
return true;
}
项目:SpaceRace
文件:MapActivity.java
@NonNull
private Marker placeMarker(@NonNull BitmapDescriptor draw, @NonNull Location pos) {
return placeMarker(draw, new LatLng(
pos.getLatitude(),
pos.getLongitude()
));
}
项目:bikedeboa-android
文件:MapViewModel.java
private void updatePinIcons(boolean mini) {
for (Marker marker : markerList) {
// Z index is the review average value
marker.setIcon(AssetHelper.getCustomPin(marker.getZIndex(), mini));
}
}
项目:geopackage-android-map
文件:GoogleMapShape.java
/**
* Expand the bounding box by the markers
*
* @param boundingBox
* @param markers
*/
private void expandBoundingBoxMarkers(BoundingBox boundingBox,
List<Marker> markers) {
for (Marker marker : markers) {
expandBoundingBox(boundingBox, marker.getPosition());
}
}
项目:proto-collecte
文件:MainActivity.java
public Marker getMyCell() {
if(line != null)
{
line.remove();
line = null;
}
Marker marker = null;
java.util.Collection<Marker> userCollection = mClusterManager.getMarkerCollection().getMarkers();
ArrayList<Marker> userList = new ArrayList<Marker>(userCollection);
if(userList.size() == 0) return null;
double res = 100000000;
for(Marker obj : userList)
{
// Log.e("Check best membre: ", obj.getTitle());
double distance = calculateDistanceInKilometer(obj.getPosition().latitude, obj.getPosition().longitude,currentLocation.latitude, currentLocation.longitude);
Log.e("Best_ distance: ", String.valueOf(distance));
if(distance < res)
{
//Log.e("Check Best: ", obj.getTitle());
res = distance;
marker = obj;
}
}
if(marker != null && line == null) {
/* line = mMap.addPolyline(new PolylineOptions()
.add(marker.getPosition(), currentLocation)
.width(10)
.color(Color.GREEN)); */
}
// Log.d("Best marker: ", marker.getTitle());
return marker;
}
项目:Geoclick
文件:MapViewFragment.java
public void onMapReady(final GoogleMap googleMap) {
for(int i=0;i<PicList.size();i++)
{
LatLng place = new LatLng(Double.valueOf(PicList.get(i).get_latitude()),Double.valueOf(PicList.get(i).get_longitude()));
//make small size icon
Bitmap smallMarker = Bitmap.createScaledBitmap(imgeHelper.getBitmapFromByteArray(PicList.get(i).get_thumbnail()), 70, 70, false);
googleMap.addMarker(new MarkerOptions().position(place)
.title(PicList.get(i).get_city())).setIcon(BitmapDescriptorFactory.fromBitmap(smallMarker));
googleMap.moveCamera(CameraUpdateFactory.newLatLng(place));
// Set a listener for marker click.
googleMap.setOnMarkerClickListener(this);
//this listener is listening the events that you click on the title of the map marker
googleMap.setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() {
@Override
public void onInfoWindowClick(Marker marker) {
DBHelper dbHelper = new DBHelper(getContext(), "Picture.db", null, 1);
picCities = dbHelper.selectPicFromCity(marker.getTitle());
//send data to citygallery activity
Intent intent = new Intent(getContext(), CItyGalleryActivity.class);
intent.putExtra("cityChoise",picCities.get(0).get_city().toString());
startActivity(intent);
dbHelper.close();
}
});
}
}
项目: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;
}
项目:open-rmbt
文件:RMBTMapFragment.java
@Override
public boolean onMarkerClick(Marker marker)
{
if (myLocationMarker != null && marker.equals(myLocationMarker))
{
// redirect to map click
onMapClick(marker.getPosition());
return true;
}
return false;
}