Java Code Examples for com.google.android.gms.maps.model.Marker#remove()

The following examples show how to use com.google.android.gms.maps.model.Marker#remove() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void clearAllSmallMarker() {
    for (Marker marker : this.arrowMarkerList) {
        marker.remove();
    }
    this.arrowMarkerList.clear();
    int i = 0;
    for (Marker marker2 : this.mMarkerList) {
        MapPointLatLng p = (MapPointLatLng) marker2.getTag();
        p.isSelect = false;
        if (this.mSelectMarker != null && ((MapPointLatLng) this.mSelectMarker.getTag()) == p) {
            p.isSelect = true;
        }
        changeViewBySetPoints(marker2, p, false, false);
        i++;
    }
}
 
Example 2
Source File: MyHistoricalLocationMarkerCollection.java    From mage-android with Apache License 2.0 5 votes vote down vote up
@Override
public void clear() {
	for (Marker marker : locationIdToMarker.values()) {
		marker.remove();
	}

	locationQueue.clear();
	locationIdToMarker.clear();
	markerIdToLocation.clear();
}
 
Example 3
Source File: MyHistoricalLocationMarkerCollection.java    From mage-android with Apache License 2.0 5 votes vote down vote up
@Override
public void add(MarkerOptions options, Pair<Location, User> pair) {
	Location location = pair.first;
	final Geometry gometry = location.getGeometry();

	if (gometry != null) {
		options.visible(visible);
		Marker marker = map.addMarker(options);
		markerIdToLocation.put(marker.getId(), pair);
		Marker oldMarker = locationIdToMarker.put(location.getId(), marker);
		if (oldMarker != null) {
			oldMarker.remove();
		}

		locationQueue.add(location);

		while (locationQueue.size() > LocationPushTask.Companion.getMinNumberOfLocationsToKeep()) {
			Location locationToRemove = locationQueue.poll();

			Marker markerToRemove = locationIdToMarker.remove(locationToRemove.getId());
			if (markerToRemove != null) {
				markerToRemove.remove();
				markerIdToLocation.remove(markerToRemove.getId());
			}
		}
	}
}
 
Example 4
Source File: LocationMarkerCollection.java    From mage-android with Apache License 2.0 5 votes vote down vote up
@Override
public void remove(Pair<Location, User> pair) {
	Marker marker = userIdToMarker.remove(pair.second.getId());
	if (marker != null) {
		markerIdToPair.remove(marker.getId());
		marker.remove();

		if (clickedAccuracyCircle != null && pair.second.getId().equals(clickedAccuracyCircleUserId)) {
			clickedAccuracyCircle.remove();
			clickedAccuracyCircle = null;
		}
	}
}
 
Example 5
Source File: PolylineMarkers.java    From geopackage-android-map with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void delete(Marker marker) {
    if (markers.remove(marker)) {
        marker.remove();
        update();
    }
}
 
Example 6
Source File: PolylineMarkers.java    From geopackage-android-map with MIT License 5 votes vote down vote up
/**
 * Remove from the map
 */
public void remove() {
    if (polyline != null) {
        polyline.remove();
        polyline = null;
    }
    for (Marker marker : markers) {
        marker.remove();
    }
}
 
Example 7
Source File: GoogleMapShapeMarkers.java    From geopackage-android-map with MIT License 5 votes vote down vote up
/**
 * Get the shape markers for a marker, only returns a value of shapes that
 * can be edited
 *
 * @param marker marker
 * @return deleted flag
 */
public boolean delete(Marker marker) {
    boolean deleted = false;
    if (contains(marker)) {
        deleted = true;
        ShapeMarkers shapeMarkers = shapeMarkersMap.remove(marker.getId());
        if (shapeMarkers != null) {
            shapeMarkers.delete(marker);
        }
        marker.remove();
    }
    return deleted;
}
 
Example 8
Source File: LocationMarkerCollection.java    From mage-android with Apache License 2.0 5 votes vote down vote up
@Override
public void clear() {
	for (Marker marker : userIdToMarker.values()) {
		marker.remove();
	}

	if (clickedAccuracyCircle != null) {
		clickedAccuracyCircle.remove();
		clickedAccuracyCircle = null;
	}

	userIdToMarker.clear();
	markerIdToPair.clear();
	latestLocationDate = new Date(0);
}
 
Example 9
Source File: MarkerManager.java    From android-custom-markers with Apache License 2.0 5 votes vote down vote up
/**
 * Remove a marker from the map.
 *
 * @param marker marker to remove
 */
public void removeMarker(T marker) {

    final Marker realMarker = markerCache.get(marker);

    if (realMarker != null) {
        realMarker.remove();
    }

    markerCache.remove(marker);
}
 
Example 10
Source File: VehicleAction.java    From Companion-For-PUBG-Android with MIT License 5 votes vote down vote up
@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();
    }
}
 
Example 11
Source File: BoatAction.java    From Companion-For-PUBG-Android with MIT License 5 votes vote down vote up
@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();
    }
}
 
Example 12
Source File: MapFragment.java    From GNSS_Compare with Apache License 2.0 5 votes vote down vote up
/**
 * Removes the series associated with {@code calculationModule} from the plot
 * @param calculationModule reference to the calculation module
 */
public void removeSeries(CalculationModule calculationModule){
    if (map != null) {

        MapDataSeries reference = dataSeries.get(calculationModule);
        for (Marker marker : reference.getMarkers())
            marker.remove();

        dataSeries.remove(calculationModule);

    }
}
 
Example 13
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void clearAllInterestMarker() {
    if (this.mSelectMarker != null && ((MapPointLatLng) this.mSelectMarker.getTag()).isIntertestPoint) {
        this.mSelectMarker = null;
    }
    for (Marker marker : this.interestMarkerList) {
        marker.remove();
    }
    this.interestMarkerList.clear();
}
 
Example 14
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void deleteSmallMaker(Marker deleteMarker) {
    if (this.arrowMarkerList.size() > 0) {
        int index = ((MapPointLatLng) deleteMarker.getTag()).nPos - 1;
        if (index != 0) {
            int n = (index - 1) * 2;
            Marker m1 = (Marker) this.arrowMarkerList.get(n);
            m1.remove();
            Marker m2 = (Marker) this.arrowMarkerList.get(n + 1);
            m2.remove();
            this.arrowMarkerList.remove(m1);
            this.arrowMarkerList.remove(m2);
        }
    }
}
 
Example 15
Source File: EmergencyInteractorImpl.java    From Saude-no-Mapa with MIT License 5 votes vote down vote up
@Override
public void clearMarkers(GoogleMap map) {
    if (map != null) {
        if (mDeviceMarkerHash.size() > 0) {
            for (Marker marker : mDeviceMarkerHash.values()) {
                marker.remove();
            }
        }
    }
}
 
Example 16
Source File: MainActivity.java    From AndroidLocationStarterKit with MIT License 4 votes vote down vote up
public void clearMalMarkers(){
    for (Marker marker : malMarkers){
        marker.remove();
    }
}
 
Example 17
Source File: MapFragment.java    From mage-android with Apache License 2.0 4 votes vote down vote up
@Override
public void onDestroyView() {
	super.onDestroyView();

	mapView.onDestroy();

	if (observations != null) {
		observations.clear();
		observations = null;
	}

	if (locations != null) {
		locations.clear();
		locations = null;
	}

	if (historicLocations != null) {
		historicLocations.clear();
		historicLocations = null;
	}

	if (searchMarkers != null) {
		for (Marker m : searchMarkers) {
			m.remove();
		}
		searchMarkers.clear();
	}

	if (mgrsTileOverlay != null) {
		mgrsTileOverlay.remove();
		mgrsTileOverlay = null;
	}

	// Close all open GeoPackages
	geoPackageCache.closeAll();

	cacheOverlays.clear();

	staticGeometryCollection = null;
	currentUser = null;
	map = null;
}
 
Example 18
Source File: RideDetailActivity.java    From android-ponewheel with MIT License 4 votes vote down vote up
void clearAllMarkersFromMap() {
    for (Marker mapMarker : mapMarkers) {
        mapMarker.remove();
    }
    mapMarkers.clear();
}
 
Example 19
Source File: GoogleMapsMapAdapter.java    From ground-android with Apache License 2.0 4 votes vote down vote up
private void removeMarker(Marker marker) {
  Timber.v("Removing marker %s", marker.getId());
  marker.remove();
}
 
Example 20
Source File: MultiMarker.java    From geopackage-android-map with MIT License 4 votes vote down vote up
/**
 * Remove from the map
 */
public void remove() {
    for (Marker marker : markers) {
        marker.remove();
    }
}