Пример #1
0
/*
 * @brief answers the requets for the computed tiles. Called by RequestManager
 */
void Job::deliver()
{
	if (empty)
	{
		shared_ptr<Tile> tile = computeEmpty();
		for (auto& id : mid->getIdentifiers())
		{
			for (auto& req : requests[*id])
				req->answer(tile);
		}
	} else {
		const shared_ptr<Renderer>& renderer = manager->getRenderer();
		STAT_START(Statistic::Slicing);
		for (auto& tile : tiles) {
			if (!tile->isRendered())
				renderer->sliceTile(meta, tile);

			for (auto& req : requests[*tile->getIdentifier()])
				req->answer(tile);
		}
		if (!cached)
			STAT_STOP(Statistic::Slicing);
	}

	STAT_WRITE();
}
GenericIt<Type>& GenericIt<Type>::operator++ () {
  STAT_START(GenericItIncrement);
  ASSERT(_state < TRANSFORMATIONS_LEN, "Iterating over an exhausted iterator");

  while ( ++_state != TRANSFORMATIONS_LEN ) {
    //_current.move(TRANSFORMATIONS[_state][0], TRANSFORMATIONS[_state][1]);
    _current.move(TRANSFORMATIONS[_state]);
    if (_current.isCoordOk(*_board)) break;
    //if (_current.x() < 9 && _current.y() < 9) break;
  }
  STAT_STOP(GenericItIncrement);
  return *this;
}
Пример #3
0
/**
 * @brief Computes a all tiles contained in the MetaIdentifier.
 *
 **/
void Job::process()
{
	shared_ptr<Geodata> geodata = manager->getGeodata();

	FixedRect rect = computeRect(mid);
	STAT_START(Statistic::GeoContainsData);
		empty = !geodata->containsData(rect);
	STAT_STOP(Statistic::GeoContainsData);

	if(empty) {
		STAT_WRITE();
		return;
	}

	cached = initTiles();
	if (cached) {
		STAT_WRITE();
		return;
	}

	STAT_START(Statistic::GeoNodes);
		auto nodeIDs = geodata->getNodeIDs(rect);
	STAT_STOP(Statistic::GeoNodes);

	STAT_START(Statistic::GeoWays);
		auto wayIDs = geodata->getWayIDs(rect);
	STAT_STOP(Statistic::GeoWays);

	STAT_START(Statistic::GeoRelation);
		auto relationIDs = geodata->getRelationIDs(rect);
	STAT_STOP(Statistic::GeoRelation);

	STAT_STATS(nodeIDs->size(), wayIDs->size(), relationIDs->size());

	shared_ptr<Stylesheet> stylesheet = manager->getStylesheetManager()->getStylesheet(mid->getStylesheetPath());
	RenderAttributes renderAttributes;
	STAT_START(Statistic::StylesheetMatch);
		stylesheet->match(nodeIDs, wayIDs, relationIDs, mid, &renderAttributes);
	STAT_STOP(Statistic::StylesheetMatch);

	const shared_ptr<Renderer>& renderer = manager->getRenderer();
	STAT_START(Statistic::Renderer);
		renderer->renderMetaTile(renderAttributes, meta);
	STAT_STOP(Statistic::Renderer);
}
ColorIt<ColorPredicate,CellIterator>& ColorIt<ColorPredicate,CellIterator>::operator++() {
  STAT_START(ColorItIncrement);
  ASSERT(_it != CellIterator::END_IT, "Iterating over an exhausted iterator");

  for (++_it; _it != CellIterator::END_IT; ++_it) {
    const BoardCell& iCell = *_it;
    if (ColorPredicate( _it.value() ) && !_mask.testAndSet(iCell.x(), iCell.y()) ) {
      _stack.push_back(iCell);
      //_stack[_level++] = iCell;
    }  
  }

  //LOG_DEBUG("After iterating on neighbourgs " << toString());
  //if(_level) {
  if(!_stack.empty()) {
    _it.reset(_stack.back());
    _stack.pop_back();
    //_it.reset(_stack[--_level]);
  } 

  STAT_STOP(ColorItIncrement);
  return *this;
}