@@ -128,6 +128,7 @@ class AdvancedStyleDrawing {
128128 let radius = 5 ;
129129 let hatch = null ;
130130 let dashArray = null ;
131+ let strokeApplied = false ;
131132
132133 for ( const layer of symbolLayers ) {
133134 if ( layer . type === "fill" ) {
@@ -146,20 +147,39 @@ class AdvancedStyleDrawing {
146147 } ;
147148 }
148149 } else if ( layer . type === "stroke" ) {
149- strokeColor = layer . color || strokeColor ;
150- strokeOpacity =
151- layer . opacity !== undefined ? layer . opacity : strokeOpacity ;
152- lineWidth = layer . width !== undefined ? layer . width : lineWidth ;
153- if ( layer . dash && Array . isArray ( layer . dash . array ) ) {
154- dashArray = layer . dash . array . slice ( ) ;
150+ const opacity =
151+ layer . opacity !== undefined ? layer . opacity : 1.0 ;
152+ const width = layer . width !== undefined ? layer . width : 1 ;
153+ const visible = opacity > 0 && width > 0 ;
154+ if ( visible && ! strokeApplied ) {
155+ strokeColor = layer . color || strokeColor ;
156+ strokeOpacity = opacity ;
157+ lineWidth = width ;
158+ strokeApplied = true ;
159+ if ( layer . dash && Array . isArray ( layer . dash . array ) ) {
160+ dashArray = layer . dash . array . slice ( ) ;
161+ }
162+ } else if ( ! strokeApplied ) {
163+ strokeColor = layer . color || strokeColor ;
164+ strokeOpacity = opacity ;
165+ lineWidth = width ;
166+ if ( layer . dash && Array . isArray ( layer . dash . array ) ) {
167+ dashArray = layer . dash . array . slice ( ) ;
168+ }
155169 }
156170 } else if ( layer . type === "markerPoint" ) {
157- radius =
171+ // marker.size from styles.json is diameter (px); use half for circle radius
172+ const sizePx =
158173 layer . marker && typeof layer . marker . size === "number"
159174 ? layer . marker . size
160- : radius ;
175+ : radius * 2 ;
176+ radius = sizePx / 2 ;
161177 }
162178 }
179+ if ( ! strokeApplied && ( baseFillColor || hatch ) ) {
180+ strokeOpacity = 1.0 ;
181+ lineWidth = lineWidth > 0 ? lineWidth : 1 ;
182+ }
163183
164184 const fillColor = baseFillColor || "#808080" ;
165185 const fillOpacity = baseFillColor ? baseFillOpacity : 0 ;
@@ -190,6 +210,8 @@ class AdvancedStyleDrawing {
190210 let strokeOpacity = 1.0 ;
191211 let lineWidth = 1 ;
192212 let radius = 5 ;
213+ let markerStrokeFromPoint = null ;
214+ let strokeApplied = false ;
193215
194216 for ( const layer of symbolLayers ) {
195217 if ( layer . type === "fill" ) {
@@ -198,20 +220,45 @@ class AdvancedStyleDrawing {
198220 fillOpacity = layer . opacity ;
199221 }
200222 } else if ( layer . type === "stroke" ) {
201- strokeColor = layer . color || strokeColor ;
202- if ( layer . opacity !== undefined ) {
203- strokeOpacity = layer . opacity ;
204- }
205- if ( layer . width !== undefined ) {
206- lineWidth = layer . width ;
223+ const opacity =
224+ layer . opacity !== undefined ? layer . opacity : 1.0 ;
225+ const width = layer . width !== undefined ? layer . width : 1 ;
226+ const visible = opacity > 0 && width > 0 ;
227+ if ( visible && ! strokeApplied ) {
228+ strokeColor = layer . color || strokeColor ;
229+ strokeOpacity = opacity ;
230+ lineWidth = width ;
231+ strokeApplied = true ;
232+ } else if ( ! strokeApplied ) {
233+ strokeColor = layer . color || strokeColor ;
234+ strokeOpacity = opacity ;
235+ lineWidth = width ;
207236 }
208- } else if ( layer . type === "markerPoint" ) {
209- radius =
210- layer . marker && typeof layer . marker . size === "number"
237+ } else if ( layer . type === "markerPoint" && layer . marker ) {
238+ const sizePx =
239+ typeof layer . marker . size === "number"
211240 ? layer . marker . size
212- : radius ;
241+ : radius * 2 ;
242+ radius = sizePx / 2 ;
243+ if (
244+ layer . marker . strokeColor != null ||
245+ ( typeof layer . marker . strokeWidth === "number" && layer . marker . strokeWidth > 0 )
246+ ) {
247+ markerStrokeFromPoint = {
248+ color : layer . marker . strokeColor || "#000000" ,
249+ width :
250+ typeof layer . marker . strokeWidth === "number" && layer . marker . strokeWidth > 0
251+ ? layer . marker . strokeWidth
252+ : 1 ,
253+ } ;
254+ }
213255 }
214256 }
257+ if ( markerStrokeFromPoint ) {
258+ strokeColor = markerStrokeFromPoint . color ;
259+ lineWidth = markerStrokeFromPoint . width ;
260+ strokeOpacity = 1.0 ;
261+ }
215262
216263 const styleForDraw = { hatch : null , dashArray : null } ;
217264
0 commit comments