-
Notifications
You must be signed in to change notification settings - Fork 14
Custom styles
Every point or track in Locus may have own custom style.
Styles are defined in class ExtraStyle
and every GeoData
class (Waypoint
and Track
extends it) has defined public styleNormal
(for common display of item) and styleHighlight
(for highlight after selection) parameters. Let's look at them closer.
To create style container for points/tracks, simply use
ExtraStyle style = new ExtraStyle()
and attach it to point/track with
point.styleNormal = style;
To define icon for points, just set this icon to existing ExtraStyle
container
style.setIconStyle("http://www.googlemapsmarkers.com/v1/009900/", 1.0f);
Recommended Uri value is defined as http:/
value, anyway local file with file:/
prefix is also supported. For smaller icons is also possible to use image encoded with Base64 as data:image/...
value.
Optionally you may use
style.setIconStyle(iconUrl, color, heading, scale)
which allows to modify color of icon and also it's rotation (in degrees) on the map.
Recommended method for using styles & more points, is styling directly PackWaypoints
container. In this case, we may attach ExtraStyle
like
pack.setExtraStyle(style);
or in this case is possible directly use Bitmap icons
pack.setBitmap(bitmap);
For tracks are prepared two main options
To style color and width of lines, use
style.setLineStyle(color, width)
`method, where width is simple value in pixels, or more advanced
style.setLineStyle(style, color, width, units)
which allows to define special style coloring options (parameter style
) and also choose if width will be defined in pixels or real metres (parameter units
). Special style
parameter is really powerful tool that allows to colorize track by speed, altitude, accuracy and some other parameters.
In case, we wants to fill track area with certain color, use
style.setPolyStyle(color, fill, outline)
-
Basics
-
Non-API tools
-
Using API
-
Work with points
-
Work with tracks
-
Integration into Locus Map
-
Other/advanced features