QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsrasterlayersaveasdialog.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrasterlayersaveasdialog.cpp
3  ---------------------
4  begin : May 2012
5  copyright : (C) 2012 by Marco Hugentobler
6  email : marco dot hugentobler at sourcepole dot ch
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #include "qgsapplication.h"
16 #include "qgslogger.h"
17 #include "qgscoordinatetransform.h"
18 #include "qgsrasterlayer.h"
20 #include "qgsrasterdataprovider.h"
23 
24 #include <QFileDialog>
25 #include <QMessageBox>
26 #include <QSettings>
27 
29  QgsRasterDataProvider* sourceProvider, const QgsRectangle& currentExtent,
30  const QgsCoordinateReferenceSystem& layerCrs, const QgsCoordinateReferenceSystem& currentCrs,
31  QWidget* parent, Qt::WindowFlags f ) :
32  QDialog( parent, f )
33  , mRasterLayer( rasterLayer ), mDataProvider( sourceProvider )
34  , mCurrentExtent( currentExtent ), mLayerCrs( layerCrs )
35  , mCurrentCrs( currentCrs )
36  , mResolutionState( OriginalResolution )
37 {
38  setupUi( this );
39  mAddNoDataManuallyToolButton->setIcon( QgsApplication::getThemeIcon( "/mActionNewAttribute.png" ) );
40  mLoadTransparentNoDataToolButton->setIcon( QgsApplication::getThemeIcon( "/mActionCopySelected.png" ) );
41  mRemoveSelectedNoDataToolButton->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteAttribute.png" ) );
42  mRemoveAllNoDataToolButton->setIcon( QgsApplication::getThemeIcon( "/mActionRemove.png" ) );
43 
44  mNoDataTableWidget->setColumnCount( 2 );
45  mNoDataTableWidget->setHorizontalHeaderItem( 0, new QTableWidgetItem( tr( "From" ) ) );
46  mNoDataTableWidget->setHorizontalHeaderItem( 1, new QTableWidgetItem( tr( "To" ) ) );
47 
49 
50  setValidators();
51  // Translated labels + EPSG are updated later
52  mCrsComboBox->addItem( "Layer", OriginalCrs );
53  mCrsComboBox->addItem( "Project", CurrentCrs );
54  mCrsComboBox->addItem( "Selected", UserCrs );
55 
57  mUserCrs.createFromOgcWmsCrs( "EPSG:4326" );
58 
59  //only one hardcoded format at the moment
60  QStringList myFormats;
61  myFormats << "GTiff";
62  foreach ( QString myFormat, myFormats )
63  {
64  mFormatComboBox->addItem( myFormat );
65  }
66 
67  //fill reasonable default values depending on the provider
68  if ( mDataProvider )
69  {
71  {
73  int xSize = mDataProvider->xSize();
74  int ySize = mDataProvider->ySize();
75  mMaximumSizeXLineEdit->setText( QString::number( xSize ) );
76  mMaximumSizeYLineEdit->setText( QString::number( ySize ) );
77  }
78  else //wms, sometimes wcs
79  {
80  mTileModeCheckBox->setChecked( true );
81  mMaximumSizeXLineEdit->setText( QString::number( 2000 ) );
82  mMaximumSizeYLineEdit->setText( QString::number( 2000 ) );
83  }
84 
85  // setup creation option widget
86  mCreateOptionsWidget->setProvider( mDataProvider->name() );
87  if ( mDataProvider->name() == "gdal" )
88  {
89  mCreateOptionsWidget->setFormat( myFormats[0] );
90  }
91  mCreateOptionsWidget->setRasterLayer( mRasterLayer );
92  mCreateOptionsWidget->update();
93  }
94 
95  // Only do pyramids if dealing directly with GDAL.
97  {
98  // setup pyramids option widget
99  // mPyramidsOptionsWidget->createOptionsWidget()->setType( QgsRasterFormatSaveOptionsWidget::ProfileLineEdit );
100  mPyramidsOptionsWidget->createOptionsWidget()->setRasterLayer( mRasterLayer );
101 
102  // TODO enable "use existing", has no effect for now, because using Create() in gdal provider
103  // if ( ! mDataProvider->hasPyramids() )
104  // mPyramidsButtonGroup->button( QgsRaster::PyramidsCopyExisting )->setEnabled( false );
105  mPyramidsUseExistingCheckBox->setEnabled( false );
106  mPyramidsUseExistingCheckBox->setVisible( false );
107 
109  connect( mPyramidsOptionsWidget, SIGNAL( overviewListChanged() ),
110  this, SLOT( populatePyramidsLevels() ) );
111  }
112  else
113  {
114  mPyramidsGroupBox->setEnabled( false );
115  }
116 
117  // restore checked state for most groupboxes (default is to restore collapsed state)
118  // create options and pyramids will be preset, if user has selected defaults in the gdal options dlg
119  mCreateOptionsGroupBox->setSaveCheckedState( true );
120  //mTilesGroupBox->setSaveCheckedState( true );
121  // don't restore nodata, it needs user input
122  // pyramids are not necessarily built every time
123 
124  mTilesGroupBox->hide();
125 
126  updateCrsGroup();
127 
128  QPushButton* okButton = mButtonBox->button( QDialogButtonBox::Ok );
129  if ( okButton )
130  {
131  okButton->setEnabled( false );
132  }
133 
134  mExtentGroupBox->setOutputCrs( outputCrs() );
135  mExtentGroupBox->setOriginalExtent( mDataProvider->extent(), mLayerCrs );
136  mExtentGroupBox->setCurrentExtent( mCurrentExtent, mCurrentCrs );
137  mExtentGroupBox->setOutputExtentFromOriginal();
138  connect( mExtentGroupBox, SIGNAL( extentChanged( QgsRectangle ) ), this, SLOT( extentChanged() ) );
139 }
140 
142 {
143  mXResolutionLineEdit->setValidator( new QDoubleValidator( this ) );
144  mYResolutionLineEdit->setValidator( new QDoubleValidator( this ) );
145  mColumnsLineEdit->setValidator( new QIntValidator( this ) );
146  mRowsLineEdit->setValidator( new QIntValidator( this ) );
147  mMaximumSizeXLineEdit->setValidator( new QIntValidator( this ) );
148  mMaximumSizeYLineEdit->setValidator( new QIntValidator( this ) );
149 }
150 
152 {
153 }
154 
156 {
157  QString fileName;
158  if ( mTileModeCheckBox->isChecked() )
159  {
160  while ( true )
161  {
162  // TODO: would not it be better to select .vrt file instead of directory?
163  fileName = QFileDialog::getExistingDirectory( this, tr( "Select output directory" ) );
164  //fileName = QFileDialog::getSaveFileName( this, tr( "Select output file" ), QString(), tr( "VRT" ) + " (*.vrt *.VRT)" );
165 
166  if ( fileName.isEmpty() ) break; // canceled
167 
168  // Check if directory is empty
169  QDir dir( fileName );
170  QString baseName = QFileInfo( fileName ).baseName();
171  QStringList filters;
172  filters << QString( "%1.*" ).arg( baseName );
173  QStringList files = dir.entryList( filters );
174  if ( !files.isEmpty() )
175  {
176  QMessageBox::StandardButton button = QMessageBox::warning( this, tr( "Warning" ),
177  tr( "The directory %1 contains files which will be overwritten: %2" ).arg( dir.absolutePath() ).arg( files.join( ", " ) ),
178  QMessageBox::Ok | QMessageBox::Cancel );
179 
180  if ( button == QMessageBox::Ok )
181  {
182  break;
183  }
184  else
185  {
186  fileName = "";
187  }
188  }
189  else
190  {
191  break;
192  }
193  }
194  }
195  else
196  {
197  fileName = QFileDialog::getSaveFileName( this, tr( "Select output file" ), QString(), tr( "GeoTIFF" ) + " (*.tif *.tiff *.TIF *.TIFF)" );
198  }
199 
200  if ( !fileName.isEmpty() )
201  {
202  mSaveAsLineEdit->setText( fileName );
203  }
204 }
205 
207 {
208  QPushButton* okButton = mButtonBox->button( QDialogButtonBox::Ok );
209  if ( !okButton )
210  {
211  return;
212  }
213 
214  okButton->setEnabled( QFileInfo( text ).absoluteDir().exists() );
215 }
216 
217 
219 {
220  //gdal-specific
221  if ( mDataProvider && mDataProvider->name() == "gdal" )
222  {
223  mCreateOptionsWidget->setFormat( text );
224  mCreateOptionsWidget->update();
225  }
226 }
227 
229 {
230  return mColumnsLineEdit->text().toInt();
231 }
232 
234 {
235  return mRowsLineEdit->text().toInt();
236 }
237 
239 {
240  return mXResolutionLineEdit->text().toDouble();
241 }
242 
244 {
245  return mYResolutionLineEdit->text().toDouble();
246 }
247 
249 {
250  return mMaximumSizeXLineEdit->text().toInt();
251 }
252 
254 {
255  return mMaximumSizeYLineEdit->text().toInt();
256 }
257 
259 {
260  return mTileModeCheckBox->isChecked();
261 }
262 
264 {
265  return mSaveAsLineEdit->text();
266 }
267 
269 {
270  return mFormatComboBox->currentText();
271 }
272 
274 {
275  return mCreateOptionsGroupBox->isChecked() ? mCreateOptionsWidget->options() : QStringList();
276 }
277 
279 {
280  return mExtentGroupBox->outputExtent();
281 }
282 
284 {
285  mFormatLabel->hide();
286  mFormatComboBox->hide();
287 }
288 
290 {
291  mSaveAsLabel->hide();
292  mSaveAsLineEdit->hide();
293  mBrowseButton->hide();
294  QPushButton* okButton = mButtonBox->button( QDialogButtonBox::Ok );
295  if ( okButton )
296  {
297  okButton->setEnabled( true );
298  }
299 }
300 
302 {
304 
305  bool on = mResolutionRadioButton->isChecked();
306  mXResolutionLineEdit->setEnabled( on );
307  mYResolutionLineEdit->setEnabled( on );
308  mOriginalResolutionPushButton->setEnabled( on && hasResolution );
309  mColumnsLineEdit->setEnabled( !on );
310  mRowsLineEdit->setEnabled( !on );
311  mOriginalSizePushButton->setEnabled( !on && hasResolution );
312 }
313 
315 {
316  double xRes, yRes;
317 
319  {
320  xRes = mDataProvider->extent().width() / mDataProvider->xSize();
321  yRes = mDataProvider->extent().height() / mDataProvider->ySize();
322  }
323  else
324  {
325  // Init to something if no original resolution is available
326  xRes = yRes = mDataProvider->extent().width() / 100;
327  }
328  setResolution( xRes, yRes, mLayerCrs );
330  recalcSize();
331 }
332 
333 void QgsRasterLayerSaveAsDialog::setResolution( double xRes, double yRes, const QgsCoordinateReferenceSystem& srcCrs )
334 {
335  if ( srcCrs != outputCrs() )
336  {
337  // We reproject pixel rectangle from center of selected extent, of course, it gives
338  // bigger xRes,yRes than reprojected edges (envelope), it may also be that
339  // close to margins are higher resolutions (even very, too high)
340  // TODO: consider more precise resolution calculation
341 
342  QgsPoint center = outputRectangle().center();
343  QgsCoordinateTransform ct( srcCrs, outputCrs() );
345 
346  QgsRectangle srcExtent( srsCenter.x() - xRes / 2, srsCenter.y() - yRes / 2, srsCenter.x() + xRes / 2, srsCenter.y() + yRes / 2 );
347 
348  QgsRectangle extent = ct.transform( srcExtent );
349  xRes = extent.width();
350  yRes = extent.height();
351  }
352  mXResolutionLineEdit->setText( QString::number( xRes ) );
353  mYResolutionLineEdit->setText( QString::number( yRes ) );
354 }
355 
357 {
358  QgsDebugMsg( "Entered" );
359  QgsRectangle extent = outputRectangle();
360  int xSize = xResolution() != 0 ? static_cast<int>( qRound( extent.width() / xResolution() ) ) : 0;
361  int ySize = yResolution() != 0 ? static_cast<int>( qRound( extent.height() / yResolution() ) ) : 0;
362  mColumnsLineEdit->setText( QString::number( xSize ) );
363  mRowsLineEdit->setText( QString::number( ySize ) );
365 }
366 
368 {
369  mColumnsLineEdit->setText( QString::number( mDataProvider->xSize() ) );
370  mRowsLineEdit->setText( QString::number( mDataProvider->ySize() ) );
372 }
373 
375 {
376  QgsDebugMsg( "Entered" );
377  QgsRectangle extent = outputRectangle();
378  double xRes = nColumns() != 0 ? extent.width() / nColumns() : 0;
379  double yRes = nRows() != 0 ? extent.height() / nRows() : 0;
380  mXResolutionLineEdit->setText( QString::number( xRes ) );
381  mYResolutionLineEdit->setText( QString::number( yRes ) );
383 }
384 
386 {
387  QgsDebugMsg( "Entered" );
388  if ( mResolutionRadioButton->isChecked() )
389  {
390  recalcSize();
391  }
392  else
393  {
396  }
397 }
398 
400 {
401  QString msg;
402  switch ( mResolutionState )
403  {
404  case OriginalResolution:
405  msg = tr( "layer" );
406  break;
407  case UserResolution:
408  msg = tr( "user defined" );
409  break;
410  default:
411  break;
412  }
413  msg = tr( "Resolution (current: %1)" ).arg( msg );
414  mResolutionGroupBox->setTitle( msg );
415 }
416 
418 {
419  // Whenever extent changes with fixed size, original resolution is lost
420  if ( mSizeRadioButton->isChecked() )
421  {
423  }
425 }
426 
428 {
430  selector->setMessage();
431  selector->setSelectedCrsId( mUserCrs.srsid() );
432  if ( selector->exec() )
433  {
435  mCrsComboBox->setCurrentIndex( mCrsComboBox->findData( UserCrs ) );
436  }
437  delete selector;
438  crsChanged();
439 }
440 
442 {
443  QgsDebugMsg( "Entered" );
444  if ( outputCrs() != mPreviousCrs )
445  {
446  mExtentGroupBox->setOutputCrs( outputCrs() );
447  QgsExtentGroupBox::ExtentState state = mExtentGroupBox->extentState();
448 
449  // Reset extent
450  // We could reproject previous but that would add additional space also if
451  // it is was not necessary or at leas it could decrease accuracy
452  if ( state == QgsExtentGroupBox::OriginalExtent )
453  {
454  mExtentGroupBox->setOutputExtentFromOriginal();
455  }
456  else if ( state == QgsExtentGroupBox::CurrentExtent )
457  {
458  mExtentGroupBox->setOutputExtentFromCurrent();
459  }
460  else
461  {
462  mExtentGroupBox->setOutputExtentFromUser( mExtentGroupBox->outputExtent(), mPreviousCrs );
463  }
464 
465  // Reset resolution
466  if ( mResolutionRadioButton->isChecked() )
467  {
469  {
471  }
472  else
473  {
474  // reset from present resolution and present crs
476  }
477  }
478  else
479  {
480  // Size does not change, we just recalc resolution from new extent
482  }
483  }
485  updateCrsGroup();
486 }
487 
489 {
490  QgsDebugMsg( "Entered" );
491 
492  mCrsComboBox->setItemText( mCrsComboBox->findData( OriginalCrs ),
493  tr( "Layer (%1, %2)" ).arg( mLayerCrs.description() ).arg( mLayerCrs.authid() ) );
494 
495  mCrsComboBox->setItemText( mCrsComboBox->findData( CurrentCrs ),
496  tr( "Project (%1, %2)" ).arg( mCurrentCrs.description() ).arg( mCurrentCrs.authid() ) );
497 
498  mCrsComboBox->setItemText( mCrsComboBox->findData( UserCrs ),
499  tr( "Selected (%1, %2)" ).arg( mUserCrs.description() ).arg( mUserCrs.authid() ) );
500 }
501 
503 {
504  int state = mCrsComboBox->itemData( mCrsComboBox->currentIndex() ).toInt();
505  if ( state == OriginalCrs )
506  {
507  return mLayerCrs;
508  }
509  else if ( state == CurrentCrs )
510  {
511  return mCurrentCrs;
512  }
513  return mUserCrs;
514 }
515 
517 {
518  if ( mRenderedModeRadioButton->isChecked() ) return RenderedImageMode;
519  return RawDataMode;
520 }
521 
523 {
524  mNoDataGroupBox->setEnabled( checked && mDataProvider->bandCount() == 1 );
525 }
526 
528 {
529  addNoDataRow( std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN() );
530 }
531 
533 {
534  if ( !mRasterLayer->renderer() ) return;
535  const QgsRasterTransparency* rasterTransparency = mRasterLayer->renderer()->rasterTransparency();
536  if ( !rasterTransparency ) return;
537 
538  foreach ( QgsRasterTransparency::TransparentSingleValuePixel transparencyPixel, rasterTransparency->transparentSingleValuePixelList() )
539  {
540  if ( transparencyPixel.percentTransparent == 100 )
541  {
542  addNoDataRow( transparencyPixel.min, transparencyPixel.max );
543  if ( transparencyPixel.min != transparencyPixel.max )
544  {
545  setNoDataToEdited( mNoDataTableWidget->rowCount() - 1 );
546  }
547  }
548  }
549 }
550 
552 {
553  mNoDataTableWidget->removeRow( mNoDataTableWidget->currentRow() );
554 }
555 
557 {
558  while ( mNoDataTableWidget->rowCount() > 0 )
559  {
560  mNoDataTableWidget->removeRow( 0 );
561  }
562 }
563 
565 {
566  mNoDataTableWidget->insertRow( mNoDataTableWidget->rowCount() );
567  for ( int i = 0; i < 2; i++ )
568  {
569  double value = i == 0 ? min : max;
570  QLineEdit *lineEdit = new QLineEdit();
571  lineEdit->setFrame( false );
572  lineEdit->setContentsMargins( 1, 1, 1, 1 );
573  QString valueString;
574  switch ( mRasterLayer->dataProvider()->srcDataType( 1 ) )
575  {
576  case QGis::Float32:
577  case QGis::Float64:
578  lineEdit->setValidator( new QDoubleValidator( 0 ) );
579  if ( !qIsNaN( value ) )
580  {
581  valueString = QgsRasterBlock::printValue( value );
582  }
583  break;
584  default:
585  lineEdit->setValidator( new QIntValidator( 0 ) );
586  if ( !qIsNaN( value ) )
587  {
588  valueString = QString::number( static_cast<int>( value ) );
589  }
590  break;
591  }
592  lineEdit->setText( valueString );
593  mNoDataTableWidget->setCellWidget( mNoDataTableWidget->rowCount() - 1, i, lineEdit );
594 
595  adjustNoDataCellWidth( mNoDataTableWidget->rowCount() - 1, i );
596 
597  connect( lineEdit, SIGNAL( textEdited( const QString & ) ), this, SLOT( noDataCellTextEdited( const QString & ) ) );
598  }
599  mNoDataTableWidget->resizeColumnsToContents();
600  mNoDataTableWidget->resizeRowsToContents();
601 }
602 
604 {
605  Q_UNUSED( text );
606 
607  QLineEdit *lineEdit = dynamic_cast<QLineEdit *>( sender() );
608  if ( !lineEdit ) return;
609  int row = -1;
610  int column = -1;
611  for ( int r = 0 ; r < mNoDataTableWidget->rowCount(); r++ )
612  {
613  for ( int c = 0 ; c < mNoDataTableWidget->columnCount(); c++ )
614  {
615  if ( mNoDataTableWidget->cellWidget( r, c ) == sender() )
616  {
617  row = r;
618  column = c;
619  break;
620  }
621  }
622  if ( row != -1 ) break;
623  }
624  QgsDebugMsg( QString( "row = %1 column =%2" ).arg( row ).arg( column ) );
625 
626  if ( column == 0 )
627  {
628  QLineEdit *toLineEdit = dynamic_cast<QLineEdit *>( mNoDataTableWidget->cellWidget( row, 1 ) );
629  if ( !toLineEdit ) return;
630  bool toChanged = mNoDataToEdited.value( row );
631  QgsDebugMsg( QString( "toChanged = %1" ).arg( toChanged ) );
632  if ( !toChanged )
633  {
634  toLineEdit->setText( lineEdit->text() );
635  }
636  }
637  else if ( column == 1 )
638  {
639  setNoDataToEdited( row );
640  }
641 }
642 
644 {
645  if ( toggled )
646  {
647  // enable pyramids
648 
649  // Disabled (Radim), auto enabling of pyramids was making impression that
650  // we (programmers) know better what you (user) want to do,
651  // certainly auto expaning was bad experience
652 
653  //if ( ! mPyramidsGroupBox->isChecked() )
654  // mPyramidsGroupBox->setChecked( true );
655 
656  // Auto expanding mPyramidsGroupBox is bad - it auto crolls content of dialog
657  //if ( mPyramidsGroupBox->isCollapsed() )
658  // mPyramidsGroupBox->setCollapsed( false );
659  //mPyramidsOptionsWidget->checkAllLevels( true );
660 
661  // Show / hide tile options
662  mTilesGroupBox->show();
663  }
664  else
665  {
666  mTilesGroupBox->hide();
667  }
668 }
669 
671 {
672  Q_UNUSED( toggled );
674 }
675 
677 {
678  QString text;
679 
680  if ( mPyramidsGroupBox->isChecked() )
681  {
682  QList<QgsRasterPyramid> myPyramidList;
683  // if use existing, get pyramids from actual layer
684  // but that's not available yet
685  if ( mPyramidsUseExistingCheckBox->isChecked() )
686  {
687  myPyramidList = mDataProvider->buildPyramidList();
688  }
689  else
690  {
691  if ( ! mPyramidsOptionsWidget->overviewList().isEmpty() )
692  myPyramidList = mDataProvider->buildPyramidList( mPyramidsOptionsWidget->overviewList() );
693  }
694  QList<QgsRasterPyramid>::iterator myRasterPyramidIterator;
695  for ( myRasterPyramidIterator = myPyramidList.begin();
696  myRasterPyramidIterator != myPyramidList.end();
697  ++myRasterPyramidIterator )
698  {
699  if ( ! mPyramidsUseExistingCheckBox->isChecked() || myRasterPyramidIterator->exists )
700  {
701  text += QString::number( myRasterPyramidIterator->xDim ) + QString( "x" ) +
702  QString::number( myRasterPyramidIterator->yDim ) + " ";
703  }
704  }
705  }
706 
707  mPyramidResolutionsLineEdit->setText( text.trimmed() );
708 }
709 
711 {
712  if ( row >= mNoDataToEdited.size() )
713  {
714  mNoDataToEdited.resize( row + 1 );
715  }
716  mNoDataToEdited[row] = true;
717 }
718 
719 double QgsRasterLayerSaveAsDialog::noDataCellValue( int row, int column ) const
720 {
721  QLineEdit *lineEdit = dynamic_cast<QLineEdit *>( mNoDataTableWidget->cellWidget( row, column ) );
722  if ( !lineEdit || lineEdit->text().isEmpty() )
723  {
724  std::numeric_limits<double>::quiet_NaN();
725  }
726  return lineEdit->text().toDouble();
727 }
728 
730 {
731  QLineEdit *lineEdit = dynamic_cast<QLineEdit *>( mNoDataTableWidget->cellWidget( row, column ) );
732  if ( !lineEdit ) return;
733 
734  int width = qMax( lineEdit->fontMetrics().width( lineEdit->text() ) + 10, 100 );
735  width = qMax( width, mNoDataTableWidget->columnWidth( column ) );
736 
737  lineEdit->setFixedWidth( width );
738 }
739 
741 {
742  QgsRasterRangeList noDataList;
743  if ( ! mNoDataGroupBox->isChecked() )
744  return noDataList;
745 
746  for ( int r = 0 ; r < mNoDataTableWidget->rowCount(); r++ )
747  {
749  noDataList.append( noData );
750 
751  }
752  return noDataList;
753 }
754 
756 {
757  return mPyramidsGroupBox->isChecked() ? mPyramidsOptionsWidget->overviewList() : QList<int>();
758 }
759 
761 {
762  if ( ! mPyramidsGroupBox->isChecked() )
764  else if ( mPyramidsUseExistingCheckBox->isChecked() )
766  else
768 }
769 
771 {
772  if ( mCreateOptionsGroupBox->isChecked() )
773  {
774  QString message = mCreateOptionsWidget->validateOptions( true, false );
775  if ( !message.isNull() )
776  return false;
777  }
778  if ( mPyramidsGroupBox->isChecked() )
779  {
780  QString message = mPyramidsOptionsWidget->createOptionsWidget()->validateOptions( true, false );
781  if ( !message.isNull() )
782  return false;
783  }
784  return true;
785 }
786 
QgsCoordinateReferenceSystem mCurrentCrs
virtual int bandCount() const =0
Get number of bands.
QList< QgsRasterTransparency::TransparentSingleValuePixel > transparentSingleValuePixelList() const
Accessor for transparentSingleValuePixelList.
QgsCoordinateReferenceSystem mPreviousCrs
A rectangle specified with double values.
Definition: qgsrectangle.h:35
void on_mSaveAsLineEdit_textChanged(const QString &text)
static QString printValue(double value)
Print double value with all necessary significant digits.
void noDataCellTextEdited(const QString &text)
#define QgsDebugMsg(str)
Definition: qgslogger.h:36
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
static QIcon getThemeIcon(const QString &theName)
Helper to get a theme icon.
A generic dialog to prompt the user for a Coordinate Reference System.
bool createFromId(const long theId, CrsType theType=PostgisCrsId)
Raster values range container.
QgsCoordinateReferenceSystem outputCrs()
double x() const
Definition: qgspoint.h:110
virtual QString name() const =0
return a provider name
virtual int ySize() const
const QgsRasterTransparency * rasterTransparency() const
QgsRasterLayerSaveAsDialog(QgsRasterLayer *rasterLayer, QgsRasterDataProvider *sourceProvider, const QgsRectangle &currentExtent, const QgsCoordinateReferenceSystem &layerCrs, const QgsCoordinateReferenceSystem &currentCrs, QWidget *parent=0, Qt::WindowFlags f=0)
bool createFromOgcWmsCrs(QString theCrs)
Set up this CRS from the given OGC CRS.
double noDataCellValue(int row, int column) const
QgsRasterRenderer * renderer() const
virtual QList< QgsRasterPyramid > buildPyramidList(QList< int > overviewList=QList< int >())
Accessor for ths raster layers pyramid list.
virtual QGis::DataType srcDataType(int bandNo) const =0
Returns source data type for the band specified by number, source data type may be shorter than dataT...
virtual QgsRectangle extent()=0
Get the extent of the data source.
QgsCoordinateReferenceSystem mUserCrs
QgsRaster::RasterBuildPyramids buildPyramidsFlag() const
void setMessage(QString theMessage="")
If no parameter is passed, the message will be a generic 'define the CRS for this layer'...
QgsPoint transform(const QgsPoint p, TransformDirection direction=ForwardTransform) const
QgsRasterDataProvider * mDataProvider
A class to represent a point geometry.
Definition: qgspoint.h:63
void addNoDataRow(double min, double max)
int min(int a, int b)
Definition: util.h:93
virtual int capabilities() const
Returns a bitmask containing the supported capabilities.
void setResolution(double xRes, double yRes, const QgsCoordinateReferenceSystem &srcCrs)
QgsRasterRangeList noData() const
QList< QgsRasterRange > QgsRasterRangeList
virtual int xSize() const
Get raster size.
Class for storing a coordinate reference system (CRS)
Class for doing transforms between two map coordinate systems.
void on_mFormatComboBox_currentIndexChanged(const QString &text)
double y() const
Definition: qgspoint.h:118
RasterBuildPyramids
Definition: qgsraster.h:71
QgsRasterDataProvider * dataProvider()
Returns the data provider.
Defines the list of pixel values to be considered as transparent or semi transparent when rendering r...
double width() const
Width of the rectangle.
Definition: qgsrectangle.h:204
void adjustNoDataCellWidth(int row, int column)
QgsCoordinateReferenceSystem mLayerCrs
int max(int a, int b)
Definition: util.h:87
QgsPoint center() const
Center point of the rectangle.
Definition: qgsrectangle.h:214
double height() const
Height of the rectangle.
Definition: qgsrectangle.h:209
Base class for raster data providers.
#define tr(sourceText)