@@ -143,6 +143,10 @@ QgsGrassProvider::QgsGrassProvider( QString uri )
143
143
{
144
144
mLayerType = LINE;
145
145
}
146
+ else if ( mGrassType == GV_FACE )
147
+ {
148
+ mLayerType = FACE;
149
+ }
146
150
else if ( mGrassType == GV_AREA )
147
151
{
148
152
mLayerType = POLYGON;
@@ -175,6 +179,7 @@ QgsGrassProvider::QgsGrassProvider( QString uri )
175
179
mQgisType = QGis::WKBLineString;
176
180
break ;
177
181
case POLYGON:
182
+ case FACE:
178
183
mQgisType = QGis::WKBPolygon;
179
184
break ;
180
185
}
@@ -347,7 +352,7 @@ bool QgsGrassProvider::nextFeature( QgsFeature& feature )
347
352
feature.clearAttributeMap ();
348
353
349
354
// TODO int may be 64 bits (memcpy)
350
- if ( type & ( GV_POINTS | GV_LINES ) ) /* points or lines */
355
+ if ( type & ( GV_POINTS | GV_LINES | GV_FACE ) ) /* points or lines */
351
356
{
352
357
Vect_read_line ( mMap , mPoints , mCats , id );
353
358
int npoints = mPoints ->n_points ;
@@ -356,10 +361,14 @@ bool QgsGrassProvider::nextFeature( QgsFeature& feature )
356
361
{
357
362
wkbsize = 1 + 4 + 2 * 8 ;
358
363
}
359
- else // GV_LINES
364
+ else if ( type & GV_LINES )
360
365
{
361
366
wkbsize = 1 + 4 + 4 + npoints * 2 * 8 ;
362
367
}
368
+ else // GV_FACE
369
+ {
370
+ wkbsize = 1 + 4 + 4 + 4 + npoints * 2 * 8 ;
371
+ }
363
372
wkb = new unsigned char [wkbsize];
364
373
unsigned char *wkbp = wkb;
365
374
wkbp[0 ] = ( unsigned char ) QgsApplication::endian ();
@@ -369,9 +378,18 @@ bool QgsGrassProvider::nextFeature( QgsFeature& feature )
369
378
memcpy ( wkbp, &mQgisType , 4 );
370
379
wkbp += 4 ;
371
380
381
+ /* Number of rings */
382
+ if ( type & GV_FACE )
383
+ {
384
+ int nrings = 1 ;
385
+ memcpy ( wkbp, &nrings, 4 );
386
+ wkbp += 4 ;
387
+ }
388
+
372
389
/* number of points */
373
- if ( type & GV_LINES )
390
+ if ( type & ( GV_LINES | GV_FACE ) )
374
391
{
392
+ QgsDebugMsg ( QString ( " set npoints = %1" ).arg ( npoints ) );
375
393
memcpy ( wkbp, &npoints, 4 );
376
394
wkbp += 4 ;
377
395
}
@@ -494,7 +512,7 @@ void QgsGrassProvider::select( QgsAttributeList fetchAttributes,
494
512
box.N = rect.yMaximum (); box.S = rect.yMinimum ();
495
513
box.E = rect.xMaximum (); box.W = rect.xMinimum ();
496
514
box.T = PORT_DOUBLE_MAX; box.B = -PORT_DOUBLE_MAX;
497
- if ( mLayerType == POINT || mLayerType == CENTROID || mLayerType == LINE || mLayerType == BOUNDARY )
515
+ if ( mLayerType == POINT || mLayerType == CENTROID || mLayerType == LINE || mLayerType == FACE || mLayerType == BOUNDARY )
498
516
{
499
517
Vect_select_lines_by_box ( mMap , &box, mGrassType , mList );
500
518
}
@@ -519,7 +537,7 @@ void QgsGrassProvider::select( QgsAttributeList fetchAttributes,
519
537
Vect_append_point ( Polygon, rect.xMinimum (), rect.yMaximum (), 0 );
520
538
Vect_append_point ( Polygon, rect.xMinimum (), rect.yMinimum (), 0 );
521
539
522
- if ( mLayerType == POINT || mLayerType == CENTROID || mLayerType == LINE || mLayerType == BOUNDARY )
540
+ if ( mLayerType == POINT || mLayerType == CENTROID || mLayerType == LINE || mLayerType == FACE || mLayerType == BOUNDARY )
523
541
{
524
542
Vect_select_lines_by_polygon ( mMap , Polygon, 0 , NULL , mGrassType , mList );
525
543
}
@@ -1386,6 +1404,10 @@ int QgsGrassProvider::grassLayerType( QString name )
1386
1404
{
1387
1405
return GV_LINES;
1388
1406
}
1407
+ else if ( ts.compare ( " face" ) == 0 )
1408
+ {
1409
+ return GV_FACE;
1410
+ }
1389
1411
else if ( ts.compare ( " polygon" ) == 0 )
1390
1412
{
1391
1413
return GV_AREA;
@@ -2314,7 +2336,7 @@ QString *QgsGrassProvider::isOrphan( int field, int cat, int *orphan )
2314
2336
{
2315
2337
int t, id;
2316
2338
int ret = Vect_cidx_find_next ( mMap , fieldIndex, cat,
2317
- GV_POINTS | GV_LINES, 0 , &t, &id );
2339
+ GV_POINTS | GV_LINES | GV_FACE , 0 , &t, &id );
2318
2340
2319
2341
if ( ret >= 0 )
2320
2342
{
0 commit comments