Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: OpenGIS Simple Features for OpenDRIVE 4 : * Purpose: Implementation of OGRXODRDriverCore. 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 "ogrsf_frmts.h" 15 : #include "ogrxodrdrivercore.h" 16 : 17 : /************************************************************************/ 18 : /* OGRXODRDriverIdentify() */ 19 : /************************************************************************/ 20 : 21 42768 : int OGRXODRDriverIdentify(GDALOpenInfo *poOpenInfo) 22 : { 23 43536 : return poOpenInfo->fpL != nullptr && 24 42782 : EQUAL(CPLGetExtension(poOpenInfo->pszFilename), "xodr") && 25 42782 : !STARTS_WITH(poOpenInfo->pszFilename, "/vsi"); 26 : } 27 : 28 : /************************************************************************/ 29 : /* OGRXODRDriverSetCommonMetadata() */ 30 : /************************************************************************/ 31 : 32 1303 : void OGRXODRDriverSetCommonMetadata(GDALDriver *poDriver) 33 : { 34 1303 : poDriver->SetDescription(DRIVER_NAME); 35 1303 : poDriver->SetMetadataItem( 36 : GDAL_DMD_LONGNAME, 37 1303 : "OpenDRIVE - Open Dynamic Road Information for Vehicle Environment"); 38 1303 : poDriver->SetMetadataItem(GDAL_DMD_EXTENSION, "xodr"); 39 1303 : poDriver->SetMetadataItem( 40 : GDAL_DMD_OPENOPTIONLIST, 41 : "<OpenOptionList>" 42 : " <Option name='EPSILON' type='float' description='Epsilon value for " 43 : "linear approximation of continuous OpenDRIVE geometries.' " 44 : "default='1.0'/>" 45 : " <Option name='DISSOLVE_TIN' type='boolean' description='Whether to " 46 : "dissolve triangulated surfaces.' default= 'NO'/>" 47 1303 : "</OpenOptionList>"); 48 1303 : poDriver->SetMetadataItem(GDAL_DCAP_VECTOR, "YES"); 49 1303 : poDriver->SetMetadataItem(GDAL_DCAP_OPEN, "YES"); 50 1303 : poDriver->SetMetadataItem(GDAL_DCAP_Z_GEOMETRIES, "YES"); 51 1303 : poDriver->pfnIdentify = OGRXODRDriverIdentify; 52 1303 : } 53 : 54 : /************************************************************************/ 55 : /* DeclareDeferredOGRXODRPlugin() */ 56 : /************************************************************************/ 57 : 58 : #ifdef PLUGIN_FILENAME 59 1595 : void DeclareDeferredOGRXODRPlugin() 60 : { 61 1595 : if (GDALGetDriverByName(DRIVER_NAME) != nullptr) 62 : { 63 302 : return; 64 : } 65 1293 : auto poDriver = new GDALPluginDriverProxy(PLUGIN_FILENAME); 66 : #ifdef PLUGIN_INSTALLATION_MESSAGE 67 : poDriver->SetMetadataItem(GDAL_DMD_PLUGIN_INSTALLATION_MESSAGE, 68 : PLUGIN_INSTALLATION_MESSAGE); 69 : #endif 70 1293 : OGRXODRDriverSetCommonMetadata(poDriver); 71 1293 : GetGDALDriverManager()->DeclareDeferredPluginDriver(poDriver); 72 : } 73 : #endif