1
1
package geoscript.style.io
2
2
3
+ import geoscript.filter.Color
3
4
import geoscript.style.Composite
4
5
import geoscript.style.Fill
5
6
import geoscript.style.Font
@@ -102,7 +103,7 @@ class SimpleStyleReader implements Reader {
102
103
)
103
104
parts. add(icon)
104
105
}
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) }) {
106
107
Font font = new Font (
107
108
size : options. get(' label-size' ,12 ),
108
109
style : options. get(' label-style' , ' normal' ),
@@ -111,8 +112,37 @@ class SimpleStyleReader implements Reader {
111
112
)
112
113
Label label = new Label (
113
114
property : options. get(' label' ),
114
- font : font
115
+ font : font,
116
+ fill : new Fill (new Color (options. get(" label-color" , " black" )))
115
117
)
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
+
116
146
parts. add(label)
117
147
}
118
148
new Composite (parts)
0 commit comments