Exemplo n.º 1
0
        /// <summary>
        /// Executes reading the specified NVG file.
        /// </summary>
        /// <param name="filePath">The path to the NVG file.</param>
        public void Execute(object filePath)
        {
            var filePathAsString = filePath as string;

            if (null == filePathAsString || !CanExecute(filePath))
            {
                // TODO: Show message dialog to user!
                return;
            }

            // Read and add the geometries using the reader and view model
            using (var nvgReader = new NvgReader(filePathAsString))
            {
                INvgElement nvgElement;
                while (null != (nvgElement = nvgReader.ReadNextElement()))
                {
                    var nvgFileMetadata = nvgElement as INvgFileMetadata;
                    if (null != nvgFileMetadata)
                    {
                        nvgFileMetadata.FileInfo = new FileInfo(filePathAsString);
                    }
                    _viewModel.MessageViewModel.AddElement(nvgElement);
                }
            }
        }
Exemplo n.º 2
0
        public void TestNvgReadAis()
        {
            var aisFile = @"Data\AIS.nvg";

            Assert.IsTrue(File.Exists(aisFile), @"The NVG file does not exists!");

            var reader  = new NvgReader(aisFile);
            var element = reader.ReadNextElement() as NvgElement;

            Assert.IsNotNull(element, @"The NVG element must not be null!");

            Assert.AreEqual(@"0.3", element.Version, @"The NVG element version is not equal to 0.3!");
            Assert.AreEqual(183, element.Children.Count, @"The NVG child element count does not match!");
        }