Line data Source code
1 : /****************************************************************************** 2 : * Project: OGR 3 : * Purpose: OGRGMLASDriver implementation 4 : * Author: Even Rouault, <even dot rouault at spatialys dot com> 5 : * 6 : * Initial development funded by the European Earth observation programme 7 : * Copernicus 8 : * 9 : ****************************************************************************** 10 : * Copyright (c) 2016, Even Rouault, <even dot rouault at spatialys dot com> 11 : * 12 : * Permission is hereby granted, free of charge, to any person obtaining a 13 : * copy of this software and associated documentation files (the "Software"), 14 : * to deal in the Software without restriction, including without limitation 15 : * the rights to use, copy, modify, merge, publish, distribute, sublicense, 16 : * and/or sell copies of the Software, and to permit persons to whom the 17 : * Software is furnished to do so, subject to the following conditions: 18 : * 19 : * The above copyright notice and this permission notice shall be included 20 : * in all copies or substantial portions of the Software. 21 : * 22 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 23 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 25 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 28 : * DEALINGS IN THE SOFTWARE. 29 : ****************************************************************************/ 30 : 31 : #include "ogr_gmlas.h" 32 : #include "ogrgmlasdrivercore.h" 33 : 34 : // g++ -I/usr/include/json -DxDEBUG_VERBOSE -DDEBUG -g -DDEBUG -ftrapv -Wall 35 : // -Wextra -Winit-self -Wunused-parameter -Wformat -Werror=format-security 36 : // -Wno-format-nonliteral -Wlogical-op -Wshadow -Werror=vla 37 : // -Wmissing-declarations -Wnon-virtual-dtor -Woverloaded-virtual 38 : // -fno-operator-names ogr/ogrsf_frmts/gmlas/*.cpp -fPIC -shared -o ogr_GMLAS.so 39 : // -Iport -Igcore -Iogr -Iogr/ogrsf_frmts -Iogr/ogrsf_frmts/mem -L. -lgdal 40 : // -I/home/even/spatialys/eea/inspire_gml/install-xerces-c-3.1.3/include 41 : 42 : /************************************************************************/ 43 : /* OGRGMLASDriverOpen() */ 44 : /************************************************************************/ 45 : 46 175 : static GDALDataset *OGRGMLASDriverOpen(GDALOpenInfo *poOpenInfo) 47 : 48 : { 49 : OGRGMLASDataSource *poDS; 50 : 51 175 : if (poOpenInfo->eAccess == GA_Update) 52 0 : return nullptr; 53 : 54 175 : if (OGRGMLASDriverIdentify(poOpenInfo) == FALSE) 55 0 : return nullptr; 56 : 57 175 : poDS = new OGRGMLASDataSource(); 58 : 59 175 : if (!poDS->Open(poOpenInfo)) 60 : { 61 17 : delete poDS; 62 17 : return nullptr; 63 : } 64 : else 65 158 : return poDS; 66 : } 67 : 68 : /************************************************************************/ 69 : /* RegisterOGRGMLAS() */ 70 : /************************************************************************/ 71 : 72 1520 : void RegisterOGRGMLAS() 73 : 74 : { 75 1520 : if (GDALGetDriverByName(DRIVER_NAME) != nullptr) 76 301 : return; 77 : 78 1219 : GDALDriver *poDriver = new GDALDriver(); 79 1219 : OGRGMLASDriverSetCommonMetadata(poDriver); 80 : 81 1219 : poDriver->pfnOpen = OGRGMLASDriverOpen; 82 1219 : poDriver->pfnCreateCopy = OGRGMLASDriverCreateCopy; 83 : 84 1219 : GetGDALDriverManager()->RegisterDriver(poDriver); 85 : }