Exemple #1
0
Style* PatternLoader::getStyle(QString name) {
  Style* pS;
  for(pS=styleList.first(); pS != 0; pS=styleList.next()) {
    if(name.compare(pS->getName())==0) { return pS; }
  }
  return NULL;
}
Exemple #2
0
Style
Style::combineWith( const Style& rhs ) const
{
    // start by deep-cloning this style.
    Style newStyle(*this);
    newStyle.copySymbols(rhs);
    if ( !this->empty() && !rhs.empty() )
        newStyle.setName( _name + std::string(":") + rhs.getName() );
    else if ( !this->empty() && rhs.empty() )
        newStyle.setName( _name );
    else if ( this->empty() && !rhs.empty() )
        newStyle.setName( rhs.getName() );
    else
        newStyle.setName( _name );
    return newStyle;
}
Exemple #3
0
void MapTile::updateLabels(float _dt, const Style& _style, const View& _view) {
    glm::mat4 mvp = _view.getViewProjectionMatrix() * m_modelMatrix;
    glm::vec2 screenSize = glm::vec2(_view.getWidth(), _view.getHeight());
    
    for(auto& label : m_labels[_style.getName()]) {
        label->update(mvp, screenSize, _dt);
    }
}
Exemple #4
0
void MapTile::pushLabelTransforms(const Style& _style, std::shared_ptr<LabelContainer> _labelContainer) {

    auto& textBuffer = m_buffers[_style.getName()];
    if(textBuffer) {
        auto ftContext = _labelContainer->getFontContext();

        ftContext->lock();
        
        for(auto& label : m_labels[_style.getName()]) {
            label->pushTransform(textBuffer);
        }
        
        textBuffer->triggerTransformUpdate();
        
        ftContext->unlock();
    }
    
}
Exemple #5
0
std::shared_ptr<TextBuffer> MapTile::getTextBuffer(const Style& _style) const {
    auto it = m_buffers.find(_style.getName());

    if (it != m_buffers.end()) {
        return it->second;
    }

    return nullptr;
}
Exemple #6
0
Style
Style::combineWith( const Style& rhs ) const
{
    // start by deep-cloning this style.
    Config conf = getConfig( false );
    Style newStyle( conf );

    // next, merge in the symbology from the other style.
    newStyle.mergeConfig( rhs.getConfig(false) );

    if ( !this->empty() && !rhs.empty() )
        newStyle.setName( _name + std::string(":") + rhs.getName() );
    else if ( !this->empty() && rhs.empty() )
        newStyle.setName( _name );
    else if ( this->empty() && !rhs.empty() )
        newStyle.setName( rhs.getName() );
    else
        newStyle.setName( _name );

    return newStyle;
}
Exemple #7
0
void Tile::draw(const Style& _style, const View& _view) {

    const auto& styleMesh = m_geometry[_style.getName()];

    if (styleMesh) {

        auto& shader = _style.getShaderProgram();

        glm::mat4 modelViewMatrix = _view.getViewMatrix() * m_modelMatrix;
        glm::mat4 modelViewProjMatrix = _view.getViewProjectionMatrix() * m_modelMatrix;

        shader->setUniformMatrix4f("u_modelView", glm::value_ptr(modelViewMatrix));
        shader->setUniformMatrix4f("u_modelViewProj", glm::value_ptr(modelViewProjMatrix));
        shader->setUniformMatrix3f("u_normalMatrix", glm::value_ptr(_view.getNormalMatrix()));

        // Set the tile zoom level, using the sign to indicate whether the tile is a proxy
        shader->setUniformf("u_tile_zoom", m_proxyCounter > 0 ? -m_id.z : m_id.z);

        styleMesh->draw(*shader);
    }
}
Exemple #8
0
void
StyleSheet::addStyle( const Style& style )
{
    _styles[ style.getName() ] = style;
}
Exemple #9
0
 bool Style::operator>(const Style& style) const {
     return name.compare(style.getName()) > 0;
 }
Exemple #10
0
void MapTile::setTextBuffer(const Style& _style, std::shared_ptr<TextBuffer> _buffer) {

    m_buffers[_style.getName()] = _buffer;
}
Exemple #11
0
void MapTile::addGeometry(const Style& _style, std::unique_ptr<VboMesh> _mesh) {

    m_geometry[_style.getName()] = std::move(_mesh); // Move-construct a unique_ptr at the value associated with the given style

}