示例#1
0
void GLWidget::updateIfNeeded() {
    if(m_revizNeeded) {
        visualizeLayer(m_activeLayer);
        m_revizNeeded = false;
    }
    if(m_repaintNeeded) {
        update();
        m_repaintNeeded = false;
    }
}
示例#2
0
void CCoverageHandler::update() {
	std::map<CCoverageCell::NType, std::list<CCoverageCell*> >::iterator itLayer;
	std::list<CCoverageCell*>::iterator itCell;
	std::list<CUnit*> uncovered;

	for (itLayer = layers.begin(); itLayer != layers.end(); ++itLayer) {
		uncovered.clear();

		for (itCell = itLayer->second.begin(); itCell != itLayer->second.end(); ++itCell)
			(*itCell)->update(uncovered);

		if (!uncovered.empty()) {
			std::list<CUnit*>::iterator itUnit;
			std::map<int, CCoverageCell*>* coveredUnits = &unitsCoveredBy[itLayer->first];

			for (itUnit = uncovered.begin(); itUnit != uncovered.end(); ++itUnit) {
				CUnit* unit = *itUnit;
				coveredUnits->erase(unit->key);
				assert(unitsCoveredCount[unit->key] > 0);
				if(--unitsCoveredCount[unit->key] == 0) {
					unit->unreg(*this); // no need to track this unit anymore
				}
				addUnit(unit);
			}

			// re-assign uncovered units to existing cores...
			for (itUnit = uncovered.begin(); itUnit != uncovered.end(); ++itUnit) {
				addUnit(*itUnit);
			}
		}
	}

	if (visualizationEnabled) {
		visualizeLayer(visualizationLayer);
	}
}