IconProvider
public class IconProvider
This provider creates icons from a given set of parameters for map content and constraints for icon dimensions for a particular map scheme. The icon creation currently does not rely on map data. Therefore, it works without online connection.
Note
This feature is in BETA state and thus there can be bugs and unexpected behavior. Related APIs may change for new releases without a deprecation process.-
Initializes an icon provider instance.
Declaration
Swift
public init(_ mapContext: MapContext)Parameters
mapContextThe map context instance which is obtained using [MapView.mapContext].
-
createRoadShieldIcon(properties:mapScheme: assetType: widthConstraintInPixels: heightConstraintInPixels: callback: ) Creates an image displaying a road shield according to the given parameters.
Note
This feature is in BETA state and thus there can be bugs and unexpected behavior. Related APIs may change for new releases without a deprecation process.Declaration
Swift
public func createRoadShieldIcon( properties: RoadShieldIconProperties, mapScheme: MapScheme, assetType: IconProviderAssetType, widthConstraintInPixels: UInt32, heightConstraintInPixels: UInt32, callback: @escaping IconProviderCallback)Parameters
propertiesThe properties which determine the kind of road shield to be created.
mapSchemeThe map scheme for which the road shield should be created.
assetTypeThe asset type for which the road shield should be created.
widthConstraintInPixelsThe maximum width of the road shield in pixels. The value is capped to a maximum of 4096 pixels. The image will be created as large as possible within the width and height constraints while maintaining the aspect ratio. If set to 0, the width will be calculated based on the heightConstraintInPixels to preserve the aspect ratio.
heightConstraintInPixelsThe maximum height of the road shield in pixels. The value is capped to a maximum of 4096 pixels. The image will be created as large as possible within the width and height constraints while maintaining the aspect ratio. If set to 0, the original image-asset’s height will be used.
callbackThe callback which is used to return the created image along with a description of the icon based on the type of road and/or place it is used, or an error code.
-
Creates an image representing a vehicle restriction as shown on the map, based on map content picking result.
Declaration
Swift
func createVehicleRestrictionIcon( pickingResult: PickMapContentResult.VehicleRestrictionResult, mapScheme: MapScheme, assetType: IconProviderAssetType, sizeConstraintsInPixels: Size2D, completion callback: @escaping IconProviderCallback)Parameters
pickingResultThe result of picking vehicle restrictions.
mapSchemeThe map scheme for which the vehicle restriction icon should be created.
assetTypeThe asset type for which the vehicle restriction icon should be created.
sizeConstraintsInPixelsThe maximum width and height of the icon in pixels. The values are capped to a maximum of 4096 pixels. The image will be created as large as possible within the width and height constraints while maintaining the aspect ratio. If either width or height is set to 0, it will be calculated automatically based on icon’s aspect ratio.
callbackThe callback which is used to return the created image along with a description of the icon based on the type of road and/or place it is used, or an error code.
-
Creates an image representing a vehicle restriction as shown on the map.
In case when
VehicleRestrictionobject specifies multiple types of restrictions, then the icon is generated for the first one according to the following priority:VehicleRestriction.restriction,VehicleRestriction.axleCount,VehicleRestriction.axleCountInGroup,VehicleRestriction.hazmatRestriction,VehicleRestriction.trailerCount.Declaration
Swift
func createVehicleRestrictionIcon( properties: VehicleRestrictionIconProperties, mapScheme: MapScheme, assetType: IconProviderAssetType, sizeConstraintsInPixels: Size2D, completion callback: @escaping IconProviderCallback)Parameters
propertiesThe properties of a restriction icon to be created.
mapSchemeThe map scheme for which the vehicle restriction icon should be created.
assetTypeThe asset type for which the vehicle restriction icon should be created.
sizeConstraintsInPixelsThe maximum width and height of the icon in pixels. The values are capped to a maximum of 4096 pixels. The image will be created as large as possible within the width and height constraints while maintaining the aspect ratio. If either width or height is set to 0, it will be calculated automatically based on icon’s aspect ratio.
callbackThe callback which is used to return the created image along with a description of the icon based on the type of road and/or place it is used, or an error code.