Class YMKSearchLayer

The search layer handles the map search requests and displays the results automatically on the map.

It also handles the map movements and resubmits searches when needed.

Instance Methods

- addPlacemarkListenerWithPlacemarkListener:

Add the placemark listener which will receive notifications from the search layer.

- addSearchResultListenerWithSearchResultListener:

Add the search result listener which will receive notifications from the search layer.

- clear

Clear the displayed search results from the map.

- deselectPlacemark

Deselect all placemarks.

- enableMapMoveOnSearchResponseWithEnable:

Enable or disable moving the map to the primary search response.

- enableResubmitsOnMapMovesWithEnable:

Enable or disable search resubmits when the map is moved.

- fetchNextPage

Load the next page of results.

- forceUpdateIconWithGeoObjectId:iconType:image:style:

Update the icon image for each suitable placemark.

- forceUpdateMapObjects

Force reloading of all visible pins from AssetsProvider.

- getSearchResultsList

Get the list of search results.

- hasNextPage

Check if more results could be loaded.

- obtainAdIconsWithEnable:

If enabled, the search layer will obtain and set advertising icons without asking AssetsProvider.

- removePlacemarkListenerWithPlacemarkListener:

Remove placemark listener.

- removeSearchResultListenerWithSearchResultListener:

Remove search result listener.

- resetAssetsProvider

Reset the asset provider to default.

- resolveUriWithUri:searchOptions:

Submit search request for URI resolution.

- resubmit

Manual resubmit.

- searchByOidWithOid:searchOptions:

Submit search request by organization ID.

- searchMetadata

Get the last search response metadata.

- selectedPlacemarkId

Selected placemark ID.

- selectPlacemarkWithGeoObjectId:

Select placemark by ID.

- setAssetsProviderWithProvider:

Set the custom asset provider, which provides images, sizes and icon styles for placemarks.

- setBaseZIndexWithZIndex:

Set the base z-index for displaying map objects from search results.

- setBitmapDownloaderWithBitmapDownloader:

Set bitmap downloader.

- setFiltersWithFilters:

Set search filters.

- setSearchManagerWithSearchManager:

Set search manager.

- setSortByDistanceWithOrigin:geometrySearchType:

Set sort order of the results by the distance to the geometry.

- setSortByRank

Set sort order of the results by search rank.

- submitQueryWithQuery:searchOptions:

Submit search query with search options.

Properties

valid

Tells if this object is valid or no.

Method Detail

-addPlacemarkListenerWithPlacemarkListener:

- (void)addPlacemarkListenerWithPlacemarkListener:(nonnull id< YMKSearchLayerTapHandler >)placemarkListener 

Add the placemark listener which will receive notifications from the search layer.

Parameters:
placemarkListener

Placemark listener to add.

-addSearchResultListenerWithSearchResultListener:

- (void)addSearchResultListenerWithSearchResultListener:(nonnull id< YMKSearchLayerResponseHandler >)searchResultListener 

Add the search result listener which will receive notifications from the search layer.

Parameters:
searchResultListener

Search result listener to add.

-clear

- (void)clear

Clear the displayed search results from the map.

-deselectPlacemark

- (void)deselectPlacemark

Deselect all placemarks.

-enableMapMoveOnSearchResponseWithEnable:

- (void)enableMapMoveOnSearchResponseWithEnable:(BOOL)enable 

Enable or disable moving the map to the primary search response.

Moving the map is enabled by default.
Parameters:
enable

Enable map moving if true, disable otherwise.

-enableResubmitsOnMapMovesWithEnable:

- (void)enableResubmitsOnMapMovesWithEnable:(BOOL)enable 

Enable or disable search resubmits when the map is moved.

Resubmits are enabled by default.
Parameters:
enable

Enable resubmits if true, disable otherwise.

-fetchNextPage

- (void)fetchNextPage

Load the next page of results.

-forceUpdateIconWithGeoObjectId:iconType:image:style:

- (void)forceUpdateIconWithGeoObjectId:(nonnull NSString *)geoObjectId
                              iconType:(YMKPlacemarkIconType)iconType
                                 image:(nonnull UIImage *)image
                                 style:(nonnull YMKIconStyle *)style 

Update the icon image for each suitable placemark.

If the placemark is not found, the image will be put in a queue and will be applied once when the placemark is created. This is not the regular way to set the image. It is highly advisable to return the correct image from AssetsProvider.
Parameters:
geoObjectId

Placemark identifier.

iconType

Icon type.

image

Icon image.

style

Icon style.

-forceUpdateMapObjects

- (void)forceUpdateMapObjects

Force reloading of all visible pins from AssetsProvider.

Use when it is necessary to update ALL the icons simultaneously (i.e. icon theme change, day/night mode, etc.). This can be a pretty expensive operation, as it wipes all the map objects off of the layer and creates them from scratch. Use only if absolutely necessary.

-getSearchResultsList

- (nonnull NSArray< YMKSearchResultItem * > *)getSearchResultsList

Get the list of search results.

-hasNextPage

- (BOOL)hasNextPage

Check if more results could be loaded.

-obtainAdIconsWithEnable:

- (void)obtainAdIconsWithEnable:(BOOL)enable 

If enabled, the search layer will obtain and set advertising icons without asking AssetsProvider.

Parameters:
enable

Enable this mode if true, disable otherwise.

-removePlacemarkListenerWithPlacemarkListener:

- (void)removePlacemarkListenerWithPlacemarkListener:(nonnull id< YMKSearchLayerTapHandler >)placemarkListener 

Remove placemark listener.

Parameters:
placemarkListener

Placemark listener to remove.

-removeSearchResultListenerWithSearchResultListener:

- (void)removeSearchResultListenerWithSearchResultListener:(nonnull id< YMKSearchLayerResponseHandler >)searchResultListener 

Remove search result listener.

Parameters:
searchResultListener

Search result listener to remove.

-resetAssetsProvider

- (void)resetAssetsProvider

Reset the asset provider to default.

-resolveUriWithUri:searchOptions:

- (void)resolveUriWithUri:(nonnull NSString *)uri
            searchOptions:(nonnull YMKSearchOptions *)searchOptions 

Submit search request for URI resolution.

Parameters:
uri

Object URI.

searchOptions

Additional search parameters. See YMKSearchOptions definition for details, and 'resolveURI' method in YMKSearchManager for currently supported options.

-resubmit

- (void)resubmit

Manual resubmit.

-searchByOidWithOid:searchOptions:

- (void)searchByOidWithOid:(nonnull NSString *)oid
             searchOptions:(nonnull YMKSearchOptions *)searchOptions 

Submit search request by organization ID.

Parameters:
oid

ID of organization.

searchOptions

Additional search parameters. See YMKSearchOptions definition for details, and 'searchByOid' method in YMKSearchManager for currently supported options.

-searchMetadata

- (nonnull YMKSearchMetadata *)searchMetadata

Get the last search response metadata.

-selectPlacemarkWithGeoObjectId:

- (void)selectPlacemarkWithGeoObjectId:(nonnull NSString *)geoObjectId 

Select placemark by ID.

Parameters:
geoObjectId

Placemark identifier.

-selectedPlacemarkId

- (nullable NSString *)selectedPlacemarkId

Selected placemark ID.

Returns:

s Placemark identifier if any placemark is selected, nothing otherwise.

-setAssetsProviderWithProvider:

- (void)setAssetsProviderWithProvider:(nonnull id< YMKAssetsProvider >)provider 

Set the custom asset provider, which provides images, sizes and icon styles for placemarks.

Parameters:
provider

Asset provider (must not be null).

-setBaseZIndexWithZIndex:

- (void)setBaseZIndexWithZIndex:(float)zIndex 

Set the base z-index for displaying map objects from search results.

It is guaranteed that all map objects from search will have the z-index within the interval [base; base + 10] Note: if the asset provider explicitly sets the z-index for an icon, then it is not guaranteed that the icon will have a z-index within the interval [base; base + 10]

-setBitmapDownloaderWithBitmapDownloader:

- (void)setBitmapDownloaderWithBitmapDownloader:(nonnull YMKSearchBitmapDownloader *)bitmapDownloader 

Set bitmap downloader.

Do not use this method; it is for internal use only.
Parameters:
bitmapDownloader

Bitmap downloader.

-setFiltersWithFilters:

- (void)setFiltersWithFilters:(nonnull NSArray< YMKSearchBusinessFilter * > *)filters 

Set search filters.

Parameters:
filters

Business filters.

-setSearchManagerWithSearchManager:

- (void)setSearchManagerWithSearchManager:(nonnull YMKSearchManager *)searchManager 

Set search manager.

Do not use this method; it is for internal use only.
Parameters:
searchManager

Search manager.

-setSortByDistanceWithOrigin:geometrySearchType:

- (void)setSortByDistanceWithOrigin:(nonnull YMKGeometry *)origin
                 geometrySearchType:(YMKGeometrySearchType)geometrySearchType 

Set sort order of the results by the distance to the geometry.

Parameters:
origin

Geometry to sort by.

geometrySearchType

Geometry search type.

-setSortByRank

- (void)setSortByRank

Set sort order of the results by search rank.

-submitQueryWithQuery:searchOptions:

- (void)submitQueryWithQuery:(nonnull NSString *)query
               searchOptions:(nonnull YMKSearchOptions *)searchOptions 

Submit search query with search options.

Parameters:
query

User query.

searchOptions

Search options.

Property Detail

valid

(assign, readonly, getter=isValid) BOOL valid

Tells if this object is valid or no.

Any method called on an invalid object will throw an exception. The object becomes invalid only on UI thread, and only when its implementation depends on objects already destroyed by now. Please refer to general docs about the interface for details on its invalidation.