protected PointCloudSource(FileHandlerBase handler) { m_id = IdentityManager.AcquireIdentity(GetType().Name); m_handler = handler; m_name = Path.GetFileName(FilePath); }
public Preview3D() { InitializeComponent(); m_id = IdentityManager.AcquireIdentity(GetType().Name); m_tileInfo = new Dictionary<PointCloudTile, TileInfo3D>(); //m_lowResMap = new Dictionary<PointCloudTile, Model3D>(); m_meshTileMap = new Dictionary<GeometryModel3D, PointCloudTile>(); m_loadedTiles = new Dictionary<PointCloudTile, GeometryModel3D>(); m_loadedTileBuffers = new Dictionary<PointCloudTile, byte[]>(); m_solidBrush = new SolidColorBrush(Colors.DarkKhaki); m_solidBrush.Freeze(); m_backgroundWorker = new ManagedBackgroundWorker(); m_backgroundWorker.WorkerReportsProgress = true; m_backgroundWorker.WorkerSupportsCancellation = true; m_backgroundWorker.DoWork += OnBackgroundDoWork; m_backgroundWorker.ProgressChanged += OnBackgroundProgressChanged; m_backgroundWorker.RunWorkerCompleted += OnBackgroundRunWorkerCompleted; m_timer = new Timer(); m_timer.Interval = 10; m_timer.Elapsed += OnTimerElapsed; }
public FileStreamUnbufferedSequentialWrite(string path, long length, long startPosition, bool truncateOnClose) { m_path = path; m_id = IdentityManager.AcquireIdentity(string.Format("{0}:{1}", this.GetType().Name, m_path)); m_buffer = BufferManager.AcquireBuffer(m_id, true); m_sectorSize = PathUtil.GetDriveSectorSize(m_path); m_length = length; m_lengthAligned = (m_length + (m_sectorSize - 1)) & (~(long)(m_sectorSize - 1)); m_truncateOnClose = truncateOnClose; const FileMode mode = FileMode.OpenOrCreate; const FileAccess access = FileAccess.Write; const FileShare share = FileShare.None; const FileOptions options = (FileFlagNoBuffering | FileOptions.WriteThrough | FileOptions.SequentialScan); m_stream = new FileStream(m_path, mode, access, share, BUFFER_SIZE, options); m_stream.SetLength(m_lengthAligned); long startPositionAligned = ((startPosition + (m_sectorSize - 1)) & (~(long)(m_sectorSize - 1))) - m_sectorSize; if (startPositionAligned >= 0) m_stream.Seek(startPositionAligned, SeekOrigin.Begin); else startPositionAligned = 0; m_bufferIndex = (int)(startPosition - startPositionAligned); }
public static Identity AcquireIdentity(string name, IdentityType type) { Identity id = new Identity(m_nextIncrementalValue, name, type); m_identities.Add(id); ++m_nextIncrementalValue; return id; }
static BufferManager() { c_id = IdentityManager.AcquireIdentity(typeof(BufferManager).Name); c_availableBuffersBySize = new Dictionary<int, Stack<BufferInstance>>(); c_availableBuffersBySize.Add(BUFFER_SIZE_BYTES, new Stack<BufferInstance>()); c_bufferMapping = new Dictionary<byte[], BufferInstance>(); c_usedBuffers = new Dictionary<BufferInstance, Identity>(); }
public ProcessingSet(FileHandlerBase inputFile) { m_id = IdentityManager.AcquireIdentity(GetType().Name); m_inputHandler = inputFile; var tiledPath = PointCloudTileSource.GetTileSourcePath(m_inputHandler.FilePath); m_tiledHandler = LASFile.Create(tiledPath, null); Directory.CreateDirectory(Path.GetDirectoryName(m_tiledHandler.FilePath)); }
public FileStreamUnbufferedSequentialRead(string path, long startPosition) { m_path = path; m_id = IdentityManager.AcquireIdentity(string.Format("{0}:{1}", GetType().Name, m_path)); m_buffer = BufferManager.AcquireBuffer(m_id, true); m_sectorSize = PathUtil.GetDriveSectorSize(m_path); m_bufferValidSize = m_buffer.Length; const FileMode mode = FileMode.Open; const FileAccess access = FileAccess.Read; const FileShare share = FileShare.Read; const FileOptions options = (FileFlagNoBuffering | FileOptions.WriteThrough | FileOptions.SequentialScan); m_stream = new FileStream(m_path, mode, access, share, BUFFER_SIZE, options); m_streamEnd = new FileStream(m_path, mode, access, share, BUFFER_SIZE, FileOptions.WriteThrough); Seek(startPosition); }
public PointCloudTileSource(LASFile file, PointCloudTileSet tileSet, Statistics zStats) : base(file, tileSet.PointCount, tileSet.Extent, file.Header.Quantization, file.Header.OffsetToPointData, (short)file.Header.PointDataRecordLength) { m_file = file; m_id = IdentityManager.AcquireIdentity(GetType().Name); m_tileSet = tileSet; m_tileSet.TileSource = this; m_statisticsZ = zStats; m_statisticsQuantizedZ = zStats.ConvertToQuantized(Quantization); m_lowResBuffer = BufferManager.AcquireBuffer(m_id, tileSet.LowResCount * PointSizeBytes); m_file.UpdateEVLR(new LASRecordIdentifier("Jacere", 0), TileSet); m_file.UpdateEVLR(new LASRecordIdentifier("Jacere", 1), StatisticsZ); }
public ProgressManagerProcess(ProgressManager progressManager, ProgressManagerProcess parent, string name) { m_progressManager = progressManager; m_id = IdentityManager.AcquireIdentity(name, IdentityType.Process); m_stopwatch = new Stopwatch(); m_parent = parent; m_children = new List<ProgressManagerProcess>(); m_progressManager.Update(0.0f); m_stopwatch.Start(); int i = 0; ProgressManagerProcess proc = this; while ((proc = proc.Parent) != null) i++; //Context.WriteLine(string.Format("{0}{1} -> Start", string.Empty.PadRight(2 * i), m_id)); //Context.WriteLine("{0}{1} {2}", string.Empty.PadRight(2 * i), m_id, "{"); ContextManager.WriteLine("{0}{1}", string.Empty.PadRight(2 * i), m_id); }
public static BufferInstance AcquireBuffer(Identity id) { return AcquireBuffer(id, BUFFER_SIZE_BYTES, false); }
public static BufferInstance AcquireBuffer(Identity id) { return(AcquireBuffer(id, BUFFER_SIZE_BYTES, false)); }
public static BufferInstance AcquireBuffer(Identity id, bool pin) { return(AcquireBuffer(id, BUFFER_SIZE_BYTES, pin)); }
public PointCloudTileManager(IPointCloudBinarySource source) { m_id = IdentityManager.AcquireIdentity(GetType().Name); m_source = source; }
public static BufferInstance AcquireBuffer(Identity id, int size) { return(AcquireBuffer(id, size, false)); }
public static BufferInstance AcquireBuffer(Identity id, int size) { return AcquireBuffer(id, size, false); }
public static BufferInstance AcquireBuffer(Identity id, bool pin) { return AcquireBuffer(id, BUFFER_SIZE_BYTES, pin); }
public static void ReleaseBuffers(Identity id) { lock (typeof(BufferManager)) { ReleaseBuffers(c_usedBuffers.Where(kvp => kvp.Value == id).Select(kvp => kvp.Key).ToArray()); } }
public static BufferInstance AcquireBuffer(Identity id, int size, bool pin) { // make sure size is reasonable BufferInstance buffer = null; lock (typeof(BufferManager)) { Stack<BufferInstance> availableBuffers = GetAvailableBuffers(size, false); if (availableBuffers != null && availableBuffers.Count > 0) { buffer = availableBuffers.Pop(); } else { var b = new byte[size]; buffer = new BufferInstance(b); c_bufferMapping.Add(b, buffer); } c_usedBuffers.Add(buffer, id); } if (pin && !buffer.Pinned) buffer.PinBuffer(); return buffer; }