Geoobject styleprovider style withImage > add text

actual jmix version

we use

stopsSource.setStyleProvider(tourStop →
new Style()
.withImage(new CircleStyle()
.withRadius(8)
.withStroke(new Stroke()
.withWidth(1.)
.withColor(setColor(tourStop)))
.withFill(new Fill(setColor(tourStop))))

works fine, but we would like to add a text inside the created ‘circle’
how to do that?

Hello Roland!

Did you try add text using withText() method? For instance:

@Install(to = "map.shopsLayer.shopsSource", subject = "styleProvider")
private Style mapShopsLayerShopsSourceStyleProvider(final Shop shop) {
    return new Style()
            .withImage(new CircleStyle()
                    .withRadius(11)
                    .withStroke(new Stroke()
                            .withWidth(1.)
                            .withColor("#008500"))
                    .withFill(new Fill("#A60000")))
            .withText(new TextStyle()
                    .withFont("bold 15px sans-serif")
                    .withText("Text"));
}

I think I had a typo in my various tests :frowning:
this works fine now, thx!

> stopsSource.setStyleProvider(tourStop ->
>             new Style()
>                 .withImage(new CircleStyle()
>                         .withRadius(8)
>                         .withStroke(new Stroke()
>                                 .withWidth(1.)
>                                 .withColor(setColor(tourStop)))
>                         .withFill(new Fill(setColor(tourStop))))
>                 .withText(new TextStyle()
>                         .withText(tourStop.getTourIndex().toString())
>                         .withFont("bold 10px sans-serif")
>                         .withFill(new Fill("lime"))
>                         .withOffsetY(0)));