Beispiel #1
0
        public void ResetToVertex(int vertexIndex, int _pathIndex)
        {
            if (m_currentPathIndex >= 0 && m_currentPathIndex < m_parent.GetPathCount())
            {
                // check if we
                // are in
                // the
                // current
                // path
                int start = _getPathBegin();
                if (vertexIndex >= start && vertexIndex < m_parent.GetPathEnd(m_currentPathIndex))
                {
                    m_currentSegmentIndex = -1;
                    m_nextSegmentIndex    = vertexIndex - start;
                    return;
                }
            }
            int path_index;

            if (_pathIndex >= 0 && _pathIndex < m_parent.GetPathCount() && vertexIndex >= m_parent.GetPathStart(_pathIndex) && vertexIndex < m_parent.GetPathEnd(_pathIndex))
            {
                path_index = _pathIndex;
            }
            else
            {
                path_index = m_parent.GetPathIndexFromPointIndex(vertexIndex);
            }
            m_nextPathIndex       = path_index + 1;
            m_currentPathIndex    = path_index;
            m_currentSegmentIndex = -1;
            m_nextSegmentIndex    = vertexIndex - m_parent.GetPathStart(path_index);
            m_segmentCount        = _getSegmentCount(path_index);
            m_pathBegin           = m_parent.GetPathStart(m_currentPathIndex);
        }
Beispiel #2
0
        public SegmentIteratorImpl(com.epl.geometry.MultiPathImpl parent, int pointIndex)
        {
            if (pointIndex < 0 || pointIndex >= parent.GetPointCount())
            {
                throw new System.IndexOutOfRangeException();
            }
            m_currentSegmentIndex = -1;
            int path = parent.GetPathIndexFromPointIndex(pointIndex);

            m_nextSegmentIndex = pointIndex - parent.GetPathStart(path);
            m_nextPathIndex    = path + 1;
            m_currentPathIndex = path;
            m_parent           = parent;
            m_segmentCount     = _getSegmentCount(m_currentPathIndex);
            m_bCirculator      = false;
            m_currentSegment   = null;
            m_pathBegin        = m_parent.GetPathStart(m_currentPathIndex);
            m_dummyPoint       = new com.epl.geometry.Point2D();
        }
Beispiel #3
0
 /// <summary>Returns the path index from the point index.</summary>
 /// <remarks>Returns the path index from the point index. This is O(log N) operation.</remarks>
 /// <param name="pointIndex">The index of the point.</param>
 /// <returns>The index of the path.</returns>
 public virtual int GetPathIndexFromPointIndex(int pointIndex)
 {
     return(m_impl.GetPathIndexFromPointIndex(pointIndex));
 }