Beispiel #1
0
        // Initialize the xServer base map layers
        public void InsertXMapBaseLayers(LayerCollection layers, string url, string copyrightText, Size maxRequestSize, string user, string password)
        {
            var baseLayer = new TiledLayer("Background")
            {
                TiledProvider = new XMapTiledProvider(url, XMapMode.Background)
                {
                    User = user, Password = password, ContextKey = "in case of context key"
                },
                Copyright      = copyrightText,
                Caption        = MapLocalizer.GetString(MapStringId.Background),
                IsBaseMapLayer = true,
                Icon           = ResourceHelper.LoadBitmapFromResource("Ptv.XServer.Controls.Map;component/Resources/Background.png")
            };

            var labelLayer = new UntiledLayer("Labels")
            {
                UntiledProvider = new XMapTiledProvider(url, XMapMode.Town)
                {
                    User = user, Password = password, ContextKey = "in case of context key"
                },
                Copyright      = copyrightText,
                MaxRequestSize = maxRequestSize,
                Caption        = MapLocalizer.GetString(MapStringId.Labels),
                Icon           = ResourceHelper.LoadBitmapFromResource("Ptv.XServer.Controls.Map;component/Resources/Labels.png")
            };

            layers.Add(baseLayer);
            layers.Add(labelLayer);
        }
Beispiel #2
0
        public void Initialize(Map map)
        {
            if (map.Xmap2LayerFactory != null)
            {
                map.Layers.Remove(map.Xmap2LayerFactory.BackgroundLayer);
                map.Layers.Remove(map.Xmap2LayerFactory.LabelLayer);
                map.Xmap2LayerFactory = null;
            }

            if (string.IsNullOrEmpty(AdjustedUrl()))
            {
                return;
            }

            map.Xmap2LayerFactory                         = new LayerFactory(this);
            map.Xmap2LayerFactory.MapStyle                = map.XMapStyle;
            map.Xmap2LayerFactory.BackgroundLayer.Icon    = ResourceHelper.LoadBitmapFromResource("Ptv.XServer.Controls.Map;component/Resources/Background.png");
            map.Xmap2LayerFactory.BackgroundLayer.Caption = MapLocalizer.GetString(MapStringId.Background);
            map.Xmap2LayerFactory.BackgroundThemes.Add("Background");
            map.Xmap2LayerFactory.BackgroundThemes.Add("Transport");

            map.Xmap2LayerFactory.LabelLayer.Icon    = ResourceHelper.LoadBitmapFromResource("Ptv.XServer.Controls.Map;component/Resources/Labels.png");
            map.Xmap2LayerFactory.LabelLayer.Caption = MapLocalizer.GetString(MapStringId.Labels);
            map.Xmap2LayerFactory.LabelThemes.Add("Labels");

            map.Layers.Add(map.Xmap2LayerFactory.BackgroundLayer);
            map.Layers.Add(map.Xmap2LayerFactory.LabelLayer);
        }
        private void InitializeMap1()
        {
            // center and radius for our map
            var center = new Point(8.4044, 49.01405);

            // the maximum zoom level of the map
            formsMap1.MaxZoom = 22;

            // set the map center to Karlsruhe
            formsMap1.SetMapLocation(center, 16);

            // insert base map layer
            formsMap1.Layers.Add(new TiledLayer("Background")
            {
                TiledProvider = new RemoteTiledProvider
                {
                    MinZoom = 0,
                    MaxZoom = 22,
                    RequestBuilderDelegate = (x, y, z) => string.Format("https://s0{0}-xserver2-europe-test.cloud.ptvgroup.com/services/rest/XMap/2.9/tile/{1}/{2}/{3}?storedProfile={4}&xtok={5}",
                                                                        "1234"[(x ^ y) % 4], z, x, y, "gravelpit", myToken)
                },
                IsBaseMapLayer = true, // set to the basemap category -> cannot be moved on top of overlays
                Icon           = ResourceHelper.LoadBitmapFromResource("Ptv.XServer.Controls.Map;component/Resources/Background.png"),
                Caption        = MapLocalizer.GetString(MapStringId.Background),
                Copyright      = "PTV AG, TomTom"
            });

            // add custom layer
            var myLayer = new ShapeLayer("MyLayer");

            formsMap1.Layers.Add(myLayer);
            AddCircle(myLayer, center, 250);
        }
Beispiel #4
0
        public Window1()
        {
            InitializeComponent();

            const string url   = "https://xmap-eu-n-test.cloud.ptvgroup.com/xmap/ws/XMap";
            const string token = "Insert your xToken here";

            // v1: Use Meta info
            InitializeMap(Map1, url, token);

            // v2: direct initialization for xServer-internet
            InsertXMapBaseLayers(Map2.Layers, url, "PTV AG, TomTom", new Size(3840, 2400), "xtok", token);

            // v3: direct initialization for xserver-internet-2
            Map3.Layers.Add(new TiledLayer("Background")
            {
                TiledProvider = new RemoteTiledProvider()
                {
                    MinZoom = 0,
                    MaxZoom = 22,
                    RequestBuilderDelegate = (x, y, z) =>
                                             $"https://s0{1 + (x + y) % 4}-xserver2-test.cloud.ptvgroup.com/services/rest/XMap/tile/{z}/{x}/{y}?xtok={token}",
                },
                Copyright      = $"© { DateTime.Now.Year } PTV AG, HERE",
                IsBaseMapLayer = true,
                Caption        = MapLocalizer.GetString(MapStringId.Background),
                Icon           = ResourceHelper.LoadBitmapFromResource("Ptv.XServer.Controls.Map;component/Resources/Background.png")
            });
        }
Beispiel #5
0
        public void InsertXMapBaseLayers(LayerCollection layers, XMapMetaInfo meta, string profile)
        {
            var baseLayer = new TiledLayer("Background")
            {
                TiledProvider = new ExtendedXMapTiledProvider(meta.Url, meta.User, meta.Password)
                {
                    ContextKey    = "in case of context key",
                    CustomProfile = profile + "-bg"
                },
                Copyright      = meta.CopyrightText,
                Caption        = MapLocalizer.GetString(MapStringId.Background),
                IsBaseMapLayer = true,
                Icon           = ResourceHelper.LoadBitmapFromResource("Ptv.XServer.Controls.Map;component/Resources/Background.png")
            };

            var labelLayer = new UntiledLayer("Labels")
            {
                UntiledProvider = new XMapTiledProvider(
                    meta.Url, XMapMode.Town)
                {
                    User          = meta.User, Password = meta.Password, ContextKey = "in case of context key",
                    CustomProfile = profile + "-fg"
                },
                Copyright      = meta.CopyrightText,
                MaxRequestSize = meta.MaxRequestSize,
                Caption        = MapLocalizer.GetString(MapStringId.Labels),
                Icon           = ResourceHelper.LoadBitmapFromResource("Ptv.XServer.Controls.Map;component/Resources/Labels.png")
            };

            layers.Add(baseLayer);
            layers.Add(labelLayer);
        }
        private void Map_Loaded(object sender, RoutedEventArgs e)
        {
            Map.Layers.Add(new TiledLayer("Background")
            {
                TiledProvider = new RemoteTiledProvider
                {
                    MinZoom = 0,
                    MaxZoom = 22,
                    RequestBuilderDelegate = (x, y, z) =>
                                             $"https://api{1+(x+y)%4}-test.cloud.ptvgroup.com/WMS/GetTile/xmap-silkysand-bg/{x}/{y}/{z}.png",
                },
                Copyright      = $"© { DateTime.Now.Year } PTV AG, TomTom",
                IsBaseMapLayer = true,
                Caption        = MapLocalizer.GetString(MapStringId.Background),
                Icon           = ResourceHelper.LoadBitmapFromResource("Ptv.XServer.Controls.Map;component/Resources/Background.png")
            });

            // -fg layers require the xServer-internet token
            var token = "Insert your xToken here";

            Map.Layers.Add(new UntiledLayer("Labels")
            {
                UntiledProvider = new WmsUntiledProvider(
                    $"https://api-test.cloud.ptvgroup.com/WMS/WMS?xtok={token}&service=WMS&request=GetMap&version=1.1.1&layers=xmap-silkysand-fg&styles=&format=image%2Fpng&transparent=true&srs=EPSG%3A3857", 19),
                Copyright = $"© { DateTime.Now.Year } PTV AG, TomTom",
                Caption   = MapLocalizer.GetString(MapStringId.Labels),
                Icon      = ResourceHelper.LoadBitmapFromResource("Ptv.XServer.Controls.Map;component/Resources/Labels.png")
            });
        }
        private void InitializeMap2()
        {
            // center and radius for our map
            var center = new Point(8.4044, 49.01405);

            // the second map instance is initialized with two basemap layers
            formsMap2.MaxZoom = 22;

            // set the map center to Karlsruhe
            formsMap2.SetMapLocation(center, 16);

            // add a base layer with only background and transport
            formsMap2.Layers.Add(new TiledLayer("Background")
            {
                TiledProvider = new RemoteTiledProvider
                {
                    MinZoom = 0,
                    MaxZoom = 22,
                    RequestBuilderDelegate = (x, y, z) => string.Format("https://s0{0}-xserver2-europe-test.cloud.ptvgroup.com/services/rest/XMap/tile/{1}/{2}/{3}?storedProfile={4}&layers=background,transport&xtok={5}",
                                                                        "1234"[(x ^ y) % 4], z, x, y, "gravelpit", myToken)
                },
                IsBaseMapLayer = true, // set to the basemap category -> cannot be moved on top of overlays
                Icon           = ResourceHelper.LoadBitmapFromResource("Ptv.XServer.Controls.Map;component/Resources/Background.png"),
                Caption        = MapLocalizer.GetString(MapStringId.Background),
                Copyright      = "PTV AG, TomTom"
            });

            // now a custom shape layer in-between background and labels
            var myLayer = new ShapeLayer("MyLayer");

            formsMap2.Layers.Add(myLayer);
            AddCircle(myLayer, center, 250);

            // now add the labels overlay layer
            formsMap2.Layers.Add(new TiledLayer("Labels")
            {
                TiledProvider = new RemoteTiledProvider
                {
                    MinZoom = 0,
                    MaxZoom = 22,
                    RequestBuilderDelegate = (x, y, z) => string.Format("https://s0{0}-xserver2-europe-test.cloud.ptvgroup.com/services/rest/XMap/tile/{1}/{2}/{3}?storedProfile={4}&layers=labels&xtok={5}",
                                                                        "1234"[(x ^ y) % 4], z, x, y, "gravelpit", myToken) // use "gravelpit-foreground" for better contrast
                },
                Icon      = ResourceHelper.LoadBitmapFromResource("Ptv.XServer.Controls.Map;component/Resources/Labels.png"),
                Caption   = MapLocalizer.GetString(MapStringId.Labels),
                Copyright = "PTV AG, TomTom"
            });
        }
        /// <summary>
        /// Inserts the xMapServer base layers, i.e. the background layers for areas like forests, rivers, population areas, et al,
        /// and their corresponding labels.
        /// </summary>
        /// <param name="layers">The LayerCollection instance, used as an extension. </param>
        /// <param name="meta">Meta information for xMapServer, further details can be seen in the <see cref="XMapMetaInfo"/> description. </param>
        public static void InsertXMapBaseLayers(this LayerCollection layers, XMapMetaInfo meta)
        {
            var baseLayer = new TiledLayer(BackgroundLayerName)
            {
                TiledProvider  = new XMapTiledProvider(meta.Url, meta.User, meta.Password, XMapMode.Background),
                Copyright      = meta.CopyrightText,
                Caption        = MapLocalizer.GetString(MapStringId.Background),
                IsBaseMapLayer = true,
                Icon           = ResourceHelper.LoadBitmapFromResource("Ptv.XServer.Controls.Map;component/Resources/Background.png")
            };

            if (BaseLayerSuccessor != null && layers[BaseLayerSuccessor] != null)
            {
                layers.Insert(layers.IndexOf(layers[BaseLayerSuccessor]), baseLayer);
            }
            else
            {
                // add tile layer
                layers.Add(baseLayer);
                BaseLayerSuccessor = null;
            }

            // don't add overlay layer for Decarta-powered maps (basemap is completely rendered on tiles)
            if (XServerUrl.IsDecartaBackend(meta.Url))
            {
                return;
            }

            var labelLayer = new UntiledLayer(LabelsLayerName)
            {
                UntiledProvider = new XMapTiledProvider(meta.Url, meta.User, meta.Password, XMapMode.Town),
                MaxRequestSize  = meta.MaxRequestSize,
                Caption         = MapLocalizer.GetString(MapStringId.Labels),
                Icon            = ResourceHelper.LoadBitmapFromResource("Ptv.XServer.Controls.Map;component/Resources/Labels.png")
            };

            if (LabelLayerPredecessor != null && layers[LabelLayerPredecessor] != null && layers.IndexOf(layers[LabelLayerPredecessor]) < layers.Count)
            {
                layers.Insert(layers.IndexOf(layers[LabelLayerPredecessor]) + 1, labelLayer);
            }
            else
            {
                // add label layer
                layers.Add(labelLayer);
                LabelLayerPredecessor = null;
            }
        }
        /// <summary> Exchanges the expander header depending on if the gadget is expanded or not. </summary>
        private void ExchangeLayersExpanderHeader()
        {
            if (inactiveLayersExpanderHeader == null)
            {
                var txtBlock = new TextBlock {
                    Text = MapLocalizer.GetString(MapStringId.Caption)
                };
                inactiveLayersExpanderHeader = txtBlock;
            }

            (LayersExpander.Header as UIElement).Visibility = Visibility.Hidden;
            var tmpHeader = inactiveLayersExpanderHeader;

            inactiveLayersExpanderHeader = LayersExpander.Header;
            LayersExpander.Header        = tmpHeader;
            ((UIElement)LayersExpander.Header).Visibility = Visibility.Visible;
        }
Beispiel #10
0
        /// <summary> Converts latitude/longitude coordinates to a textual representation. </summary>
        /// <param name="lat"> Latitude of the coordinate. </param>
        /// <param name="lon"> Longitude of the coordinate. </param>
        /// <param name="padZeroes"> If true the latitude and longitude degrees are padded with zeroes. </param>
        /// <returns> Textual representation of the input coordinates in a grad/min/sec format. </returns>
        public static string LatLonToString(double lat, double lon, bool padZeroes)
        {
            bool latIsNeg = lat < 0;

            lat = Math.Abs(lat);

            int    degLat = (int)lat;
            int    minLat = (int)((lat - degLat) * 60);
            double secLat = (lat - degLat - (double)minLat / 60) * 3600;

            bool lonIsNeg = lon < 0;

            lon = Math.Abs(lon);
            int    degLon = (int)lon;
            int    minLon = (int)((lon - degLon) * 60);
            double secLon = (lon - degLon - (double)minLon / 60) * 3600;

            string format = padZeroes ? "{0:00}° {1:00}′ {2:00}″ {3}, {4:000}° {5:00}′ {6:00}″ {7}" : "{0}° {1:00}′ {2:00}″ {3}, {4}° {5:00}′ {6:00}″ {7}";

            return(string.Format(format,
                                 degLat, minLat, Math.Floor(secLat), latIsNeg ? MapLocalizer.GetString(MapStringId.South) : MapLocalizer.GetString(MapStringId.North),
                                 degLon, minLon, Math.Floor(secLon), lonIsNeg ? MapLocalizer.GetString(MapStringId.West) : MapLocalizer.GetString(MapStringId.East)));
        }
Beispiel #11
0
        public void InitializeBasemap()
        {
            var bgLayer = Map.Layers["Background"];

            if (bgLayer != null)
            {
                Map.Layers.Remove(bgLayer);
            }
            var fgLayer = Map.Layers["Labels"];

            if (fgLayer != null)
            {
                Map.Layers.Remove(fgLayer);
            }

            const string copyrightText  = "PTV AG, TomTom";
            var          maxRequestSize = new Size(3840, 2400);
            const string user           = "******";
            const string password       = "******"; // this token is only for test purpose
            const string url            = "https://xmap-eu-n-test.cloud.ptvgroup.com/xmap/ws/XMap";

            ILayer baseLayer;

            if (singleTileBackground || useSingleLayerBM)
            {
                baseLayer = new UntiledLayer("Background")
                {
                    UntiledProvider = new XMapTiledProvider(url, XMapMode.Background)
                    {
                        User          = user, Password = password,
                        CustomProfile = profile + (useSingleLayerBM? "" : "-bg")
                    },
                    Copyright        = copyrightText,
                    Caption          = MapLocalizer.GetString(MapStringId.Background),
                    Icon             = ResourceHelper.LoadBitmapFromResource("Ptv.XServer.Controls.Map;component/Resources/Background.png"),
                    CanvasCategories = new[] { CanvasCategory.BaseMap }
                };
            }
            else
            {
                baseLayer = new TiledLayer("Background")
                {
                    TiledProvider = new XMapTiledProvider(url, XMapMode.Background)
                    {
                        User = user, Password = password, CustomProfile = profile + "-bg"
                    },
                    Copyright      = copyrightText,
                    Caption        = MapLocalizer.GetString(MapStringId.Background),
                    IsBaseMapLayer = true,
                    Icon           = ResourceHelper.LoadBitmapFromResource("Ptv.XServer.Controls.Map;component/Resources/Background.png")
                };
            }

            if (!useSingleLayerBM)
            {
                var labelLayer = new UntiledLayer("Labels")
                {
                    UntiledProvider = new XMapTiledProvider(url, XMapMode.Town)
                    {
                        User = user, Password = password, CustomProfile = profile + "-fg"
                    },
                    Copyright      = copyrightText,
                    MaxRequestSize = maxRequestSize,
                    Caption        = MapLocalizer.GetString(MapStringId.Labels),
                    Icon           = ResourceHelper.LoadBitmapFromResource("Ptv.XServer.Controls.Map;component/Resources/Labels.png")
                };
                Map.Layers.Insert(0, labelLayer);
            }

            Map.Layers.Insert(0, baseLayer);
        }
 /// <summary> Initializes a new instance of the <see cref="LayersGadget"/> class. </summary>
 public LayersGadget()
 {
     InitializeComponent();
     HeaderText.Content = MapLocalizer.GetString(MapStringId.Caption);
 }
        /// <summary> Updates the list of layers to be shown in the gadget. </summary>
        private void UpdateLayerList()
        {
            LayersStack.Children.Clear();
            LayersStack.RowDefinitions.Clear();
            LayersStack.Margin = new Thickness(1);
            layerIndices.Clear();
            // Since the header size is calculated on the longest layer caption we have to ensure
            // that in case of a layer stack modification the header size is recalculated. We force this
            // by setting 'headerSizeSet' to false.
            headerSizeSet = false;

            foreach (var item in layers.Select((layer, index) => new { layer, index }))
            {
                item.layer.PropertyChanged += layer_PropertyChanged;

                if (LayerListReverted)
                {
                    layerIndices.Add(item.index);
                }
                else
                {
                    layerIndices.Insert(0, item.index);
                }
            }

            foreach (var item in layerIndices.Select((t, index) => new { layer = layers[t], index }))
            {
                LayersStack.RowDefinitions.Add(new RowDefinition());

                var label = new Label {
                    Tag = item.layer.Name, Padding = new Thickness(-1), Margin = LayersStack.Margin
                };

                // opacityBinding is needed for the image and the layer name -> create once and bind it multiple times
                var opacityBinding = new Binding("Opacity")
                {
                    Source = label
                };

                // Create the text block first because the image size depends on the fond size.
                var textBlock = new TextBlock
                {
                    Tag                 = item.layer.Name,
                    Text                = item.layer.Caption,
                    Padding             = new Thickness(2),
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    VerticalAlignment   = VerticalAlignment.Center,
                    FontWeight          = FontWeights.Normal,
                    FontSize            = HeaderText.FontSize
                };

                textBlock.SetBinding(OpacityProperty, opacityBinding);

                if (item.layer.HasSettingsDialog)
                {
                    textBlock.MouseLeftButtonUp += textBlock_MouseLeftButtonUp;
                    textBlock.TextDecorations.Add(TextDecorations.Underline);
                    textBlock.ToolTip = MapLocalizer.GetString(MapStringId.Options);
                }

                var image = new Image
                {
                    Source            = item.layer.Icon ?? DefaultImageSource,
                    Width             = textBlock.FontSize + 8,
                    Height            = textBlock.FontSize + 8,
                    Margin            = new Thickness(2),
                    VerticalAlignment = VerticalAlignment.Center
                };

                image.SetBinding(OpacityProperty, opacityBinding);
                label.Content = image;

                // Einfügen ins Grid
                Grid.SetColumn(label, 0);
                Grid.SetRow(label, item.index);
                LayersStack.Children.Add(label);

                Grid.SetColumn(textBlock, 1);
                Grid.SetRow(textBlock, item.index);
                LayersStack.Children.Add(textBlock);

                var checkBox = new CheckBox
                {
                    IsChecked         = layers.IsVisible(item.layer),
                    Tag               = item.layer.Name,
                    Margin            = new Thickness(3),
                    VerticalAlignment = VerticalAlignment.Center,
                    ToolTip           = MapLocalizer.GetString(MapStringId.Visibility)
                };
                checkBox.Checked   += visibility_Checked;
                checkBox.Unchecked += visibility_Unchecked;
                Grid.SetColumn(checkBox, 2);
                Grid.SetRow(checkBox, item.index);
                LayersStack.Children.Add(checkBox);

                var slider = new Slider {
                    Tag = item.layer.Name, Margin = new Thickness(3), Width = 40, Minimum = 0, Maximum = 100, VerticalAlignment = VerticalAlignment.Center
                };
                // store any slider (used for calculation of header items later on.
                referenceSlider      = slider;
                slider.ValueChanged += slider_ValueChanged;
                slider.Value         = item.layer.Opacity * 100;
                Grid.SetColumn(slider, 4);
                Grid.SetRow(slider, item.index);
                LayersStack.Children.Add(slider);

                if (!(item.layer is ILayerGeoSearch))
                {
                    continue;                                   // IsChecked = null for the existence of an exclusive selectable layer
                }
                // and this layer itself is not exclusive selectable.

                checkBox = new CheckBox
                {
                    IsChecked         = true,
                    Tag               = item.layer.Name,
                    Margin            = new Thickness(3),
                    VerticalAlignment = VerticalAlignment.Center
                };
                // checkBox.IsThreeState = true; // By clicking it can be iterated through all three states.

                checkBox.Checked            += selection_Checked;
                checkBox.Unchecked          += selection_Unchecked;
                checkBox.MouseRightButtonUp += selection_Exclusive;
                checkBox.ToolTip             = MapLocalizer.GetString(MapStringId.Selectability);

                Grid.SetColumn(checkBox, selectionColumn);
                Grid.SetRow(checkBox, item.index);
                LayersStack.Children.Add(checkBox);
            }

            UpdateSelection();
        }
Beispiel #14
0
        private static string GetDescription(LayerObject layerObject)
        {
            string descr = layerObject?.descr;

            if (string.IsNullOrEmpty(descr))
            {
                return(string.Empty);
            }

            // match Values for xPOIAcc
            if (descr.Contains('#'))
            {
                var poidesc = descr.Split('#')[1];
                poidesc = poidesc.Trim('|').Replace("|", "\n");

                var match = Regex.Match(poidesc, @"^(?:[^\|=:]+):([^\|=:]*)$");
                if (match.Success)
                {
                    poidesc = match.Groups[1].Value;
                }

                return(poidesc);
            }

            // match KVP-style description string: a=b|b=c|... for Feature Layer
            var m = Regex.Match(descr, @"^(?!\|)(?:\|?([^\|=]+)=([^\|]*))+$");

            // no match - just return descr
            if (!m.Success)
            {
                return(descr);
            }

            var result  = new StringBuilder(4);
            var message = string.Empty;

            for (var i = 0; i < m.Groups[1].Captures.Count; ++i)
            {
                var key   = m.Groups[1].Captures[i].Value.Trim().ToUpper();
                var value = m.Groups[2].Captures[i].Value.Trim();

                switch (key)
                {
                // Traffic incidents
                case "ABSOLUTESPEED":
                    var s = Convert.ToInt16(value);
                    if (s > 0)
                    {
                        result.AppendWithSeparator(string.Format(MapLocalizer.GetString(MapStringId.ToolTipTrafficIncidentsAbsoluteSpeed), s), Environment.NewLine);
                    }
                    break;

                case "MESSAGE": message = value; break;

                case "LENGTH": result.AppendWithSeparator(string.Format(MapLocalizer.GetString(MapStringId.ToolTipTrafficIncidentsLength), Convert.ToDouble(value) / 1000), Environment.NewLine); break;

                case "DELAY": result.AppendWithSeparator(string.Format(MapLocalizer.GetString(MapStringId.ToolTipTrafficIncidentsDelay), Math.Round(Convert.ToDouble(value) / 60)), Environment.NewLine); break;

                // Truck attributes
                case "TOTALPERMITTEDWEIGHT": result.AppendWithSeparator(string.Format(MapLocalizer.GetString(MapStringId.ToolTipTruckAttributesTotalPermittedWeight), Convert.ToDouble(value)), Environment.NewLine); break;

                case "LOADTYPE":
                    switch (value)
                    {
                    case "0": value = MapLocalizer.GetString(MapStringId.ToolTipTruckAttributesLoadTypePassenger); break;

                    case "1": value = MapLocalizer.GetString(MapStringId.ToolTipTruckAttributesLoadTypeGoods); break;

                    default: value = MapLocalizer.GetString(MapStringId.ToolTipTruckAttributesLoadTypeMixed); break;
                    }
                    result.AppendWithSeparator(string.Format(MapLocalizer.GetString(MapStringId.ToolTipTruckAttributesLoadType), value), Environment.NewLine);
                    break;

                case "MAXHEIGHT": result.AppendWithSeparator(string.Format(MapLocalizer.GetString(MapStringId.ToolTipTruckAttributesMaxHeight), Convert.ToDouble(value) / 100), Environment.NewLine); break;

                case "MAXWEIGHT": result.AppendWithSeparator(string.Format(MapLocalizer.GetString(MapStringId.ToolTipTruckAttributesMaxWeight), Convert.ToDouble(value)), Environment.NewLine); break;

                case "MAXWIDTH": result.AppendWithSeparator(string.Format(MapLocalizer.GetString(MapStringId.ToolTipTruckAttributesMaxWidth), Convert.ToDouble(value) / 100), Environment.NewLine); break;

                case "MAXLENGTH": result.AppendWithSeparator(string.Format(MapLocalizer.GetString(MapStringId.ToolTipTruckAttributesMaxLength), Convert.ToDouble(value) / 100), Environment.NewLine); break;

                case "MAXAXLELOAD": result.AppendWithSeparator(string.Format(MapLocalizer.GetString(MapStringId.ToolTipTruckAttributesMaxAxleLoad), Convert.ToDouble(value)), Environment.NewLine); break;

                case "HAZARDOUSTOWATERS": result.AppendWithSeparator(MapLocalizer.GetString(MapStringId.ToolTipTruckAttributesHazardousToWaters), Environment.NewLine); break;

                case "HAZARDOUSGOODS": result.AppendWithSeparator(MapLocalizer.GetString(MapStringId.ToolTipTruckAttributesHazardousGoods), Environment.NewLine); break;

                case "COMBUSTIBLES": result.AppendWithSeparator(MapLocalizer.GetString(MapStringId.ToolTipTruckAttributesCombustibles), Environment.NewLine); break;

                case "FREEFORDELIVERY": result.AppendWithSeparator(MapLocalizer.GetString(MapStringId.ToolTipTruckAttributesFreeForDelivery), Environment.NewLine); break;

                case "TUNNELRESTRICTION": result.AppendWithSeparator(string.Format(MapLocalizer.GetString(MapStringId.ToolTipTruckAttributesTunnelRestriction), value), Environment.NewLine); break;
                }
            }

            if (!string.IsNullOrEmpty(message))
            {
                result.AppendWithSeparator(FormatToolTip(MapLocalizer.GetString(MapStringId.ToolTipTrafficIncidentsMessage), message), Environment.NewLine);
            }

            return(result.ToString());
        }