Skip to content

Commit fbb569f

Browse files
committed
Fixed tests
1 parent 7f10203 commit fbb569f

File tree

3 files changed

+64
-12
lines changed

3 files changed

+64
-12
lines changed

api/v3/wms_types.go

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,60 @@ func (wmsService *WMSService) GetBoundingBox() WMSBoundingBox {
205205

206206
}
207207

208+
type AnnotatedLayer struct {
209+
// The name of the group that this layer belongs to, nil if it is not a member of a group. Groups can be a member of the toplayer as a group
210+
GroupName *string
211+
// Only for spec.Service.Layer
212+
IsTopLayer bool
213+
// Top layer or layer below the toplayer with children itself
214+
IsGroupLayer bool
215+
// Contains actual data
216+
IsDataLayer bool
217+
Layer Layer
218+
}
219+
220+
func (wmsService *WMSService) GetAnnotatedLayers() []AnnotatedLayer {
221+
result := make([]AnnotatedLayer, 0)
222+
223+
topLayer := wmsService.Layer
224+
annotatedTopLayer := AnnotatedLayer{
225+
GroupName: nil,
226+
IsTopLayer: true,
227+
IsGroupLayer: topLayer.Name != nil,
228+
IsDataLayer: false,
229+
Layer: topLayer,
230+
}
231+
result = append(result, annotatedTopLayer)
232+
233+
for _, topLayerChild := range *topLayer.Layers {
234+
groupName := topLayer.Name
235+
isGroupLayer := topLayerChild.Layers != nil && len(*topLayerChild.Layers) > 0
236+
isDataLayer := !isGroupLayer
237+
result = append(result, AnnotatedLayer{
238+
GroupName: groupName,
239+
IsTopLayer: false,
240+
IsGroupLayer: isGroupLayer,
241+
IsDataLayer: isDataLayer,
242+
Layer: topLayerChild,
243+
})
244+
245+
if topLayerChild.Layers != nil && len(*topLayerChild.Layers) > 0 {
246+
for _, middleLayerChild := range *topLayerChild.Layers {
247+
groupName = topLayerChild.Name
248+
result = append(result, AnnotatedLayer{
249+
GroupName: groupName,
250+
IsTopLayer: false,
251+
IsGroupLayer: false,
252+
IsDataLayer: true,
253+
Layer: middleLayerChild,
254+
})
255+
}
256+
}
257+
}
258+
259+
return result
260+
}
261+
208262
func (wmsService *WMSService) GetAllLayers() (layers []Layer) {
209263
return wmsService.Layer.GetAllLayers()
210264
}

0 commit comments

Comments
 (0)