StoresStyle

@Serializable
class StoresStyle(val breakPoint: Int, val default: StoresStyle.DefaultRule, val rules: List<StoresStyle.TypedRule> = listOf())

Class to structure a Woosmap Store Style

The same JSON style can be used than with the JavaScript library.

StoresStyle.buildFromJson("""
{
breakPoint: 14,
default: {
color: "#008a2f",
size: 8,
minSize: 1,
icon: {
url: 'https://images.woosmap.com/starbucks-marker.svg',
scaledSize: {
height: 40,
width: 34
},
anchor: {
x: 0,
y: 5
}
},
selectedIcon: {
url: 'https://images.woosmap.com/starbucks-selected-marker.svg',
...
}
}
}
""")

Constructors

Link copied to clipboard
constructor(breakPoint: Int, default: StoresStyle.DefaultRule, rules: List<StoresStyle.TypedRule> = listOf())

Types

Link copied to clipboard
object Companion
Link copied to clipboard
@Serializable
data class DefaultRule(val color: String, val icon: Icon, val selectedIcon: Icon? = null, val minSize: Double = 0.5, val size: Double = 8.0) : StoresStyle.Rule

Structure for the default rule.

Link copied to clipboard
abstract class Rule

Common structure for all style rules.

Link copied to clipboard
@Serializable
data class TypedRule(val color: String, val icon: Icon, val selectedIcon: Icon? = null, val type: String) : StoresStyle.Rule

Structure for rules that apply to a given type.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun iconForType(type: String): Icon

Get the icon for a given type or the default icon if no rules apply to that type.

Link copied to clipboard

Get the rule that apply to a given type, the default rule will be returned if there is none.

Link copied to clipboard

Get the selection icon for a given type or the default selection icon if no rules apply.

Link copied to clipboard

Get a selection icon for a list of types, the first to match will be used. If no rules apply the default selection icon or the default icon will be used.