本文整理汇总了C++中constOf函数的典型用法代码示例。如果您正苦于以下问题:C++ constOf函数的具体用法?C++ constOf怎么用?C++ constOf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了constOf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: collectSources
std::shared_ptr<OsmAnd::ObfDataInterface> OsmAnd::ObfsCollection_P::obtainDataInterface() const
{
// Check if sources were invalidated
if (_collectedSourcesInvalidated.loadAcquire() > 0)
collectSources();
// Create ObfReaders from collected sources
QList< std::shared_ptr<const ObfReader> > obfReaders;
{
QReadLocker scopedLocker(&_collectedSourcesLock);
for(const auto& collectedSources : constOf(_collectedSources))
{
obfReaders.reserve(obfReaders.size() + collectedSources.size());
for(const auto& obfFile : constOf(collectedSources))
{
std::shared_ptr<const ObfReader> obfReader(new ObfReader(obfFile));
if (!obfReader->isOpened() || !obfReader->obtainInfo())
continue;
obfReaders.push_back(qMove(obfReader));
}
}
}
return std::shared_ptr<ObfDataInterface>(new ObfDataInterface(obfReaders));
}
开发者ID:rotorliu,项目名称:OsmAnd-core,代码行数:26,代码来源:ObfsCollection_P.cpp
示例2: resolvedRuleNode
std::shared_ptr<OsmAnd::ResolvedMapStyle_P::RuleNode> OsmAnd::ResolvedMapStyle_P::resolveRuleNode(
const std::shared_ptr<const UnresolvedMapStyle::RuleNode>& unresolvedRuleNode)
{
const std::shared_ptr<RuleNode> resolvedRuleNode(new RuleNode(
unresolvedRuleNode->isSwitch));
// Resolve values
for (const auto& itUnresolvedValueEntry : rangeOf(constOf(unresolvedRuleNode->values)))
{
const auto& name = itUnresolvedValueEntry.key();
const auto& value = itUnresolvedValueEntry.value();
// Find value definition id and object
const auto valueDefId = getValueDefinitionIdByName(name);
const auto& valueDef = getValueDefinitionById(valueDefId);
if (valueDefId < 0 || !valueDef)
{
LogPrintf(LogSeverityLevel::Warning,
"Ignoring unknown value '%s' = '%s'",
qPrintable(name),
qPrintable(value));
continue;
}
// Try to resolve value
ResolvedValue resolvedValue;
if (!resolveValue(value, valueDef->dataType, valueDef->isComplex, resolvedValue))
{
LogPrintf(LogSeverityLevel::Warning,
"Ignoring value for '%s' since '%s' can not be resolved",
qPrintable(name),
qPrintable(value));
continue;
}
resolvedRuleNode->values[valueDefId] = resolvedValue;
}
// <switch>/<case> subnodes
for (const auto& unresolvedChild : constOf(unresolvedRuleNode->oneOfConditionalSubnodes))
{
const auto resolvedChild = resolveRuleNode(unresolvedChild);
if (!resolvedChild)
return nullptr;
resolvedRuleNode->oneOfConditionalSubnodes.push_back(resolvedChild);
}
// <apply> subnodes
for (const auto& unresolvedChild : constOf(unresolvedRuleNode->applySubnodes))
{
const auto resolvedChild = resolveRuleNode(unresolvedChild);
if (!resolvedChild)
return nullptr;
resolvedRuleNode->applySubnodes.push_back(resolvedChild);
}
return resolvedRuleNode;
}
开发者ID:kalegs,项目名称:OsmAnd-core,代码行数:60,代码来源:ResolvedMapStyle_P.cpp
示例3: _useBasemap
OsmAnd::RoutePlannerContext::RoutePlannerContext(
const QList< std::shared_ptr<ObfReader> >& sources,
const std::shared_ptr<RoutingConfiguration>& routingConfig,
const QString& vehicle,
bool useBasemap,
float initialHeading /*= std::numeric_limits<float>::quiet_NaN()*/,
QHash<QString, QString>* options /*=nullptr*/,
size_t memoryLimit )
: _useBasemap(useBasemap)
, _memoryUsageLimit(memoryLimit)
, _loadedTiles(0)
, _initialHeading(initialHeading)
, sources(sources)
, configuration(routingConfig)
, _routeStatistics(new RouteStatistics)
, profileContext(new RoutingProfileContext(configuration->routingProfiles[vehicle], options))
{
_partialRecalculationDistanceLimit = Utilities::parseArbitraryFloat(configuration->resolveAttribute(vehicle, "recalculateDistanceHelp"), 10000.0f);
_heuristicCoefficient = Utilities::parseArbitraryFloat(configuration->resolveAttribute(vehicle, "heuristicCoefficient"), 1.0f);
_planRoadDirection = Utilities::parseArbitraryInt(configuration->resolveAttribute(vehicle, "planRoadDirection"), 0);
_roadTilesLoadingZoomLevel = Utilities::parseArbitraryUInt(configuration->resolveAttribute(vehicle, "zoomToLoadTiles"), DefaultRoadTilesLoadingZoomLevel);
for(const auto& source : constOf(sources))
{
const auto& obfInfo = source->obtainInfo();
for(const auto& routingSection : constOf(obfInfo->routingSections))
_sourcesLUT.insert(routingSection.get(), source);
}
}
开发者ID:SfietKonstantin,项目名称:OsmAnd-core,代码行数:29,代码来源:RoutePlannerContext.cpp
示例4:
bool OsmAnd::ObfDataInterface::loadMapObjects(
QList< std::shared_ptr<const OsmAnd::Model::BinaryMapObject> >* resultOut, MapFoundationType* foundationOut,
const AreaI& area31, const ZoomLevel zoom,
const IQueryController* const controller /*= nullptr*/, const FilterMapObjectsByIdSignature filterById /*= nullptr*/,
ObfMapSectionReader_Metrics::Metric_loadMapObjects* const metric /*= nullptr*/)
{
if (foundationOut)
*foundationOut = MapFoundationType::Undefined;
// Iterate through all OBF readers
for(const auto& obfReader : constOf(obfReaders))
{
// Check if request is aborted
if (controller && controller->isAborted())
return false;
// Iterate over all map sections of each OBF reader
const auto& obfInfo = obfReader->obtainInfo();
for(const auto& mapSection : constOf(obfInfo->mapSections))
{
// Check if request is aborted
if (controller && controller->isAborted())
return false;
// Read objects from each map section
OsmAnd::ObfMapSectionReader::loadMapObjects(obfReader, mapSection, zoom, &area31, resultOut, foundationOut, filterById, nullptr, controller, metric);
}
}
return true;
}
开发者ID:rotorliu,项目名称:OsmAnd-core,代码行数:31,代码来源:ObfDataInterface.cpp
示例5: shared_from_this
bool OsmAnd::MapRendererKeyedSymbolsResource::obtainData(bool& dataAvailable, const IQueryController* queryController)
{
// Obtain collection link and maintain it
const auto link_ = link.lock();
if (!link_)
return false;
const auto collection = static_cast<MapRendererKeyedResourcesCollection*>(&link_->collection);
// Get source
std::shared_ptr<IMapDataProvider> provider_;
bool ok = resourcesManager->obtainProviderFor(static_cast<MapRendererBaseResourcesCollection*>(collection), provider_);
if (!ok)
return false;
const auto provider = std::static_pointer_cast<IMapKeyedDataProvider>(provider_);
// Obtain source data from provider
std::shared_ptr<IMapKeyedDataProvider::Data> keyedData;
const auto requestSucceeded = provider->obtainData(key, keyedData);
if (!requestSucceeded)
return false;
// Store data
dataAvailable = static_cast<bool>(keyedData);
if (dataAvailable)
_sourceData = std::static_pointer_cast<IMapKeyedSymbolsProvider::Data>(keyedData);
// Process data
if (!dataAvailable)
return true;
// Convert data
for (const auto& mapSymbol : constOf(_sourceData->symbolsGroup->symbols))
{
const auto rasterMapSymbol = std::dynamic_pointer_cast<RasterMapSymbol>(mapSymbol);
if (!rasterMapSymbol)
continue;
rasterMapSymbol->bitmap = resourcesManager->adjustBitmapToConfiguration(
rasterMapSymbol->bitmap,
AlphaChannelPresence::Present);
}
// Register all obtained symbols
_mapSymbolsGroup = _sourceData->symbolsGroup;
const auto self = shared_from_this();
QList< PublishOrUnpublishMapSymbol > mapSymbolsToPublish;
mapSymbolsToPublish.reserve(_mapSymbolsGroup->symbols.size());
for (const auto& symbol : constOf(_mapSymbolsGroup->symbols))
{
PublishOrUnpublishMapSymbol mapSymbolToPublish = {
_mapSymbolsGroup,
std::static_pointer_cast<const MapSymbol>(symbol),
self };
mapSymbolsToPublish.push_back(mapSymbolToPublish);
}
resourcesManager->batchPublishMapSymbols(mapSymbolsToPublish);
return true;
}
开发者ID:jmakovicka,项目名称:OsmAnd-core,代码行数:59,代码来源:MapRendererKeyedSymbolsResource.cpp
示例6: iteratorOf
bool OsmAnd::ResolvedMapStyle_P::mergeAndResolveParameters()
{
// Process styles chain in direct order, to exclude redefined parameters
auto citUnresolvedMapStyle = iteratorOf(owner->unresolvedMapStylesChain);
while (citUnresolvedMapStyle.hasNext())
{
const auto& unresolvedMapStyle = citUnresolvedMapStyle.next();
for (const auto& unresolvedParameter : constOf(unresolvedMapStyle->parameters))
{
const auto nameId = resolveStringIdInLUT(unresolvedParameter->name);
auto& resolvedParameter = _parameters[nameId];
// Skip already defined parameters
if (resolvedParameter)
continue;
// Resolve possible values
QList<MapStyleConstantValue> resolvedPossibleValues;
for (const auto& possibleValue : constOf(unresolvedParameter->possibleValues))
{
MapStyleConstantValue resolvedPossibleValue;
if (!parseConstantValue(possibleValue, unresolvedParameter->dataType, false, resolvedPossibleValue))
{
LogPrintf(LogSeverityLevel::Error,
"Failed to parse '%s' as possible value for '%s' (%s)",
qPrintable(possibleValue),
qPrintable(unresolvedParameter->name),
qPrintable(unresolvedParameter->title));
return false;
}
resolvedPossibleValues.push_back(qMove(resolvedPossibleValue));
}
// Create new resolved parameter
const std::shared_ptr<Parameter> newResolvedParameter(new Parameter(
unresolvedParameter->title,
unresolvedParameter->description,
unresolvedParameter->category,
nameId,
unresolvedParameter->dataType,
resolvedPossibleValues));
resolvedParameter = newResolvedParameter;
// Register parameter as value definition
const auto newValueDefId = _valuesDefinitions.size();
const std::shared_ptr<ParameterValueDefinition> inputValueDefinition(new ParameterValueDefinition(
newValueDefId,
unresolvedParameter->name,
newResolvedParameter));
_valuesDefinitions.push_back(inputValueDefinition);
_valuesDefinitionsIndicesByName.insert(unresolvedParameter->name, newValueDefId);
}
}
return true;
}
开发者ID:kalegs,项目名称:OsmAnd-core,代码行数:58,代码来源:ResolvedMapStyle_P.cpp
示例7: LogPrintf
bool OsmAnd::MapRendererKeyedSymbolsResource::uploadToGPU()
{
bool ok;
bool anyUploadFailed = false;
const auto link_ = link.lock();
const auto collection = static_cast<MapRendererKeyedResourcesCollection*>(&link_->collection);
QHash< std::shared_ptr<MapSymbol>, std::shared_ptr<const GPUAPI::ResourceInGPU> > uploaded;
for (const auto& symbol : constOf(_sourceData->symbolsGroup->symbols))
{
// Prepare data and upload to GPU
std::shared_ptr<const GPUAPI::ResourceInGPU> resourceInGPU;
ok = resourcesManager->uploadSymbolToGPU(symbol, resourceInGPU);
// If upload have failed, stop
if (!ok)
{
LogPrintf(LogSeverityLevel::Error, "Failed to upload keyed symbol");
anyUploadFailed = true;
break;
}
// Mark this symbol as uploaded
uploaded.insert(symbol, qMove(resourceInGPU));
}
// If at least one symbol failed to upload, consider entire tile as failed to upload,
// and unload its partial GPU resources
if (anyUploadFailed)
{
uploaded.clear();
return false;
}
// All resources have been uploaded to GPU successfully by this point
_retainableCacheMetadata = _sourceData->retainableCacheMetadata;
_sourceData.reset();
for (const auto& entry : rangeOf(constOf(uploaded)))
{
const auto& symbol = entry.key();
auto& resource = entry.value();
// Unload GPU data from symbol, since it's uploaded already
resourcesManager->releaseGpuUploadableDataFrom(symbol);
// Move reference
_resourcesInGPU.insert(symbol, qMove(resource));
}
return true;
}
开发者ID:jmakovicka,项目名称:OsmAnd-core,代码行数:55,代码来源:MapRendererKeyedSymbolsResource.cpp
示例8:
bool OsmAnd::ObfDataInterface::loadIntersectionsFromStreets(
const QList< std::shared_ptr<const Street> >& streets,
QHash< std::shared_ptr<const Street>, QList< std::shared_ptr<const StreetIntersection> > >* resultOut /*= nullptr*/,
const AreaI* const bbox31 /*= nullptr*/,
const ObfAddressSectionReader::IntersectionVisitorFunction visitor /*= nullptr*/,
const std::shared_ptr<const IQueryController>& queryController /*= nullptr*/)
{
for (const auto& obfReader : constOf(obfReaders))
{
if (queryController && queryController->isAborted())
return false;
const auto& obfInfo = obfReader->obtainInfo();
for (const auto& addressSection : constOf(obfInfo->addressSections))
{
if (queryController && queryController->isAborted())
return false;
if (bbox31)
{
bool accept = false;
accept = accept || addressSection->area31.contains(*bbox31);
accept = accept || addressSection->area31.intersects(*bbox31);
accept = accept || bbox31->contains(addressSection->area31);
if (!accept)
continue;
}
for (const auto& street : constOf(streets))
{
if (addressSection != street->streetGroup->obfSection)
continue;
QList< std::shared_ptr<const StreetIntersection> > intermediateResult;
OsmAnd::ObfAddressSectionReader::loadIntersectionsFromStreet(
obfReader,
street,
resultOut ? &intermediateResult : nullptr,
bbox31,
visitor,
queryController);
if (resultOut)
resultOut->insert(street, intermediateResult);
}
}
}
return true;
}
开发者ID:vasvlad,项目名称:OsmAnd-core,代码行数:51,代码来源:ObfDataInterface.cpp
示例9: routingRule
void OsmAnd::RoutingConfiguration::parseRoutingRuleset( QXmlStreamReader* xmlParser, RoutingProfile* routingProfile, RoutingRuleset::Type rulesetType, QStack< std::shared_ptr<struct RoutingRule> >& ruleset )
{
const auto& attribs = xmlParser->attributes();
std::shared_ptr<RoutingRule> routingRule(new RoutingRule());
routingRule->_tagName = xmlParser->name().toString();
routingRule->_t = attribs.value("t").toString();
routingRule->_v = attribs.value("v").toString();
routingRule->_param = attribs.value("param").toString();
routingRule->_value1 = attribs.value("value1").toString();
routingRule->_value2 = attribs.value("value2").toString();
routingRule->_type = attribs.value("type").toString();
if(routingRule->_type == "" && rulesetType == RoutingRuleset::Type::RoadSpeed ) {
routingRule->_type = "speed";
}
auto context = routingProfile->getRuleset(rulesetType);
if(routingRule->_tagName == "select")
{
context->registerSelectExpression(attribs.value("value").toString(), routingRule->_type);
addRulesetSubclause(routingRule.get(), context.get());
for(const auto& item : constOf(ruleset))
addRulesetSubclause(item.get(), context.get());
}
else if (!ruleset.isEmpty() && ruleset.top()->_tagName == "select")
{
addRulesetSubclause(routingRule.get(), context.get());
}
ruleset.push(routingRule);
}
开发者ID:vmkrish,项目名称:OsmAnd-core,代码行数:32,代码来源:RoutingConfiguration.cpp
示例10: scopedLocker
void OsmAnd::RasterizerEnvironment_P::applyTo( MapStyleEvaluator& evaluator ) const
{
QMutexLocker scopedLocker(&_settingsChangeMutex);
for(const auto& settingEntry : rangeOf(constOf(_settings)))
{
const auto& valueDef = settingEntry.key();
const auto& settingValue = settingEntry.value();
switch(valueDef->dataType)
{
case MapStyleValueDataType::Integer:
evaluator.setIntegerValue(valueDef->id,
settingValue.isComplex
? settingValue.asComplex.asInt.evaluate(owner->displayDensityFactor)
: settingValue.asSimple.asInt);
break;
case MapStyleValueDataType::Float:
evaluator.setFloatValue(valueDef->id,
settingValue.isComplex
? settingValue.asComplex.asFloat.evaluate(owner->displayDensityFactor)
: settingValue.asSimple.asFloat);
break;
case MapStyleValueDataType::Boolean:
case MapStyleValueDataType::String:
case MapStyleValueDataType::Color:
assert(!settingValue.isComplex);
evaluator.setIntegerValue(valueDef->id, settingValue.asSimple.asUInt);
break;
}
}
}
开发者ID:vmkrish,项目名称:OsmAnd-core,代码行数:32,代码来源:RasterizerEnvironment_P.cpp
示例11: assert
void OsmAnd::MapRasterizer_P::rasterizeMapPrimitives(
const Context& context,
SkCanvas& canvas,
const MapPrimitiviser::PrimitivesCollection& primitives,
PrimitivesType type,
const std::shared_ptr<const IQueryController>& queryController)
{
assert(type != PrimitivesType::Points);
for (const auto& primitive : constOf(primitives))
{
if (queryController && queryController->isAborted())
return;
if (type == PrimitivesType::Polygons)
{
rasterizePolygon(
context,
canvas,
primitive);
}
else if (type == PrimitivesType::Polylines || type == PrimitivesType::Polylines_ShadowOnly)
{
rasterizePolyline(
context,
canvas,
primitive,
(type == PrimitivesType::Polylines_ShadowOnly));
}
}
}
开发者ID:biddyweb,项目名称:OsmAnd-core,代码行数:31,代码来源:MapRasterizer_P.cpp
示例12: clearCacheConditional
void OsmAnd::CachingRoadLocator_P::clearCacheNotInTiles(const QSet<TileId> tiles, const ZoomLevel zoomLevel, const bool checkAlsoIntersection)
{
clearCacheConditional(
[tiles, zoomLevel, checkAlsoIntersection]
(const std::shared_ptr<const ObfRoutingSectionReader::DataBlock>& dataBlock) -> bool
{
bool shouldRemove = true;
for (const auto& tileId : constOf(tiles))
{
const auto tileBBox31 = Utilities::tileBoundingBox31(tileId, zoomLevel);
if (tileBBox31.contains(dataBlock->area31) || dataBlock->area31.contains(tileBBox31))
{
shouldRemove = false;
break;
}
if (checkAlsoIntersection && tileBBox31.intersects(dataBlock->area31))
{
shouldRemove = false;
break;
}
}
return shouldRemove;
});
}
开发者ID:jmakovicka,项目名称:OsmAnd-core,代码行数:26,代码来源:CachingRoadLocator_P.cpp
示例13: bitset
QBitArray OsmAnd::RoutingRulesetContext::encode( const std::shared_ptr<const ObfRoutingSectionInfo>& section, const QVector<uint32_t>& roadTypes )
{
QBitArray bitset(ruleset->owner->_universalRules.size());
auto itTagValueAttribIdCache = owner->_tagValueAttribIdCache.find(section);
if(itTagValueAttribIdCache == owner->_tagValueAttribIdCache.end())
itTagValueAttribIdCache = owner->_tagValueAttribIdCache.insert(section, QMap<uint32_t, uint32_t>());
for(const auto& type : constOf(roadTypes))
{
auto itId = itTagValueAttribIdCache->find(type);
if(itId == itTagValueAttribIdCache->end())
{
const auto& encodingRule = section->_d->_encodingRules[type];
assert(encodingRule);
auto id = ruleset->owner->registerTagValueAttribute(encodingRule->_tag, encodingRule->_value);
itId = itTagValueAttribIdCache->insert(type, id);
}
auto id = *itId;
if(bitset.size() <= id)
bitset.resize(id + 1);
bitset.setBit(id);
}
return bitset;
}
开发者ID:TAstylex,项目名称:OsmAnd-core,代码行数:28,代码来源:RoutingRulesetContext.cpp
示例14: scopedLocker
void OsmAnd::MapRendererTiledResourcesCollection::Snapshot::forEachResourceExecute(const ResourceActionCallback action)
{
QReadLocker scopedLocker(&_lock);
bool doCancel = false;
for (const auto& storage : constOf(_storage))
{
for (const auto& entry : constOf(storage))
{
action(entry, doCancel);
if (doCancel)
return;
}
}
}
开发者ID:SfietKonstantin,项目名称:OsmAnd-core,代码行数:16,代码来源:MapRendererTiledResourcesCollection.cpp
示例15: readSubsectionChildrenHeaders
void OsmAnd::ObfRoutingSectionReader_P::querySubsections(
const std::unique_ptr<ObfReader_P>& reader, const QList< std::shared_ptr<ObfRoutingSubsectionInfo> >& in,
QList< std::shared_ptr<const ObfRoutingSubsectionInfo> >* resultOut /*= nullptr*/,
IQueryFilter* filter /*= nullptr*/,
std::function<bool (const std::shared_ptr<const ObfRoutingSubsectionInfo>&)> visitor /*= nullptr*/)
{
auto cis = reader->_codedInputStream.get();
for(const auto& subsection : constOf(in))
{
// If section is completely outside of bbox, skip it
if(filter && !filter->acceptsArea(subsection->_area31))
continue;
// Load children if they are not yet loaded
if(subsection->_subsectionsOffset != 0 && subsection->_subsections.isEmpty())
{
cis->Seek(subsection->_offset);
auto oldLimit = cis->PushLimit(subsection->_length);
cis->Skip(subsection->_subsectionsOffset - subsection->_offset);
const auto contains = !filter || filter->acceptsArea(subsection->_area31);
readSubsectionChildrenHeaders(reader, subsection, contains ? std::numeric_limits<uint32_t>::max() : 1);
cis->PopLimit(oldLimit);
}
querySubsections(reader, subsection->_subsections, resultOut, filter, visitor);
if(!visitor || visitor(subsection))
{
if(resultOut)
resultOut->push_back(subsection);
}
}
}
开发者ID:TAstylex,项目名称:OsmAnd-core,代码行数:34,代码来源:ObfRoutingSectionReader_P.cpp
示例16:
void OsmAnd::RoutePlanner::calculateTimeSpeedInRoute( OsmAnd::RoutePlannerContext::CalculationContext* context, QVector< std::shared_ptr<RouteSegment> >& route )
{
for(const auto& segment : constOf(route))
{
float distOnRoadToPass = 0;
float speed = context->owner->profileContext->getSpeed(segment->road);
if (qFuzzyCompare(speed, 0))
speed = context->owner->profileContext->profile->minDefaultSpeed;
const auto isIncrement = segment->startPointIndex < segment->endPointIndex;
float distanceSum = 0;
for(auto pointIdx = segment->startPointIndex; pointIdx != segment->endPointIndex; isIncrement ? pointIdx++ : pointIdx--)
{
const auto& point1 = segment->road->points[pointIdx];
const auto& point2 = segment->road->points[pointIdx + (isIncrement ? +1 : -1)];
auto distance = Utilities::distance(
Utilities::get31LongitudeX(point1.x), Utilities::get31LatitudeY(point1.y),
Utilities::get31LongitudeX(point2.x), Utilities::get31LatitudeY(point2.y)
);
distanceSum += distance;
auto obstacle = context->owner->profileContext->getObstaclesExtraTime(segment->road, pointIdx);
if (obstacle < 0)
obstacle = 0;
distOnRoadToPass += distance / speed + obstacle;
}
// last point turn time can be added
// if (i + 1 < result.size()) { distOnRoadToPass += ctx.getRouter().calculateTurnTime(); }
segment->_time = distOnRoadToPass;
segment->_speed = speed;
segment->_distance = distanceSum;
}
}
开发者ID:SfietKonstantin,项目名称:OsmAnd-core,代码行数:35,代码来源:RoutePlanner_Analyzer.cpp
示例17: getValueDefinitionById
QString OsmAnd::ResolvedMapStyle_P::dumpRuleNodeOutputValues(
const std::shared_ptr<const RuleNode>& ruleNode,
const QString& prefix,
const bool allowOverride) const
{
QString dump;
const auto builtinValueDefs = MapStyleBuiltinValueDefinitions::get();
for (const auto& ruleValueEntry : rangeOf(constOf(ruleNode->values)))
{
const auto valueDefId = ruleValueEntry.key();
const auto& valueDef = getValueDefinitionById(valueDefId);
// Skip all non-Output values
if (valueDef->valueClass != MapStyleValueDefinition::Class::Output)
continue;
const auto& resolvedRuleValue = ruleValueEntry.value();
dump += prefix + QString(QLatin1String("%1 %2 = %3;\n"))
.arg(allowOverride ? QLatin1String("setOrOverride") : QLatin1String("setIfNotSet"))
.arg(valueDef->name)
.arg(dumpResolvedValue(resolvedRuleValue, valueDef->dataType));
}
return dump;
}
开发者ID:lcmi,项目名称:OsmAnd-core,代码行数:27,代码来源:ResolvedMapStyle_P.cpp
示例18: scopedLocker
bool OsmAnd::ObfsCollection_P::remove(const ObfsCollection::SourceOriginId entryId)
{
QWriteLocker scopedLocker(&_sourcesOriginsLock);
const auto itSourceOrigin = _sourcesOrigins.find(entryId);
if (itSourceOrigin == _sourcesOrigins.end())
return false;
const auto& sourceOrigin = *itSourceOrigin;
if (sourceOrigin->type == SourceOriginType::Directory)
{
const auto& directoryAsSourceOrigin = std::static_pointer_cast<const DirectoryAsSourceOrigin>(sourceOrigin);
for(const auto watchedSubdirectory : constOf(directoryAsSourceOrigin->watchedSubdirectories))
_fileSystemWatcher->removePath(watchedSubdirectory);
_fileSystemWatcher->removePath(directoryAsSourceOrigin->directory.canonicalPath());
}
else if (sourceOrigin->type == SourceOriginType::File)
{
const auto& fileAsSourceOrigin = std::static_pointer_cast<const FileAsSourceOrigin>(sourceOrigin);
_fileSystemWatcher->removePath(fileAsSourceOrigin->fileInfo.canonicalFilePath());
}
_sourcesOrigins.erase(itSourceOrigin);
invalidateCollectedSources();
return true;
}
开发者ID:rotorliu,项目名称:OsmAnd-core,代码行数:30,代码来源:ObfsCollection_P.cpp
示例19: getGPUAPI
void OsmAnd::AtlasMapRendererDebugStage_OpenGL::renderLines3D()
{
const auto gpuAPI = getGPUAPI();
GL_CHECK_PRESENT(glUseProgram);
GL_CHECK_PRESENT(glUniformMatrix4fv);
GL_CHECK_PRESENT(glUniform1f);
GL_CHECK_PRESENT(glUniform2f);
GL_CHECK_PRESENT(glUniform3f);
GL_CHECK_PRESENT(glDrawElements);
gpuAPI->glBindVertexArray_wrapper(_vaoLine3D);
GL_CHECK_RESULT;
// Activate program
glUseProgram(_programLine3D.id);
GL_CHECK_RESULT;
// Set projection*view*model matrix:
const auto& mProjectionView = internalState.mPerspectiveProjection * internalState.mCameraView;
glUniformMatrix4fv(_programLine3D.vs.param.mProjectionViewModel, 1, GL_FALSE, glm::value_ptr(mProjectionView));
GL_CHECK_RESULT;
for(const auto& primitive : constOf(_lines3D))
{
const auto& line = primitive.first;
const auto& color = primitive.second;
// Set line color
glUniform4f(_programLine3D.fs.param.color, SkColorGetR(color) / 255.0f, SkColorGetG(color) / 255.0f, SkColorGetB(color) / 255.0f, SkColorGetA(color) / 255.0f);
GL_CHECK_RESULT;
// Iterate over pairs of points
auto itV0 = line.cbegin();
auto itV1 = itV0 + 1;
for(const auto itEnd = line.cend(); itV1 != itEnd; itV0 = itV1, ++itV1)
{
const auto& v0 = *itV0;
const auto& v1 = *itV1;
// Set line coordinates
glUniform4f(_programLine3D.vs.param.v0, v0.x, v0.y, v0.z, 1.0f);
GL_CHECK_RESULT;
glUniform4f(_programLine3D.vs.param.v1, v1.x, v1.y, v1.z, 1.0f);
GL_CHECK_RESULT;
// Draw the line actually
glDrawElements(GL_LINES, 2, GL_UNSIGNED_SHORT, nullptr);
GL_CHECK_RESULT;
}
}
// Deactivate program
glUseProgram(0);
GL_CHECK_RESULT;
// Deselect VAO
gpuAPI->glBindVertexArray_wrapper(0);
GL_CHECK_RESULT;
}
开发者ID:TAstylex,项目名称:OsmAnd-core,代码行数:60,代码来源:AtlasMapRendererDebugStage_OpenGL.cpp
示例20: constOf
bool OsmAnd::MapRendererTiledResourcesCollection::updateCollectionSnapshot() const
{
const auto invalidatesDiscarded = _collectionSnapshotInvalidatesCount.fetchAndAddOrdered(0);
if (invalidatesDiscarded == 0)
return true;
// Copy from original storage to temp storage
Storage storageCopy;
{
if (!_collectionLock.tryLockForRead())
return false;
for (int zoomLevel = MinZoomLevel; zoomLevel <= MaxZoomLevel; zoomLevel++)
{
const auto& sourceStorageLevel = constOf(_storage)[zoomLevel];
auto& targetStorageLevel = storageCopy[zoomLevel];
targetStorageLevel = detachedOf(sourceStorageLevel);
}
_collectionLock.unlock();
}
_collectionSnapshotInvalidatesCount.fetchAndAddOrdered(-invalidatesDiscarded);
// Copy from temp storage to snapshot
{
QWriteLocker scopedLocker(&_snapshot->_lock);
_snapshot->_storage = qMove(storageCopy);
}
return true;
}
开发者ID:SfietKonstantin,项目名称:OsmAnd-core,代码行数:33,代码来源:MapRendererTiledResourcesCollection.cpp
注:本文中的constOf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论