Exemple #1
0
void QgsMapSettings::setLayers( const QList<QgsMapLayer *> &layers )
{
  // filter list, removing null layers and non-spatial layers
  auto filteredList = layers;
  filteredList.erase( std::remove_if( filteredList.begin(), filteredList.end(),
                                      []( QgsMapLayer * layer )
  {
    return !layer || !layer->isSpatial();
  } ), filteredList.end() );

  mLayers = _qgis_listRawToQPointer( filteredList );
}
Exemple #2
0
void QgsLayerTree::setCustomLayerOrder( const QList<QgsMapLayer *> &customLayerOrder )
{
  QgsWeakMapLayerPointerList newOrder = _qgis_listRawToQPointer( customLayerOrder );

  if ( newOrder == mCustomLayerOrder )
    return;

  mCustomLayerOrder = newOrder;
  emit customLayerOrderChanged();

  if ( mHasCustomLayerOrder )
    emit layerOrderChanged();
}
void QgsMapRendererParallelJob::renderLabelsStatic( QgsMapRendererParallelJob *self )
{
  LabelRenderJob &job = self->mLabelJob;

  if ( !job.cached )
  {
    QTime labelTime;
    labelTime.start();

    QPainter painter;
    if ( job.img )
    {
      job.img->fill( 0 );
      painter.begin( job.img );
    }
    else
    {
      painter.begin( &self->mFinalImage );
    }

    // draw the labels!
    try
    {
      drawLabeling( self->mSettings, job.context, self->mLabelingEngineV2.get(), &painter );
    }
    catch ( QgsException &e )
    {
      Q_UNUSED( e );
      QgsDebugMsg( "Caught unhandled QgsException: " + e.what() );
    }
    catch ( std::exception &e )
    {
      Q_UNUSED( e );
      QgsDebugMsg( "Caught unhandled std::exception: " + QString::fromAscii( e.what() ) );
    }
    catch ( ... )
    {
      QgsDebugMsg( "Caught unhandled unknown exception" );
    }

    painter.end();

    job.renderingTime = labelTime.elapsed();
    job.complete = true;
    job.participatingLayers = _qgis_listRawToQPointer( self->mLabelingEngineV2->participatingLayers() );
    if ( job.img )
    {
      self->mFinalImage = composeImage( self->mSettings, self->mLayerJobs, self->mLabelJob );
    }
  }
}
Exemple #4
0
void QgsTask::setDependentLayers( const QList< QgsMapLayer * > &dependentLayers )
{
  mDependentLayers = _qgis_listRawToQPointer( dependentLayers );
}