Exemplo n.º 1
0
void QgsLayoutItemLegend::onAtlasFeature()
{
  if ( !mLayout->reportContext().feature().isValid() )
    return;
  mInAtlas = mFilterOutAtlas;
  updateFilterByMap();
}
Exemplo n.º 2
0
void QgsComposerLegend::onAtlasFeature( QgsFeature *feat )
{
  if ( !feat )
    return;
  mInAtlas = mFilterOutAtlas;
  updateFilterByMap();
}
Exemplo n.º 3
0
void QgsComposerLegend::updateItem()
{
  if ( !updatesEnabled() )
    return;

  updateFilterByMap( false );
  QgsComposerItem::updateItem();
}
Exemplo n.º 4
0
void QgsLayoutItemLegend::nodeCustomPropertyChanged( QgsLayerTreeNode *, const QString & )
{
  if ( autoUpdateModel() )
  {
    // in "auto update" mode, some parameters on the main app legend may have been changed (expression filtering)
    // we must then call updateItem to reflect the changes
    updateFilterByMap( false );
  }
}
Exemplo n.º 5
0
void QgsLayoutItemLegend::setAutoUpdateModel( bool autoUpdate )
{
  if ( autoUpdate == autoUpdateModel() )
    return;

  setCustomLayerTree( autoUpdate ? nullptr : mLayout->project()->layerTreeRoot()->clone() );
  adjustBoxSize();
  updateFilterByMap( false );
}
Exemplo n.º 6
0
void QgsComposerLegend::setComposerMap( const QgsComposerMap* map )
{
  if ( mComposerMap )
  {
    disconnect( mComposerMap, SIGNAL( destroyed( QObject* ) ), this, SLOT( invalidateCurrentMap() ) );
    disconnect( mComposerMap, SIGNAL( itemChanged() ), this, SLOT( updateFilterByMap() ) );
    disconnect( mComposerMap, SIGNAL( extentChanged() ), this, SLOT( updateFilterByMap() ) );
    disconnect( mComposerMap, SIGNAL( layerStyleOverridesChanged() ), this, SLOT( mapLayerStyleOverridesChanged() ) );
  }

  mComposerMap = map;

  if ( map )
  {
    QObject::connect( map, SIGNAL( destroyed( QObject* ) ), this, SLOT( invalidateCurrentMap() ) );
    QObject::connect( map, SIGNAL( itemChanged() ), this, SLOT( updateFilterByMap() ) );
    QObject::connect( map, SIGNAL( extentChanged() ), this, SLOT( updateFilterByMap() ) );
    QObject::connect( map, SIGNAL( layerStyleOverridesChanged() ), this, SLOT( mapLayerStyleOverridesChanged() ) );
  }

  updateItem();
}
Exemplo n.º 7
0
void QgsLayoutItemLegend::mapLayerStyleOverridesChanged()
{
  if ( !mMap )
    return;

  // map's style has been changed, so make sure to update the legend here
  if ( mLegendFilterByMap )
  {
    // legend is being filtered by map, so we need to re run the hit test too
    // as the style overrides may also have affected the visible symbols
    updateFilterByMap( false );
  }
  else
  {
    mLegendModel->setLayerStyleOverrides( mMap->layerStyleOverrides() );

    Q_FOREACH ( QgsLayerTreeLayer *nodeLayer, mLegendModel->rootGroup()->findLayers() )
      mLegendModel->refreshLayerLegend( nodeLayer );
  }

  adjustBoxSize();
  updateFilterByMap( false );
}
Exemplo n.º 8
0
void QgsLayoutItemLegend::setLinkedMap( QgsLayoutItemMap *map )
{
  if ( mMap )
  {
    setupMapConnections( mMap, false );
  }

  mMap = map;

  if ( mMap )
  {
    setupMapConnections( mMap, true );
  }

  updateFilterByMap();
}
Exemplo n.º 9
0
void QgsComposerLegend::onAtlasEnded()
{
  mInAtlas = false;
  updateFilterByMap();
}
Exemplo n.º 10
0
void QgsComposerLegend::updateFilterByMapAndRedraw()
{
  updateFilterByMap( true );
}
Exemplo n.º 11
0
void QgsLayoutItemLegend::onAtlasEnded()
{
  mInAtlas = false;
  updateFilterByMap();
}
Exemplo n.º 12
0
void QgsLayoutItemLegend::updateFilterByMapAndRedraw()
{
  updateFilterByMap( true );
}
Exemplo n.º 13
0
void QgsLayoutItemLegend::updateLegend()
{
  adjustBoxSize();
  updateFilterByMap( false );
}
Exemplo n.º 14
0
void QgsLayoutItemLegend::setLegendFilterByMapEnabled( bool enabled )
{
  mLegendFilterByMap = enabled;
  updateFilterByMap( false );
}
Exemplo n.º 15
0
void QgsComposerLegend::updateItem()
{
  updateFilterByMap( false );
  QgsComposerItem::updateItem();
}
Exemplo n.º 16
0
void QgsComposerLegend::setLegendFilterByMapEnabled( bool enabled )
{
  mLegendFilterByMap = enabled;
  updateFilterByMap();
}