PDA

View Full Version : Changing Visual Advice icons



mz87
16.01.2016, 13:42
Hi!

Is it possible to change visual advice icons? I mean, at least change some colors etc.?

I found this post: http://forum.skobbler.com/showthread.php/7022-Visual-advice-file-list but there's no solution

I guess this is described like some json style or something like that?! Can You point that where should I edit info to change those properties?

thanks

Adela_Silvia
20.01.2016, 11:42
The visual advices are generated dynamically, based on the real road geometry. You can customize the background & colours via:

iOS: To listen for/intercept navigation events (more details can be found here):

Visual instructions listen to didChangeFirstVisualAdvice
Inside the SKRouteState parameter you will find information about the:
Path to the current (first) visual advice: currentVisualAdvicePath (if you want a coloured image use firstVisualAdviceImageWithColor)
Path to the next (second) visual advice: secondaryVisualAdvicePath (if you want a coloured image use secondVisualAdviceImageWithColor)
Instructions (as text) for the first advice: currentAdviceInstruction
Instructions (as text) for the second advice: nextAdviceInstruction



Android:
To listen for/intercept navigation events you will need to implement SKNavigationListener (more details can be found here):

Visual instructions listen to onVisualAdviceChanged
Inside the SKNavigationState parameter you will find information about the:
Path to the current (first) visual advice: getCurrentAdviceVisualAdviceFile
Path to the next (second) visual advice: getNextAdviceVisualAdviceFile
Instructions (as text) for the first advice: getAdviceInstruction
To modify the colour of the visual advices, use something like:




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().renderVisualAdvi ceImage(currentImageCrossingDescriptor,
currentVisualAdviceImage, firstVisualAdviceColor);

}

mz87
20.01.2016, 12:38
Thanks, Adela! This works great :)