Skip to content

Commit

Permalink
gui stable, added cache checkboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
mbernasocchi authored and pka committed Jul 5, 2011
1 parent 9564033 commit 1667fb8
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 21 deletions.
16 changes: 11 additions & 5 deletions src/plugins/globe/globe.earth
Expand Up @@ -3,7 +3,7 @@
<loading_policy mode="sequential"/>

<cache type="tilecache">
<path>/home/pi/devel/gis/qgis/.qgis/cache/globe</path>
<path>/home/marco/.qgis/cache/globe</path>
</cache>

<image name="world" driver="gdal">
Expand All @@ -25,21 +25,27 @@
<url>http://demo.pelicanmapping.com/rmweb/data/srtm30_plus_tms/tms.xml</url>
</heightfield>
-->
<<<<<<< Updated upstream

=======
>>>>>>> Stashed changes
<!--
<heightfield name="WorldWind bil" driver="worldwind">
<worldwind_cache>/home/pi/devel/gis/qgis/.qgis/cache/globe/worldwind_srtm</worldwind_cache>
<worldwind_cache>/home/marco/.qgis/cache/globe/worldwind_srtm</worldwind_cache>
<cache_enabled>false</cache_enabled>
</heightfield>
-->
<<<<<<< Updated upstream

<!--
=======

>>>>>>> Stashed changes
<heightfield name="aster_dem" driver="gdal">
<url>/home/pi/data/geodata/Lech/ASTGTM_N47E010/ASTGTM_N47E010_dem.tif</url>
<url>/home/marco/data/geodata/Lech/ASTGTM_N47E010/ASTGTM_N47E010_dem.tif</url>
<cache_enabled>false</cache_enabled>
</heightfield>
-->


<!--
<vertical_scale>2</vertical_scale>
<sample_ratio>0.25</sample_ratio>
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/globe/globe_plugin.cpp
Expand Up @@ -606,7 +606,7 @@ void GlobePlugin::layersChanged()
for(int i = 0; i < table->rowCount(); ++i)
{
QString type = table->item(i, 0)->text();
QString uri = table->item(i, 1)->text();
QString uri = table->item(i, 2)->text();
MapLayer* layer = 0;

if( "Raster" == type)
Expand All @@ -633,6 +633,8 @@ void GlobePlugin::layersChanged()
//map->addElevationLayer( new osgEarth::ElevationLayer( "SRTM", tms ) );
}
map->addMapLayer( layer );

bool cache = table->item(i, 1)->checkState();
layer->setCache( 0 ); //TODO: from dialog
}

Expand Down
22 changes: 10 additions & 12 deletions src/plugins/globe/globe_plugin_dialog.cpp
Expand Up @@ -201,9 +201,12 @@ void QgsGlobePluginDialog::on_elevationAdd_clicked()
int i = elevationDatasourcesWidget->rowCount();
QTableWidgetItem *type = new QTableWidgetItem(elevationCombo->currentText());
QTableWidgetItem *uri = new QTableWidgetItem(elevationPath->text());
QTableWidgetItem* cache = new QTableWidgetItem();
cache->setCheckState(Qt::Unchecked);
elevationDatasourcesWidget->setRowCount(1+i);
elevationDatasourcesWidget->setItem(i, 0, type);
elevationDatasourcesWidget->setItem(i, 1, uri);
elevationDatasourcesWidget->setItem(i, 1, cache);
elevationDatasourcesWidget->setItem(i, 2, uri);
elevationDatasourcesWidget->setCurrentItem(type, QItemSelectionModel::Clear);
}
}
Expand Down Expand Up @@ -280,13 +283,10 @@ void QgsGlobePluginDialog::readElevationDatasources()

elevationDatasourcesWidget->setRowCount(1+i);
elevationDatasourcesWidget->setItem(i, 0, type);
elevationDatasourcesWidget->setItem(i, 1, uri);
QCheckBox *cacheCheckbox= new QCheckBox();
elevationDatasourcesWidget->setCellWidget(i, 2, cacheCheckbox);
if(cache)
{
cacheCheckbox->setChecked(true);
}
QTableWidgetItem* chkBoxItem = new QTableWidgetItem();
(cache) ? chkBoxItem->setCheckState(Qt::Checked) : chkBoxItem->setCheckState(Qt::Unchecked);
elevationDatasourcesWidget->setItem(i, 1, chkBoxItem);
elevationDatasourcesWidget->setItem(i, 2, uri);
}
}

Expand All @@ -296,10 +296,8 @@ void QgsGlobePluginDialog::saveElevationDatasources()
for(int i = 0; i < elevationDatasourcesWidget->rowCount(); ++i)
{
QString type = elevationDatasourcesWidget->item(i, 0)->text();
QString uri = elevationDatasourcesWidget->item(i, 1)->text();
//TODO
QCheckBox *cacheCheckbox = qobject_cast<QCheckBox*>(elevationDatasourcesWidget->cellWidget(i, 2));
bool cache = cacheCheckbox->isChecked();
bool cache = elevationDatasourcesWidget->item(i, 1)->checkState();
QString uri = elevationDatasourcesWidget->item(i, 2)->text();

QString iNum;
iNum.setNum(i);
Expand Down
1 change: 0 additions & 1 deletion src/plugins/globe/globe_plugin_dialog.h
Expand Up @@ -36,7 +36,6 @@ class QgsGlobePluginDialog:public QDialog, private Ui::QgsGlobePluginDialogGuiBa

private:
QSettings settings;
QCheckBox cacheCheckbox;
QString openFile();
void updateStereoDialog();
void restartGlobe();
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/globe/globe_plugin_dialog_guibase.ui
Expand Up @@ -271,7 +271,7 @@
</column>
<column>
<property name="text">
<string>Path</string>
<string>Cache</string>
</property>
<property name="font">
<font>
Expand All @@ -282,7 +282,7 @@
</column>
<column>
<property name="text">
<string>Cache</string>
<string>Path</string>
</property>
<property name="font">
<font>
Expand Down

0 comments on commit 1667fb8

Please sign in to comment.