QgsRasterInterface * QgsHueSaturationFilter::clone() const
{
  QgsDebugMsg( "Entered hue/saturation filter" );
  QgsHueSaturationFilter * filter = new QgsHueSaturationFilter( 0 );
  filter->setSaturation( mSaturation );
  filter->setGrayscaleMode( mGrayscaleMode );
  filter->setColorizeOn( mColorizeOn );
  filter->setColorizeColor( mColorizeColor );
  filter->setColorizeStrength( mColorizeStrength );
  return filter;
}
Beispiel #2
0
QgsHueSaturationFilter* QgsHueSaturationFilter::clone() const
{
  QgsDebugMsgLevel( "Entered hue/saturation filter", 4 );
  QgsHueSaturationFilter * filter = new QgsHueSaturationFilter( nullptr );
  filter->setSaturation( mSaturation );
  filter->setGrayscaleMode( mGrayscaleMode );
  filter->setColorizeOn( mColorizeOn );
  filter->setColorizeColor( mColorizeColor );
  filter->setColorizeStrength( mColorizeStrength );
  return filter;
}
Beispiel #3
0
void QgsRendererRasterPropertiesWidget::apply()
{
    mRasterLayer->brightnessFilter()->setBrightness( mSliderBrightness->value() );
    mRasterLayer->brightnessFilter()->setContrast( mSliderContrast->value() );

    QgsRasterRendererWidget* rendererWidget = dynamic_cast<QgsRasterRendererWidget*>( stackedWidget->currentWidget() );
    if ( rendererWidget )
    {
        mRasterLayer->setRenderer( rendererWidget->renderer() );
    }

    // Hue and saturation controls
    QgsHueSaturationFilter *hueSaturationFilter = mRasterLayer->hueSaturationFilter();
    if ( hueSaturationFilter )
    {
        hueSaturationFilter->setSaturation( sliderSaturation->value() );
        hueSaturationFilter->setGrayscaleMode(( QgsHueSaturationFilter::GrayscaleMode ) comboGrayscale->currentIndex() );
        hueSaturationFilter->setColorizeOn( mColorizeCheck->checkState() );
        hueSaturationFilter->setColorizeColor( btnColorizeColor->color() );
        hueSaturationFilter->setColorizeStrength( sliderColorizeStrength->value() );
    }

    QgsRasterResampleFilter* resampleFilter = mRasterLayer->resampleFilter();
    if ( resampleFilter )
    {
        QgsRasterResampler *zoomedInResampler = nullptr;
        QString zoomedInResamplingMethod = mZoomedInResamplingComboBox->currentText();
        if ( zoomedInResamplingMethod == tr( "Bilinear" ) )
        {
            zoomedInResampler = new QgsBilinearRasterResampler();
        }
        else if ( zoomedInResamplingMethod == tr( "Cubic" ) )
        {
            zoomedInResampler = new QgsCubicRasterResampler();
        }

        resampleFilter->setZoomedInResampler( zoomedInResampler );

        //raster resampling
        QgsRasterResampler *zoomedOutResampler = nullptr;
        QString zoomedOutResamplingMethod = mZoomedOutResamplingComboBox->currentText();
        if ( zoomedOutResamplingMethod == tr( "Average" ) )
        {
            zoomedOutResampler = new QgsBilinearRasterResampler();
        }

        resampleFilter->setZoomedOutResampler( zoomedOutResampler );

        resampleFilter->setMaxOversampling( mMaximumOversamplingSpinBox->value() );
    }

    mRasterLayer->setBlendMode( mBlendModeComboBox->blendMode() );
}
void QgsRendererRasterPropertiesWidget::apply()
{
  mRasterLayer->brightnessFilter()->setBrightness( mSliderBrightness->value() );
  mRasterLayer->brightnessFilter()->setContrast( mSliderContrast->value() );

  QgsRasterRendererWidget* rendererWidget = dynamic_cast<QgsRasterRendererWidget*>( stackedWidget->currentWidget() );
  if ( rendererWidget )
  {
    mRasterLayer->setRenderer( rendererWidget->renderer() );
  }

  // Hue and saturation controls
  QgsHueSaturationFilter *hueSaturationFilter = mRasterLayer->hueSaturationFilter();
  if ( hueSaturationFilter )
  {
    hueSaturationFilter->setSaturation( sliderSaturation->value() );
    hueSaturationFilter->setGrayscaleMode(( QgsHueSaturationFilter::GrayscaleMode ) comboGrayscale->currentIndex() );
    hueSaturationFilter->setColorizeOn( mColorizeCheck->checkState() );
    hueSaturationFilter->setColorizeColor( btnColorizeColor->color() );
    hueSaturationFilter->setColorizeStrength( sliderColorizeStrength->value() );
  }

  mRasterLayer->setBlendMode( mBlendModeComboBox->blendMode() );
}
void QgsRendererRasterPropertiesWidget::apply()
{
  mRasterLayer->brightnessFilter()->setBrightness( mSliderBrightness->value() );
  mRasterLayer->brightnessFilter()->setContrast( mSliderContrast->value() );

  QgsRasterRendererWidget* rendererWidget = dynamic_cast<QgsRasterRendererWidget*>( stackedWidget->currentWidget() );
  if ( rendererWidget )
  {
    QgsRasterRenderer* newRenderer = rendererWidget->renderer();

    // there are transparency related data stored in renderer instances, but they
    // are not configured in the widget, so we need to copy them over from existing renderer
    QgsRasterRenderer* oldRenderer = mRasterLayer->renderer();
    if ( oldRenderer )
      newRenderer->copyCommonProperties( oldRenderer );

    mRasterLayer->setRenderer( newRenderer );
  }

  // Hue and saturation controls
  QgsHueSaturationFilter *hueSaturationFilter = mRasterLayer->hueSaturationFilter();
  if ( hueSaturationFilter )
  {
    hueSaturationFilter->setSaturation( sliderSaturation->value() );
    hueSaturationFilter->setGrayscaleMode(( QgsHueSaturationFilter::GrayscaleMode ) comboGrayscale->currentIndex() );
    hueSaturationFilter->setColorizeOn( mColorizeCheck->checkState() );
    hueSaturationFilter->setColorizeColor( btnColorizeColor->color() );
    hueSaturationFilter->setColorizeStrength( sliderColorizeStrength->value() );
  }

  QgsRasterResampleFilter* resampleFilter = mRasterLayer->resampleFilter();
  if ( resampleFilter )
  {
    QgsRasterResampler *zoomedInResampler = nullptr;
    QString zoomedInResamplingMethod = mZoomedInResamplingComboBox->currentText();
    if ( zoomedInResamplingMethod == tr( "Bilinear" ) )
    {
      zoomedInResampler = new QgsBilinearRasterResampler();
    }
    else if ( zoomedInResamplingMethod == tr( "Cubic" ) )
    {
      zoomedInResampler = new QgsCubicRasterResampler();
    }

    resampleFilter->setZoomedInResampler( zoomedInResampler );

    //raster resampling
    QgsRasterResampler *zoomedOutResampler = nullptr;
    QString zoomedOutResamplingMethod = mZoomedOutResamplingComboBox->currentText();
    if ( zoomedOutResamplingMethod == tr( "Average" ) )
    {
      zoomedOutResampler = new QgsBilinearRasterResampler();
    }

    resampleFilter->setZoomedOutResampler( zoomedOutResampler );

    resampleFilter->setMaxOversampling( mMaximumOversamplingSpinBox->value() );
  }

  mRasterLayer->setBlendMode( mBlendModeComboBox->blendMode() );
}