@@ -75,8 +75,6 @@ OGRVRTGeomFieldProps::~OGRVRTGeomFieldProps()
75
75
{
76
76
if (poSRS != nullptr)
77
77
const_cast<OGRSpatialReference *>(poSRS)->Release();
78
- if (poSrcRegion != nullptr)
79
- delete poSrcRegion;
80
78
}
81
79
82
80
/************************************************************************/
@@ -467,8 +465,9 @@ bool OGRVRTLayer::ParseGeometryField(CPLXMLNode *psNode,
467
465
const char *pszSrcRegion = CPLGetXMLValue(psSrcRegionNode, "", nullptr);
468
466
if (pszSrcRegion != nullptr)
469
467
{
470
- OGRGeometryFactory::createFromWkt(pszSrcRegion, nullptr,
471
- &poProps->poSrcRegion);
468
+ poProps->poSrcRegion =
469
+ OGRGeometryFactory::createFromWkt(pszSrcRegion).first;
470
+
472
471
if (poProps->poSrcRegion == nullptr)
473
472
{
474
473
CPLError(CE_Warning, CPLE_AppDefined,
@@ -1325,7 +1324,7 @@ bool OGRVRTLayer::ResetSourceReading()
1325
1324
{
1326
1325
OGRGeometry *poNewSpatialGeom = nullptr;
1327
1326
OGRGeometry *poSrcRegion =
1328
- apoGeomFieldProps[m_iGeomFieldFilter]->poSrcRegion;
1327
+ apoGeomFieldProps[m_iGeomFieldFilter]->poSrcRegion.get() ;
1329
1328
std::unique_ptr<OGRGeometry> poIntersection;
1330
1329
1331
1330
if (poSrcRegion == nullptr)
@@ -1442,7 +1441,8 @@ void OGRVRTLayer::ClipAndAssignSRS(OGRFeature *poFeature)
1442
1441
if (apoGeomFieldProps[i]->poSrcRegion != nullptr &&
1443
1442
apoGeomFieldProps[i]->bSrcClip && poGeom != nullptr)
1444
1443
{
1445
- poGeom = poGeom->Intersection(apoGeomFieldProps[i]->poSrcRegion);
1444
+ poGeom =
1445
+ poGeom->Intersection(apoGeomFieldProps[i]->poSrcRegion.get());
1446
1446
if (poGeom != nullptr)
1447
1447
poGeom->assignSpatialReference(
1448
1448
GetLayerDefn()->GetGeomFieldDefn(i)->GetSpatialRef());
@@ -1507,13 +1507,11 @@ OGRFeature *OGRVRTLayer::TranslateFeature(OGRFeature *&poSrcFeat,
1507
1507
1508
1508
if (pszWKT != nullptr)
1509
1509
{
1510
- OGRGeometry *poGeom = nullptr;
1511
-
1512
- OGRGeometryFactory::createFromWkt(pszWKT, nullptr, &poGeom);
1510
+ auto [poGeom, _] = OGRGeometryFactory::createFromWkt(pszWKT);
1513
1511
if (poGeom == nullptr)
1514
1512
CPLDebug("OGR_VRT", "Did not get geometry from %s", pszWKT);
1515
1513
1516
- poDstFeat->SetGeomFieldDirectly (i, poGeom);
1514
+ poDstFeat->SetGeomField (i, std::move( poGeom) );
1517
1515
}
1518
1516
}
1519
1517
else if (eGeometryStyle == VGS_WKB && iGeomField != -1)
@@ -1619,7 +1617,7 @@ OGRFeature *OGRVRTLayer::TranslateFeature(OGRFeature *&poSrcFeat,
1619
1617
{
1620
1618
OGRGeometry *poGeom = poDstFeat->GetGeomFieldRef(i);
1621
1619
if (poGeom != nullptr &&
1622
- !poGeom->Intersects(apoGeomFieldProps[i]->poSrcRegion))
1620
+ !poGeom->Intersects(apoGeomFieldProps[i]->poSrcRegion.get() ))
1623
1621
{
1624
1622
delete poSrcFeat;
1625
1623
delete poDstFeat;
0 commit comments