inline typename SlicedCurvilinear<ScalarParam,dimensionParam,ValueScalarParam>::CellID SlicedCurvilinear<ScalarParam,dimensionParam,ValueScalarParam>::Cell::getNeighbourID( int neighbourIndex) const { int direction=neighbourIndex>>1; if(neighbourIndex&0x1) { if(index[direction]<ds->numCells[direction]-1) return CellID(baseVertexIndex+ds->vertexStrides[direction]); else return CellID(); } else { if(index[direction]>0) return CellID(baseVertexIndex-ds->vertexStrides[direction]); else return CellID(); } }
void ListCtrl::calcCellRect() { WFX_CONDITION(m_nStartRow != -1); WFX_CONDITION(m_nEndRow != -1); WFX_CONDITION(m_nStartCol != -1); WFX_CONDITION(m_nEndCol != -1); WFX_CONDITION(m_nEndRow >= m_nStartRow); WFX_CONDITION(m_nEndCol >= m_nEndCol); m_rgRectFast.clear(); m_rgRect.clear(); m_rgRowNumRect.clear(); ULONG nTotalRow = getTotalRows(); ULONG nTotalCol = getTotalColumns(); ULONG nSeqBarWidth = getRowNumBarWidth(); ULONG nHeadHeight = getHeadHeight(); Rect rcWid = getClientRect(); Rect rcCell = rcWid; Rect rcRowNum = rcWid; ULONG nWidth = 0; ULONG nHeight = 0; rcRowNum.right = rcRowNum.left + nSeqBarWidth; rcCell.left += nSeqBarWidth + 1; rcCell.top += nHeadHeight + 1; m_rgRectFast.resize(m_nEndRow - m_nStartRow + 1); for (LONG nRow = m_nStartRow; nRow <= m_nEndRow; nRow++) { nHeight = getRowHeight(nRow); rcCell.bottom = rcCell.top + nHeight; rcRowNum.top = rcCell.top; rcRowNum.bottom = rcCell.bottom; m_rgRowNumRect.push_back(rcRowNum); if (rcCell.bottom > rcWid.bottom) rcCell.bottom = rcWid.bottom; m_rgRectFast[nRow - m_nStartRow].resize(m_nEndCol - m_nStartCol + 1); for (LONG nCol = m_nStartCol; nCol <= m_nEndCol; nCol++) { nWidth = getColumnWidth(nCol); rcCell.right = rcCell.left + nWidth; m_rgRect.insert(std::make_pair(CellID(nRow, nCol), rcCell)); m_rgRectFast[nRow - m_nStartRow][nCol - m_nStartCol] = rcCell; rcCell.left += rcCell.right - rcCell.left; } rcCell.left = rcWid.left + nSeqBarWidth + 1; rcCell.top += rcCell.bottom - rcCell.top; } }