Skip to content
Permalink
Browse files
add option to load result to canvas in Heatmap plugin (fix #6645)
  • Loading branch information
alexbruy committed Mar 28, 2014
1 parent e846a89 commit 8c97462b087fe2a180a6f2f4b711b735c8425314
@@ -312,8 +312,11 @@ void Heatmap::run()
// Finally close the dataset
GDALClose(( GDALDatasetH ) heatmapDS );

// Open the file in QGIS window
mQGisIface->addRasterLayer( d.outputFilename(), QFileInfo( d.outputFilename() ).baseName() );
// Open the file in QGIS window if requested
if ( d.addToCanvas() )
{
mQGisIface->addRasterLayer( d.outputFilename(), QFileInfo( d.outputFilename() ).baseName() );
}
}
}

@@ -106,6 +106,8 @@ HeatmapGui::HeatmapGui( QWidget* parent, Qt::WindowFlags fl, QMap<QString, QVari
updateBBox();
updateSize();

mAddToCanvas->setChecked( s.value( "/Heatmap/addToCanvas", true ).toBool() );

blockAllSignals( false );

//finally set right the ok button
@@ -215,6 +217,7 @@ void HeatmapGui::saveSettings()
// Save persistent settings
QSettings s;
s.setValue( "/Heatmap/lastFormat", QVariant( formatCombo->currentIndex() ) );
s.setValue( "/Heatmap/addToCanvas", mAddToCanvas->isChecked() );

// Store temporary settings, which only apply to this session
mHeatmapSessionSettings->insert( QString( "lastInputLayer" ), QVariant( inputLayerCombo->itemData( inputLayerCombo->currentIndex() ) ) );
@@ -582,6 +585,11 @@ int HeatmapGui::weightField()
return weightFieldCombo->itemData( weightindex ).toInt();
}

bool HeatmapGui::addToCanvas()
{
return mAddToCanvas->isChecked();
}

QString HeatmapGui::outputFilename()
{
QString outputFileName;
@@ -60,6 +60,9 @@ class HeatmapGui : public QDialog, private Ui::HeatmapGuiBase
/** Returns the attrinute field for weighted heat */
int weightField();

/** Returns state of the add to canvas checkbox*/
bool addToCanvas();

/** Returns the output filename/path */
QString outputFilename();

@@ -303,6 +303,13 @@
</layout>
</widget>
</item>
<item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="mAddToCanvas">
<property name="text">
<string>Add generated file to map</string>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>

0 comments on commit 8c97462

Please sign in to comment.