@@ -1324,6 +1324,11 @@ void QgsGrassProvider::onFeatureAdded( QgsFeatureId fid )
1324
1324
QgsDebugMsg ( QString ( " newCats[%1] = %2" ).arg ( fid ).arg ( newCat ) );
1325
1325
}
1326
1326
}
1327
+
1328
+ if ( type == GV_BOUNDARY )
1329
+ {
1330
+ setAddedFeaturesSymbol ();
1331
+ }
1327
1332
}
1328
1333
1329
1334
Vect_destroy_line_struct ( points );
@@ -1358,9 +1363,12 @@ void QgsGrassProvider::onFeatureDeleted( QgsFeatureId fid )
1358
1363
}
1359
1364
}
1360
1365
1366
+ int type = 0 ;
1361
1367
mLayer ->map ()->lockReadWrite ();
1362
1368
G_TRY
1363
1369
{
1370
+ type = Vect_read_line ( map (), 0 , 0 , realLine ); // to know if symbols have to be updated
1371
+
1364
1372
Vect_delete_line ( map (), realLine );
1365
1373
// oldLids are maping to the very first, original version (used by undo)
1366
1374
int oldestLid = oldLid;
@@ -1377,6 +1385,11 @@ void QgsGrassProvider::onFeatureDeleted( QgsFeatureId fid )
1377
1385
QgsDebugMsg ( QString ( " Cannot delete line : %1" ).arg ( e.what () ) );
1378
1386
}
1379
1387
mLayer ->map ()->unlockReadWrite ();
1388
+
1389
+ if ( type == GV_BOUNDARY )
1390
+ {
1391
+ setAddedFeaturesSymbol ();
1392
+ }
1380
1393
}
1381
1394
1382
1395
void QgsGrassProvider::onGeometryChanged ( QgsFeatureId fid, QgsGeometry &geom )
@@ -1392,7 +1405,7 @@ void QgsGrassProvider::onGeometryChanged( QgsFeatureId fid, QgsGeometry &geom )
1392
1405
struct line_pnts *points = Vect_new_line_struct ();
1393
1406
struct line_cats *cats = Vect_new_cats_struct ();
1394
1407
1395
- int type;
1408
+ int type = 0 ;
1396
1409
G_TRY
1397
1410
{
1398
1411
type = Vect_read_line ( map (), points, cats, realLine );
@@ -1450,6 +1463,11 @@ void QgsGrassProvider::onGeometryChanged( QgsFeatureId fid, QgsGeometry &geom )
1450
1463
1451
1464
Vect_destroy_line_struct ( points );
1452
1465
Vect_destroy_cats_struct ( cats );
1466
+
1467
+ if ( type == GV_BOUNDARY )
1468
+ {
1469
+ setAddedFeaturesSymbol ();
1470
+ }
1453
1471
}
1454
1472
1455
1473
void QgsGrassProvider::onAttributeValueChanged ( QgsFeatureId fid, int idx, const QVariant &value )
@@ -1536,6 +1554,35 @@ void QgsGrassProvider::onAttributeDeleted( int idx )
1536
1554
}
1537
1555
}
1538
1556
1557
+ void QgsGrassProvider::setAddedFeaturesSymbol ()
1558
+ {
1559
+ QgsDebugMsg ( " entered" );
1560
+ if ( !mEditBuffer )
1561
+ {
1562
+ return ;
1563
+ }
1564
+ QgsFeatureMap& features = const_cast <QgsFeatureMap&>( mEditBuffer ->addedFeatures () );
1565
+ Q_FOREACH ( QgsFeatureId fid, features.keys () )
1566
+ {
1567
+ QgsFeature feature = features[fid];
1568
+ if ( !feature.geometry () || !feature.geometry ()->geometry () ||
1569
+ feature.geometry ()->geometry ()->wkbType () != QgsWKBTypes::LineString )
1570
+ {
1571
+ continue ;
1572
+ }
1573
+ int lid = QgsGrassFeatureIterator::lidFromFid ( fid );
1574
+ int realLid = lid;
1575
+ if ( mLayer ->map ()->newLids ().contains ( lid ) )
1576
+ {
1577
+ realLid = mLayer ->map ()->newLids ().value ( lid );
1578
+ }
1579
+ QgsDebugMsg ( QString ( " fid = %1 lid = %2 realLid = %3" ).arg ( fid ).arg ( lid ).arg ( realLid ) );
1580
+ QgsGrassVectorMap::TopoSymbol symbol = mLayer ->map ()->topoSymbol ( realLid );
1581
+ feature.setAttribute ( QgsGrassVectorMap::topoSymbolFieldName (), symbol );
1582
+ features[fid] = feature;
1583
+ }
1584
+ }
1585
+
1539
1586
void QgsGrassProvider::onUndoIndexChanged ( int index )
1540
1587
{
1541
1588
Q_UNUSED ( index )
0 commit comments