Class IconProvider

java.lang.Object
com.here.sdk.mapview.IconProvider

public class IconProvider extends Object
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.
  • Constructor Details

    • IconProvider

      public IconProvider(MapContext mapContext)
      Creates an IconProvider.
      Parameters:
      mapContext - The map context instance.
  • Method Details

    • createRoadShieldIcon

      public void createRoadShieldIcon(@NonNull RoadShieldIconProperties properties, @NonNull MapScheme mapScheme, @NonNull IconProviderAssetType assetType, long widthConstraintInPixels, long heightConstraintInPixels, @NonNull IconProvider.IconCallback callback)
      Creates an image displaying a road shield according to the given parameters.
      Parameters:
      properties - The properties which determine the kind of road shield to be created.
      mapScheme - The map scheme for which the road shield should be created.
      assetType - The asset type for which the road shield should be created.
      widthConstraintInPixels - The 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.
      heightConstraintInPixels - The 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.
      callback - The callback which is used to return the created image or an error code. 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.
    • createVehicleRestrictionIcon

      public void createVehicleRestrictionIcon(@NonNull PickMapContentResult.VehicleRestrictionResult pickingResult, @NonNull MapScheme mapScheme, @NonNull IconProviderAssetType assetType, @NonNull Size2D sizeConstraintsInPixels, @NonNull IconProvider.IconCallback callback)
      Creates an image representing a vehicle restriction as shown on the map, based on map content picking result.
      Parameters:
      pickingResult - The result of picking vehicle restrictions.
      mapScheme - The map scheme for which the vehicle restriction icon should be created.
      assetType - The asset type for which the vehicle restriction icon should be created.
      sizeConstraintsInPixels - The 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.
      callback - The callback which is used to return the created image, or an error code.
    • createVehicleRestrictionIcon

      public void createVehicleRestrictionIcon(@NonNull VehicleRestrictionIconProperties iconProperties, @NonNull MapScheme mapScheme, @NonNull IconProviderAssetType assetType, @NonNull Size2D sizeConstraintsInPixels, @NonNull IconProvider.IconCallback callback)
      Creates an image representing a vehicle restriction as shown on the map.

      In case when `VehicleRestriction` object 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.

      Parameters:
      iconProperties - The properties of the icon.
      mapScheme - The map scheme for which the vehicle restriction icon should be created.
      assetType - The asset type for which the vehicle restriction icon should be created.
      sizeConstraintsInPixels - The 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.
      callback - The callback which is used to return the created image, or an error code.