Search code examples
androidskmaps

Scout SDK: custom visual advice images


Using Scout SDK 2.5, looking for way to customize visual advice images for navigation. As I understand the visual advice images are generated on the fly and there is no package of images, which can be replaced in order to use custom ones.

Question: is it possible to customize the color of generated on the fly images? I see that they have grey gamma for now, what about to change the gray gamma in different one?


Solution

  • The images are generated as transparent png – you can style their color scheme via renderVisualAdviceImage – it should be something similar to the following:

    public void onVisualAdviceChanged(final boolean firstVisualAdviceChanged, final boolean secondVisualAdviceChanged,
    final SKNavigationState navigationState) {          
    if (firstVisualAdviceChanged) {
                   SKCrossingDescriptor currentImageCrossingDescriptor =
    navigationState.getFirstCrossingDescriptor();
                   String currentVisualAdviceImage = "[base path of map resouces]/current_advice_image.png";
                   final SKVisualAdviceColor firstVisualAdviceColor = new SKVisualAdviceColor();
                   firstVisualAdviceColor.setAllowedStreetColor(new
    float[]{0.2f, 0.2f, 0.2f, 0.4f});
                   firstVisualAdviceColor.setForbiddenStreetColor(new
    float[]{0.2f, 0.2f, 0.2f, 0.7f});
                   firstVisualAdviceColor.setRouteStreetColor(new
    float[]{0.2f, 0.2f, 0.2f, 1});
    
    SKNavigationManager.getInstance().renderVisualAdviceImage(currentImageCrossingDescriptor,
       currentVisualAdviceImage, firstVisualAdviceColor);
    
    }
    

    Where the array expected by SKVisualAdviceColor is made of 0 to 1 values matched to red/green/blue/alpha values.