Пример #1
0
    // Return the list of cells crossed when moving from the start point
    // to the end point.
    CellList emit()
    {
        CellList cells;

        int gridX = xcell(m_xstart);
        int gridY = ycell(m_ystart);

        int xlast = xcell(m_xend);
        int ylast = ycell(m_yend);

        cells.push_back( {gridX, gridY} );
        while (gridX != xlast || gridY != ylast)
        {
            if (m_tMaxX < m_tMaxY)
            {
                m_tMaxX += m_tDeltaX;
                gridX += m_stepX;
            }
            else
            {
                m_tMaxY += m_tDeltaY;
                gridY += m_stepY;
            }
            cells.push_back( { gridX, gridY } );
        }
        return cells;
    }
Пример #2
0
SqlitePage::CellList SqlitePage::cellList() {
    CellList cellList;
    CellPointers cellPtrs = cellPointers();
    for (CellPointers::iterator pos = cellPtrs.begin();
         pos != cellPtrs.end(); ++pos) {
        CellInfo cellInfo;
        cellInfo.offset = *pos;
        base::varint_t vint_playload = parseVarint(page_.begin() + *pos, page_.end());
        base::varint_t vint_rowid = parseVarint(page_.begin() + *pos + vint_playload.length, page_.end());
        cellInfo.length = vint_playload.value + vint_playload.length + vint_rowid.length;
        cellList.push_back(cellInfo);
    }
    return cellList;
}
Пример #3
0
void ForestTechniqueManager::Cell::bin()
{
    // put trees in appropriate cells.
    TreeList treesNotAssigned;
    for(TreeList::iterator titr=_trees.begin();
        titr!=_trees.end();
        ++titr)
    {
        Tree* tree = titr->get();
        bool assigned = false;
        for(CellList::iterator citr=_cells.begin();
            citr!=_cells.end() && !assigned;
            ++citr)
        {
            if ((*citr)->contains(tree->_position))
            {
                (*citr)->addTree(tree);
                assigned = true;
            }
        }
        if (!assigned) treesNotAssigned.push_back(tree);
    }

    // put the unassigned trees back into the original local tree list.
    _trees.swap(treesNotAssigned);


    // prune empty cells.
    CellList cellsNotEmpty;
    for(CellList::iterator citr=_cells.begin();
        citr!=_cells.end();
        ++citr)
    {
        if (!((*citr)->_trees.empty()))
        {
            cellsNotEmpty.push_back(*citr);
        }
    }
    _cells.swap(cellsNotEmpty);


}
    virtual void visit(AstCell* nodep, AstNUser*) {
	// Must do ifaces first, so push to list and do in proper order
	m_cellps.push_back(nodep);
    }