Skip to content
Permalink
Browse files
fix #2788
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13681 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Jun 7, 2010
1 parent 41a3c03 commit 04cfd5506e82ae8b349c496bd8389c1c8497b31f
@@ -4,6 +4,6 @@
<qgisgrassmodule label="Import loaded raster" module="r.in.gdal">
<flag key="o" answer="on" hidden="yes" />
<flag key="e" answer="off" hidden="yes" />
<gdal key="input" label="GDAL raster layer" />
<gdal key="input" label="GDAL raster layer" />
<option key="output" />
</qgisgrassmodule>
@@ -2269,11 +2269,11 @@ void QgsGrassModuleInput::updateQgisLayers()

QString current = mLayerComboBox->currentText();
mLayerComboBox->clear();
mMaps.resize( 0 );
mGeometryTypes.resize( 0 );
mVectorLayerNames.resize( 0 );
mMapLayers.resize( 0 );
mVectorFields.resize( 0 );
mMaps.clear();
mGeometryTypes.clear();
mVectorLayerNames.clear();
mMapLayers.clear();
mVectorFields.clear();

// If not required, add an empty item to combobox and a padding item into
// layer containers.
@@ -2458,12 +2458,10 @@ QStringList QgsGrassModuleInput::options()
QStringList list;
QString opt;

int c = mLayerComboBox->currentIndex();
if ( c < 0 ) // not found
int current = mLayerComboBox->currentIndex();
if ( current < 0 ) // not found
return list;

unsigned current = c;

// TODO: this is hack for network nodes, do it somehow better
if ( mMapId.isEmpty() )
{
@@ -2537,15 +2535,15 @@ QString QgsGrassModuleInput::currentMap()
{
QgsDebugMsg( "called." );

unsigned int limit = 0;
int limit = 0;
if ( !mRequired )
limit = 1;

unsigned int current = mLayerComboBox->currentIndex();
int current = mLayerComboBox->currentIndex();
if ( current < limit )
return QString();

if ( current >= limit && current < mMaps.size() )
if ( current >= limit && current < mMaps.size() )
{
return mMaps[current];
}
@@ -2762,8 +2760,8 @@ void QgsGrassModuleGdalInput::updateQgisLayers()

QString current = mLayerComboBox->currentText();
mLayerComboBox->clear();
mUri.resize( 0 );
mOgrLayers.resize( 0 );
mUri.clear();
mOgrLayers.clear();

// If not required, add an empty item to combobox and a padding item into
// layer containers.
@@ -2857,7 +2855,6 @@ void QgsGrassModuleGdalInput::updateQgisLayers()
if ( layer->name() == current ) mLayerComboBox->setItemText( mLayerComboBox->currentIndex(), current );

mUri.push_back( uri );

mOgrLayers.push_back( ogrLayer );
mOgrWheres.push_back( ogrWhere );
}
@@ -2867,6 +2864,8 @@ void QgsGrassModuleGdalInput::updateQgisLayers()
mLayerComboBox->addItem( layer->name() );
if ( layer->name() == current ) mLayerComboBox->setItemText( mLayerComboBox->currentIndex(), current );
mUri.push_back( uri );
mOgrLayers.push_back( "" );
mOgrWheres.push_back( "" );
}
}
}
@@ -2875,21 +2874,19 @@ QStringList QgsGrassModuleGdalInput::options()
{
QStringList list;

int c = mLayerComboBox->currentIndex();
if ( c < 0 )
int current = mLayerComboBox->currentIndex();
if ( current < 0 )
return list;

unsigned int current = c;

QString opt( mKey + "=" );

if ( current >= 0 && current < mUri.size() )
if ( current >= 0 && current < mUri.size() )
{
opt.append( mUri[current] );
}
list.push_back( opt );

if ( !mOgrLayerOption.isNull() && mOgrLayers[current].length() > 0 )
if ( !mOgrLayerOption.isEmpty() && mOgrLayers[current].size() > 0 )
{
opt = mOgrLayerOption + "=";
// GDAL 1.4.0 supports schemas (r9998)
@@ -2918,7 +2915,7 @@ QStringList QgsGrassModuleGdalInput::options()
list.push_back( opt );
}

if ( !mOgrWhereOption.isNull() && mOgrWheres[current].length() > 0 )
if ( !mOgrWhereOption.isEmpty() && mOgrWheres[current].length() > 0 )
{
list.push_back( mOgrWhereOption + "=" + mOgrWheres[current] );
}
@@ -640,13 +640,13 @@ class QgsGrassModuleInput: public QgsGrassModuleGroupBoxItem
QString mMapId;

//! Vector of map@mapset in the combobox
std::vector<QString> mMaps;
QStringList mMaps;

//! Type of vector in the combobox
std::vector<QString> mGeometryTypes;
QStringList mGeometryTypes;

//! Layer names in the combobox
std::vector<QString> mVectorLayerNames;
QStringList mVectorLayerNames;

//! Pointers to vector layers in combobox
std::vector<QgsMapLayer*> mMapLayers;
@@ -709,13 +709,13 @@ class QgsGrassModuleGdalInput: public QgsGrassModuleGroupBoxItem
QComboBox *mLayerComboBox;

//! Vector of URI in the combobox
std::vector<QString> mUri;
QStringList mUri;

//! Ogr layer options
std::vector<QString> mOgrLayers;
QStringList mOgrLayers;

//! Ogr where clauses
std::vector<QString> mOgrWheres;
QStringList mOgrWheres;

//! Required field
bool mRequired;

0 comments on commit 04cfd55

Please sign in to comment.