Skip to content

Commit edd29db

Browse files
committed
Addendum for fixing the random delete bugs
1 parent 839bf50 commit edd29db

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/COM classes/Shapefile.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ class ATL_NO_VTABLE CShapefile :
314314
// OGR layers can lookup by fixed FID rather than ever-changing ShapeIndex
315315
// (Shape indices change when removing rows, and may change on OGR reload)
316316
std::map<long, long> _ogrFid2ShapeIndex;
317+
std::set<long> _deletedFids;
317318
bool _hasOgrFidMapping = false;
318319

319320
// table is initialized in CreateNew or Open methods
@@ -503,6 +504,23 @@ class ATL_NO_VTABLE CShapefile :
503504
{
504505
_ogrFid2ShapeIndex.insert(std::make_pair(ogrFid, shapeIndex));
505506
}
507+
bool MarkShapeDeleted(long shapeIndex)
508+
{
509+
if (!_hasOgrFidMapping)
510+
return false;
511+
512+
for (auto const& it : _ogrFid2ShapeIndex)
513+
if (it.second == shapeIndex)
514+
_deletedFids.insert(it.first);
515+
}
516+
std::set<long> GetDeletedShapeFIDs()
517+
{
518+
return std::set<long>(_deletedFids);
519+
}
520+
void ClearDeleteShapeFIDs()
521+
{
522+
_deletedFids.clear();
523+
}
506524

507525
// give OGR layers the ability to retain visibility flags on reload
508526
bool GetVisibilityFlags(map<long, BYTE> &flags);

0 commit comments

Comments
 (0)