| 1 |
/****************************************************************************** |
| 2 |
* |
| 3 |
* Project: OpenGIS Simple Features for OpenDRIVE |
| 4 |
* Purpose: Implementation of OGRXODRDriver. |
| 5 |
* Author: Michael Scholz, German Aerospace Center (DLR) |
| 6 |
* Gülsen Bardak, German Aerospace Center (DLR) |
| 7 |
* |
| 8 |
****************************************************************************** |
| 9 |
* Copyright 2024 German Aerospace Center (DLR), Institute of Transportation Systems |
| 10 |
* |
| 11 |
* SPDX-License-Identifier: MIT |
| 12 |
****************************************************************************/ |
| 13 |
|
| 14 |
#include "ogr_xodr.h" |
| 15 |
#include "ogrxodrdrivercore.h" |
| 16 |
#include "cpl_conv.h" |
| 17 |
#include "cpl_error.h" |
| 18 |
|
| 19 |
static GDALDataset *OGRXODRDriverOpen(GDALOpenInfo *poOpenInfo) |
| 20 |
{ |
| 21 |
if (poOpenInfo->eAccess == GA_Update || poOpenInfo->fpL == nullptr) |
| 22 |
return nullptr; |
| 23 |
|
| 24 |
auto dataSource = std::make_unique<OGRXODRDataSource>(); |
| 25 |
|
| 26 |
if (!dataSource->Open(poOpenInfo->pszFilename, |
| 27 |
poOpenInfo->papszOpenOptions)) |
| 28 |
{ |
| 29 |
return nullptr; |
| 30 |
} |
| 31 |
|
| 32 |
return dataSource.release(); |
| 33 |
} |
| 34 |
|
| 35 |
void RegisterOGRXODR() |
| 36 |
{ |
| 37 |
if (!GDAL_CHECK_VERSION(DRIVER_NAME)) |
| 38 |
return; |
| 39 |
|
| 40 |
if (GDALGetDriverByName(DRIVER_NAME) != nullptr) |
| 41 |
return; |
| 42 |
|
| 43 |
GDALDriver *poDriver = new GDALDriver(); |
| 44 |
OGRXODRDriverSetCommonMetadata(poDriver); |
| 45 |
poDriver->pfnOpen = OGRXODRDriverOpen; |
| 46 |
GetGDALDriverManager()->RegisterDriver(poDriver); |
| 47 |
} |