File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -1514,13 +1514,29 @@ void QgsGrassModule::viewOutput()
1514
1514
QgsGrass::getDefaultLocation (),
1515
1515
QgsGrass::getDefaultMapset (), map );
1516
1516
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
+
1517
1529
// TODO common method for add all layers
1518
1530
for ( int j = 0 ; j < layers.count (); j++ )
1519
1531
{
1520
1532
QString uri = QgsGrass::getDefaultGisdbase () + " /"
1521
1533
+ QgsGrass::getDefaultLocation () + " /"
1522
1534
+ QgsGrass::getDefaultMapset () + " /"
1523
1535
+ map + " /" + layers[j];
1536
+
1537
+ // skip 0_* layers
1538
+ if (onlyLayer1 && layers[j].left (1 ) != " 1" )
1539
+ continue ;
1524
1540
1525
1541
// TODO vector layer name
1526
1542
mIface ->addVectorLayer ( uri, layers[j], " grass" );
Original file line number Diff line number Diff line change @@ -273,6 +273,7 @@ void QgsGrassSelect::setMaps()
273
273
if ( list[j] == lastVectorMap ) sel = idx;
274
274
idx++;
275
275
}
276
+
276
277
}
277
278
else if ( type == RASTER )
278
279
{
@@ -354,6 +355,20 @@ void QgsGrassSelect::setLayers()
354
355
idx++;
355
356
}
356
357
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
+
357
372
if ( sel >= 0 ) {
358
373
elayer->setCurrentItem (sel);
359
374
} else {
You can’t perform that action at this time.
0 commit comments