public bool MoveNext()
        {
            // check for cancel
            if (m_current != null && m_process != null && !m_process.Update(m_current))
            {
                return(false);
            }

            if (m_stream.Position < m_endPosition)
            {
                int bytesRead = m_stream.Read(m_buffer.Data, 0, m_usableBytesPerBuffer);

                if (bytesRead == 0)
                {
                    throw new Exception("I did something wrong");
                }

                if (m_stream.Position > m_endPosition)
                {
                    bytesRead -= (int)(m_stream.Position - m_endPosition);
                }

                int index = (m_current != null) ? m_current.Index + 1 : 0;
                m_current = new PointCloudBinarySourceEnumeratorChunk(index, m_buffer, bytesRead, m_source.PointSizeBytes, (float)(m_stream.Position - m_source.PointDataOffset) / (m_endPosition - m_source.PointDataOffset));

                return(true);
            }

            return(false);
        }
Пример #2
0
        public bool MoveNext()
        {
            // check for cancel
            if (m_current != null && m_process != null && !m_process.Update(m_current))
            {
                return(false);
            }

            if (m_tileEnumerator.MoveNext())
            {
                PointCloudTile tile = m_tileEnumerator.Current;
                tile.ReadTile(m_stream, m_buffer.Data);

                m_current = new PointCloudTileSourceEnumeratorChunk(tile, m_buffer);

                return(true);
            }
            return(false);
        }
        public bool MoveNext()
        {
            // check for cancel
            if (m_current != null && m_process != null)
            {
                long  pointsReadInPreviousSources = m_sources.Take(m_currentSourceIndex).Sum(s => s.Count);
                float progress = (pointsReadInPreviousSources + m_current.Progress * m_sources[m_currentSourceIndex].Count) / m_points;

                if (!m_process.Update(progress))
                {
                    return(false);
                }
            }

            if (m_currentSourceEnumerator != null && m_currentSourceEnumerator.MoveNext())
            {
                m_current = m_currentSourceEnumerator.Current;
                return(true);
            }

            while (m_currentSourceIndex < m_sources.Length - 1)
            {
                if (m_currentSourceEnumerator != null)
                {
                    m_currentSourceEnumerator.Dispose();
                }

                m_currentSourceIndex++;
                m_currentSourceEnumerator = m_sources[m_currentSourceIndex].GetBlockEnumerator(m_buffer);

                if (m_currentSourceEnumerator.MoveNext())
                {
                    m_current = m_currentSourceEnumerator.Current;
                    return(true);
                }
            }

            return(false);
        }