Skip to content

Commit 8c97462

Browse files
committedMar 28, 2014
add option to load result to canvas in Heatmap plugin (fix #6645)
1 parent e846a89 commit 8c97462

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed
 

‎src/plugins/heatmap/heatmap.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,11 @@ void Heatmap::run()
312312
// Finally close the dataset
313313
GDALClose(( GDALDatasetH ) heatmapDS );
314314

315-
// Open the file in QGIS window
316-
mQGisIface->addRasterLayer( d.outputFilename(), QFileInfo( d.outputFilename() ).baseName() );
315+
// Open the file in QGIS window if requested
316+
if ( d.addToCanvas() )
317+
{
318+
mQGisIface->addRasterLayer( d.outputFilename(), QFileInfo( d.outputFilename() ).baseName() );
319+
}
317320
}
318321
}
319322

‎src/plugins/heatmap/heatmapgui.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ HeatmapGui::HeatmapGui( QWidget* parent, Qt::WindowFlags fl, QMap<QString, QVari
106106
updateBBox();
107107
updateSize();
108108

109+
mAddToCanvas->setChecked( s.value( "/Heatmap/addToCanvas", true ).toBool() );
110+
109111
blockAllSignals( false );
110112

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

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

588+
bool HeatmapGui::addToCanvas()
589+
{
590+
return mAddToCanvas->isChecked();
591+
}
592+
585593
QString HeatmapGui::outputFilename()
586594
{
587595
QString outputFileName;

‎src/plugins/heatmap/heatmapgui.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ class HeatmapGui : public QDialog, private Ui::HeatmapGuiBase
6060
/** Returns the attrinute field for weighted heat */
6161
int weightField();
6262

63+
/** Returns state of the add to canvas checkbox*/
64+
bool addToCanvas();
65+
6366
/** Returns the output filename/path */
6467
QString outputFilename();
6568

‎src/plugins/heatmap/heatmapguibase.ui

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,13 @@
303303
</layout>
304304
</widget>
305305
</item>
306+
<item row="5" column="0" colspan="3">
307+
<widget class="QCheckBox" name="mAddToCanvas">
308+
<property name="text">
309+
<string>Add generated file to map</string>
310+
</property>
311+
</widget>
312+
</item>
306313
</layout>
307314
</widget>
308315
<tabstops>

0 commit comments

Comments
 (0)
Please sign in to comment.