Ejemplo n.º 1
0
bool GisBinFile::readCompressdRow(int row, char* charValues)
{
    char nBytes;
    if(file_.get(nBytes))
    {
        if((int) nBytes == 4 || (int) nBytes == 8)
        {
            setWordSize((int) nBytes);
            int totBytes = nCols() * dataSize_;
            gotoPos(row * nBytes + 1L);
            int rowSize;
            if((int) nBytes == 4)
            {
                int rowPtr, nextRowPtr;
                read(&rowPtr);
                read(&nextRowPtr);
                gotoPos(rowPtr);
                rowSize = nextRowPtr - rowPtr - 1;
            }
            else
            {
                off_t rowPtr, nextRowPtr;
                read(&rowPtr);
                read(&nextRowPtr);
                gotoPos(rowPtr);
                rowSize = nextRowPtr - rowPtr;
            }
            char compressFlag;
            file_.get(compressFlag);
            //			if ( rowSize < totBytes )
            if((compressFlag == 0x01) && ((rowSize - 1) < totBytes))
            {
                unsigned int i = 0;
                while (i < totBytes)
                {
                    char charCount;
                    file_.get(charCount);
                    char charValue;
                    file_.get(charValue);
                    unsigned int j = 0;
                    for(j = i; j < i + (unsigned char) charCount; j++)
                        charValues[j] = charValue;
                    i += (unsigned char) charCount;
                }
            }
            else
                this->readNChar(charValues, totBytes);
            return true;
        }
    }
    return false;
}
Ejemplo n.º 2
0
/** No descriptions */
void DirHistoryButton::slotPopupActivated(QAction * action)
{
    if (action && action->data().canConvert<int>()) {
        int id = action->data().toInt();
        emit gotoPos(id);
    }
}
Ejemplo n.º 3
0
void CMap::refreshStripes()
{
    const int oldx = m_mapx<<4;
    const int oldy = m_mapy<<4;

    resetScrolls();

    gotoPos(oldx, oldy);
}
Ejemplo n.º 4
0
bool GisBinFile::readCompressdRow(int row, float* floatValues)
{
    char nBytes;
    if(file_.get(nBytes))
    {
        if((int) nBytes == 4 || (int) nBytes == 8)
        {
            setWordSize((int) nBytes);
            int totBytes = nCols() * dataSize_;
            unsigned char* expandedValues = new unsigned char[totBytes];
            gotoPos(row * nBytes + 1L);
            int rowSize;
            if((int) nBytes == 4)
            {
                int rowPtr, nextRowPtr;
                read(&rowPtr);
                read(&nextRowPtr);
                gotoPos(rowPtr);
                rowSize = nextRowPtr - rowPtr - 1;
            }
            else
            {
                off_t rowPtr, nextRowPtr;
                read(&rowPtr);
                read(&nextRowPtr);
                gotoPos(rowPtr);
                rowSize = nextRowPtr - rowPtr - 1;
            }
            char compressFlag;
            file_.get(compressFlag);
            if(compressFlag == 0x31)
            {
                unsigned char* charValues = new unsigned char[rowSize];
                this->readNChar((char *) charValues, rowSize);
                if(!GisUncompress(rowSize, charValues, totBytes, expandedValues))
                {
                    delete[] charValues;
                    return false;
                }
                delete[] charValues;
            }
            else
                this->readNChar((char *) expandedValues, totBytes);
            int i = 0;
            int j = 0;
            while (i < totBytes)
            {
                char fvalchar[4];
                for(int k = 0; k < 4; k++)
                {
                    if(swappMode_)
                        fvalchar[3 - k] = expandedValues[i++];
                    else
                        fvalchar[k] = expandedValues[i++];
                }
                floatValues[j++] = *((float*) &fvalchar[0]);
            }
            delete[] expandedValues;
            return true;
        }
    }
    return false;
}