webgis: small code refactoring in WMS legend