11package geoscript.style.io
22
3+ import geoscript.filter.Color
34import geoscript.style.Composite
45import geoscript.style.Fill
56import geoscript.style.Font
@@ -102,7 +103,7 @@ class SimpleStyleReader implements Reader {
102103 )
103104 parts. add(icon)
104105 }
105- if ([' label-size' ,' label-style' ,' label-weight' ,' label-family' ]. any{ options. containsKey(it) }) {
106+ if ([' label' , ' label -size' ,' label-style' ,' label-weight' ,' label-family' , ' label-color ' ]. any{ options. containsKey(it) }) {
106107 Font font = new Font (
107108 size : options. get(' label-size' ,12 ),
108109 style : options. get(' label-style' , ' normal' ),
@@ -111,8 +112,37 @@ class SimpleStyleReader implements Reader {
111112 )
112113 Label label = new Label (
113114 property : options. get(' label' ),
114- font : font
115+ font : font,
116+ fill : new Fill (new Color (options. get(" label-color" , " black" )))
115117 )
118+ if ([' label-halo-color' ,' label-halo-radius' ]. any { options. containsKey(it)}) {
119+ label. halo(new Fill (options. get(" label-halo-color" , " white" )), options. get(" label-halo-radius" , 5 ))
120+ }
121+ String placement = options. get(" label-placement" , " point" )
122+ if (placement. equalsIgnoreCase(" point" )) {
123+ // label-point-anchor, label-point-displace, label-point-rotate
124+ Map params = [
125+ anchor : options. get(" label-point-anchor" ," 0.5,0.5" )?. split(" ," ),
126+ displace : options. get(" label-point-displace" ," 0,0" )?. split(" ," ),
127+ rotate : options. get(" label-point-rotate" ,0 ) as double
128+ ]
129+ label. point(params)
130+ } else if (placement. equalsIgnoreCase(" line" )) {
131+ // label-line-offset, label-line-gap, label-line-igap, label-line-align, label-line-follow,
132+ // label-line-group, label-line-displacement, label-line-repeat
133+ Map params = [
134+ offset : options. get(" label-line-offset" , 0 ) as double ,
135+ gap : options. get(" label-line-gap" ),
136+ igap : options. get(" label-line-igap" ),
137+ align : options. get(" label-line-align" , false ) as boolean ,
138+ follow : options. get(" label-line-follow" , false ) as boolean ,
139+ group : options. get(" label-line-group" , false ) as boolean ,
140+ displacement : options. get(" label-line-displacement" ),
141+ repeat : options. get(" label-line-repeat" )
142+ ]
143+ label. linear(params)
144+ }
145+
116146 parts. add(label)
117147 }
118148 new Composite (parts)
0 commit comments