Skip to content

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
 

‎src/plugins/grass/qgsgrassmodule.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,13 +1514,29 @@ void QgsGrassModule::viewOutput()
15141514
QgsGrass::getDefaultLocation(),
15151515
QgsGrass::getDefaultMapset(), map );
15161516

1517+
// check whether there are 1_* layers
1518+
// if so, 0_* layers won't be added
1519+
bool onlyLayer1 = false;
1520+
for ( int j = 0; j < layers.count(); j++ )
1521+
{
1522+
if (layers[j].left(1) == "1")
1523+
{
1524+
onlyLayer1 = true;
1525+
break;
1526+
}
1527+
}
1528+
15171529
// TODO common method for add all layers
15181530
for ( int j = 0; j < layers.count(); j++ )
15191531
{
15201532
QString uri = QgsGrass::getDefaultGisdbase() + "/"
15211533
+ QgsGrass::getDefaultLocation() + "/"
15221534
+ QgsGrass::getDefaultMapset() + "/"
15231535
+ map + "/" + layers[j];
1536+
1537+
// skip 0_* layers
1538+
if (onlyLayer1 && layers[j].left(1) != "1")
1539+
continue;
15241540

15251541
// TODO vector layer name
15261542
mIface->addVectorLayer( uri, layers[j], "grass");

‎src/plugins/grass/qgsgrassselect.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ void QgsGrassSelect::setMaps()
273273
if ( list[j] == lastVectorMap ) sel = idx;
274274
idx++;
275275
}
276+
276277
}
277278
else if ( type == RASTER )
278279
{
@@ -354,6 +355,20 @@ void QgsGrassSelect::setLayers()
354355
idx++;
355356
}
356357

358+
// if last used layer has not been found
359+
// make default a map from layer 1
360+
if (sel == -1)
361+
{
362+
for ( int j = 0; j < layers.count(); j++ )
363+
{
364+
if (layers[j].left(1) == "1")
365+
{
366+
sel = j;
367+
break;
368+
}
369+
}
370+
}
371+
357372
if ( sel >= 0 ) {
358373
elayer->setCurrentItem(sel);
359374
} else {

0 commit comments

Comments
 (0)
Please sign in to comment.