Exemplo n.º 1
0
        internal override int QueryCoordinates(com.epl.geometry.Point2D[] dst, int dstSize, int beginIndex, int endIndex)
        {
            int endIndexC = endIndex < 0 ? m_pointCount : endIndex;

            endIndexC = System.Math.Min(endIndexC, beginIndex + dstSize);
            if (beginIndex < 0 || beginIndex >= m_pointCount || endIndexC < beginIndex || dst.Length != dstSize)
            {
                throw new System.ArgumentException();
            }
            // GEOMTHROW(invalid_argument);
            com.epl.geometry.AttributeStreamOfDbl xy = (com.epl.geometry.AttributeStreamOfDbl)GetAttributeStreamRef(com.epl.geometry.VertexDescription.Semantics.POSITION);
            int pointCountToRead = endIndexC - beginIndex;

            double[] dstArray = new double[pointCountToRead * 2];
            xy.ReadRange(2 * beginIndex, pointCountToRead * 2, dstArray, 0, true);
            for (int i = 0; i < pointCountToRead; i++)
            {
                dst[i] = new com.epl.geometry.Point2D(dstArray[i * 2], dstArray[i * 2 + 1]);
            }
            return(endIndexC);
        }
        // Checked vs. Jan 11, 2011
        internal virtual int QueryCoordinates(com.epl.geometry.Point2D[] dst, int dstSize, int beginIndex, int endIndex)
        {
            int endIndexC = endIndex < 0 ? m_pointCount : endIndex;

            endIndexC = System.Math.Min(endIndexC, beginIndex + dstSize);
            if (beginIndex < 0 || beginIndex >= m_pointCount || endIndexC < beginIndex)
            {
                throw new System.ArgumentException();
            }
            com.epl.geometry.AttributeStreamOfDbl xy = (com.epl.geometry.AttributeStreamOfDbl)GetAttributeStreamRef(com.epl.geometry.VertexDescription.Semantics.POSITION);
            int j = 0;

            double[] dstArray = new double[dst.Length * 2];
            xy.ReadRange(2 * beginIndex, (endIndexC - beginIndex) * 2, dstArray, j, true);
            for (int i = 0; i < dst.Length; i++)
            {
                dst[i] = new com.epl.geometry.Point2D(dstArray[i * 2], dstArray[i * 2 + 1]);
            }
            // for (int i = beginIndex; i < endIndexC; i++, j++)
            // {
            // xy.read(2 * i, dst[j]);
            // }
            return(endIndexC);
        }