public void CanRetrieveFileFormat()
        {
            PointCloudFileFormat.Register(new PointCloudFileFormat("Test Description 2", new[] { ".test2" }, null, null));

            var format = PointCloudFileFormat.FromFileName(@"C:\Data\pointcloud.test2");

            Assert.IsTrue(format != null);
            Assert.IsTrue(format.Description == "Test Description 2");
        }
        public void CanRetrieveFileFormat2()
        {
            PointCloudFileFormat.Register(new PointCloudFileFormat("Test Description 3", new[] { ".test3", ".tst3" }, null, null));

            var format1 = PointCloudFileFormat.FromFileName(@"C:\Data\pointcloud.test3");
            var format2 = PointCloudFileFormat.FromFileName(@"C:\Data\pointcloud.tst3");

            Assert.IsTrue(format1 != null && format1.Description == "Test Description 3");
            Assert.IsTrue(format2 != null && format2.Description == "Test Description 3");
        }
Esempio n. 3
0
 /// <summary>
 /// Parses file.
 /// Format is guessed based on file extension.
 /// </summary>
 public static IEnumerable <Chunk> Parse(string filename, ParseConfig config)
 {
     if (filename == null)
     {
         throw new ArgumentNullException(nameof(filename));
     }
     if (!File.Exists(filename))
     {
         throw new FileNotFoundException($"File does not exit ({filename}).", filename);
     }
     return(PointCloudFileFormat.FromFileName(filename).ParseFile(filename, config));
 }
Esempio n. 4
0
        /// <summary>
        /// Imports file into out-of-core store.
        /// Format is guessed based on file extension.
        /// </summary>
        public static PointSet Import(string filename, string storeDirectory, LruDictionary <string, object> cache)
        {
            if (filename == null)
            {
                throw new ArgumentNullException(nameof(filename));
            }
            if (!File.Exists(filename))
            {
                throw new FileNotFoundException("File does not exit.", filename);
            }

            var config = ImportConfig.Default
                         .WithStorage(OpenStore(storeDirectory, cache))
                         .WithKey(FileHelpers.ComputeMd5Hash(filename, true))
            ;

            var result = PointCloudFileFormat.FromFileName(filename).ImportFile(filename, config);

            config.Storage.Flush();
            return(result);
        }
Esempio n. 5
0
        /// <summary>
        /// Imports file.
        /// Format is guessed based on file extension.
        /// </summary>
        public static PointSet Import(string filename, ImportConfig config = null)
        {
            if (filename == null)
            {
                throw new ArgumentNullException(nameof(filename));
            }
            if (!File.Exists(filename))
            {
                throw new FileNotFoundException("File does not exit.", filename);
            }

            if (config == null)
            {
                config = ImportConfig.Default
                         .WithInMemoryStore()
                         .WithKey(FileHelpers.ComputeMd5Hash(filename, true))
                ;
            }

            return(PointCloudFileFormat.FromFileName(filename).ImportFile(filename, config));
        }
Esempio n. 6
0
 /// <summary></summary>
 public static PointSet ImportFile(this PointCloudFileFormat self, string filename, ImportConfig config)
 => PointCloud.Chunks(self.ParseFile(filename, config.ParseConfig), config);
Esempio n. 7
0
 /// <summary>
 /// Gets general info for given point cloud file.
 /// </summary>
 public static PointFileInfo ParseFileInfo(string filename, ParseConfig config)
 => PointCloudFileFormat.FromFileName(filename).ParseFileInfo(filename, config);
Esempio n. 8
0
 static Pts()
 {
     PtsFormat = new PointCloudFileFormat("pts", new[] { ".pts" }, PtsInfo, Chunks);
     PointCloudFileFormat.Register(PtsFormat);
 }
Esempio n. 9
0
 static Yxh()
 {
     YxhFormat = new PointCloudFileFormat("yxh", new[] { ".yxh" }, YxhInfo, Chunks);
     PointCloudFileFormat.Register(YxhFormat);
 }
Esempio n. 10
0
 static E57()
 {
     E57Format = new PointCloudFileFormat("e57", new[] { ".e57" }, E57Info, Chunks);
     PointCloudFileFormat.Register(E57Format);
 }
Esempio n. 11
0
        public void UnknownFileFormatGivesUnknown()
        {
            var format = PointCloudFileFormat.FromFileName(@"C:\Data\pointcloud.foo");

            Assert.IsTrue(format == PointCloudFileFormat.Unknown);
        }
Esempio n. 12
0
 public void CanRegisterFileFormat()
 {
     PointCloudFileFormat.Register(new PointCloudFileFormat("Test Description 1", new[] { ".test1" }, null, null));
 }
Esempio n. 13
0
 static Laszip()
 {
     LaszipFormat = new PointCloudFileFormat("LASzip", new[] { ".las", ".laz" }, LaszipInfo, Chunks);
     PointCloudFileFormat.Register(LaszipFormat);
 }