mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Revert "indentation update"
This reverts commit 7dd58aa8f62022e710e03af78cfd7d7ce08e83f5.
This commit is contained in:
parent
4b263d6b06
commit
af0782d7d5
@ -577,22 +577,22 @@ void QgsComposer::on_mActionExportAsPDF_triggered()
|
||||
QSettings myQSettings; // where we keep last used filter in persistent state
|
||||
QString lastUsedFile = myQSettings.value( "/UI/lastSaveAsPdfFile", "qgis.pdf" ).toString();
|
||||
QFileInfo file( lastUsedFile );
|
||||
|
||||
|
||||
outputFileName = QFileDialog::getSaveFileName(
|
||||
this,
|
||||
tr( "Choose a file name to save the map as" ),
|
||||
file.path(),
|
||||
tr( "PDF Format" ) + " (*.pdf *.PDF)" );
|
||||
this,
|
||||
tr( "Choose a file name to save the map as" ),
|
||||
file.path(),
|
||||
tr( "PDF Format" ) + " (*.pdf *.PDF)" );
|
||||
if ( outputFileName.isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( !outputFileName.endsWith( ".pdf", Qt::CaseInsensitive ) )
|
||||
{
|
||||
outputFileName += ".pdf";
|
||||
}
|
||||
|
||||
|
||||
myQSettings.setValue( "/UI/lastSaveAsPdfFile", outputFileName );
|
||||
}
|
||||
// else, we need to choose a directory
|
||||
@ -601,33 +601,33 @@ void QgsComposer::on_mActionExportAsPDF_triggered()
|
||||
if ( atlasMap->atlasFilenamePattern().size() == 0 )
|
||||
{
|
||||
int res = QMessageBox::warning( 0, tr( "Empty filename pattern" ),
|
||||
tr( "The filename pattern is empty. A default one will be used." ),
|
||||
QMessageBox::Ok | QMessageBox::Cancel,
|
||||
QMessageBox::Ok );
|
||||
tr( "The filename pattern is empty. A default one will be used." ),
|
||||
QMessageBox::Ok | QMessageBox::Cancel,
|
||||
QMessageBox::Ok );
|
||||
if ( res == QMessageBox::Cancel )
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
atlasMap->setAtlasFilenamePattern( "'output_'||$feature" );
|
||||
}
|
||||
|
||||
QSettings myQSettings;
|
||||
QString lastUsedDir = myQSettings.value( "/UI/lastSaveAtlasAsPdfDir", "." ).toString();
|
||||
outputDir = QFileDialog::getExistingDirectory( this,
|
||||
tr( "Directory where to save PDF files" ),
|
||||
lastUsedDir,
|
||||
QFileDialog::ShowDirsOnly );
|
||||
outputDir = QFileDialog::getExistingDirectory(this,
|
||||
tr("Directory where to save PDF files"),
|
||||
lastUsedDir,
|
||||
QFileDialog::ShowDirsOnly);
|
||||
if ( outputDir.isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
// test directory (if it exists and is writeable)
|
||||
if ( !QDir( outputDir ).exists() || !QFileInfo( outputDir ).isWritable() )
|
||||
if ( !QDir(outputDir).exists() || !QFileInfo(outputDir).isWritable() )
|
||||
{
|
||||
QMessageBox::warning( 0, tr( "Unable to write into the directory" ),
|
||||
tr( "The given output directory is not writeable. Cancelling." ),
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::Ok );
|
||||
tr( "The given output directory is not writeable. Cancelling." ),
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -647,7 +647,7 @@ void QgsComposer::on_mActionExportAsPDF_triggered()
|
||||
}
|
||||
QPainter painter( &printer );
|
||||
|
||||
QProgressDialog progress( tr( "Rendering maps..." ), tr( "Abort" ), 0, atlasRender.numFeatures(), this );
|
||||
QProgressDialog progress( tr("Rendering maps..."), tr("Abort"), 0, atlasRender.numFeatures(), this );
|
||||
QApplication::setOverrideCursor( Qt::BusyCursor );
|
||||
mView->setPaintingEnabled( false );
|
||||
|
||||
@ -656,31 +656,31 @@ void QgsComposer::on_mActionExportAsPDF_triggered()
|
||||
if ( hasAnAtlas )
|
||||
{
|
||||
if ( 0 == atlasRender.numFeatures() )
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
progress.setValue( featureI );
|
||||
// process input events in order to allow aborting
|
||||
// process input events in order to allow aborting
|
||||
QCoreApplication::processEvents();
|
||||
if ( progress.wasCanceled() )
|
||||
{
|
||||
atlasRender.end();
|
||||
break;
|
||||
atlasRender.end();
|
||||
break;
|
||||
}
|
||||
try
|
||||
{
|
||||
atlasRender.prepareForFeature( featureI );
|
||||
atlasRender.prepareForFeature( featureI );
|
||||
}
|
||||
catch ( std::runtime_error& e )
|
||||
{
|
||||
QMessageBox::warning( this, tr( "Atlas processing error" ),
|
||||
e.what(),
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::Ok );
|
||||
break;
|
||||
QMessageBox::warning( this, tr( "Atlas processing error" ),
|
||||
e.what(),
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::Ok);
|
||||
break;
|
||||
}
|
||||
if ( !atlasOnASingleFile )
|
||||
{
|
||||
outputFileName = QDir( outputDir ).filePath( atlasRender.currentFilename() ) + ".pdf";
|
||||
outputFileName = QDir(outputDir).filePath( atlasRender.currentFilename() ) + ".pdf";
|
||||
}
|
||||
}
|
||||
|
||||
@ -692,15 +692,14 @@ void QgsComposer::on_mActionExportAsPDF_triggered()
|
||||
{
|
||||
if ( featureI > 0 )
|
||||
{
|
||||
printer.newPage();
|
||||
printer.newPage();
|
||||
}
|
||||
mComposition->doPrint( printer, painter );
|
||||
}
|
||||
|
||||
featureI++;
|
||||
}
|
||||
while ( hasAnAtlas && featureI < atlasRender.numFeatures() );
|
||||
|
||||
} while ( hasAnAtlas && featureI < atlasRender.numFeatures() );
|
||||
|
||||
if ( hasAnAtlas )
|
||||
{
|
||||
atlasRender.end();
|
||||
@ -745,7 +744,7 @@ void QgsComposer::on_mActionPrint_triggered()
|
||||
mComposition->beginPrint( mPrinter );
|
||||
QPainter painter( &mPrinter );
|
||||
atlasRender.begin();
|
||||
QProgressDialog progress( tr( "Rendering maps..." ), tr( "Abort" ), 0, atlasRender.numFeatures(), this );
|
||||
QProgressDialog progress( tr("Rendering maps..."), tr("Abort"), 0, atlasRender.numFeatures(), this );
|
||||
|
||||
for ( size_t i = 0; i < atlasRender.numFeatures(); ++i )
|
||||
{
|
||||
@ -755,26 +754,26 @@ void QgsComposer::on_mActionPrint_triggered()
|
||||
|
||||
if ( progress.wasCanceled() )
|
||||
{
|
||||
atlasRender.end();
|
||||
break;
|
||||
atlasRender.end();
|
||||
break;
|
||||
}
|
||||
try
|
||||
{
|
||||
atlasRender.prepareForFeature( i );
|
||||
atlasRender.prepareForFeature( i );
|
||||
}
|
||||
catch ( std::runtime_error& e )
|
||||
{
|
||||
QMessageBox::warning( this, tr( "Atlas processing error" ),
|
||||
e.what(),
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::Ok );
|
||||
break;
|
||||
QMessageBox::warning( this, tr( "Atlas processing error" ),
|
||||
e.what(),
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::Ok);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ( i > 0 )
|
||||
{
|
||||
mPrinter.newPage();
|
||||
mPrinter.newPage();
|
||||
}
|
||||
mComposition->doPrint( mPrinter, painter );
|
||||
}
|
||||
@ -821,26 +820,26 @@ void QgsComposer::on_mActionExportAsImage_triggered()
|
||||
if ( 0 == mComposition->atlasMap() )
|
||||
{
|
||||
QPair<QString, QString> fileNExt = QgisGui::getSaveAsImageName( this, tr( "Choose a file name to save the map image as" ) );
|
||||
|
||||
|
||||
if ( fileNExt.first.isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
mView->setPaintingEnabled( false );
|
||||
|
||||
|
||||
for ( int i = 0; i < mComposition->numPages(); ++i )
|
||||
{
|
||||
QImage image = mComposition->printPageAsRaster( i );
|
||||
if ( i == 0 )
|
||||
{
|
||||
image.save( fileNExt.first, fileNExt.second.toLocal8Bit().constData() );
|
||||
image.save( fileNExt.first, fileNExt.second.toLocal8Bit().constData() );
|
||||
}
|
||||
else
|
||||
{
|
||||
QFileInfo fi( fileNExt.first );
|
||||
QString outputFilePath = fi.absolutePath() + "/" + fi.baseName() + "_" + QString::number( i + 1 ) + "." + fi.suffix();
|
||||
image.save( outputFilePath, fileNExt.second.toLocal8Bit().constData() );
|
||||
QFileInfo fi( fileNExt.first );
|
||||
QString outputFilePath = fi.absolutePath() + "/" + fi.baseName() + "_" + QString::number( i + 1 ) + "." + fi.suffix();
|
||||
image.save( outputFilePath, fileNExt.second.toLocal8Bit().constData() );
|
||||
}
|
||||
}
|
||||
mView->setPaintingEnabled( true );
|
||||
@ -852,12 +851,12 @@ void QgsComposer::on_mActionExportAsImage_triggered()
|
||||
if ( atlasMap->atlasFilenamePattern().size() == 0 )
|
||||
{
|
||||
int res = QMessageBox::warning( 0, tr( "Empty filename pattern" ),
|
||||
tr( "The filename pattern is empty. A default one will be used." ),
|
||||
QMessageBox::Ok | QMessageBox::Cancel,
|
||||
QMessageBox::Ok );
|
||||
tr( "The filename pattern is empty. A default one will be used." ),
|
||||
QMessageBox::Ok | QMessageBox::Cancel,
|
||||
QMessageBox::Ok );
|
||||
if ( res == QMessageBox::Cancel )
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
atlasMap->setAtlasFilenamePattern( "'output_'||$feature" );
|
||||
}
|
||||
@ -866,7 +865,7 @@ void QgsComposer::on_mActionExportAsImage_triggered()
|
||||
QString lastUsedDir = myQSettings.value( "/UI/lastSaveAtlasAsImagesDir", "." ).toString();
|
||||
QString lastUsedFormat = myQSettings.value( "/UI/lastSaveAtlasAsImagesFormat", "jpg" ).toString();
|
||||
|
||||
QFileDialog dlg( this, tr( "Directory where to save image files" ) );
|
||||
QFileDialog dlg( this, tr("Directory where to save image files") );
|
||||
dlg.setFileMode( QFileDialog::Directory );
|
||||
dlg.setOption( QFileDialog::ShowDirsOnly, true );
|
||||
|
||||
@ -875,22 +874,22 @@ void QgsComposer::on_mActionExportAsImage_triggered()
|
||||
QComboBox *box = new QComboBox();
|
||||
QHBoxLayout* hlayout = new QHBoxLayout();
|
||||
QWidget* widget = new QWidget();
|
||||
|
||||
|
||||
QList<QByteArray> formats = QImageWriter::supportedImageFormats();
|
||||
int selectedFormat = 0;
|
||||
for ( int i = 0; i < formats.size(); ++i )
|
||||
{
|
||||
QString format = QString( formats.at( i ) );
|
||||
QString format = QString( formats.at(i) );
|
||||
if ( format == lastUsedFormat )
|
||||
{
|
||||
selectedFormat = i;
|
||||
selectedFormat = i;
|
||||
}
|
||||
box->addItem( format );
|
||||
}
|
||||
box->setCurrentIndex( selectedFormat );
|
||||
|
||||
hlayout->setMargin( 0 );
|
||||
hlayout->addWidget( new QLabel( tr( "Image format: " ) ) );
|
||||
hlayout->addWidget( new QLabel( tr("Image format: ")) );
|
||||
hlayout->addWidget( box );
|
||||
widget->setLayout( hlayout );
|
||||
dlg.layout()->addWidget( widget );
|
||||
@ -900,11 +899,11 @@ void QgsComposer::on_mActionExportAsImage_triggered()
|
||||
return;
|
||||
}
|
||||
QStringList s = dlg.selectedFiles();
|
||||
if ( s.size() < 1 || s.at( 0 ).isEmpty() )
|
||||
if ( s.size() < 1 || s.at(0).isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
QString dir = s.at( 0 );
|
||||
QString dir = s.at(0);
|
||||
QString format = box->currentText();
|
||||
QString fileExt = "." + format;
|
||||
|
||||
@ -913,12 +912,12 @@ void QgsComposer::on_mActionExportAsImage_triggered()
|
||||
return;
|
||||
}
|
||||
// test directory (if it exists and is writeable)
|
||||
if ( !QDir( dir ).exists() || !QFileInfo( dir ).isWritable() )
|
||||
if ( !QDir(dir).exists() || !QFileInfo(dir).isWritable() )
|
||||
{
|
||||
QMessageBox::warning( 0, tr( "Unable to write into the directory" ),
|
||||
tr( "The given output directory is not writeable. Cancelling." ),
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::Ok );
|
||||
tr( "The given output directory is not writeable. Cancelling." ),
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -931,49 +930,49 @@ void QgsComposer::on_mActionExportAsImage_triggered()
|
||||
QApplication::setOverrideCursor( Qt::BusyCursor );
|
||||
|
||||
atlasRender.begin( atlasMap->atlasFilenamePattern() );
|
||||
|
||||
QProgressDialog progress( tr( "Rendering maps..." ), tr( "Abort" ), 0, atlasRender.numFeatures(), this );
|
||||
|
||||
QProgressDialog progress( tr("Rendering maps..."), tr("Abort"), 0, atlasRender.numFeatures(), this );
|
||||
|
||||
for ( size_t feature = 0; feature < atlasRender.numFeatures(); ++feature )
|
||||
{
|
||||
progress.setValue( feature );
|
||||
// process input events in order to allow cancelling
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
|
||||
if ( progress.wasCanceled() )
|
||||
{
|
||||
atlasRender.end();
|
||||
break;
|
||||
atlasRender.end();
|
||||
break;
|
||||
}
|
||||
try
|
||||
{
|
||||
atlasRender.prepareForFeature( feature );
|
||||
atlasRender.prepareForFeature( feature );
|
||||
}
|
||||
catch ( std::runtime_error& e )
|
||||
{
|
||||
QMessageBox::warning( this, tr( "Atlas processing error" ),
|
||||
e.what(),
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::Ok );
|
||||
break;
|
||||
QMessageBox::warning( this, tr( "Atlas processing error" ),
|
||||
e.what(),
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::Ok);
|
||||
break;
|
||||
}
|
||||
|
||||
QString filename = QDir( dir ).filePath( atlasRender.currentFilename() ) + fileExt;
|
||||
|
||||
QString filename = QDir(dir).filePath(atlasRender.currentFilename()) + fileExt;
|
||||
|
||||
for ( int i = 0; i < mComposition->numPages(); ++i )
|
||||
{
|
||||
QImage image = mComposition->printPageAsRaster( i );
|
||||
|
||||
if ( i == 0 )
|
||||
{
|
||||
image.save( filename, format.toLocal8Bit().constData() );
|
||||
}
|
||||
else
|
||||
{
|
||||
QFileInfo fi( filename );
|
||||
QString outputFilePath = fi.absolutePath() + "/" + fi.baseName() + "_" + QString::number( i + 1 ) + "." + fi.suffix();
|
||||
image.save( outputFilePath, format.toLocal8Bit().constData() );
|
||||
}
|
||||
QImage image = mComposition->printPageAsRaster( i );
|
||||
|
||||
if ( i == 0 )
|
||||
{
|
||||
image.save( filename, format.toLocal8Bit().constData() );
|
||||
}
|
||||
else
|
||||
{
|
||||
QFileInfo fi( filename );
|
||||
QString outputFilePath = fi.absolutePath() + "/" + fi.baseName() + "_" + QString::number( i + 1 ) + "." + fi.suffix();
|
||||
image.save( outputFilePath, format.toLocal8Bit().constData() );
|
||||
}
|
||||
}
|
||||
}
|
||||
atlasRender.end();
|
||||
@ -1025,12 +1024,12 @@ void QgsComposer::on_mActionExportAsSVG_triggered()
|
||||
{
|
||||
QString lastUsedFile = settings.value( "/UI/lastSaveAsSvgFile", "qgis.svg" ).toString();
|
||||
QFileInfo file( lastUsedFile );
|
||||
|
||||
|
||||
outputFileName = QFileDialog::getSaveFileName(
|
||||
this,
|
||||
tr( "Choose a file name to save the map as" ),
|
||||
file.path(),
|
||||
tr( "SVG Format" ) + " (*.svg *.SVG)" );
|
||||
this,
|
||||
tr( "Choose a file name to save the map as" ),
|
||||
file.path(),
|
||||
tr( "SVG Format" ) + " (*.svg *.SVG)" );
|
||||
if ( outputFileName.isEmpty() )
|
||||
return;
|
||||
|
||||
@ -1038,7 +1037,7 @@ void QgsComposer::on_mActionExportAsSVG_triggered()
|
||||
{
|
||||
outputFileName += ".svg";
|
||||
}
|
||||
|
||||
|
||||
settings.setValue( "/UI/lastSaveAsSvgFile", outputFileName );
|
||||
}
|
||||
else
|
||||
@ -1048,12 +1047,12 @@ void QgsComposer::on_mActionExportAsSVG_triggered()
|
||||
if ( atlasMap->atlasFilenamePattern().size() == 0 )
|
||||
{
|
||||
int res = QMessageBox::warning( 0, tr( "Empty filename pattern" ),
|
||||
tr( "The filename pattern is empty. A default one will be used." ),
|
||||
QMessageBox::Ok | QMessageBox::Cancel,
|
||||
QMessageBox::Ok );
|
||||
tr( "The filename pattern is empty. A default one will be used." ),
|
||||
QMessageBox::Ok | QMessageBox::Cancel,
|
||||
QMessageBox::Ok );
|
||||
if ( res == QMessageBox::Cancel )
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
atlasMap->setAtlasFilenamePattern( "'output_'||$feature" );
|
||||
}
|
||||
@ -1061,27 +1060,27 @@ void QgsComposer::on_mActionExportAsSVG_triggered()
|
||||
QSettings myQSettings;
|
||||
QString lastUsedDir = myQSettings.value( "/UI/lastSaveAtlasAsSvgDir", "." ).toString();
|
||||
|
||||
outputDir = QFileDialog::getExistingDirectory( this,
|
||||
tr( "Directory where to save SVG files" ),
|
||||
lastUsedDir,
|
||||
QFileDialog::ShowDirsOnly );
|
||||
outputDir = QFileDialog::getExistingDirectory(this,
|
||||
tr("Directory where to save SVG files"),
|
||||
lastUsedDir,
|
||||
QFileDialog::ShowDirsOnly);
|
||||
if ( outputDir.isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
// test directory (if it exists and is writeable)
|
||||
if ( !QDir( outputDir ).exists() || !QFileInfo( outputDir ).isWritable() )
|
||||
if ( !QDir(outputDir).exists() || !QFileInfo(outputDir).isWritable() )
|
||||
{
|
||||
QMessageBox::warning( 0, tr( "Unable to write into the directory" ),
|
||||
tr( "The given output directory is not writeable. Cancelling." ),
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::Ok );
|
||||
tr( "The given output directory is not writeable. Cancelling." ),
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
myQSettings.setValue( "/UI/lastSaveAtlasAsSvgDir", outputDir );
|
||||
}
|
||||
|
||||
|
||||
mView->setPaintingEnabled( false );
|
||||
|
||||
QgsAtlasRendering atlasRender( mComposition );
|
||||
@ -1090,36 +1089,36 @@ void QgsComposer::on_mActionExportAsSVG_triggered()
|
||||
{
|
||||
atlasRender.begin( mComposition->atlasMap()->atlasFilenamePattern() );
|
||||
}
|
||||
QProgressDialog progress( tr( "Rendering maps..." ), tr( "Abort" ), 0, atlasRender.numFeatures(), this );
|
||||
QProgressDialog progress( tr("Rendering maps..."), tr("Abort"), 0, atlasRender.numFeatures(), this );
|
||||
|
||||
do
|
||||
{
|
||||
if ( hasAnAtlas )
|
||||
{
|
||||
if ( atlasRender.numFeatures() == 0 )
|
||||
break;
|
||||
break;
|
||||
|
||||
progress.setValue( featureI );
|
||||
// process input events in order to allow aborting
|
||||
QCoreApplication::processEvents();
|
||||
if ( progress.wasCanceled() )
|
||||
{
|
||||
atlasRender.end();
|
||||
break;
|
||||
atlasRender.end();
|
||||
break;
|
||||
}
|
||||
try
|
||||
{
|
||||
atlasRender.prepareForFeature( featureI );
|
||||
atlasRender.prepareForFeature( featureI );
|
||||
}
|
||||
catch ( std::runtime_error& e )
|
||||
{
|
||||
QMessageBox::warning( this, tr( "Atlas processing error" ),
|
||||
e.what(),
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::Ok );
|
||||
break;
|
||||
QMessageBox::warning( this, tr( "Atlas processing error" ),
|
||||
e.what(),
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::Ok);
|
||||
break;
|
||||
}
|
||||
outputFileName = QDir( outputDir ).filePath( atlasRender.currentFilename() ) + ".svg";
|
||||
outputFileName = QDir(outputDir).filePath( atlasRender.currentFilename() ) + ".svg";
|
||||
}
|
||||
|
||||
for ( int i = 0; i < mComposition->numPages(); ++i )
|
||||
@ -1130,14 +1129,14 @@ void QgsComposer::on_mActionExportAsSVG_triggered()
|
||||
#endif
|
||||
if ( i == 0 )
|
||||
{
|
||||
generator.setFileName( outputFileName );
|
||||
generator.setFileName( outputFileName );
|
||||
}
|
||||
else
|
||||
{
|
||||
QFileInfo fi( outputFileName );
|
||||
generator.setFileName( fi.absolutePath() + "/" + fi.baseName() + "_" + QString::number( i + 1 ) + "." + fi.suffix() );
|
||||
QFileInfo fi( outputFileName );
|
||||
generator.setFileName( fi.absolutePath() + "/" + fi.baseName() + "_" + QString::number( i + 1 ) + "." + fi.suffix() );
|
||||
}
|
||||
|
||||
|
||||
//width in pixel
|
||||
int width = ( int )( mComposition->paperWidth() * mComposition->printResolution() / 25.4 );
|
||||
//height in pixel
|
||||
@ -1147,15 +1146,14 @@ void QgsComposer::on_mActionExportAsSVG_triggered()
|
||||
generator.setViewBox( QRect( 0, 0, width, height ) );
|
||||
#endif
|
||||
generator.setResolution( mComposition->printResolution() ); //because the rendering is done in mm, convert the dpi
|
||||
|
||||
|
||||
QPainter p( &generator );
|
||||
|
||||
|
||||
mComposition->renderPage( &p, i );
|
||||
p.end();
|
||||
}
|
||||
featureI++;
|
||||
}
|
||||
while ( hasAnAtlas && featureI < atlasRender.numFeatures() );
|
||||
} while ( hasAnAtlas && featureI < atlasRender.numFeatures() );
|
||||
|
||||
if ( hasAnAtlas )
|
||||
atlasRender.end();
|
||||
|
@ -102,7 +102,7 @@ void QgsComposerLabelWidget::on_mFontColorButton_clicked()
|
||||
|
||||
void QgsComposerLabelWidget::on_mInsertExpressionButton_clicked()
|
||||
{
|
||||
if ( !mComposerLabel )
|
||||
if ( !mComposerLabel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -422,13 +422,13 @@ void QgsComposerMapWidget::updateGuiElements()
|
||||
{
|
||||
mIsAtlasCheckBox->setCheckState( Qt::Checked );
|
||||
|
||||
int idx = mAtlasCoverageLayerComboBox->findData( qVariantFromValue(( void* )mComposerMap->atlasCoverageLayer() ) );
|
||||
int idx = mAtlasCoverageLayerComboBox->findData( qVariantFromValue( (void*)mComposerMap->atlasCoverageLayer() ));
|
||||
if ( idx != -1 )
|
||||
{
|
||||
mAtlasCoverageLayerComboBox->setCurrentIndex( idx );
|
||||
mAtlasCoverageLayerComboBox->setCurrentIndex( idx );
|
||||
}
|
||||
|
||||
mAtlasMarginSpinBox->setValue( static_cast<int>( mComposerMap->atlasMargin() * 100 ) );
|
||||
|
||||
mAtlasMarginSpinBox->setValue( static_cast<int>(mComposerMap->atlasMargin() * 100) );
|
||||
mAtlasFilenamePatternEdit->setText( mComposerMap->atlasFilenamePattern() );
|
||||
mAtlasFixedScaleCheckBox->setCheckState( mComposerMap->atlasFixedScale() ? Qt::Checked : Qt::Unchecked );
|
||||
mAtlasHideCoverageCheckBox->setCheckState( mComposerMap->atlasHideCoverage() ? Qt::Checked : Qt::Unchecked );
|
||||
@ -438,7 +438,7 @@ void QgsComposerMapWidget::updateGuiElements()
|
||||
{
|
||||
mIsAtlasCheckBox->setCheckState( Qt::Unchecked );
|
||||
}
|
||||
|
||||
|
||||
blockAllSignals( false );
|
||||
}
|
||||
}
|
||||
@ -940,14 +940,14 @@ void QgsComposerMapWidget::on_mIsAtlasCheckBox_stateChanged( int state )
|
||||
if ( composition->atlasMap() != 0 && composition->atlasMap() != mComposerMap )
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText( tr( "An atlas map already exists." ) );
|
||||
msgBox.setInformativeText( "Are you sure to define this map as the new atlas map ?" );
|
||||
msgBox.setStandardButtons( QMessageBox::Yes | QMessageBox::No );
|
||||
msgBox.setDefaultButton( QMessageBox::No );
|
||||
msgBox.setText(tr("An atlas map already exists."));
|
||||
msgBox.setInformativeText("Are you sure to define this map as the new atlas map ?");
|
||||
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No );
|
||||
msgBox.setDefaultButton(QMessageBox::No);
|
||||
if ( msgBox.exec() != QMessageBox::Yes )
|
||||
{
|
||||
mIsAtlasCheckBox->setCheckState( Qt::Unchecked );
|
||||
return;
|
||||
mIsAtlasCheckBox->setCheckState( Qt::Unchecked );
|
||||
return;
|
||||
}
|
||||
}
|
||||
composition->setAtlasMap( mComposerMap );
|
||||
@ -959,9 +959,9 @@ void QgsComposerMapWidget::on_mIsAtlasCheckBox_stateChanged( int state )
|
||||
for ( QMap<QString, QgsMapLayer*>::const_iterator it = layers.begin(); it != layers.end(); ++it )
|
||||
{
|
||||
// Only consider vector layers
|
||||
if ( dynamic_cast<QgsVectorLayer*>( it.value() ) )
|
||||
if ( dynamic_cast<QgsVectorLayer*>(it.value()) )
|
||||
{
|
||||
mAtlasCoverageLayerComboBox->insertItem( idx++, it.key(), /* userdata */ qVariantFromValue(( void* )it.value() ) );
|
||||
mAtlasCoverageLayerComboBox->insertItem( idx++, it.key(), /* userdata */ qVariantFromValue( (void*)it.value() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -987,7 +987,7 @@ void QgsComposerMapWidget::on_mAtlasCoverageLayerComboBox_currentIndexChanged( i
|
||||
return;
|
||||
}
|
||||
|
||||
QgsVectorLayer* layer = reinterpret_cast<QgsVectorLayer*>( mAtlasCoverageLayerComboBox->itemData( index ).value<void*>() );
|
||||
QgsVectorLayer* layer = reinterpret_cast<QgsVectorLayer*>(mAtlasCoverageLayerComboBox->itemData( index ).value<void*>());
|
||||
mComposerMap->setAtlasCoverageLayer( layer );
|
||||
}
|
||||
|
||||
@ -1026,7 +1026,7 @@ void QgsComposerMapWidget::on_mAtlasFilenameExpressionButton_clicked()
|
||||
|
||||
void QgsComposerMapWidget::on_mAtlasHideCoverageCheckBox_stateChanged( int state )
|
||||
{
|
||||
if ( !mComposerMap )
|
||||
if (!mComposerMap)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -1035,7 +1035,7 @@ void QgsComposerMapWidget::on_mAtlasHideCoverageCheckBox_stateChanged( int state
|
||||
|
||||
void QgsComposerMapWidget::on_mAtlasFixedScaleCheckBox_stateChanged( int state )
|
||||
{
|
||||
if ( !mComposerMap )
|
||||
if (!mComposerMap)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -1054,7 +1054,7 @@ void QgsComposerMapWidget::on_mAtlasFixedScaleCheckBox_stateChanged( int state )
|
||||
|
||||
void QgsComposerMapWidget::on_mAtlasSingleFileCheckBox_stateChanged( int state )
|
||||
{
|
||||
if ( !mComposerMap )
|
||||
if (!mComposerMap)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -58,18 +58,18 @@ void QgsComposerHtml::setUrl( const QUrl& url )
|
||||
qApp->processEvents();
|
||||
}
|
||||
|
||||
if ( frameCount() < 1 ) return;
|
||||
if ( frameCount() < 1) return;
|
||||
//QSize contentsSize = mWebPage->mainFrame()->contentsSize();
|
||||
|
||||
QRectF contentRect = this->mFrameItems.at( 0 )->boundingRect();
|
||||
QRectF contentRect = this->mFrameItems.at(0)->boundingRect();
|
||||
//there is going to be a little rounding error converting from float to int
|
||||
QSize contentsSize = QSize(( int )( contentRect.width() * mHtmlUnitsToMM ),
|
||||
( int )( contentRect.height() * mHtmlUnitsToMM ) );
|
||||
QSize contentsSize = QSize( (int)(contentRect.width() * mHtmlUnitsToMM),
|
||||
(int)(contentRect.height() * mHtmlUnitsToMM));
|
||||
mWebPage->setViewportSize( contentsSize );
|
||||
|
||||
//suppress scroll bars always
|
||||
mWebPage->mainFrame()->setScrollBarPolicy( Qt::Horizontal, Qt::ScrollBarAlwaysOff );
|
||||
mWebPage->mainFrame()->setScrollBarPolicy( Qt::Vertical, Qt::ScrollBarAlwaysOff );
|
||||
mWebPage->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
|
||||
mWebPage->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
|
||||
|
||||
mSize.setWidth( contentsSize.width() / mHtmlUnitsToMM );
|
||||
mSize.setHeight( contentsSize.height() / mHtmlUnitsToMM );
|
||||
|
@ -22,9 +22,9 @@
|
||||
#include <QPainter>
|
||||
|
||||
QgsComposerLabel::QgsComposerLabel( QgsComposition *composition ):
|
||||
QgsComposerItem( composition ), mMargin( 1.0 ), mFontColor( QColor( 0, 0, 0 ) ),
|
||||
mHAlignment( Qt::AlignLeft ), mVAlignment( Qt::AlignTop ),
|
||||
mExpressionFeature( 0 ), mExpressionLayer( 0 )
|
||||
QgsComposerItem( composition ), mMargin( 1.0 ), mFontColor( QColor( 0, 0, 0 ) ),
|
||||
mHAlignment( Qt::AlignLeft ), mVAlignment( Qt::AlignTop ),
|
||||
mExpressionFeature( 0 ), mExpressionLayer( 0 )
|
||||
{
|
||||
//default font size is 10 point
|
||||
mFont.setPointSizeF( 10 );
|
||||
@ -90,7 +90,7 @@ QString QgsComposerLabel::displayText() const
|
||||
QString displayText = mText;
|
||||
replaceDateText( displayText );
|
||||
QMap<QString, QVariant> subs = mSubstitutions;
|
||||
subs[ "$page" ] = QVariant(( int )mComposition->itemPageNumber( this ) + 1 );
|
||||
subs[ "$page" ] = QVariant((int)mComposition->itemPageNumber( this ) + 1);
|
||||
return QgsExpression::replaceExpressionText( displayText, mExpressionFeature, mExpressionLayer, &subs );
|
||||
}
|
||||
|
||||
@ -105,9 +105,9 @@ void QgsComposerLabel::replaceDateText( QString& text ) const
|
||||
int openingBracketPos = text.indexOf( "(", currentDatePos );
|
||||
int closingBracketPos = text.indexOf( ")", openingBracketPos + 1 );
|
||||
if ( openingBracketPos != -1 &&
|
||||
closingBracketPos != -1 &&
|
||||
( closingBracketPos - openingBracketPos ) > 1 &&
|
||||
openingBracketPos == currentDatePos + constant.size() )
|
||||
closingBracketPos != -1 &&
|
||||
( closingBracketPos - openingBracketPos ) > 1 &&
|
||||
openingBracketPos == currentDatePos + constant.size() )
|
||||
{
|
||||
formatText = text.mid( openingBracketPos + 1, closingBracketPos - openingBracketPos - 1 );
|
||||
text.replace( currentDatePos, closingBracketPos - currentDatePos + 1, QDate::currentDate().toString( formatText ) );
|
||||
|
@ -39,13 +39,13 @@
|
||||
|
||||
QgsComposerMap::QgsComposerMap( QgsComposition *composition, int x, int y, int width, int height )
|
||||
: QgsComposerItem( x, y, width, height, composition ), mKeepLayerSet( false ),
|
||||
mOverviewFrameMapId( -1 ), mGridEnabled( false ), mGridStyle( Solid ),
|
||||
mOverviewFrameMapId( -1 ), mGridEnabled( false ), mGridStyle( Solid ),
|
||||
mGridIntervalX( 0.0 ), mGridIntervalY( 0.0 ), mGridOffsetX( 0.0 ), mGridOffsetY( 0.0 ), mGridAnnotationPrecision( 3 ), mShowGridAnnotation( false ),
|
||||
mLeftGridAnnotationPosition( OutsideMapFrame ), mRightGridAnnotationPosition( OutsideMapFrame ), mTopGridAnnotationPosition( OutsideMapFrame ),
|
||||
mBottomGridAnnotationPosition( OutsideMapFrame ), mAnnotationFrameDistance( 1.0 ), mLeftGridAnnotationDirection( Horizontal ), mRightGridAnnotationDirection( Horizontal ),
|
||||
mTopGridAnnotationDirection( Horizontal ), mBottomGridAnnotationDirection( Horizontal ), mGridFrameStyle( NoGridFrame ), mGridFrameWidth( 2.0 ),
|
||||
mCrossLength( 3 ), mMapCanvas( 0 ), mDrawCanvasItems( true ),
|
||||
mAtlasHideCoverage( false ), mAtlasFixedScale( false ), mAtlasMargin( 0.10 ), mAtlasFilenamePattern( "'output_'||$feature" ), mAtlasCoverageLayer( 0 ), mAtlasSingleFile( false )
|
||||
mCrossLength( 3 ), mMapCanvas( 0 ), mDrawCanvasItems( true ),
|
||||
mAtlasHideCoverage( false ), mAtlasFixedScale( false ), mAtlasMargin( 0.10 ), mAtlasFilenamePattern("'output_'||$feature"), mAtlasCoverageLayer(0), mAtlasSingleFile( false )
|
||||
{
|
||||
mComposition = composition;
|
||||
mOverviewFrameMapSymbol = 0;
|
||||
@ -86,8 +86,8 @@ QgsComposerMap::QgsComposerMap( QgsComposition *composition )
|
||||
mLeftGridAnnotationPosition( OutsideMapFrame ), mRightGridAnnotationPosition( OutsideMapFrame ), mTopGridAnnotationPosition( OutsideMapFrame ),
|
||||
mBottomGridAnnotationPosition( OutsideMapFrame ), mAnnotationFrameDistance( 1.0 ), mLeftGridAnnotationDirection( Horizontal ), mRightGridAnnotationDirection( Horizontal ),
|
||||
mTopGridAnnotationDirection( Horizontal ), mBottomGridAnnotationDirection( Horizontal ), mGridFrameStyle( NoGridFrame ), mGridFrameWidth( 2.0 ), mCrossLength( 3 ),
|
||||
mMapCanvas( 0 ), mDrawCanvasItems( true ),
|
||||
mAtlasHideCoverage( false ), mAtlasFixedScale( false ), mAtlasMargin( 0.10 ), mAtlasFilenamePattern( "'output_'||$feature" ), mAtlasCoverageLayer( 0 ), mAtlasSingleFile( false )
|
||||
mMapCanvas( 0 ), mDrawCanvasItems( true ),
|
||||
mAtlasHideCoverage( false ), mAtlasFixedScale( false ), mAtlasMargin( 0.10 ), mAtlasFilenamePattern("'output_'||$feature"), mAtlasCoverageLayer(0), mAtlasSingleFile( false )
|
||||
{
|
||||
mOverviewFrameMapSymbol = 0;
|
||||
createDefaultOverviewFrameSymbol();
|
||||
@ -762,7 +762,7 @@ bool QgsComposerMap::writeXML( QDomElement& elem, QDomDocument & doc ) const
|
||||
atlasElem.setAttribute( "hideCoverage", mAtlasHideCoverage ? "true" : "false" );
|
||||
atlasElem.setAttribute( "fixedScale", mAtlasFixedScale ? "true" : "false" );
|
||||
atlasElem.setAttribute( "singleFile", mAtlasSingleFile ? "true" : "false" );
|
||||
atlasElem.setAttribute( "margin", QString::number( mAtlasMargin ) );
|
||||
atlasElem.setAttribute( "margin", QString::number(mAtlasMargin) );
|
||||
atlasElem.setAttribute( "filenamePattern", mAtlasFilenamePattern );
|
||||
|
||||
composerMapElem.appendChild( atlasElem );
|
||||
@ -918,10 +918,10 @@ bool QgsComposerMap::readXML( const QDomElement& itemElem, const QDomDocument& d
|
||||
QMap<QString, QgsMapLayer*> layers = QgsMapLayerRegistry::instance()->mapLayers();
|
||||
for ( QMap<QString, QgsMapLayer*>::const_iterator it = layers.begin(); it != layers.end(); ++it )
|
||||
{
|
||||
if ( it.key() == atlasElem.attribute( "coverageLayer" ) )
|
||||
if ( it.key() == atlasElem.attribute("coverageLayer") )
|
||||
{
|
||||
mAtlasCoverageLayer = dynamic_cast<QgsVectorLayer*>( it.value() );
|
||||
break;
|
||||
mAtlasCoverageLayer = dynamic_cast<QgsVectorLayer*>(it.value());
|
||||
break;
|
||||
}
|
||||
}
|
||||
mAtlasMargin = atlasElem.attribute( "margin", "0.0" ).toDouble();
|
||||
|
@ -119,7 +119,7 @@ void QgsLegendModel::setLayerSet( const QStringList& layerIds )
|
||||
|
||||
QStandardItem* QgsLegendModel::addGroup( QString text, int position )
|
||||
{
|
||||
if ( text.isNull() )
|
||||
if( text.isNull() )
|
||||
text = tr( "Group" );
|
||||
|
||||
QgsComposerGroupItem* groupItem = new QgsComposerGroupItem( text );
|
||||
|
@ -902,8 +902,8 @@ void QgsCoordinateReferenceSystem::setProj4String( QString theProj4String )
|
||||
{
|
||||
char *oldlocale = setlocale( LC_NUMERIC, NULL );
|
||||
/* the next setlocale() invalides the return of previous setlocale() */
|
||||
if ( oldlocale != NULL )
|
||||
oldlocale = strdup( oldlocale );
|
||||
if (oldlocale != NULL)
|
||||
oldlocale = strdup(oldlocale);
|
||||
|
||||
setlocale( LC_NUMERIC, "C" );
|
||||
OSRDestroySpatialReference( mCRS );
|
||||
@ -919,7 +919,7 @@ void QgsCoordinateReferenceSystem::setProj4String( QString theProj4String )
|
||||
#endif
|
||||
|
||||
setlocale( LC_NUMERIC, oldlocale );
|
||||
free( oldlocale );
|
||||
free(oldlocale);
|
||||
}
|
||||
void QgsCoordinateReferenceSystem::setGeographicFlag( bool theGeoFlag )
|
||||
{
|
||||
|
@ -319,8 +319,8 @@ void QgsCoordinateTransform::transformInPlace( double& x, double& y, double& z,
|
||||
}
|
||||
|
||||
void QgsCoordinateTransform::transformInPlace(
|
||||
QVector<double>& x, QVector<double>& y, QVector<double>& z,
|
||||
TransformDirection direction ) const
|
||||
QVector<double>& x, QVector<double>& y, QVector<double>& z,
|
||||
TransformDirection direction ) const
|
||||
{
|
||||
if ( mShortCircuit || !mInitialisedFlag )
|
||||
return;
|
||||
@ -373,8 +373,8 @@ void QgsCoordinateTransform::transformInPlace( float& x, float& y, float& z,
|
||||
}
|
||||
|
||||
void QgsCoordinateTransform::transformInPlace(
|
||||
QVector<float>& x, QVector<float>& y, QVector<float>& z,
|
||||
TransformDirection direction ) const
|
||||
QVector<float>& x, QVector<float>& y, QVector<float>& z,
|
||||
TransformDirection direction ) const
|
||||
{
|
||||
if ( mShortCircuit || !mInitialisedFlag )
|
||||
return;
|
||||
|
@ -802,7 +802,7 @@ static QVariant fcnFormatNumber( const QVariantList& values, QgsFeature*, QgsExp
|
||||
static QVariant fcnFormatDate( const QVariantList& values, QgsFeature*, QgsExpression* parent )
|
||||
{
|
||||
QDateTime dt = getDateTimeValue( values.at( 0 ), parent );
|
||||
QString format = getStringValue( values.at( 1 ), parent );
|
||||
QString format = getStringValue( values.at( 1 ), parent );
|
||||
return dt.toString( format );
|
||||
}
|
||||
|
||||
@ -882,7 +882,7 @@ const QList<QgsExpression::FunctionDef> &QgsExpression::BuiltinFunctions()
|
||||
<< FunctionDef( "$rownum", 0, fcnRowNumber, QObject::tr( "Record" ) )
|
||||
<< FunctionDef( "$id", 0, fcnFeatureId, QObject::tr( "Record" ) )
|
||||
<< FunctionDef( "$scale", 0, fcnScale, QObject::tr( "Record" ) )
|
||||
// private functions
|
||||
// private functions
|
||||
<< FunctionDef( "_specialcol_", 1, fcnSpecialColumn, QObject::tr( "Special" ) )
|
||||
;
|
||||
}
|
||||
@ -933,7 +933,7 @@ QList<QgsExpression::FunctionDef> QgsExpression::specialColumns()
|
||||
QList<FunctionDef> defs;
|
||||
for ( QMap<QString, QVariant>::const_iterator it = gmSpecialColumns.begin(); it != gmSpecialColumns.end(); ++it )
|
||||
{
|
||||
defs << FunctionDef( it.key(), 0, 0, QObject::tr( "Record" ) );
|
||||
defs << FunctionDef( it.key(), 0, 0, QObject::tr( "Record" ));
|
||||
}
|
||||
return defs;
|
||||
}
|
||||
@ -1126,7 +1126,7 @@ QString QgsExpression::replaceExpressionText( QString action, QgsFeature* feat,
|
||||
{
|
||||
QVariant oldValue = QgsExpression::specialColumn( sit.key() );
|
||||
if ( !oldValue.isNull() )
|
||||
savedValues.insert( sit.key(), oldValue );
|
||||
savedValues.insert( sit.key(), oldValue );
|
||||
|
||||
// set the new value
|
||||
QgsExpression::setSpecialColumn( sit.key(), sit.value() );
|
||||
@ -2146,7 +2146,7 @@ QVariant QgsExpression::NodeColumnRef::eval( QgsExpression* /*parent*/, QgsFeatu
|
||||
{
|
||||
return f->attributeMap()[mIndex];
|
||||
}
|
||||
return QVariant( "[" + mName + "]" );
|
||||
return QVariant("[" + mName + "]");
|
||||
}
|
||||
|
||||
bool QgsExpression::NodeColumnRef::prepare( QgsExpression* parent, const QgsFieldMap& fields )
|
||||
|
@ -3946,10 +3946,10 @@ QString QgsGeometry::exportToWkt()
|
||||
{
|
||||
mWkt += "POINT(";
|
||||
x = ( double * )( mGeometry + 5 );
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
mWkt += " ";
|
||||
y = ( double * )( mGeometry + 5 + sizeof( double ) );
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
mWkt += ")";
|
||||
return mWkt;
|
||||
}
|
||||
@ -3975,11 +3975,11 @@ QString QgsGeometry::exportToWkt()
|
||||
mWkt += ", ";
|
||||
}
|
||||
x = ( double * ) ptr;
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
mWkt += " ";
|
||||
ptr += sizeof( double );
|
||||
y = ( double * ) ptr;
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
ptr += sizeof( double );
|
||||
if ( hasZValue )
|
||||
{
|
||||
@ -4030,11 +4030,11 @@ QString QgsGeometry::exportToWkt()
|
||||
mWkt += ",";
|
||||
}
|
||||
x = ( double * ) ptr;
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
mWkt += " ";
|
||||
ptr += sizeof( double );
|
||||
y = ( double * ) ptr;
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
ptr += sizeof( double );
|
||||
if ( hasZValue )
|
||||
{
|
||||
@ -4068,11 +4068,11 @@ QString QgsGeometry::exportToWkt()
|
||||
mWkt += ", ";
|
||||
}
|
||||
x = ( double * )( ptr );
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
mWkt += " ";
|
||||
ptr += sizeof( double );
|
||||
y = ( double * )( ptr );
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
ptr += sizeof( double );
|
||||
if ( hasZValue )
|
||||
{
|
||||
@ -4112,11 +4112,11 @@ QString QgsGeometry::exportToWkt()
|
||||
mWkt += ", ";
|
||||
}
|
||||
x = ( double * ) ptr;
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
ptr += sizeof( double );
|
||||
mWkt += " ";
|
||||
y = ( double * ) ptr;
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
ptr += sizeof( double );
|
||||
if ( hasZValue )
|
||||
{
|
||||
@ -4168,11 +4168,11 @@ QString QgsGeometry::exportToWkt()
|
||||
mWkt += ",";
|
||||
}
|
||||
x = ( double * ) ptr;
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
ptr += sizeof( double );
|
||||
mWkt += " ";
|
||||
y = ( double * ) ptr;
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
ptr += sizeof( double );
|
||||
if ( hasZValue )
|
||||
{
|
||||
@ -4226,10 +4226,10 @@ QString QgsGeometry::exportToGeoJSON()
|
||||
{
|
||||
mWkt += "{ \"type\": \"Point\", \"coordinates\": [";
|
||||
x = ( double * )( mGeometry + 5 );
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
mWkt += ", ";
|
||||
y = ( double * )( mGeometry + 5 + sizeof( double ) );
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
mWkt += "] }";
|
||||
return mWkt;
|
||||
}
|
||||
@ -4256,11 +4256,11 @@ QString QgsGeometry::exportToGeoJSON()
|
||||
}
|
||||
mWkt += "[";
|
||||
x = ( double * ) ptr;
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
mWkt += ", ";
|
||||
ptr += sizeof( double );
|
||||
y = ( double * ) ptr;
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
ptr += sizeof( double );
|
||||
if ( hasZValue )
|
||||
{
|
||||
@ -4313,11 +4313,11 @@ QString QgsGeometry::exportToGeoJSON()
|
||||
}
|
||||
mWkt += "[";
|
||||
x = ( double * ) ptr;
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
mWkt += ", ";
|
||||
ptr += sizeof( double );
|
||||
y = ( double * ) ptr;
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
ptr += sizeof( double );
|
||||
if ( hasZValue )
|
||||
{
|
||||
@ -4353,11 +4353,11 @@ QString QgsGeometry::exportToGeoJSON()
|
||||
}
|
||||
mWkt += "[";
|
||||
x = ( double * )( ptr );
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
mWkt += ", ";
|
||||
ptr += sizeof( double );
|
||||
y = ( double * )( ptr );
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
ptr += sizeof( double );
|
||||
if ( hasZValue )
|
||||
{
|
||||
@ -4399,11 +4399,11 @@ QString QgsGeometry::exportToGeoJSON()
|
||||
}
|
||||
mWkt += "[";
|
||||
x = ( double * ) ptr;
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
ptr += sizeof( double );
|
||||
mWkt += ", ";
|
||||
y = ( double * ) ptr;
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
ptr += sizeof( double );
|
||||
if ( hasZValue )
|
||||
{
|
||||
@ -4457,11 +4457,11 @@ QString QgsGeometry::exportToGeoJSON()
|
||||
}
|
||||
mWkt += "[";
|
||||
x = ( double * ) ptr;
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *x, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
ptr += sizeof( double );
|
||||
mWkt += ", ";
|
||||
y = ( double * ) ptr;
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
mWkt += QString::number( *y, 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
ptr += sizeof( double );
|
||||
if ( hasZValue )
|
||||
{
|
||||
|
@ -311,13 +311,13 @@ void QgsComposerView::mouseReleaseEvent( QMouseEvent* e )
|
||||
}
|
||||
if ( composition() )
|
||||
{
|
||||
QgsComposerMap* composerMap = new QgsComposerMap( composition(), mRubberBandItem->transform().dx(), mRubberBandItem->transform().dy(), mRubberBandItem->rect().width(), mRubberBandItem->rect().height() );
|
||||
composition()->addComposerMap( composerMap );
|
||||
scene()->removeItem( mRubberBandItem );
|
||||
delete mRubberBandItem;
|
||||
mRubberBandItem = 0;
|
||||
emit actionFinished();
|
||||
composition()->pushAddRemoveCommand( composerMap, tr( "Map added" ) );
|
||||
QgsComposerMap* composerMap = new QgsComposerMap( composition(), mRubberBandItem->transform().dx(), mRubberBandItem->transform().dy(), mRubberBandItem->rect().width(), mRubberBandItem->rect().height() );
|
||||
composition()->addComposerMap( composerMap );
|
||||
scene()->removeItem( mRubberBandItem );
|
||||
delete mRubberBandItem;
|
||||
mRubberBandItem = 0;
|
||||
emit actionFinished();
|
||||
composition()->pushAddRemoveCommand( composerMap, tr( "Map added" ) );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -442,10 +442,10 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
|
||||
if ( bboxOk )
|
||||
searchRect.set( minx, miny, maxx, maxy );
|
||||
else
|
||||
searchRect.set( searchRect.xMinimum() - 0.000001
|
||||
, searchRect.yMinimum() - 0.000001
|
||||
, searchRect.xMaximum() + 0.000001
|
||||
, searchRect.yMaximum() + 0.000001 );
|
||||
searchRect.set( searchRect.xMinimum()-0.000001
|
||||
, searchRect.yMinimum()-0.000001
|
||||
, searchRect.xMaximum()+0.000001
|
||||
, searchRect.yMaximum()+0.000001 );
|
||||
QgsCoordinateReferenceSystem layerCrs = layer->crs();
|
||||
|
||||
startGetFeature( request, format, layerCrs, &searchRect );
|
||||
@ -516,7 +516,7 @@ void QgsWFSServer::startGetFeature( QgsRequestHandler& request, const QString& f
|
||||
if ( format == "GeoJSON" )
|
||||
{
|
||||
fcString = "{\"type\": \"FeatureCollection\",\n";
|
||||
fcString += " \"bbox\": [ " + QString::number( rect->xMinimum(), 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) ) + ", " + QString::number( rect->yMinimum(), 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) ) + ", " + QString::number( rect->xMaximum(), 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) ) + ", " + QString::number( rect->yMaximum(), 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) ) + "],\n";
|
||||
fcString += " \"bbox\": [ " + QString::number( rect->xMinimum(), 'f', 6 ).remove( QRegExp("[0]{1,5}$") ) + ", " + QString::number( rect->yMinimum(), 'f', 6 ).remove( QRegExp("[0]{1,5}$") ) + ", " + QString::number( rect->xMaximum(), 'f', 6 ).remove( QRegExp("[0]{1,5}$") ) + ", " + QString::number( rect->yMaximum(), 'f', 6 ).remove( QRegExp("[0]{1,5}$") ) + "],\n";
|
||||
fcString += " \"features\": [\n";
|
||||
result = fcString.toUtf8();
|
||||
request.startGetFeatureResponse( &result, format );
|
||||
@ -696,7 +696,7 @@ QString QgsWFSServer::createFeatureGeoJSON( QgsFeature* feat, QgsCoordinateRefer
|
||||
{
|
||||
QgsRectangle box = geom->boundingBox();
|
||||
|
||||
fStr += " \"bbox\": [ " + QString::number( box.xMinimum(), 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) ) + ", " + QString::number( box.yMinimum(), 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) ) + ", " + QString::number( box.xMaximum(), 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) ) + ", " + QString::number( box.yMaximum(), 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) ) + "],\n";
|
||||
fStr += " \"bbox\": [ " + QString::number( box.xMinimum(), 'f', 6 ).remove( QRegExp("[0]{1,5}$") ) + ", " + QString::number( box.yMinimum(), 'f', 6 ).remove( QRegExp("[0]{1,5}$") ) + ", " + QString::number( box.xMaximum(), 'f', 6 ).remove( QRegExp("[0]{1,5}$") ) + ", " + QString::number( box.yMaximum(), 'f', 6 ).remove( QRegExp("[0]{1,5}$") ) + "],\n";
|
||||
|
||||
fStr += " \"geometry\": ";
|
||||
fStr += geom->exportToGeoJSON();
|
||||
@ -1025,9 +1025,9 @@ QDomElement QgsWFSServer::createCoordinateElem( const QVector<QgsPoint> points,
|
||||
{
|
||||
coordString += " ";
|
||||
}
|
||||
coordString += QString::number( pointIt->x(), 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
coordString += QString::number( pointIt->x(), 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
coordString += ",";
|
||||
coordString += QString::number( pointIt->y(), 'f', 6 ).remove( QRegExp( "[0]{1,5}$" ) );
|
||||
coordString += QString::number( pointIt->y(), 'f', 6 ).remove( QRegExp("[0]{1,5}$") );
|
||||
}
|
||||
|
||||
QDomText coordText = doc.createTextNode( coordString );
|
||||
|
@ -1377,7 +1377,7 @@ QString QgsGdalProvider::buildPyramids( QList<QgsRasterPyramid> const & theRaste
|
||||
}
|
||||
|
||||
// are we using Erdas Imagine external overviews?
|
||||
char* myConfigUseRRD = strdup( CPLGetConfigOption( "USE_RRD", "NO" ) );
|
||||
char* myConfigUseRRD = strdup(CPLGetConfigOption( "USE_RRD", "NO" ));
|
||||
if ( theFormat == PyramidsErdas )
|
||||
CPLSetConfigOption( "USE_RRD", "YES" );
|
||||
else
|
||||
@ -1471,7 +1471,7 @@ QString QgsGdalProvider::buildPyramids( QList<QgsRasterPyramid> const & theRaste
|
||||
//emit drawingProgress( 0, 0 );
|
||||
// restore former USE_RRD config (Erdas)
|
||||
CPLSetConfigOption( "USE_RRD", myConfigUseRRD );
|
||||
free( myConfigUseRRD );
|
||||
free(myConfigUseRRD);
|
||||
return "FAILED_NOT_SUPPORTED";
|
||||
}
|
||||
else
|
||||
@ -1488,7 +1488,7 @@ QString QgsGdalProvider::buildPyramids( QList<QgsRasterPyramid> const & theRaste
|
||||
|
||||
// restore former USE_RRD config (Erdas)
|
||||
CPLSetConfigOption( "USE_RRD", myConfigUseRRD );
|
||||
free( myConfigUseRRD );
|
||||
free(myConfigUseRRD);
|
||||
|
||||
QgsDebugMsg( "Pyramid overviews built" );
|
||||
|
||||
|
@ -27,24 +27,24 @@
|
||||
|
||||
class TestQgsComposerLabel: public QObject
|
||||
{
|
||||
Q_OBJECT;
|
||||
private slots:
|
||||
void initTestCase();// will be called before the first testfunction is executed.
|
||||
void cleanupTestCase();// will be called after the last testfunction was executed.
|
||||
void init();// will be called before each testfunction is executed.
|
||||
void cleanup();// will be called after every testfunction.
|
||||
|
||||
// test simple expression evaluation
|
||||
void evaluation();
|
||||
// test expression evaluation when a feature is set
|
||||
void feature_evaluation();
|
||||
// test "$page" expressions
|
||||
void page_evaluation();
|
||||
Q_OBJECT;
|
||||
private slots:
|
||||
void initTestCase();// will be called before the first testfunction is executed.
|
||||
void cleanupTestCase();// will be called after the last testfunction was executed.
|
||||
void init();// will be called before each testfunction is executed.
|
||||
void cleanup();// will be called after every testfunction.
|
||||
|
||||
// test simple expression evaluation
|
||||
void evaluation();
|
||||
// test expression evaluation when a feature is set
|
||||
void feature_evaluation();
|
||||
// test "$page" expressions
|
||||
void page_evaluation();
|
||||
private:
|
||||
QgsComposition* mComposition;
|
||||
QgsComposerLabel* mComposerLabel;
|
||||
QgsMapRenderer* mMapRenderer;
|
||||
QgsVectorLayer* mVectorLayer;
|
||||
QgsComposition* mComposition;
|
||||
QgsComposerLabel* mComposerLabel;
|
||||
QgsMapRenderer* mMapRenderer;
|
||||
QgsVectorLayer* mVectorLayer;
|
||||
};
|
||||
|
||||
void TestQgsComposerLabel::initTestCase()
|
||||
@ -56,7 +56,7 @@ void TestQgsComposerLabel::initTestCase()
|
||||
QFileInfo vectorFileInfo( QString( TEST_DATA_DIR ) + QDir::separator() + "france_parts.shp" );
|
||||
mVectorLayer = new QgsVectorLayer( vectorFileInfo.filePath(),
|
||||
vectorFileInfo.completeBaseName(),
|
||||
"ogr" );
|
||||
"ogr" );
|
||||
QgsMapLayerRegistry::instance()->addMapLayers( QList<QgsMapLayer*>() << mVectorLayer );
|
||||
|
||||
//create composition with composer map
|
||||
@ -108,8 +108,8 @@ void TestQgsComposerLabel::evaluation()
|
||||
// $CURRENT_DATE() evaluation (inside an expression)
|
||||
QDate now = QDate::currentDate();
|
||||
int dd = now.day();
|
||||
|
||||
QString expected = "__" + QString( "%1" ).arg( dd + 1, 2, 10, QChar( '0' ) ) + "(ok)__";
|
||||
|
||||
QString expected = "__" + QString("%1").arg(dd+1, 2, 10, QChar('0')) + "(ok)__";
|
||||
mComposerLabel->setText( "__[%$CURRENT_DATE(dd) + 1%](ok)__" );
|
||||
QString evaluated = mComposerLabel->displayText();
|
||||
QCOMPARE( evaluated, expected );
|
||||
@ -173,7 +173,7 @@ void TestQgsComposerLabel::page_evaluation()
|
||||
|
||||
// move to the second page and re-evaluate
|
||||
mComposerLabel->setItemPosition( 0, 320 );
|
||||
QCOMPARE( mComposerLabel->displayText(), QString( "2/2" ) );
|
||||
QCOMPARE( mComposerLabel->displayText(), QString("2/2") );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,29 +31,29 @@
|
||||
|
||||
class TestQgsComposerMapAtlas: public QObject
|
||||
{
|
||||
Q_OBJECT;
|
||||
private slots:
|
||||
void initTestCase();// will be called before the first testfunction is executed.
|
||||
void cleanupTestCase();// will be called after the last testfunction was executed.
|
||||
void init();// will be called before each testfunction is executed.
|
||||
void cleanup();// will be called after every testfunction.
|
||||
|
||||
// test filename pattern evaluation
|
||||
void filename();
|
||||
// test rendering with an autoscale atlas
|
||||
void autoscale_render();
|
||||
// test rendering with a fixed scale atlas
|
||||
void fixedscale_render();
|
||||
// test rendering with a hidden coverage
|
||||
void hiding_render();
|
||||
Q_OBJECT;
|
||||
private slots:
|
||||
void initTestCase();// will be called before the first testfunction is executed.
|
||||
void cleanupTestCase();// will be called after the last testfunction was executed.
|
||||
void init();// will be called before each testfunction is executed.
|
||||
void cleanup();// will be called after every testfunction.
|
||||
|
||||
// test filename pattern evaluation
|
||||
void filename();
|
||||
// test rendering with an autoscale atlas
|
||||
void autoscale_render();
|
||||
// test rendering with a fixed scale atlas
|
||||
void fixedscale_render();
|
||||
// test rendering with a hidden coverage
|
||||
void hiding_render();
|
||||
private:
|
||||
QgsComposition* mComposition;
|
||||
QgsComposerLabel* mLabel1;
|
||||
QgsComposerLabel* mLabel2;
|
||||
QgsComposerMap* mAtlasMap;
|
||||
QgsComposerMap* mOverview;
|
||||
QgsMapRenderer* mMapRenderer;
|
||||
QgsVectorLayer* mVectorLayer;
|
||||
QgsComposition* mComposition;
|
||||
QgsComposerLabel* mLabel1;
|
||||
QgsComposerLabel* mLabel2;
|
||||
QgsComposerMap* mAtlasMap;
|
||||
QgsComposerMap* mOverview;
|
||||
QgsMapRenderer* mMapRenderer;
|
||||
QgsVectorLayer* mVectorLayer;
|
||||
};
|
||||
|
||||
void TestQgsComposerMapAtlas::initTestCase()
|
||||
@ -65,7 +65,7 @@ void TestQgsComposerMapAtlas::initTestCase()
|
||||
QFileInfo vectorFileInfo( QString( TEST_DATA_DIR ) + QDir::separator() + "france_parts.shp" );
|
||||
mVectorLayer = new QgsVectorLayer( vectorFileInfo.filePath(),
|
||||
vectorFileInfo.completeBaseName(),
|
||||
"ogr" );
|
||||
"ogr" );
|
||||
|
||||
QgsMapLayerRegistry::instance()->addMapLayers( QList<QgsMapLayer*>() << mVectorLayer );
|
||||
|
||||
@ -141,7 +141,7 @@ void TestQgsComposerMapAtlas::filename()
|
||||
for ( size_t fi = 0; fi < atlasRender.numFeatures(); ++fi )
|
||||
{
|
||||
atlasRender.prepareForFeature( fi );
|
||||
QString expected = QString( "output_%1" ).arg(( int )( fi + 1 ) );
|
||||
QString expected = QString( "output_%1" ).arg( (int)(fi+1) );
|
||||
QCOMPARE( atlasRender.currentFilename(), expected );
|
||||
}
|
||||
atlasRender.end();
|
||||
@ -151,7 +151,7 @@ void TestQgsComposerMapAtlas::filename()
|
||||
void TestQgsComposerMapAtlas::autoscale_render()
|
||||
{
|
||||
mAtlasMap->setAtlasFixedScale( false );
|
||||
mAtlasMap->setAtlasMargin( 0.10f );
|
||||
mAtlasMap->setAtlasMargin( 0.10 );
|
||||
|
||||
QgsAtlasRendering atlasRender( mComposition );
|
||||
|
||||
@ -163,12 +163,12 @@ void TestQgsComposerMapAtlas::autoscale_render()
|
||||
mLabel1->adjustSizeToText();
|
||||
|
||||
QgsCompositionChecker checker( "Atlas autoscale test", mComposition,
|
||||
QString( TEST_DATA_DIR ) + QDir::separator() + "control_images" + QDir::separator() +
|
||||
"expected_composermapatlas" + QDir::separator() +
|
||||
QString( "autoscale_%1.png" ).arg(( int )fit ) );
|
||||
QString( TEST_DATA_DIR ) + QDir::separator() + "control_images" + QDir::separator() +
|
||||
"expected_composermapatlas" + QDir::separator() +
|
||||
QString( "autoscale_%1.png" ).arg((int)fit) );
|
||||
QVERIFY( checker.testComposition( 0 ) );
|
||||
}
|
||||
atlasRender.end();
|
||||
atlasRender.end();
|
||||
}
|
||||
|
||||
void TestQgsComposerMapAtlas::fixedscale_render()
|
||||
@ -186,12 +186,12 @@ void TestQgsComposerMapAtlas::fixedscale_render()
|
||||
mLabel1->adjustSizeToText();
|
||||
|
||||
QgsCompositionChecker checker( "Atlas fixedscale test", mComposition,
|
||||
QString( TEST_DATA_DIR ) + QDir::separator() + "control_images" + QDir::separator() +
|
||||
"expected_composermapatlas" + QDir::separator() +
|
||||
QString( "fixedscale_%1.png" ).arg(( int )fit ) );
|
||||
QString( TEST_DATA_DIR ) + QDir::separator() + "control_images" + QDir::separator() +
|
||||
"expected_composermapatlas" + QDir::separator() +
|
||||
QString( "fixedscale_%1.png" ).arg((int)fit) );
|
||||
QVERIFY( checker.testComposition( 0 ) );
|
||||
}
|
||||
atlasRender.end();
|
||||
atlasRender.end();
|
||||
|
||||
}
|
||||
|
||||
@ -211,12 +211,12 @@ void TestQgsComposerMapAtlas::hiding_render()
|
||||
mLabel1->adjustSizeToText();
|
||||
|
||||
QgsCompositionChecker checker( "Atlas hidden test", mComposition,
|
||||
QString( TEST_DATA_DIR ) + QDir::separator() + "control_images" + QDir::separator() +
|
||||
"expected_composermapatlas" + QDir::separator() +
|
||||
QString( "hiding_%1.png" ).arg(( int )fit ) );
|
||||
QString( TEST_DATA_DIR ) + QDir::separator() + "control_images" + QDir::separator() +
|
||||
"expected_composermapatlas" + QDir::separator() +
|
||||
QString( "hiding_%1.png" ).arg((int)fit) );
|
||||
QVERIFY( checker.testComposition( 0 ) );
|
||||
}
|
||||
atlasRender.end();
|
||||
atlasRender.end();
|
||||
|
||||
}
|
||||
|
||||
|
@ -545,31 +545,31 @@ class TestQgsExpression: public QObject
|
||||
QCOMPARE( vPerimeter.toDouble(), 20. );
|
||||
}
|
||||
|
||||
void eval_special_columns()
|
||||
{
|
||||
QTest::addColumn<QString>( "string" );
|
||||
QTest::addColumn<QVariant>( "result" );
|
||||
void eval_special_columns()
|
||||
{
|
||||
QTest::addColumn<QString>( "string" );
|
||||
QTest::addColumn<QVariant>( "result" );
|
||||
|
||||
QgsExpression::setSpecialColumn( "$var1", QVariant(( int )42 ) );
|
||||
QgsExpression::setSpecialColumn( "$var1", QVariant((int)42) );
|
||||
|
||||
QgsExpression exp( "$var1 + 1" );
|
||||
QVariant v1 = exp.evaluate();
|
||||
QCOMPARE( v1.toInt(), 43 );
|
||||
QgsExpression exp( "$var1 + 1" );
|
||||
QVariant v1 = exp.evaluate();
|
||||
QCOMPARE( v1.toInt(), 43 );
|
||||
|
||||
QgsExpression::setSpecialColumn( "$var1", QVariant((int)100) );
|
||||
QVariant v2 = exp.evaluate();
|
||||
QCOMPARE( v2.toInt(), 101 );
|
||||
|
||||
QgsExpression::setSpecialColumn( "$var1", QVariant(( int )100 ) );
|
||||
QVariant v2 = exp.evaluate();
|
||||
QCOMPARE( v2.toInt(), 101 );
|
||||
QgsExpression exp2( "_specialcol_('$var1')+1" );
|
||||
QVariant v3 = exp2.evaluate();
|
||||
QCOMPARE( v3.toInt(), 101 );
|
||||
|
||||
QgsExpression exp2( "_specialcol_('$var1')+1" );
|
||||
QVariant v3 = exp2.evaluate();
|
||||
QCOMPARE( v3.toInt(), 101 );
|
||||
QgsExpression exp3( "_specialcol_('undefined')");
|
||||
QVariant v4 = exp3.evaluate();
|
||||
QCOMPARE( v4, QVariant() );
|
||||
|
||||
QgsExpression exp3( "_specialcol_('undefined')" );
|
||||
QVariant v4 = exp3.evaluate();
|
||||
QCOMPARE( v4, QVariant() );
|
||||
|
||||
QgsExpression::unsetSpecialColumn( "$var1" );
|
||||
}
|
||||
QgsExpression::unsetSpecialColumn( "$var1" );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user