Beispiel #1
0
        private void RemoveLayer(NvgLayerItem layerItem)
        {
            var mapView = _viewModel.FocusMapView;

            if (null == mapView)
            {
                return;
            }

            // Remove the associated layer
            mapView.Map.Layers.Remove(layerItem.MessageLayer);
        }
Beispiel #2
0
        /// <summary>
        /// Processes all added NVG elements using the registered map view.
        /// Make sure this method is called from the UI thread!
        /// </summary>
        public async void ProcessAllMessages()
        {
            var mapView = _viewModel.FocusMapView;

            if (null == mapView)
            {
                return;
            }

            // Create a new message layer and wait till the layer was loaded
            var messageLayer = new MessageLayer();

            mapView.Map.Layers.Add(messageLayer);
            await mapView.LayersLoadedAsync(new[] { messageLayer });

            // Process all messages
            ulong messageCount = 0;
            var   layerName    = @"Message Layer";

            foreach (var nvgElement in _nvgElements)
            {
                messageCount += ProcessAllMessages(nvgElement, messageLayer);
            }

            // If only one NVG element was processed use the filename as the layer name
            if (1 == _nvgElements.Count)
            {
                var nvgFileMetadata = _nvgElements.First() as INvgFileMetadata;
                if (null != nvgFileMetadata?.FileInfo)
                {
                    layerName = nvgFileMetadata.FileInfo.Name;
                }
            }

            var nvgLayerItem = new NvgLayerItem(messageLayer)
            {
                Name         = layerName,
                MessageCount = messageCount
            };

            LayerItems.Add(nvgLayerItem);

            // Clear the elements
            _nvgElements.Clear();
        }