本文整理汇总了C++中StyleContext::setFeature方法的典型用法代码示例。如果您正苦于以下问题:C++ StyleContext::setFeature方法的具体用法?C++ StyleContext::setFeature怎么用?C++ StyleContext::setFeature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StyleContext
的用法示例。
在下文中一共展示了StyleContext::setFeature方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: build
void Tile::build(StyleContext& _ctx, const Scene& _scene, const TileData& _data, const DataSource& _source) {
const auto& layers = _scene.layers();
_ctx.setGlobal("$zoom", m_id.z);
for (auto& style : _scene.styles()) {
style->onBeginBuildTile(*this);
}
for (const auto& datalayer : layers) {
if (datalayer.source() != _source.name()) { continue; }
for (const auto& collection : _data.layers) {
if (!collection.name.empty() && collection.name != datalayer.collection()) { continue; }
for (const auto& feat : collection.features) {
_ctx.setFeature(feat);
std::vector<DrawRule> rules;
datalayer.match(feat, _ctx, rules);
for (auto& rule : rules) {
auto* style = _scene.findStyle(rule.style);
if (style) {
rule.eval(_ctx);
style->buildFeature(*this, feat, rule);
}
}
}
}
}
for (auto& style : _scene.styles()) {
style->onEndBuildTile(*this);
}
for (auto& geometry : m_geometry) {
geometry.second->compileVertexBuffer();
}
}
示例2: match
bool DrawRuleMergeSet::match(const Feature& _feature, const SceneLayer& _layer, StyleContext& _ctx) {
_ctx.setFeature(_feature);
m_matchedRules.clear();
m_queuedLayers.clear();
// If uber layer is marked not visible return immediately
if (!_layer.visible()) {
return false;
}
// If the first filter doesn't match, return immediately
if (!_layer.filter().eval(_feature, _ctx)) { return false; }
m_queuedLayers.push_back(&_layer);
// Iterate depth-first over the layer hierarchy
while (!m_queuedLayers.empty()) {
// Pop a layer off the top of the stack
const auto& layer = *m_queuedLayers.back();
m_queuedLayers.pop_back();
// Merge rules from layer into accumulated set
mergeRules(layer);
// Push each of the layer's matching sublayers onto the stack
for (const auto& sublayer : layer.sublayers()) {
// Skip matching this sublayer if marked not visible
if (!sublayer.visible()) {
continue;
}
if (sublayer.filter().eval(_feature, _ctx)) {
m_queuedLayers.push_back(&sublayer);
}
}
}
return true;
}