Пример #1
0
        private string GetSprite(object iconImage)
        {
            string icon = Helper.ProcessStoppable(iconImage);

            Converter.AppendDebug("Default icon", iconImage);

            if (icon.Contains("{"))
            {
                var split = icon.Split(new [] { '{', '}' });
                if (split.Length == 1)
                {
                    return($"function() {{ return feature.{split[0]}; }}");
                }
                if (split.Length == 3)
                {
                    return($"function() {{ return \"{split[0]}\" + feature.{split[1]} + \"{split[2]}\"; }}");
                }
                if (split.Length == 5)
                {
                    return($"function() {{ return \"{split[0]}\" + feature.{split[1]} + \"{split[2]}\" + feature.{split[3]} + \"{split[4]}\"; }}");
                }

                return("?");
            }

            return(icon);
        }
Пример #2
0
        private string GetTextField(object source, Layer layer)
        {
            string textSource = Helper.ProcessStoppable(source);

            if (layer.Id == "road_label" && layer.SourceLayer == "transportation_name")
            {
                return("global.ref_source");
            }

            if (textSource == "{name_en}" || textSource == "{name}")
            {
                return("global.name_source");
            }

            if (textSource.Contains("{"))
            {
                var split = textSource.Split(new[] { '{', '}' });
                if (split.Length == 1)
                {
                    return($"function() {{ return feature.{split[0]}; }}");
                }
                if (split.Length == 3)
                {
                    return($"function() {{ return \"{split[0]}\" + feature.{split[1]} + \"{split[2]}\"; }}");
                }
                if (split.Length == 5)
                {
                    return($"function() {{ return \"{split[0]}\" + feature.{split[1]} + \"{split[2]}\" + feature.{split[3]} + \"{split[4]}\"; }}");
                }

                return("?");
            }

            Converter.AppendDebug("Default TextField ignored", textSource);

            return(LayerUtils.IsRefTextLayer(layer) ? "global.ref_source" : "global.default_text_source");
        }