| 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Project: WFS Translator |
| 4 | * Purpose: Implements OGRWFSLayer class. |
| 5 | * Author: Even Rouault, <even dot rouault at spatialys.com> |
| 6 | * |
| 7 | ****************************************************************************** |
| 8 | * Copyright (c) 2010-2013, Even Rouault <even dot rouault at spatialys.com> |
| 9 | * |
| 10 | * SPDX-License-Identifier: MIT |
| 11 | ****************************************************************************/ |
| 12 | |
| 13 | #include "cpl_port.h"cxx . . $ `<file>/port/cpl_port.h`/ |
| 14 | #include "ogr_wfs.h"cxx . . $ `<file>/ogr/ogrsf_frmts/wfs/ogr_wfs.h`/ |
| 15 | #include "ogr_api.h"cxx . . $ `<file>/ogr/ogr_api.h`/ |
| 16 | #include "cpl_minixml.h"cxx . . $ `<file>/port/cpl_minixml.h`/ |
| 17 | #include "cpl_http.h"cxx . . $ `<file>/port/cpl_http.h`/ |
| 18 | #include "parsexsd.h"cxx . . $ `<file>/ogr/ogrsf_frmts/gmlutils/parsexsd.h`/ |
| 19 | #include "ogrwfsfilter.h"cxx . . $ `<file>/ogr/ogrsf_frmts/gmlutils/ogrwfsfilter.h`/ |
| 20 | |
| 21 | /************************************************************************/ |
| 22 | /* OGRWFSLayer() */ |
| 23 | /************************************************************************/ |
| 24 | |
| 25 | OGRWFSLayercxx . . $ OGRWFSLayer#::OGRWFSLayercxx . . $ OGRWFSLayer#OGRWFSLayer(c8a485eb8a84abaf).(OGRWFSDataSourcecxx . . $ OGRWFSDataSource# *poDSIn, OGRSpatialReferencecxx . . $ OGRSpatialReference# *poSRSIn, |
| 26 | int bAxisOrderAlreadyInvertedIn, |
| 27 | const char *pszBaseURLIn, const char *pszNameIn, |
| 28 | const char *pszNSIn, const char *pszNSValIn) |
| 29 | : poDScxx . . $ OGRWFSLayer#poDS.(poDSIn), bAxisOrderAlreadyInvertedcxx . . $ OGRWFSLayer#bAxisOrderAlreadyInverted.(bAxisOrderAlreadyInvertedIn), |
| 30 | m_poSRScxx . . $ OGRWFSLayer#m_poSRS.(poSRSIn), pszBaseURLcxx . . $ OGRWFSLayer#pszBaseURL.(CPLStrdup(pszBaseURLIn)), |
| 31 | pszNamecxx . . $ OGRWFSLayer#pszName.(CPLStrdup(pszNameIn)), |
| 32 | pszNScxx . . $ OGRWFSLayer#pszNS.(pszNSIn ? CPLStrdup(pszNSIn) : nullptr), |
| 33 | pszNSValcxx . . $ OGRWFSLayer#pszNSVal.(pszNSValIn ? CPLStrdup(pszNSValIn) : nullptr), |
| 34 | // If changing that, change in the GML driver too |
| 35 | m_osTmpDircxx . . $ OGRWFSLayer#m_osTmpDir.(VSIMemGenerateHiddenFilename("_ogr_wfs_")) |
| 36 | { |
| 37 | SetDescriptioncxx . . $ GDALMajorObject#SetDescription(85c52e162fed56f9).(pszNamecxx . . $ OGRWFSLayer#pszName.); |
| 38 | } |
| 39 | |
| 40 | /************************************************************************/ |
| 41 | /* Clone() */ |
| 42 | /************************************************************************/ |
| 43 | |
| 44 | OGRWFSLayercxx . . $ OGRWFSLayer# *OGRWFSLayercxx . . $ OGRWFSLayer#::Clonecxx . . $ OGRWFSLayer#Clone(8b236fd99a6195fb).() |
| 45 | { |
| 46 | OGRWFSLayercxx . . $ OGRWFSLayer# *poDupLayer = |
| 47 | new OGRWFSLayercxx . . $ OGRWFSLayer#(poDScxx . . $ OGRWFSLayer#poDS., m_poSRScxx . . $ OGRWFSLayer#m_poSRS., bAxisOrderAlreadyInvertedcxx . . $ OGRWFSLayer#bAxisOrderAlreadyInverted., pszBaseURLcxx . . $ OGRWFSLayer#pszBaseURL., |
| 48 | pszNamecxx . . $ OGRWFSLayer#pszName., pszNScxx . . $ OGRWFSLayer#pszNS., pszNSValcxx . . $ OGRWFSLayer#pszNSVal.); |
| 49 | if (m_poSRScxx . . $ OGRWFSLayer#m_poSRS.) |
| 50 | m_poSRScxx . . $ OGRWFSLayer#m_poSRS.->Referencecxx . . $ OGRSpatialReference#Reference(b126dc7c1de90089).(); |
| 51 | poDupLayer->poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn. = GetLayerDefncxx . . $ OGRWFSLayer#GetLayerDefn(448b209f43d15bcc).()->Clonecxx . . $ OGRFeatureDefn#Clone(df2524e70945a265).(); |
| 52 | poDupLayer->poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->Referencecxx . . $ OGRFeatureDefn#Reference(b126dc7c1de90089).(); |
| 53 | poDupLayer->bGotApproximateLayerDefncxx . . $ OGRWFSLayer#bGotApproximateLayerDefn. = bGotApproximateLayerDefncxx . . $ OGRWFSLayer#bGotApproximateLayerDefn.; |
| 54 | poDupLayer->eGeomTypecxx . . $ OGRWFSLayer#eGeomType. = poDupLayer->poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->GetGeomTypecxx . . $ OGRFeatureDefn#GetGeomType(5a40c54c5ff210ce).(); |
| 55 | poDupLayer->pszRequiredOutputFormatcxx . . $ OGRWFSLayer#pszRequiredOutputFormat. = |
| 56 | pszRequiredOutputFormatcxx . . $ OGRWFSLayer#pszRequiredOutputFormat. ? CPLStrdup(pszRequiredOutputFormatcxx . . $ OGRWFSLayer#pszRequiredOutputFormat.) : nullptr; |
| 57 | |
| 58 | /* Copy existing schema file if already found */ |
| 59 | CPLString osSrcFileName = CPLSPrintf("%s/file.xsd", m_osTmpDircxx . . $ OGRWFSLayer#m_osTmpDir..c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 60 | CPLString osTargetFileName = |
| 61 | CPLSPrintf("%s/file.xsd", poDupLayer->m_osTmpDircxx . . $ OGRWFSLayer#m_osTmpDir..c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 62 | CPL_IGNORE_RET_VAL(CPLCopyFile(osTargetFileName, osSrcFileName)); |
| 63 | |
| 64 | return poDupLayer; |
| 65 | } |
| 66 | |
| 67 | /************************************************************************/ |
| 68 | /* ~OGRWFSLayer() */ |
| 69 | /************************************************************************/ |
| 70 | |
| 71 | OGRWFSLayercxx . . $ OGRWFSLayer#::~cxx . . $ OGRWFSLayer#`~OGRWFSLayer`(ced63f7c635d850d).OGRWFSLayercxx . . $ OGRWFSLayer#() |
| 72 | |
| 73 | { |
| 74 | if (bInTransactioncxx . . $ OGRWFSLayer#bInTransaction.) |
| 75 | OGRWFSLayercxx . . $ OGRWFSLayer#::CommitTransactioncxx . . $ OGRWFSLayer#CommitTransaction(b126dc7c1de90089).(); |
| 76 | |
| 77 | if (m_poSRScxx . . $ OGRWFSLayer#m_poSRS. != nullptr) |
| 78 | m_poSRScxx . . $ OGRWFSLayer#m_poSRS.->Releasecxx . . $ OGRSpatialReference#Release(49f6e7a06ebc5aa8).(); |
| 79 | |
| 80 | if (poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn. != nullptr) |
| 81 | poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->Releasecxx . . $ OGRFeatureDefn#Release(49f6e7a06ebc5aa8).(); |
| 82 | delete poGMLFeatureClasscxx . . $ OGRWFSLayer#poGMLFeatureClass.; |
| 83 | |
| 84 | CPLFreecxx . . $ `port/cpl_conv.h:97:9`!(pszBaseURLcxx . . $ OGRWFSLayer#pszBaseURL.); |
| 85 | CPLFreecxx . . $ `port/cpl_conv.h:97:9`!(pszNamecxx . . $ OGRWFSLayer#pszName.); |
| 86 | CPLFreecxx . . $ `port/cpl_conv.h:97:9`!(pszNScxx . . $ OGRWFSLayer#pszNS.); |
| 87 | CPLFreecxx . . $ `port/cpl_conv.h:97:9`!(pszNSValcxx . . $ OGRWFSLayer#pszNSVal.); |
| 88 | |
| 89 | GDALClosecxx . . $ GDALClose(3d5aeed3fac2555e).(poBaseDScxx . . $ OGRWFSLayer#poBaseDS.); |
| 90 | |
| 91 | delete poFetchedFilterGeomcxx . . $ OGRWFSLayer#poFetchedFilterGeom.; |
| 92 | |
| 93 | VSIRmdirRecursive(m_osTmpDircxx . . $ OGRWFSLayer#m_osTmpDir..c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 94 | |
| 95 | CPLFreecxx . . $ `port/cpl_conv.h:97:9`!(pszRequiredOutputFormatcxx . . $ OGRWFSLayer#pszRequiredOutputFormat.); |
| 96 | } |
| 97 | |
| 98 | /************************************************************************/ |
| 99 | /* SetActiveSRS() */ |
| 100 | /************************************************************************/ |
| 101 | |
| 102 | OGRErr OGRWFSLayercxx . . $ OGRWFSLayer#::SetActiveSRScxx . . $ OGRWFSLayer#SetActiveSRS(c97ce1880b024022).(int /*iGeomField*/, |
| 103 | const OGRSpatialReferencecxx . . $ OGRSpatialReference# *poSRS) |
| 104 | { |
| 105 | if (poSRS == nullptr) |
| 106 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 107 | const char *const apszOptions[] = { |
| 108 | "IGNORE_DATA_AXIS_TO_SRS_AXIS_MAPPING=YES", nullptr}; |
| 109 | size_t i = 0; |
| 110 | for (const auto &poSupportedSRS : m_apoSupportedCRSListcxx . . $ OGRWFSLayer#m_apoSupportedCRSList.) |
| 111 | { |
| 112 | if (poSupportedSRS->cxx . . $ OGRRefCountedPtrBase#`operator->`(5a2a78a048fb49a8).IsSamecxx . . $ OGRSpatialReference#IsSame(237d09acedc929c6).(poSRS, apszOptions)) |
| 113 | { |
| 114 | m_osSRSNamecxx . . $ OGRWFSLayer#m_osSRSName. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). m_aosSupportedCRSListcxx . . $ OGRWFSLayer#m_aosSupportedCRSList.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i]; |
| 115 | if (m_poSRScxx . . $ OGRWFSLayer#m_poSRS.) |
| 116 | m_poSRScxx . . $ OGRWFSLayer#m_poSRS.->Releasecxx . . $ OGRSpatialReference#Release(49f6e7a06ebc5aa8).(); |
| 117 | m_poSRScxx . . $ OGRWFSLayer#m_poSRS. = poSRS->Clonecxx . . $ OGRSpatialReference#Clone(1a0fa159535833d7).(); |
| 118 | m_poSRScxx . . $ OGRWFSLayer#m_poSRS.->SetAxisMappingStrategycxx . . $ OGRSpatialReference#SetAxisMappingStrategy(3d39f43974738d6a).(OAMS_TRADITIONAL_GIS_ORDER); |
| 119 | if (poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.) |
| 120 | { |
| 121 | auto poGeomFieldDefn = poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->GetGeomFieldDefncxx . . $ OGRFeatureDefn#GetGeomFieldDefn(39768c424f32bab2).(0); |
| 122 | if (poGeomFieldDefn) |
| 123 | { |
| 124 | poGeomFieldDefn->SetSpatialRefcxx . . $ OGRGeomFieldDefn#SetSpatialRef(9ff39b79387a6086).(m_poSRScxx . . $ OGRWFSLayer#m_poSRS.); |
| 125 | } |
| 126 | } |
| 127 | m_oExtentscxx . . $ OGRWFSLayer#m_oExtents. = OGREnvelope(); |
| 128 | if (m_oWGS84Extentscxx . . $ OGRWFSLayer#m_oWGS84Extents..IsInit()) |
| 129 | { |
| 130 | OGRSpatialReferencecxx . . $ OGRSpatialReference# oWGS84cxx . . $ OGRSpatialReference#OGRSpatialReference(85c52e162fed56f9).; |
| 131 | oWGS84.SetWellKnownGeogCScxx . . $ OGRSpatialReference#SetWellKnownGeogCS(5c4306d8553b3696).("WGS84"); |
| 132 | oWGS84.SetAxisMappingStrategycxx . . $ OGRSpatialReference#SetAxisMappingStrategy(3d39f43974738d6a).(OAMS_TRADITIONAL_GIS_ORDER); |
| 133 | auto poCT = stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<OGRCoordinateTransformationcxx . . $ OGRCoordinateTransformation#>( |
| 134 | OGRCreateCoordinateTransformationcxx . . $ OGRCreateCoordinateTransformation(2d3c2de25cb16c6e).(&oWGS84, m_poSRScxx . . $ OGRWFSLayer#m_poSRS.)); |
| 135 | if (poCT) |
| 136 | { |
| 137 | poCT->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).TransformBoundscxx . . $ OGRCoordinateTransformation#TransformBounds(c92a20ebafafd4c5).( |
| 138 | m_oWGS84Extentscxx . . $ OGRWFSLayer#m_oWGS84Extents..MinX, m_oWGS84Extentscxx . . $ OGRWFSLayer#m_oWGS84Extents..MinY, |
| 139 | m_oWGS84Extentscxx . . $ OGRWFSLayer#m_oWGS84Extents..MaxX, m_oWGS84Extentscxx . . $ OGRWFSLayer#m_oWGS84Extents..MaxY, |
| 140 | &m_oExtentscxx . . $ OGRWFSLayer#m_oExtents..MinX, &m_oExtentscxx . . $ OGRWFSLayer#m_oExtents..MinY, &m_oExtentscxx . . $ OGRWFSLayer#m_oExtents..MaxX, |
| 141 | &m_oExtentscxx . . $ OGRWFSLayer#m_oExtents..MaxY, 20); |
| 142 | } |
| 143 | } |
| 144 | SetSpatialFiltercxx . . $ OGRLayer#SetSpatialFilter(fed901b2566802ff).(nullptr); |
| 145 | ResetReadingcxx . . $ OGRWFSLayer#ResetReading(49f6e7a06ebc5aa8).(); |
| 146 | return OGRERR_NONEcxx . . $ `ogr/ogr_core.h:390:9`!; |
| 147 | } |
| 148 | ++i; |
| 149 | } |
| 150 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 151 | } |
| 152 | |
| 153 | /************************************************************************/ |
| 154 | /* GetDescribeFeatureTypeURL() */ |
| 155 | /************************************************************************/ |
| 156 | |
| 157 | CPLString OGRWFSLayercxx . . $ OGRWFSLayer#::GetDescribeFeatureTypeURLcxx . . $ OGRWFSLayer#GetDescribeFeatureTypeURL(aa6080b2436c07ab).(CPL_UNUSEDcxx . . $ `port/cpl_port.h:1040:9`! int bWithNS) |
| 158 | { |
| 159 | CPLString osURL(pszBaseURLcxx . . $ OGRWFSLayer#pszBaseURL.); |
| 160 | osURL = CPLURLAddKVP(osURL, "SERVICE", "WFS"); |
| 161 | osURL = CPLURLAddKVP(osURL, "VERSION", poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).()); |
| 162 | osURL = CPLURLAddKVP(osURL, "REQUEST", "DescribeFeatureType"); |
| 163 | osURL = CPLURLAddKVP(osURL, "TYPENAME", WFS_EscapeURLcxx . . $ WFS_EscapeURL(a9d72c988d85d6d8).(pszNamecxx . . $ OGRWFSLayer#pszName.)); |
| 164 | osURL = CPLURLAddKVP(osURL, "PROPERTYNAME", nullptr); |
| 165 | osURL = CPLURLAddKVP(osURL, "MAXFEATURES", nullptr); |
| 166 | osURL = CPLURLAddKVP(osURL, "COUNT", nullptr); |
| 167 | osURL = CPLURLAddKVP(osURL, "FILTER", nullptr); |
| 168 | osURL = CPLURLAddKVP(osURL, "OUTPUTFORMAT", |
| 169 | pszRequiredOutputFormatcxx . . $ OGRWFSLayer#pszRequiredOutputFormat. && |
| 170 | !EQUALcxx . . $ `port/cpl_port.h:532:9`!(pszRequiredOutputFormat, "json") |
| 171 | ? WFS_EscapeURLcxx . . $ WFS_EscapeURL(a9d72c988d85d6d8).(pszRequiredOutputFormatcxx . . $ OGRWFSLayer#pszRequiredOutputFormat.).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).() |
| 172 | : nullptr); |
| 173 | |
| 174 | if (pszNScxx . . $ OGRWFSLayer#pszNS. && poDScxx . . $ OGRWFSLayer#poDS.->GetNeedNAMESPACEcxx . . $ OGRWFSDataSource#GetNeedNAMESPACE(50ce9a9e25b4a850).()) |
| 175 | { |
| 176 | /* Older Deegree version require NAMESPACE (e.g. |
| 177 | * http://www.nokis.org/deegree2/ogcwebservice) */ |
| 178 | /* This has been now corrected */ |
| 179 | CPLString osValue("xmlns("); |
| 180 | osValue +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). pszNScxx . . $ OGRWFSLayer#pszNS.; |
| 181 | osValue +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "="; |
| 182 | osValue +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). pszNSValcxx . . $ OGRWFSLayer#pszNSVal.; |
| 183 | osValue +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). ")"; |
| 184 | osURL = CPLURLAddKVP(osURL, "NAMESPACE", WFS_EscapeURLcxx . . $ WFS_EscapeURL(a9d72c988d85d6d8).(osValue)); |
| 185 | } |
| 186 | |
| 187 | return osURL; |
| 188 | } |
| 189 | |
| 190 | /************************************************************************/ |
| 191 | /* DescribeFeatureType() */ |
| 192 | /************************************************************************/ |
| 193 | |
| 194 | OGRFeatureDefncxx . . $ OGRFeatureDefn# *OGRWFSLayercxx . . $ OGRWFSLayer#::DescribeFeatureTypecxx . . $ OGRWFSLayer#DescribeFeatureType(407fccde18759965).() |
| 195 | { |
| 196 | CPLString osURL = GetDescribeFeatureTypeURLcxx . . $ OGRWFSLayer#GetDescribeFeatureTypeURL(aa6080b2436c07ab).(TRUEcxx . . $ `port/cpl_port.h:1184:9`!); |
| 197 | |
| 198 | CPLDebug("WFS", "%s", osURL.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 199 | |
| 200 | CPLHTTPResult *psResult = poDScxx . . $ OGRWFSLayer#poDS.->HTTPFetchcxx . . $ OGRWFSDataSource#HTTPFetch(38e266439c02e448).(osURL, nullptr); |
| 201 | if (psResult == nullptr) |
| 202 | { |
| 203 | return nullptr; |
| 204 | } |
| 205 | |
| 206 | if (strstr(reinterpret_cast<const char *>(psResult->pabyData), |
| 207 | "<ServiceExceptionReport") != nullptr) |
| 208 | { |
| 209 | if (poDScxx . . $ OGRWFSLayer#poDS.->IsOldDeegreecxx . . $ OGRWFSDataSource#IsOldDeegree(c5f7da30cbc0f4e9).( |
| 210 | reinterpret_cast<const char *>(psResult->pabyData))) |
| 211 | { |
| 212 | CPLHTTPDestroyResult(psResult); |
| 213 | return DescribeFeatureTypecxx . . $ OGRWFSLayer#DescribeFeatureType(407fccde18759965).(); |
| 214 | } |
| 215 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Error returned by server : %s", |
| 216 | psResult->pabyData); |
| 217 | CPLHTTPDestroyResult(psResult); |
| 218 | return nullptr; |
| 219 | } |
| 220 | |
| 221 | CPLXMLNodecxx . . $ CPLXMLNode# *psXML = |
| 222 | CPLParseXMLString(reinterpret_cast<const char *>(psResult->pabyData)); |
| 223 | if (psXML == nullptr) |
| 224 | { |
| 225 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Invalid XML content : %s", |
| 226 | psResult->pabyData); |
| 227 | CPLHTTPDestroyResult(psResult); |
| 228 | return nullptr; |
| 229 | } |
| 230 | CPLHTTPDestroyResult(psResult); |
| 231 | |
| 232 | const CPLXMLNodecxx . . $ CPLXMLNode# *psSchema = WFSFindNodecxx . . $ WFSFindNode(bbc3ba4ab96ca979).(psXML, "schema"); |
| 233 | if (psSchema == nullptr) |
| 234 | { |
| 235 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Cannot find <Schema>"); |
| 236 | CPLDestroyXMLNode(psXML); |
| 237 | |
| 238 | return nullptr; |
| 239 | } |
| 240 | |
| 241 | OGRFeatureDefncxx . . $ OGRFeatureDefn# *poFDefn = ParseSchemacxx . . $ OGRWFSLayer#ParseSchema(f243b86b4209cc84).(psSchema); |
| 242 | if (poFDefn) |
| 243 | poDScxx . . $ OGRWFSLayer#poDS.->SaveLayerSchemacxx . . $ OGRWFSDataSource#SaveLayerSchema(bbf43b735a1afe7b).(pszNamecxx . . $ OGRWFSLayer#pszName., psSchema); |
| 244 | |
| 245 | CPLDestroyXMLNode(psXML); |
| 246 | return poFDefn; |
| 247 | } |
| 248 | |
| 249 | /************************************************************************/ |
| 250 | /* ParseSchema() */ |
| 251 | /************************************************************************/ |
| 252 | |
| 253 | OGRFeatureDefncxx . . $ OGRFeatureDefn# *OGRWFSLayercxx . . $ OGRWFSLayer#::ParseSchemacxx . . $ OGRWFSLayer#ParseSchema(f243b86b4209cc84).(const CPLXMLNodecxx . . $ CPLXMLNode# *psSchema) |
| 254 | { |
| 255 | osTargetNamespacecxx . . $ OGRWFSLayer#osTargetNamespace. = CPLGetXMLValue(psSchema, "targetNamespace", ""); |
| 256 | |
| 257 | CPLString osTmpFileName; |
| 258 | |
| 259 | osTmpFileName = CPLSPrintf("%s/file.xsd", m_osTmpDircxx . . $ OGRWFSLayer#m_osTmpDir..c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 260 | CPLSerializeXMLTreeToFile(psSchema, osTmpFileName); |
| 261 | |
| 262 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<GMLFeatureClasscxx . . $ GMLFeatureClass# *> aosClassescxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 263 | bool bFullyUnderstood = false; |
| 264 | bool bUseSchemaImports = false; |
| 265 | bool bHaveSchema = GMLParseXSDcxx . . $ GMLParseXSD(48e53934138cfdb4).(osTmpFileName, bUseSchemaImports, aosClasses, |
| 266 | bFullyUnderstood); |
| 267 | |
| 268 | if (bHaveSchema && aosClasses.sizecxx . . $ std/vector#size(c9b1e749b64d5edc).() == 1) |
| 269 | { |
| 270 | // CPLDebug("WFS", "Creating %s for %s", osTmpFileName.c_str(), |
| 271 | // GetName()); |
| 272 | return BuildLayerDefnFromFeatureClasscxx . . $ OGRWFSLayer#BuildLayerDefnFromFeatureClass(8829742ebd8174aa).(aosClasses[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0]); |
| 273 | } |
| 274 | else if (bHaveSchema) |
| 275 | { |
| 276 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<GMLFeatureClass *>::const_iteratorcxx . . $ std/vector#const_iterator# oIter = |
| 277 | aosClasses.begincxx . . $ std/vector#begin(55a6de06420d4903).(); |
| 278 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<GMLFeatureClass *>::const_iteratorcxx . . $ std/vector#const_iterator# oEndIter = |
| 279 | aosClasses.endcxx . . $ std/vector#end(55a6de06420d4903).(); |
| 280 | while (oIter != oEndIter) |
| 281 | { |
| 282 | GMLFeatureClasscxx . . $ GMLFeatureClass# *poClass = *oIter; |
| 283 | ++oIter; |
| 284 | delete poClass; |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | VSIUnlink(osTmpFileName); |
| 289 | |
| 290 | return nullptr; |
| 291 | } |
| 292 | |
| 293 | /************************************************************************/ |
| 294 | /* BuildLayerDefnFromFeatureClass() */ |
| 295 | /************************************************************************/ |
| 296 | |
| 297 | OGRFeatureDefncxx . . $ OGRFeatureDefn# * |
| 298 | OGRWFSLayercxx . . $ OGRWFSLayer#::BuildLayerDefnFromFeatureClasscxx . . $ OGRWFSLayer#BuildLayerDefnFromFeatureClass(8829742ebd8174aa).(GMLFeatureClasscxx . . $ GMLFeatureClass# *poClass) |
| 299 | { |
| 300 | poGMLFeatureClasscxx . . $ OGRWFSLayer#poGMLFeatureClass. = poClass; |
| 301 | |
| 302 | OGRFeatureDefncxx . . $ OGRFeatureDefn# *poFDefn = new OGRFeatureDefncxx . . $ OGRFeatureDefn#(pszNamecxx . . $ OGRWFSLayer#pszName.); |
| 303 | poFDefn->SetGeomTypecxx . . $ OGRFeatureDefn#SetGeomType(f47ce3f1fe923726).(wkbNone); |
| 304 | if (poGMLFeatureClasscxx . . $ OGRWFSLayer#poGMLFeatureClass.->GetGeometryPropertyCountcxx . . $ GMLFeatureClass#GetGeometryPropertyCount(455f465bc33b4cdf).() > 0) |
| 305 | { |
| 306 | poFDefn->SetGeomTypecxx . . $ OGRFeatureDefn#SetGeomType(f47ce3f1fe923726).(static_cast<OGRwkbGeometryType>( |
| 307 | poGMLFeatureClasscxx . . $ OGRWFSLayer#poGMLFeatureClass.->GetGeometryPropertycxx . . $ GMLFeatureClass#GetGeometryProperty(d57792ed8f30a1b4).(0)->GetTypecxx . . $ GMLGeometryPropertyDefn#GetType(5a40c54c5ff210ce).())); |
| 308 | poFDefn->GetGeomFieldDefncxx . . $ OGRFeatureDefn#GetGeomFieldDefn(39768c424f32bab2).(0)->SetSpatialRefcxx . . $ OGRGeomFieldDefn#SetSpatialRef(9ff39b79387a6086).(m_poSRScxx . . $ OGRWFSLayer#m_poSRS.); |
| 309 | } |
| 310 | |
| 311 | /* -------------------------------------------------------------------- */ |
| 312 | /* Added attributes (properties). */ |
| 313 | /* -------------------------------------------------------------------- */ |
| 314 | if (poDScxx . . $ OGRWFSLayer#poDS.->ExposeGMLIdcxx . . $ OGRWFSDataSource#ExposeGMLId(50ce9a9e25b4a850).()) |
| 315 | { |
| 316 | OGRFieldDefncxx . . $ OGRFieldDefn# oFieldcxx . . $ OGRFieldDefn#OGRFieldDefn(786ecb48a0b3b841).("gml_id", OFTString); |
| 317 | oField.SetNullablecxx . . $ OGRFieldDefn#SetNullable(d4f767463ce0a6b3).(FALSEcxx . . $ `port/cpl_port.h:1180:9`!); |
| 318 | poFDefn->AddFieldDefncxx . . $ OGRFeatureDefn#AddFieldDefn(f8bad7d30df65bbb).(&oField); |
| 319 | } |
| 320 | |
| 321 | for (int iField = 0; iField < poGMLFeatureClasscxx . . $ OGRWFSLayer#poGMLFeatureClass.->GetPropertyCountcxx . . $ GMLFeatureClass#GetPropertyCount(455f465bc33b4cdf).(); |
| 322 | iField++) |
| 323 | { |
| 324 | GMLPropertyDefncxx . . $ GMLPropertyDefn# *poProperty = poGMLFeatureClasscxx . . $ OGRWFSLayer#poGMLFeatureClass.->GetPropertycxx . . $ GMLFeatureClass#GetProperty(b950e76b5d86c48f).(iField); |
| 325 | OGRFieldSubType eSubType = OFSTNone; |
| 326 | const OGRFieldType eFType = |
| 327 | GML_GetOGRFieldTypecxx . . $ GML_GetOGRFieldType(81aaa77e722cb32a).(poProperty->GetTypecxx . . $ GMLPropertyDefn#GetType(eb020ce77ce58ae).(), eSubType); |
| 328 | |
| 329 | OGRFieldDefncxx . . $ OGRFieldDefn# oFieldcxx . . $ OGRFieldDefn#OGRFieldDefn(786ecb48a0b3b841).(poProperty->GetNamecxx . . $ GMLPropertyDefn#GetName(a9f41ea0e82d88cf).(), eFType); |
| 330 | oField.SetSubTypecxx . . $ OGRFieldDefn#SetSubType(89cba9d8fed1b3f9).(eSubType); |
| 331 | if (STARTS_WITH_CIcxx . . $ `port/cpl_port.h:543:9`!(oField.GetNameRef(), "ogr:")) |
| 332 | oField.SetNamecxx . . $ OGRFieldDefn#SetName(85c52e162fed56f9).(poProperty->GetNamecxx . . $ GMLPropertyDefn#GetName(a9f41ea0e82d88cf).() + 4); |
| 333 | if (poProperty->GetWidthcxx . . $ GMLPropertyDefn#GetWidth(455f465bc33b4cdf).() > 0) |
| 334 | oField.SetWidthcxx . . $ OGRFieldDefn#SetWidth(d4f767463ce0a6b3).(poProperty->GetWidthcxx . . $ GMLPropertyDefn#GetWidth(455f465bc33b4cdf).()); |
| 335 | if (poProperty->GetPrecisioncxx . . $ GMLPropertyDefn#GetPrecision(455f465bc33b4cdf).() > 0) |
| 336 | oField.SetPrecisioncxx . . $ OGRFieldDefn#SetPrecision(d4f767463ce0a6b3).(poProperty->GetPrecisioncxx . . $ GMLPropertyDefn#GetPrecision(455f465bc33b4cdf).()); |
| 337 | if (!poDScxx . . $ OGRWFSLayer#poDS.->IsEmptyAsNullcxx . . $ OGRWFSDataSource#IsEmptyAsNull(50ce9a9e25b4a850).()) |
| 338 | oField.SetNullablecxx . . $ OGRFieldDefn#SetNullable(d4f767463ce0a6b3).(poProperty->IsNullablecxx . . $ GMLPropertyDefn#IsNullable(50ce9a9e25b4a850).()); |
| 339 | |
| 340 | poFDefn->AddFieldDefncxx . . $ OGRFeatureDefn#AddFieldDefn(f8bad7d30df65bbb).(&oField); |
| 341 | } |
| 342 | |
| 343 | if (poGMLFeatureClasscxx . . $ OGRWFSLayer#poGMLFeatureClass.->GetGeometryPropertyCountcxx . . $ GMLFeatureClass#GetGeometryPropertyCount(455f465bc33b4cdf).() > 0) |
| 344 | { |
| 345 | const char *pszGeometryColumnName = |
| 346 | poGMLFeatureClasscxx . . $ OGRWFSLayer#poGMLFeatureClass.->GetGeometryPropertycxx . . $ GMLFeatureClass#GetGeometryProperty(d57792ed8f30a1b4).(0)->GetSrcElementcxx . . $ GMLGeometryPropertyDefn#GetSrcElement(a9f41ea0e82d88cf).(); |
| 347 | if (pszGeometryColumnName[0] != '\0') |
| 348 | { |
| 349 | osGeometryColumnNamecxx . . $ OGRWFSLayer#osGeometryColumnName. = pszGeometryColumnName; |
| 350 | if (poFDefn->GetGeomFieldCountcxx . . $ OGRFeatureDefn#GetGeomFieldCount(455f465bc33b4cdf).() > 0) |
| 351 | { |
| 352 | poFDefn->GetGeomFieldDefncxx . . $ OGRFeatureDefn#GetGeomFieldDefn(39768c424f32bab2).(0)->SetNullablecxx . . $ OGRGeomFieldDefn#SetNullable(d4f767463ce0a6b3).( |
| 353 | poGMLFeatureClasscxx . . $ OGRWFSLayer#poGMLFeatureClass.->GetGeometryPropertycxx . . $ GMLFeatureClass#GetGeometryProperty(d57792ed8f30a1b4).(0)->IsNullablecxx . . $ GMLGeometryPropertyDefn#IsNullable(50ce9a9e25b4a850).()); |
| 354 | poFDefn->GetGeomFieldDefncxx . . $ OGRFeatureDefn#GetGeomFieldDefn(39768c424f32bab2).(0)->SetNamecxx . . $ OGRGeomFieldDefn#SetName(85c52e162fed56f9).(pszGeometryColumnName); |
| 355 | } |
| 356 | } |
| 357 | } |
| 358 | |
| 359 | return poFDefn; |
| 360 | } |
| 361 | |
| 362 | /************************************************************************/ |
| 363 | /* MakeGetFeatureURL() */ |
| 364 | /************************************************************************/ |
| 365 | |
| 366 | CPLString OGRWFSLayercxx . . $ OGRWFSLayer#::MakeGetFeatureURLcxx . . $ OGRWFSLayer#MakeGetFeatureURL(c3114674e28cccff).(int nRequestMaxFeatures, |
| 367 | int bRequestHits) |
| 368 | { |
| 369 | CPLString osURL(pszBaseURLcxx . . $ OGRWFSLayer#pszBaseURL.); |
| 370 | osURL = CPLURLAddKVP(osURL, "SERVICE", "WFS"); |
| 371 | osURL = CPLURLAddKVP(osURL, "VERSION", poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).()); |
| 372 | osURL = CPLURLAddKVP(osURL, "REQUEST", "GetFeature"); |
| 373 | if (atoicxx . . $ atoi(f5ecf3191ed0cd93).(poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).()) >= 2) |
| 374 | osURL = CPLURLAddKVP(osURL, "TYPENAMES", WFS_EscapeURLcxx . . $ WFS_EscapeURL(a9d72c988d85d6d8).(pszNamecxx . . $ OGRWFSLayer#pszName.)); |
| 375 | else |
| 376 | osURL = CPLURLAddKVP(osURL, "TYPENAME", WFS_EscapeURLcxx . . $ WFS_EscapeURL(a9d72c988d85d6d8).(pszNamecxx . . $ OGRWFSLayer#pszName.)); |
| 377 | if (!m_osSRSNamecxx . . $ OGRWFSLayer#m_osSRSName..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) |
| 378 | osURL = |
| 379 | CPLURLAddKVP(osURL, "SRSNAME", WFS_EscapeURLcxx . . $ WFS_EscapeURL(a9d72c988d85d6d8).(m_osSRSNamecxx . . $ OGRWFSLayer#m_osSRSName..c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).())); |
| 380 | if (pszRequiredOutputFormatcxx . . $ OGRWFSLayer#pszRequiredOutputFormat.) |
| 381 | osURL = CPLURLAddKVP(osURL, "OUTPUTFORMAT", |
| 382 | WFS_EscapeURLcxx . . $ WFS_EscapeURL(a9d72c988d85d6d8).(pszRequiredOutputFormatcxx . . $ OGRWFSLayer#pszRequiredOutputFormat.)); |
| 383 | |
| 384 | if (poDScxx . . $ OGRWFSLayer#poDS.->IsPagingAllowedcxx . . $ OGRWFSDataSource#IsPagingAllowed(50ce9a9e25b4a850).() && !bRequestHits) |
| 385 | { |
| 386 | nRequestMaxFeatures = poDScxx . . $ OGRWFSLayer#poDS.->GetPageSizecxx . . $ OGRWFSDataSource#GetPageSize(455f465bc33b4cdf).(); |
| 387 | /* If the feature count is known and is less than the page size, we don't |
| 388 | * need to do paging. Skipping the pagination parameters improves compatibility |
| 389 | * with remote datasources that don't have a primary key. |
| 390 | * Without a primary key, the WFS server can't support paging, since there |
| 391 | * is no natural sort order defined. */ |
| 392 | if (nFeaturescxx . . $ OGRWFSLayer#nFeatures. < 0 || |
| 393 | (nRequestMaxFeatures && nFeaturescxx . . $ OGRWFSLayer#nFeatures. > nRequestMaxFeatures)) |
| 394 | { |
| 395 | osURL = |
| 396 | CPLURLAddKVP(osURL, "STARTINDEX", |
| 397 | CPLSPrintf("%d", nPagingStartIndexcxx . . $ OGRWFSLayer#nPagingStartIndex. + |
| 398 | poDScxx . . $ OGRWFSLayer#poDS.->GetBaseStartIndexcxx . . $ OGRWFSDataSource#GetBaseStartIndex(455f465bc33b4cdf).())); |
| 399 | bPagingActivecxx . . $ OGRWFSLayer#bPagingActive. = true; |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | if (nRequestMaxFeatures) |
| 404 | { |
| 405 | osURL = CPLURLAddKVP( |
| 406 | osURL, atoicxx . . $ atoi(f5ecf3191ed0cd93).(poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).()) >= 2 ? "COUNT" : "MAXFEATURES", |
| 407 | CPLSPrintf("%d", nRequestMaxFeatures)); |
| 408 | } |
| 409 | if (pszNScxx . . $ OGRWFSLayer#pszNS. && poDScxx . . $ OGRWFSLayer#poDS.->GetNeedNAMESPACEcxx . . $ OGRWFSDataSource#GetNeedNAMESPACE(50ce9a9e25b4a850).()) |
| 410 | { |
| 411 | /* Older Deegree version require NAMESPACE (e.g. |
| 412 | * http://www.nokis.org/deegree2/ogcwebservice) */ |
| 413 | /* This has been now corrected */ |
| 414 | CPLString osValue("xmlns("); |
| 415 | osValue +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). pszNScxx . . $ OGRWFSLayer#pszNS.; |
| 416 | osValue +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "="; |
| 417 | osValue +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). pszNSValcxx . . $ OGRWFSLayer#pszNSVal.; |
| 418 | osValue +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). ")"; |
| 419 | osURL = CPLURLAddKVP(osURL, "NAMESPACE", WFS_EscapeURLcxx . . $ WFS_EscapeURL(a9d72c988d85d6d8).(osValue)); |
| 420 | } |
| 421 | |
| 422 | delete poFetchedFilterGeomcxx . . $ OGRWFSLayer#poFetchedFilterGeom.; |
| 423 | poFetchedFilterGeomcxx . . $ OGRWFSLayer#poFetchedFilterGeom. = nullptr; |
| 424 | |
| 425 | CPLString osGeomFilter; |
| 426 | |
| 427 | if (m_poFilterGeomcxx . . $ OGRLayer#m_poFilterGeom. != nullptr && !osGeometryColumnNamecxx . . $ OGRWFSLayer#osGeometryColumnName..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) |
| 428 | { |
| 429 | OGREnvelope oEnvelope; |
| 430 | m_poFilterGeomcxx . . $ OGRLayer#m_poFilterGeom.->getEnvelopecxx . . $ OGRGeometry#getEnvelope(e5217c1f2a4fd7ce).(&oEnvelope); |
| 431 | |
| 432 | poFetchedFilterGeomcxx . . $ OGRWFSLayer#poFetchedFilterGeom. = m_poFilterGeomcxx . . $ OGRLayer#m_poFilterGeom.->clonecxx . . $ OGRGeometry#clone(bac917acb50a3c43).(); |
| 433 | |
| 434 | osGeomFilter = "<BBOX>"; |
| 435 | if (atoicxx . . $ atoi(f5ecf3191ed0cd93).(poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).()) >= 2) |
| 436 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "<ValueReference>"; |
| 437 | else |
| 438 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "<PropertyName>"; |
| 439 | if (pszNScxx . . $ OGRWFSLayer#pszNS.) |
| 440 | { |
| 441 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). pszNScxx . . $ OGRWFSLayer#pszNS.; |
| 442 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). ":"; |
| 443 | } |
| 444 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). osGeometryColumnNamecxx . . $ OGRWFSLayer#osGeometryColumnName.; |
| 445 | if (atoicxx . . $ atoi(f5ecf3191ed0cd93).(poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).()) >= 2) |
| 446 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "</ValueReference>"; |
| 447 | else |
| 448 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "</PropertyName>"; |
| 449 | |
| 450 | if (atoicxx . . $ atoi(f5ecf3191ed0cd93).(poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).()) >= 2) |
| 451 | { |
| 452 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "<gml:Envelope"; |
| 453 | |
| 454 | CPLString osSRSName = CPLURLGetValue(pszBaseURLcxx . . $ OGRWFSLayer#pszBaseURL., "SRSNAME"); |
| 455 | if (!osSRSName.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) |
| 456 | { |
| 457 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " srsName=\""; |
| 458 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). osSRSName; |
| 459 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "\""; |
| 460 | } |
| 461 | |
| 462 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). ">"; |
| 463 | if (bAxisOrderAlreadyInvertedcxx . . $ OGRWFSLayer#bAxisOrderAlreadyInverted.) |
| 464 | { |
| 465 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). |
| 466 | CPLSPrintf("<gml:lowerCorner>%.16f " |
| 467 | "%.16f</gml:lowerCorner><gml:upperCorner>%.16f " |
| 468 | "%.16f</gml:upperCorner>", |
| 469 | oEnvelope.MinY, oEnvelope.MinX, oEnvelope.MaxY, |
| 470 | oEnvelope.MaxX); |
| 471 | } |
| 472 | else |
| 473 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). |
| 474 | CPLSPrintf("<gml:lowerCorner>%.16f " |
| 475 | "%.16f</gml:lowerCorner><gml:upperCorner>%.16f " |
| 476 | "%.16f</gml:upperCorner>", |
| 477 | oEnvelope.MinX, oEnvelope.MinY, oEnvelope.MaxX, |
| 478 | oEnvelope.MaxY); |
| 479 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "</gml:Envelope>"; |
| 480 | } |
| 481 | else if (poDScxx . . $ OGRWFSLayer#poDS.->RequiresEnvelopeSpatialFiltercxx . . $ OGRWFSDataSource#RequiresEnvelopeSpatialFilter(50ce9a9e25b4a850).()) |
| 482 | { |
| 483 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "<Envelope xmlns=\"http://www.opengis.net/gml\">"; |
| 484 | if (bAxisOrderAlreadyInvertedcxx . . $ OGRWFSLayer#bAxisOrderAlreadyInverted.) |
| 485 | { |
| 486 | /* We can go here in WFS 1.1 with geographic coordinate systems |
| 487 | */ |
| 488 | /* that are natively return in lat,long order, but as we have */ |
| 489 | /* presented long,lat order to the user, we must switch back */ |
| 490 | /* for the server... */ |
| 491 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). |
| 492 | CPLSPrintf("<coord><X>%.16f</X><Y>%.16f</Y></" |
| 493 | "coord><coord><X>%.16f</X><Y>%.16f</Y></coord>", |
| 494 | oEnvelope.MinY, oEnvelope.MinX, oEnvelope.MaxY, |
| 495 | oEnvelope.MaxX); |
| 496 | } |
| 497 | else |
| 498 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). |
| 499 | CPLSPrintf("<coord><X>%.16f</X><Y>%.16f</Y></" |
| 500 | "coord><coord><X>%.16f</X><Y>%.16f</Y></coord>", |
| 501 | oEnvelope.MinX, oEnvelope.MinY, oEnvelope.MaxX, |
| 502 | oEnvelope.MaxY); |
| 503 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "</Envelope>"; |
| 504 | } |
| 505 | else |
| 506 | { |
| 507 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "<gml:Box>"; |
| 508 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "<gml:coordinates>"; |
| 509 | if (bAxisOrderAlreadyInvertedcxx . . $ OGRWFSLayer#bAxisOrderAlreadyInverted.) |
| 510 | { |
| 511 | /* We can go here in WFS 1.1 with geographic coordinate systems |
| 512 | */ |
| 513 | /* that are natively return in lat,long order, but as we have */ |
| 514 | /* presented long,lat order to the user, we must switch back */ |
| 515 | /* for the server... */ |
| 516 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). |
| 517 | CPLSPrintf("%.16f,%.16f %.16f,%.16f", oEnvelope.MinY, |
| 518 | oEnvelope.MinX, oEnvelope.MaxY, oEnvelope.MaxX); |
| 519 | } |
| 520 | else |
| 521 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). |
| 522 | CPLSPrintf("%.16f,%.16f %.16f,%.16f", oEnvelope.MinX, |
| 523 | oEnvelope.MinY, oEnvelope.MaxX, oEnvelope.MaxY); |
| 524 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "</gml:coordinates>"; |
| 525 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "</gml:Box>"; |
| 526 | } |
| 527 | osGeomFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "</BBOX>"; |
| 528 | } |
| 529 | |
| 530 | if (!osGeomFilter.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).() || !osWFSWherecxx . . $ OGRWFSLayer#osWFSWhere..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) |
| 531 | { |
| 532 | CPLString osFilter; |
| 533 | if (atoicxx . . $ atoi(f5ecf3191ed0cd93).(poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).()) >= 2) |
| 534 | osFilter = "<Filter xmlns=\"http://www.opengis.net/fes/2.0\""; |
| 535 | else |
| 536 | osFilter = "<Filter xmlns=\"http://www.opengis.net/ogc\""; |
| 537 | if (pszNScxx . . $ OGRWFSLayer#pszNS.) |
| 538 | { |
| 539 | osFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " xmlns:"; |
| 540 | osFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). pszNScxx . . $ OGRWFSLayer#pszNS.; |
| 541 | osFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "=\""; |
| 542 | osFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). pszNSValcxx . . $ OGRWFSLayer#pszNSVal.; |
| 543 | osFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "\""; |
| 544 | } |
| 545 | if (atoicxx . . $ atoi(f5ecf3191ed0cd93).(poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).()) >= 2) |
| 546 | osFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " xmlns:gml=\"http://www.opengis.net/gml/3.2\">"; |
| 547 | else |
| 548 | osFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " xmlns:gml=\"http://www.opengis.net/gml\">"; |
| 549 | if (!osGeomFilter.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).() && !osWFSWherecxx . . $ OGRWFSLayer#osWFSWhere..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) |
| 550 | osFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "<And>"; |
| 551 | osFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). osWFSWherecxx . . $ OGRWFSLayer#osWFSWhere.; |
| 552 | osFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). osGeomFilter; |
| 553 | if (!osGeomFilter.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).() && !osWFSWherecxx . . $ OGRWFSLayer#osWFSWhere..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) |
| 554 | osFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "</And>"; |
| 555 | osFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "</Filter>"; |
| 556 | |
| 557 | osURL = CPLURLAddKVP(osURL, "FILTER", WFS_EscapeURLcxx . . $ WFS_EscapeURL(a9d72c988d85d6d8).(osFilter)); |
| 558 | } |
| 559 | |
| 560 | if (bRequestHits) |
| 561 | { |
| 562 | osURL = CPLURLAddKVP(osURL, "RESULTTYPE", "hits"); |
| 563 | } |
| 564 | else if (!aoSortColumnscxx . . $ OGRWFSLayer#aoSortColumns..emptycxx . . $ std/vector#empty(3482b152b9333168).()) |
| 565 | { |
| 566 | CPLString osSortBy; |
| 567 | for (const auto &sColumn : aoSortColumnscxx . . $ OGRWFSLayer#aoSortColumns.) |
| 568 | { |
| 569 | if (!osSortBy.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) |
| 570 | osSortBy +=cxx . . $ std/__cxx11/basic_string#`operator+=`(63cc1ae870623930). ','; |
| 571 | osSortBy +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). sColumn.osColumncxx . . $ OGRWFSSortDesc#osColumn.; |
| 572 | if (!sColumn.bAsccxx . . $ OGRWFSSortDesc#bAsc.) |
| 573 | { |
| 574 | if (atoicxx . . $ atoi(f5ecf3191ed0cd93).(poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).()) >= 2) |
| 575 | osSortBy +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " DESC"; |
| 576 | else |
| 577 | osSortBy +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " D"; |
| 578 | } |
| 579 | } |
| 580 | osURL = CPLURLAddKVP(osURL, "SORTBY", WFS_EscapeURLcxx . . $ WFS_EscapeURL(a9d72c988d85d6d8).(osSortBy)); |
| 581 | } |
| 582 | |
| 583 | /* If no PROPERTYNAME is specified, build one if there are ignored fields */ |
| 584 | CPLString osPropertyName = CPLURLGetValue(osURL, "PROPERTYNAME"); |
| 585 | const char *pszPropertyName = osPropertyName.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(); |
| 586 | if (pszPropertyName[0] == 0 && poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn. != nullptr) |
| 587 | { |
| 588 | bool bHasIgnoredField = false; |
| 589 | osPropertyName.clearcxx . . $ std/__cxx11/basic_string#clear(ced63f7c635d850d).(); |
| 590 | for (int iField = 0; iField < poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->GetFieldCountcxx . . $ OGRFeatureDefn#GetFieldCount(455f465bc33b4cdf).(); iField++) |
| 591 | { |
| 592 | if (EQUALcxx . . $ `port/cpl_port.h:532:9`!(poFeatureDefn->GetFieldDefn(iField)->GetNameRef(), |
| 593 | "gml_id")) |
| 594 | { |
| 595 | /* fake field : skip it */ |
| 596 | } |
| 597 | else if (poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->GetFieldDefncxx . . $ OGRFeatureDefn#GetFieldDefn(2ec36f91b6ceefc7).(iField)->IsIgnoredcxx . . $ OGRFieldDefn#IsIgnored(455f465bc33b4cdf).()) |
| 598 | { |
| 599 | bHasIgnoredField = true; |
| 600 | } |
| 601 | else |
| 602 | { |
| 603 | if (!osPropertyName.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) |
| 604 | osPropertyName +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). ","; |
| 605 | osPropertyName +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). |
| 606 | poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->GetFieldDefncxx . . $ OGRFeatureDefn#GetFieldDefn(2ec36f91b6ceefc7).(iField)->GetNameRefcxx . . $ OGRFieldDefn#GetNameRef(a9f41ea0e82d88cf).(); |
| 607 | } |
| 608 | } |
| 609 | if (!osGeometryColumnNamecxx . . $ OGRWFSLayer#osGeometryColumnName..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) |
| 610 | { |
| 611 | if (poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->IsGeometryIgnoredcxx . . $ OGRFeatureDefn#IsGeometryIgnored(455f465bc33b4cdf).()) |
| 612 | { |
| 613 | bHasIgnoredField = true; |
| 614 | } |
| 615 | else |
| 616 | { |
| 617 | if (!osPropertyName.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) |
| 618 | osPropertyName +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). ","; |
| 619 | osPropertyName +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). osGeometryColumnNamecxx . . $ OGRWFSLayer#osGeometryColumnName.; |
| 620 | } |
| 621 | } |
| 622 | |
| 623 | if (bHasIgnoredField && !osPropertyName.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) |
| 624 | { |
| 625 | osURL = CPLURLAddKVP(osURL, "PROPERTYNAME", |
| 626 | WFS_EscapeURLcxx . . $ WFS_EscapeURL(a9d72c988d85d6d8).(osPropertyName)); |
| 627 | } |
| 628 | } |
| 629 | |
| 630 | return osURL; |
| 631 | } |
| 632 | |
| 633 | /************************************************************************/ |
| 634 | /* OGRWFSFetchContentDispositionFilename() */ |
| 635 | /************************************************************************/ |
| 636 | |
| 637 | static const char *OGRWFSFetchContentDispositionFilenamecxx . . $ OGRWFSFetchContentDispositionFilename(2b8f9b7a4ce5d5b5).(char **papszHeaders) |
| 638 | { |
| 639 | const char *pszContentDisposition = |
| 640 | CSLFetchNameValue(papszHeaders, "Content-Disposition"); |
| 641 | if (pszContentDisposition && |
| 642 | STARTS_WITHcxx . . $ `port/cpl_port.h:541:9`!(pszContentDisposition, "attachment; filename=")) |
| 643 | { |
| 644 | return pszContentDisposition + strlen("attachment; filename="); |
| 645 | } |
| 646 | return nullptr; |
| 647 | } |
| 648 | |
| 649 | /************************************************************************/ |
| 650 | /* MustRetryIfNonCompliantServer() */ |
| 651 | /************************************************************************/ |
| 652 | |
| 653 | bool OGRWFSLayercxx . . $ OGRWFSLayer#::MustRetryIfNonCompliantServercxx . . $ OGRWFSLayer#MustRetryIfNonCompliantServer(c5f7da30cbc0f4e9).(const char *pszServerAnswer) |
| 654 | { |
| 655 | bool bRetry = false; |
| 656 | |
| 657 | /* Deegree server does not support PropertyIsNotEqualTo */ |
| 658 | /* We have to turn it into <Not><PropertyIsEqualTo> */ |
| 659 | if (!osWFSWherecxx . . $ OGRWFSLayer#osWFSWhere..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).() && poDScxx . . $ OGRWFSLayer#poDS.->PropertyIsNotEqualToSupportedcxx . . $ OGRWFSDataSource#PropertyIsNotEqualToSupported(50ce9a9e25b4a850).() && |
| 660 | strstr(pszServerAnswer, |
| 661 | "Unknown comparison operation: 'PropertyIsNotEqualTo'") != |
| 662 | nullptr) |
| 663 | { |
| 664 | poDScxx . . $ OGRWFSLayer#poDS.->SetPropertyIsNotEqualToUnSupportedcxx . . $ OGRWFSDataSource#SetPropertyIsNotEqualToUnSupported(49f6e7a06ebc5aa8).(); |
| 665 | bRetry = true; |
| 666 | } |
| 667 | |
| 668 | /* Deegree server requires the gml: prefix in GmlObjectId element, but ESRI |
| 669 | */ |
| 670 | /* doesn't like it at all ! Other servers don't care... */ |
| 671 | if (!osWFSWherecxx . . $ OGRWFSLayer#osWFSWhere..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).() && !poDScxx . . $ OGRWFSLayer#poDS.->DoesGmlObjectIdNeedGMLPrefixcxx . . $ OGRWFSDataSource#DoesGmlObjectIdNeedGMLPrefix(455f465bc33b4cdf).() && |
| 672 | strstr(pszServerAnswer, |
| 673 | "<GmlObjectId> requires 'gml:id'-attribute!") != nullptr) |
| 674 | { |
| 675 | poDScxx . . $ OGRWFSLayer#poDS.->SetGmlObjectIdNeedsGMLPrefixcxx . . $ OGRWFSDataSource#SetGmlObjectIdNeedsGMLPrefix(49f6e7a06ebc5aa8).(); |
| 676 | bRetry = true; |
| 677 | } |
| 678 | |
| 679 | /* GeoServer can return the error 'Only FeatureIds are supported when |
| 680 | * encoding id filters to SDE' */ |
| 681 | if (!osWFSWherecxx . . $ OGRWFSLayer#osWFSWhere..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).() && !bUseFeatureIdAtLayerLevelcxx . . $ OGRWFSLayer#bUseFeatureIdAtLayerLevel. && |
| 682 | strstr(pszServerAnswer, "Only FeatureIds are supported") != nullptr) |
| 683 | { |
| 684 | bUseFeatureIdAtLayerLevelcxx . . $ OGRWFSLayer#bUseFeatureIdAtLayerLevel. = true; |
| 685 | bRetry = true; |
| 686 | } |
| 687 | |
| 688 | if (bRetry) |
| 689 | { |
| 690 | SetAttributeFiltercxx . . $ OGRWFSLayer#SetAttributeFilter(5c4306d8553b3696).(osSQLWherecxx . . $ OGRWFSLayer#osSQLWhere.); |
| 691 | bHasFetchedcxx . . $ OGRWFSLayer#bHasFetched. = true; |
| 692 | bReloadNeededcxx . . $ OGRWFSLayer#bReloadNeeded. = false; |
| 693 | } |
| 694 | |
| 695 | return bRetry; |
| 696 | } |
| 697 | |
| 698 | /************************************************************************/ |
| 699 | /* FetchGetFeature() */ |
| 700 | /************************************************************************/ |
| 701 | |
| 702 | GDALDatasetcxx . . $ GDALDataset# *OGRWFSLayercxx . . $ OGRWFSLayer#::FetchGetFeaturecxx . . $ OGRWFSLayer#FetchGetFeature(250b47e63605a70e).(int nRequestMaxFeatures) |
| 703 | { |
| 704 | |
| 705 | CPLString osURL = MakeGetFeatureURLcxx . . $ OGRWFSLayer#MakeGetFeatureURL(c3114674e28cccff).(nRequestMaxFeatures, FALSEcxx . . $ `port/cpl_port.h:1180:9`!); |
| 706 | CPLDebug("WFS", "%s", osURL.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 707 | |
| 708 | CPLHTTPResult *psResult = nullptr; |
| 709 | |
| 710 | CPLString osOutputFormat = CPLURLGetValue(osURL, "OUTPUTFORMAT"); |
| 711 | |
| 712 | const auto ReadNumberMatched = [this](const char *pszData) |
| 713 | { |
| 714 | const char *pszNumberMatched = strstr(pszData, " numberMatched=\""); |
| 715 | if (!pszNumberMatched) |
| 716 | pszNumberMatched = strstr(pszData, "\n" |
| 717 | "numberMatched=\""); |
| 718 | if (pszNumberMatched) |
| 719 | { |
| 720 | pszNumberMatched += strlen(" numberMatched=\""); |
| 721 | if (*pszNumberMatched >= '0' && *pszNumberMatched <= '9') |
| 722 | { |
| 723 | m_nNumberMatchedcxx . . $ OGRWFSLayer#m_nNumberMatched. = CPLAtoGIntBig(pszNumberMatched); |
| 724 | CPLDebug("WFS", "numberMatched = " CPL_FRMT_GIBcxx . . $ `port/cpl_port.h:257:9`!, |
| 725 | m_nNumberMatchedcxx . . $ OGRWFSLayer#m_nNumberMatched.); |
| 726 | if (!bCountFeaturesInGetNextFeaturecxx . . $ OGRWFSLayer#bCountFeaturesInGetNextFeature.) |
| 727 | nFeaturescxx . . $ OGRWFSLayer#nFeatures. = m_nNumberMatchedcxx . . $ OGRWFSLayer#m_nNumberMatched.; |
| 728 | } |
| 729 | } |
| 730 | }; |
| 731 | |
| 732 | if (CPLTestBool(CPLGetConfigOption("OGR_WFS_USE_STREAMING", "YES"))) |
| 733 | { |
| 734 | CPLConfigOptionSetter oDisableVSICACHE( |
| 735 | "VSI_CACHE", "FALSE", /* bSetOnlyIfUndefined = */ false); |
| 736 | |
| 737 | CPLString osStreamingName; |
| 738 | if (STARTS_WITHcxx . . $ `port/cpl_port.h:541:9`!(osURL, "/vsimem/") && |
| 739 | CPLTestBool(CPLGetConfigOption("CPL_CURL_ENABLE_VSIMEM", "FALSE"))) |
| 740 | { |
| 741 | osStreamingName = osURL; |
| 742 | } |
| 743 | else |
| 744 | { |
| 745 | osStreamingName +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "/vsicurl_streaming/"; |
| 746 | osStreamingName +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). osURL; |
| 747 | } |
| 748 | |
| 749 | /* Try streaming when the output format is GML and that we have a .xsd |
| 750 | */ |
| 751 | /* that we are able to understand */ |
| 752 | CPLString osXSDFileName = CPLSPrintf("%s/file.xsd", m_osTmpDircxx . . $ OGRWFSLayer#m_osTmpDir..c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 753 | VSIStatBufL sBuf; |
| 754 | GDALDrivercxx . . $ GDALDriver# *poDriver = nullptr; |
| 755 | if ((osOutputFormat.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).() || |
| 756 | osOutputFormat.ifind("GML") != stdcxx . . $ std/::string::nposcxx . . $ std/__cxx11/basic_string#npos.) && |
| 757 | VSIStatL(osXSDFileName, &sBuf) == 0 && |
| 758 | (poDriver = GDALDrivercxx . . $ GDALDriver#::FromHandlecxx . . $ GDALDriver#FromHandle(605f5c792cfb013b).(GDALGetDriverByName("GML"))) != |
| 759 | nullptr && |
| 760 | poDriver->pfnOpencxx . . $ GDALDriver#pfnOpen.) |
| 761 | { |
| 762 | bStreamingDScxx . . $ OGRWFSLayer#bStreamingDS. = true; |
| 763 | CPLStringList aosOptions; |
| 764 | aosOptions.SetNameValue("XSD", osXSDFileName.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 765 | aosOptions.SetNameValue("EMPTY_AS_NULL", |
| 766 | poDScxx . . $ OGRWFSLayer#poDS.->IsEmptyAsNullcxx . . $ OGRWFSDataSource#IsEmptyAsNull(50ce9a9e25b4a850).() ? "YES" : "NO"); |
| 767 | if (CPLGetConfigOption("GML_INVERT_AXIS_ORDER_IF_LAT_LONG", |
| 768 | nullptr) == nullptr) |
| 769 | { |
| 770 | aosOptions.SetNameValue( |
| 771 | "INVERT_AXIS_ORDER_IF_LAT_LONG", |
| 772 | poDScxx . . $ OGRWFSLayer#poDS.->InvertAxisOrderIfLatLongcxx . . $ OGRWFSDataSource#InvertAxisOrderIfLatLong(50ce9a9e25b4a850).() ? "YES" : "NO"); |
| 773 | } |
| 774 | if (CPLGetConfigOption("GML_CONSIDER_EPSG_AS_URN", nullptr) == |
| 775 | nullptr) |
| 776 | { |
| 777 | aosOptions.SetNameValue("CONSIDER_EPSG_AS_URN", |
| 778 | poDScxx . . $ OGRWFSLayer#poDS.->GetConsiderEPSGAsURNcxx . . $ OGRWFSDataSource#GetConsiderEPSGAsURN(1b8c726d1b99eee0).().c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 779 | } |
| 780 | if (CPLGetConfigOption("GML_EXPOSE_GML_ID", nullptr) == nullptr) |
| 781 | { |
| 782 | aosOptions.SetNameValue("EXPOSE_GML_ID", |
| 783 | poDScxx . . $ OGRWFSLayer#poDS.->ExposeGMLIdcxx . . $ OGRWFSDataSource#ExposeGMLId(50ce9a9e25b4a850).() ? "YES" : "NO"); |
| 784 | // iGMLOOIdex ++; |
| 785 | } |
| 786 | |
| 787 | GDALOpenInfocxx . . $ GDALOpenInfo# oOpenInfocxx . . $ GDALOpenInfo#GDALOpenInfo(5369a9d766ba1673).(osStreamingName.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), GA_ReadOnly); |
| 788 | if (oOpenInfo.nHeaderBytescxx . . $ GDALOpenInfo#nHeaderBytes. && m_nNumberMatchedcxx . . $ OGRWFSLayer#m_nNumberMatched. < 0) |
| 789 | { |
| 790 | const char *pszData = |
| 791 | reinterpret_cast<const char *>(oOpenInfo.pabyHeadercxx . . $ GDALOpenInfo#pabyHeader.); |
| 792 | ReadNumberMatched(cxx . . $ OGRWFSLayer#FetchGetFeature(250b47e63605a70e).$anonymous_type_0#`operator()`(acfedb98bf840c77).pszData); |
| 793 | } |
| 794 | oOpenInfo.papszOpenOptionscxx . . $ GDALOpenInfo#papszOpenOptions. = aosOptions.List(); |
| 795 | |
| 796 | auto poOutputDS = poDriver->Opencxx . . $ GDALDriver#Open(f2cee46feaec9a11).(&oOpenInfo, true); |
| 797 | if (poOutputDS) |
| 798 | { |
| 799 | return poOutputDS; |
| 800 | } |
| 801 | } |
| 802 | /* Try streaming when the output format is FlatGeobuf */ |
| 803 | else if ((osOutputFormat.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).() || |
| 804 | osOutputFormat.ifind("flatgeobuf") != stdcxx . . $ std/::string::nposcxx . . $ std/__cxx11/basic_string#npos.) && |
| 805 | VSIStatL(osXSDFileName, &sBuf) == 0 && |
| 806 | GDALGetDriverByName("FlatGeobuf") != nullptr) |
| 807 | { |
| 808 | bStreamingDScxx . . $ OGRWFSLayer#bStreamingDS. = true; |
| 809 | const char *const apszAllowedDrivers[] = {"FlatGeobuf", nullptr}; |
| 810 | |
| 811 | GDALDatasetcxx . . $ GDALDataset# *poFlatGeobuf_DS = |
| 812 | GDALDatasetcxx . . $ GDALDataset#::Opencxx . . $ GDALDataset#Open(b5df334a701f7bea).(osStreamingName, GDAL_OF_VECTORcxx . . $ `gcore/gdal.h:1130:9`!, |
| 813 | apszAllowedDrivers, nullptr, nullptr); |
| 814 | if (poFlatGeobuf_DS) |
| 815 | { |
| 816 | return poFlatGeobuf_DS; |
| 817 | } |
| 818 | } |
| 819 | else |
| 820 | { |
| 821 | bStreamingDScxx . . $ OGRWFSLayer#bStreamingDS. = false; |
| 822 | } |
| 823 | |
| 824 | { |
| 825 | /* In case of failure, read directly the content to examine */ |
| 826 | /* it, if it is XML error content */ |
| 827 | char szBuffer[2048]; |
| 828 | int nRead = 0; |
| 829 | VSILFILE *fp = VSIFOpenL(osStreamingName, "rb"); |
| 830 | if (fp) |
| 831 | { |
| 832 | nRead = static_cast<int>( |
| 833 | VSIFReadL(szBuffer, 1, sizeof(szBuffer) - 1, fp)); |
| 834 | szBuffer[nRead] = '\0'; |
| 835 | VSIFCloseL(fp); |
| 836 | } |
| 837 | |
| 838 | if (nRead != 0) |
| 839 | { |
| 840 | if (strstr(szBuffer, "<wfs:FeatureCollection") != nullptr) |
| 841 | { |
| 842 | poDriver = |
| 843 | GDALDrivercxx . . $ GDALDriver#::FromHandlecxx . . $ GDALDriver#FromHandle(605f5c792cfb013b).(GDALGetDriverByName("GML")); |
| 844 | if (poDriver == nullptr) |
| 845 | { |
| 846 | CPLError( |
| 847 | CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 848 | "Cannot read features as GML driver is missing"); |
| 849 | return nullptr; |
| 850 | } |
| 851 | else if (poDriver->pfnOpencxx . . $ GDALDriver#pfnOpen. == nullptr) |
| 852 | { |
| 853 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 854 | "Cannot read features as GML driver has no " |
| 855 | "read support"); |
| 856 | return nullptr; |
| 857 | } |
| 858 | } |
| 859 | |
| 860 | if (MustRetryIfNonCompliantServercxx . . $ OGRWFSLayer#MustRetryIfNonCompliantServer(c5f7da30cbc0f4e9).(szBuffer)) |
| 861 | return FetchGetFeaturecxx . . $ OGRWFSLayer#FetchGetFeature(250b47e63605a70e).(nRequestMaxFeatures); |
| 862 | |
| 863 | if (strstr(szBuffer, "<ServiceExceptionReport") != nullptr || |
| 864 | strstr(szBuffer, "<ows:ExceptionReport") != nullptr) |
| 865 | { |
| 866 | if (poDScxx . . $ OGRWFSLayer#poDS.->IsOldDeegreecxx . . $ OGRWFSDataSource#IsOldDeegree(c5f7da30cbc0f4e9).(szBuffer)) |
| 867 | { |
| 868 | return FetchGetFeaturecxx . . $ OGRWFSLayer#FetchGetFeature(250b47e63605a70e).(nRequestMaxFeatures); |
| 869 | } |
| 870 | |
| 871 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 872 | "Error returned by server : %s", szBuffer); |
| 873 | return nullptr; |
| 874 | } |
| 875 | } |
| 876 | } |
| 877 | } |
| 878 | |
| 879 | bStreamingDScxx . . $ OGRWFSLayer#bStreamingDS. = false; |
| 880 | psResult = poDScxx . . $ OGRWFSLayer#poDS.->HTTPFetchcxx . . $ OGRWFSDataSource#HTTPFetch(38e266439c02e448).(osURL, nullptr); |
| 881 | if (psResult == nullptr) |
| 882 | { |
| 883 | return nullptr; |
| 884 | } |
| 885 | |
| 886 | const char *pszContentType = ""; |
| 887 | if (psResult->pszContentType) |
| 888 | pszContentType = psResult->pszContentType; |
| 889 | |
| 890 | VSIMkdir(m_osTmpDircxx . . $ OGRWFSLayer#m_osTmpDir..c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), 0); |
| 891 | |
| 892 | GBytecxx . . $ GByte# *pabyData = psResult->pabyData; |
| 893 | int nDataLen = psResult->nDataLen; |
| 894 | bool bIsMultiPart = false; |
| 895 | const char *pszAttachmentFilename = nullptr; |
| 896 | |
| 897 | if (strstr(pszContentType, "multipart") && |
| 898 | CPLHTTPParseMultipartMime(psResult)) |
| 899 | { |
| 900 | bIsMultiPart = true; |
| 901 | VSIRmdirRecursive(m_osTmpDircxx . . $ OGRWFSLayer#m_osTmpDir..c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 902 | VSIMkdir(m_osTmpDircxx . . $ OGRWFSLayer#m_osTmpDir..c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), 0); |
| 903 | for (int i = 0; i < psResult->nMimePartCount; i++) |
| 904 | { |
| 905 | CPLString osTmpFileName = m_osTmpDircxx . . $ OGRWFSLayer#m_osTmpDir. +cxx . . $ std/operator+(40fc1db9226233c6). "/"; |
| 906 | pszAttachmentFilename = OGRWFSFetchContentDispositionFilenamecxx . . $ OGRWFSFetchContentDispositionFilename(2b8f9b7a4ce5d5b5).( |
| 907 | psResult->pasMimePart[i].papszHeaders); |
| 908 | |
| 909 | if (pszAttachmentFilename) |
| 910 | osTmpFileName +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). pszAttachmentFilename; |
| 911 | else |
| 912 | osTmpFileName +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). CPLSPrintf("file_%d", i); |
| 913 | |
| 914 | GBytecxx . . $ GByte# *pData = static_cast<GBytecxx . . $ GByte# *>( |
| 915 | VSI_MALLOC_VERBOSEcxx . . $ `port/cpl_vsi.h:375:9`!(psResult->pasMimePart[i].nDataLen)); |
| 916 | if (pData) |
| 917 | { |
| 918 | memcpy(pData, psResult->pasMimePart[i].pabyData, |
| 919 | psResult->pasMimePart[i].nDataLen); |
| 920 | VSILFILE *fp = VSIFileFromMemBuffer( |
| 921 | osTmpFileName, pData, psResult->pasMimePart[i].nDataLen, |
| 922 | TRUEcxx . . $ `port/cpl_port.h:1184:9`!); |
| 923 | VSIFCloseL(fp); |
| 924 | } |
| 925 | } |
| 926 | } |
| 927 | else |
| 928 | pszAttachmentFilename = |
| 929 | OGRWFSFetchContentDispositionFilenamecxx . . $ OGRWFSFetchContentDispositionFilename(2b8f9b7a4ce5d5b5).(psResult->papszHeaders); |
| 930 | |
| 931 | bool bJSON = false; |
| 932 | bool bCSV = false; |
| 933 | bool bKML = false; |
| 934 | bool bKMZ = false; |
| 935 | bool bFlatGeobuf = false; |
| 936 | bool bZIP = false; |
| 937 | bool bGZIP = false; |
| 938 | |
| 939 | const char *pszOutputFormat = osOutputFormat.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(); |
| 940 | |
| 941 | if (FindSubStringInsensitivecxx . . $ FindSubStringInsensitive(1320557f0feba62c).(pszContentType, "json") || |
| 942 | FindSubStringInsensitivecxx . . $ FindSubStringInsensitive(1320557f0feba62c).(pszOutputFormat, "json")) |
| 943 | { |
| 944 | bJSON = true; |
| 945 | } |
| 946 | else if (FindSubStringInsensitivecxx . . $ FindSubStringInsensitive(1320557f0feba62c).(pszContentType, "csv") || |
| 947 | FindSubStringInsensitivecxx . . $ FindSubStringInsensitive(1320557f0feba62c).(pszOutputFormat, "csv")) |
| 948 | { |
| 949 | bCSV = true; |
| 950 | } |
| 951 | else if (FindSubStringInsensitivecxx . . $ FindSubStringInsensitive(1320557f0feba62c).(pszContentType, "kml") || |
| 952 | FindSubStringInsensitivecxx . . $ FindSubStringInsensitive(1320557f0feba62c).(pszOutputFormat, "kml")) |
| 953 | { |
| 954 | bKML = true; |
| 955 | } |
| 956 | else if (FindSubStringInsensitivecxx . . $ FindSubStringInsensitive(1320557f0feba62c).(pszContentType, "kmz") || |
| 957 | FindSubStringInsensitivecxx . . $ FindSubStringInsensitive(1320557f0feba62c).(pszOutputFormat, "kmz")) |
| 958 | { |
| 959 | bKMZ = true; |
| 960 | } |
| 961 | else if (FindSubStringInsensitivecxx . . $ FindSubStringInsensitive(1320557f0feba62c).(pszContentType, "flatgeobuf") || |
| 962 | FindSubStringInsensitivecxx . . $ FindSubStringInsensitive(1320557f0feba62c).(pszOutputFormat, "flatgeobuf")) |
| 963 | { |
| 964 | bFlatGeobuf = true; |
| 965 | } |
| 966 | else if (strstr(pszContentType, "application/zip") != nullptr) |
| 967 | { |
| 968 | bZIP = true; |
| 969 | } |
| 970 | else if (strstr(pszContentType, "application/gzip") != nullptr) |
| 971 | { |
| 972 | bGZIP = true; |
| 973 | } |
| 974 | |
| 975 | const char *pszData = reinterpret_cast<const char *>(pabyData); |
| 976 | if (MustRetryIfNonCompliantServercxx . . $ OGRWFSLayer#MustRetryIfNonCompliantServer(c5f7da30cbc0f4e9).(pszData)) |
| 977 | { |
| 978 | CPLHTTPDestroyResult(psResult); |
| 979 | return FetchGetFeaturecxx . . $ OGRWFSLayer#FetchGetFeature(250b47e63605a70e).(nRequestMaxFeatures); |
| 980 | } |
| 981 | |
| 982 | if (strstr(pszData, "<ServiceExceptionReport") != nullptr || |
| 983 | strstr(pszData, "<ows:ExceptionReport") != nullptr) |
| 984 | { |
| 985 | if (poDScxx . . $ OGRWFSLayer#poDS.->IsOldDeegreecxx . . $ OGRWFSDataSource#IsOldDeegree(c5f7da30cbc0f4e9).(pszData)) |
| 986 | { |
| 987 | CPLHTTPDestroyResult(psResult); |
| 988 | return FetchGetFeaturecxx . . $ OGRWFSLayer#FetchGetFeature(250b47e63605a70e).(nRequestMaxFeatures); |
| 989 | } |
| 990 | |
| 991 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Error returned by server : %s", |
| 992 | pabyData); |
| 993 | CPLHTTPDestroyResult(psResult); |
| 994 | return nullptr; |
| 995 | } |
| 996 | |
| 997 | if (m_nNumberMatchedcxx . . $ OGRWFSLayer#m_nNumberMatched. < 0) |
| 998 | ReadNumberMatched(cxx . . $ OGRWFSLayer#FetchGetFeature(250b47e63605a70e).$anonymous_type_0#`operator()`(acfedb98bf840c77).pszData); |
| 999 | |
| 1000 | CPLString osTmpFileName; |
| 1001 | |
| 1002 | if (!bIsMultiPart) |
| 1003 | { |
| 1004 | if (bJSON) |
| 1005 | osTmpFileName = m_osTmpDircxx . . $ OGRWFSLayer#m_osTmpDir. +cxx . . $ std/operator+(40fc1db9226233c6). "/file.geojson"; |
| 1006 | else if (bZIP) |
| 1007 | osTmpFileName = m_osTmpDircxx . . $ OGRWFSLayer#m_osTmpDir. +cxx . . $ std/operator+(40fc1db9226233c6). "/file.zip"; |
| 1008 | else if (bCSV) |
| 1009 | osTmpFileName = m_osTmpDircxx . . $ OGRWFSLayer#m_osTmpDir. +cxx . . $ std/operator+(40fc1db9226233c6). "/file.csv"; |
| 1010 | else if (bKML) |
| 1011 | osTmpFileName = m_osTmpDircxx . . $ OGRWFSLayer#m_osTmpDir. +cxx . . $ std/operator+(40fc1db9226233c6). "/file.kml"; |
| 1012 | else if (bKMZ) |
| 1013 | osTmpFileName = m_osTmpDircxx . . $ OGRWFSLayer#m_osTmpDir. +cxx . . $ std/operator+(40fc1db9226233c6). "/file.kmz"; |
| 1014 | else if (bFlatGeobuf) |
| 1015 | osTmpFileName = m_osTmpDircxx . . $ OGRWFSLayer#m_osTmpDir. +cxx . . $ std/operator+(40fc1db9226233c6). "/file.fgb"; |
| 1016 | /* GML is a special case. It needs the .xsd file that has been saved */ |
| 1017 | /* as file.xsd, so we cannot used the attachment filename */ |
| 1018 | else if (pszAttachmentFilename && |
| 1019 | !EQUALcxx . . $ `port/cpl_port.h:532:9`!(CPLGetExtensionSafe(pszAttachmentFilename).c_str(), |
| 1020 | "GML")) |
| 1021 | { |
| 1022 | osTmpFileName = m_osTmpDircxx . . $ OGRWFSLayer#m_osTmpDir. +cxx . . $ std/operator+(40fc1db9226233c6). "/"; |
| 1023 | osTmpFileName +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). pszAttachmentFilename; |
| 1024 | } |
| 1025 | else |
| 1026 | { |
| 1027 | osTmpFileName = m_osTmpDircxx . . $ OGRWFSLayer#m_osTmpDir. +cxx . . $ std/operator+(40fc1db9226233c6). "/file.gfs"; |
| 1028 | VSIUnlink(osTmpFileName); |
| 1029 | |
| 1030 | osTmpFileName = m_osTmpDircxx . . $ OGRWFSLayer#m_osTmpDir. +cxx . . $ std/operator+(40fc1db9226233c6). "/file.gml"; |
| 1031 | } |
| 1032 | |
| 1033 | VSILFILE *fp = |
| 1034 | VSIFileFromMemBuffer(osTmpFileName, pabyData, nDataLen, TRUEcxx . . $ `port/cpl_port.h:1184:9`!); |
| 1035 | VSIFCloseL(fp); |
| 1036 | psResult->pabyData = nullptr; |
| 1037 | |
| 1038 | if (bZIP) |
| 1039 | { |
| 1040 | osTmpFileName = "/vsizip/" +cxx . . $ std/operator+(42c652dfebe55ad7). osTmpFileName; |
| 1041 | } |
| 1042 | else if (bGZIP) |
| 1043 | { |
| 1044 | osTmpFileName = "/vsigzip/" +cxx . . $ std/operator+(42c652dfebe55ad7). osTmpFileName; |
| 1045 | } |
| 1046 | } |
| 1047 | else |
| 1048 | { |
| 1049 | pabyData = nullptr; |
| 1050 | nDataLen = 0; |
| 1051 | osTmpFileName = m_osTmpDircxx . . $ OGRWFSLayer#m_osTmpDir.; |
| 1052 | } |
| 1053 | |
| 1054 | CPLHTTPDestroyResult(psResult); |
| 1055 | |
| 1056 | const char *const *papszOpenOptions = nullptr; |
| 1057 | const char *apszGMLOpenOptions[4] = {nullptr, nullptr, nullptr, nullptr}; |
| 1058 | int iGMLOOIdex = 0; |
| 1059 | if (CPLGetConfigOption("GML_INVERT_AXIS_ORDER_IF_LAT_LONG", nullptr) == |
| 1060 | nullptr) |
| 1061 | { |
| 1062 | apszGMLOpenOptions[iGMLOOIdex] = |
| 1063 | CPLSPrintf("INVERT_AXIS_ORDER_IF_LAT_LONG=%s", |
| 1064 | poDScxx . . $ OGRWFSLayer#poDS.->InvertAxisOrderIfLatLongcxx . . $ OGRWFSDataSource#InvertAxisOrderIfLatLong(50ce9a9e25b4a850).() ? "YES" : "NO"); |
| 1065 | iGMLOOIdex++; |
| 1066 | } |
| 1067 | if (CPLGetConfigOption("GML_CONSIDER_EPSG_AS_URN", nullptr) == nullptr) |
| 1068 | { |
| 1069 | apszGMLOpenOptions[iGMLOOIdex] = CPLSPrintf( |
| 1070 | "CONSIDER_EPSG_AS_URN=%s", poDScxx . . $ OGRWFSLayer#poDS.->GetConsiderEPSGAsURNcxx . . $ OGRWFSDataSource#GetConsiderEPSGAsURN(1b8c726d1b99eee0).().c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 1071 | iGMLOOIdex++; |
| 1072 | } |
| 1073 | if (CPLGetConfigOption("GML_EXPOSE_GML_ID", nullptr) == nullptr) |
| 1074 | { |
| 1075 | apszGMLOpenOptions[iGMLOOIdex] = |
| 1076 | CPLSPrintf("EXPOSE_GML_ID=%s", poDScxx . . $ OGRWFSLayer#poDS.->ExposeGMLIdcxx . . $ OGRWFSDataSource#ExposeGMLId(50ce9a9e25b4a850).() ? "YES" : "NO"); |
| 1077 | // iGMLOOIdex ++; |
| 1078 | } |
| 1079 | |
| 1080 | GDALDriverH hDrv = GDALIdentifyDriver(osTmpFileName, nullptr); |
| 1081 | if (hDrv != nullptr && hDrv == GDALGetDriverByName("GML")) |
| 1082 | papszOpenOptions = apszGMLOpenOptions; |
| 1083 | |
| 1084 | auto poPageDS = stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<GDALDatasetcxx . . $ GDALDataset#>(GDALDatasetcxx . . $ GDALDataset#::Opencxx . . $ GDALDataset#Open(b5df334a701f7bea).( |
| 1085 | osTmpFileName, GDAL_OF_VECTORcxx . . $ `gcore/gdal.h:1130:9`!, nullptr, papszOpenOptions, nullptr)); |
| 1086 | if (poPageDS ==cxx . . $ std/`operator==`(e445595a98297a59). nullptr && (bZIP || bIsMultiPart)) |
| 1087 | { |
| 1088 | char **papszFileList = VSIReadDir(osTmpFileName); |
| 1089 | for (int i = 0; papszFileList != nullptr && papszFileList[i] != nullptr; |
| 1090 | i++) |
| 1091 | { |
| 1092 | const CPLString osFullFilename = |
| 1093 | CPLFormFilenameSafe(osTmpFileName, papszFileList[i], nullptr); |
| 1094 | hDrv = GDALIdentifyDriver(osFullFilename, nullptr); |
| 1095 | if (hDrv != nullptr && hDrv == GDALGetDriverByName("GML")) |
| 1096 | papszOpenOptions = apszGMLOpenOptions; |
| 1097 | poPageDS.resetcxx . . $ std/unique_ptr#reset(c8c3025d73122d7d).(GDALDatasetcxx . . $ GDALDataset#::Opencxx . . $ GDALDataset#Open(b5df334a701f7bea).(osFullFilename, GDAL_OF_VECTORcxx . . $ `gcore/gdal.h:1130:9`!, |
| 1098 | nullptr, papszOpenOptions, |
| 1099 | nullptr)); |
| 1100 | if (poPageDS !=cxx . . $ std/`operator!=`(e445595a98297a59). nullptr) |
| 1101 | break; |
| 1102 | } |
| 1103 | |
| 1104 | CSLDestroy(papszFileList); |
| 1105 | } |
| 1106 | |
| 1107 | if (poPageDS ==cxx . . $ std/`operator==`(e445595a98297a59). nullptr) |
| 1108 | { |
| 1109 | if (pabyData != nullptr && !bJSON && !bZIP && |
| 1110 | strstr(reinterpret_cast<const char *>(pabyData), |
| 1111 | "<wfs:FeatureCollection") == nullptr && |
| 1112 | strstr(reinterpret_cast<const char *>(pabyData), |
| 1113 | "<gml:FeatureCollection") == nullptr) |
| 1114 | { |
| 1115 | if (nDataLen > 1000) |
| 1116 | pabyData[1000] = 0; |
| 1117 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Error: cannot parse %s", |
| 1118 | pabyData); |
| 1119 | } |
| 1120 | return nullptr; |
| 1121 | } |
| 1122 | |
| 1123 | OGRLayercxx . . $ OGRLayer# *poLayer = poPageDS->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).GetLayercxx . . $ GDALDataset#GetLayer(7a9909270c12ab7d).(0); |
| 1124 | if (poLayer == nullptr) |
| 1125 | { |
| 1126 | return nullptr; |
| 1127 | } |
| 1128 | |
| 1129 | return poPageDS.releasecxx . . $ std/unique_ptr#release(aad4c3669c5e940c).(); |
| 1130 | } |
| 1131 | |
| 1132 | /************************************************************************/ |
| 1133 | /* GetLayerDefn() */ |
| 1134 | /************************************************************************/ |
| 1135 | |
| 1136 | const OGRFeatureDefncxx . . $ OGRFeatureDefn# *OGRWFSLayercxx . . $ OGRWFSLayer#::GetLayerDefncxx . . $ OGRWFSLayer#GetLayerDefn(448b209f43d15bcc).() const |
| 1137 | { |
| 1138 | if (!poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.) |
| 1139 | { |
| 1140 | const_cast<OGRWFSLayercxx . . $ OGRWFSLayer# *>(this)->BuildLayerDefncxx . . $ OGRWFSLayer#BuildLayerDefn(49f6e7a06ebc5aa8).(); |
| 1141 | } |
| 1142 | return poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.; |
| 1143 | } |
| 1144 | |
| 1145 | /************************************************************************/ |
| 1146 | /* BuildLayerDefn() */ |
| 1147 | /************************************************************************/ |
| 1148 | |
| 1149 | void OGRWFSLayercxx . . $ OGRWFSLayer#::BuildLayerDefncxx . . $ OGRWFSLayer#BuildLayerDefn(49f6e7a06ebc5aa8).() |
| 1150 | { |
| 1151 | CPLAssertcxx . . $ `port/cpl_error.h:353:9`!(!poFeatureDefn); |
| 1152 | |
| 1153 | if (poDScxx . . $ OGRWFSLayer#poDS.->GetLayerCountcxx . . $ OGRWFSDataSource#GetLayerCount(455f465bc33b4cdf).() > 1) |
| 1154 | { |
| 1155 | poDScxx . . $ OGRWFSLayer#poDS.->LoadMultipleLayerDefncxx . . $ OGRWFSDataSource#LoadMultipleLayerDefn(915e195ca83c0780).(GetNamecxx . . $ OGRWFSLayer#GetName(a9f41ea0e82d88cf).(), pszNScxx . . $ OGRWFSLayer#pszNS., pszNSValcxx . . $ OGRWFSLayer#pszNSVal.); |
| 1156 | } |
| 1157 | |
| 1158 | if (!poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.) |
| 1159 | BuildLayerDefncxx . . $ OGRWFSLayer#BuildLayerDefn(4015e855666a3160).(nullptr); |
| 1160 | } |
| 1161 | |
| 1162 | /************************************************************************/ |
| 1163 | /* BuildLayerDefn() */ |
| 1164 | /************************************************************************/ |
| 1165 | |
| 1166 | OGRFeatureDefncxx . . $ OGRFeatureDefn# *OGRWFSLayercxx . . $ OGRWFSLayer#::BuildLayerDefncxx . . $ OGRWFSLayer#BuildLayerDefn(4015e855666a3160).(OGRFeatureDefncxx . . $ OGRFeatureDefn# *poSrcFDefn) |
| 1167 | { |
| 1168 | bool bUnsetWidthPrecision = false; |
| 1169 | |
| 1170 | poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn. = new OGRFeatureDefncxx . . $ OGRFeatureDefn#(pszNamecxx . . $ OGRWFSLayer#pszName.); |
| 1171 | poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->GetGeomFieldDefncxx . . $ OGRFeatureDefn#GetGeomFieldDefn(39768c424f32bab2).(0)->SetSpatialRefcxx . . $ OGRGeomFieldDefn#SetSpatialRef(9ff39b79387a6086).(m_poSRScxx . . $ OGRWFSLayer#m_poSRS.); |
| 1172 | poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->Referencecxx . . $ OGRFeatureDefn#Reference(b126dc7c1de90089).(); |
| 1173 | |
| 1174 | GDALDatasetcxx . . $ GDALDataset# *l_poDS = nullptr; |
| 1175 | |
| 1176 | if (poSrcFDefn == nullptr) |
| 1177 | poSrcFDefn = DescribeFeatureTypecxx . . $ OGRWFSLayer#DescribeFeatureType(407fccde18759965).(); |
| 1178 | if (poSrcFDefn == nullptr) |
| 1179 | { |
| 1180 | l_poDS = FetchGetFeaturecxx . . $ OGRWFSLayer#FetchGetFeature(250b47e63605a70e).(1); |
| 1181 | if (l_poDS == nullptr) |
| 1182 | { |
| 1183 | return poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.; |
| 1184 | } |
| 1185 | OGRLayercxx . . $ OGRLayer# *l_poLayer = l_poDS->GetLayercxx . . $ GDALDataset#GetLayer(7a9909270c12ab7d).(0); |
| 1186 | if (l_poLayer == nullptr) |
| 1187 | { |
| 1188 | return poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.; |
| 1189 | } |
| 1190 | poSrcFDefn = l_poLayer->GetLayerDefncxx . . $ OGRLayer#GetLayerDefn(407fccde18759965).(); |
| 1191 | osGeometryColumnNamecxx . . $ OGRWFSLayer#osGeometryColumnName. = l_poLayer->GetGeometryColumncxx . . $ OGRLayer#GetGeometryColumn(a9f41ea0e82d88cf).(); |
| 1192 | bGotApproximateLayerDefncxx . . $ OGRWFSLayer#bGotApproximateLayerDefn. = true; |
| 1193 | /* We cannot trust width and precision based on a single feature */ |
| 1194 | bUnsetWidthPrecision = true; |
| 1195 | } |
| 1196 | |
| 1197 | const CPLStringList aosPropertyName(CSLTokenizeString2( |
| 1198 | CPLURLGetValue(pszBaseURLcxx . . $ OGRWFSLayer#pszBaseURL., "PROPERTYNAME"), "(,)", 0)); |
| 1199 | |
| 1200 | poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->SetGeomTypecxx . . $ OGRFeatureDefn#SetGeomType(f47ce3f1fe923726).(poSrcFDefn->GetGeomTypecxx . . $ OGRFeatureDefn#GetGeomType(5a40c54c5ff210ce).()); |
| 1201 | if (poSrcFDefn->GetGeomFieldCountcxx . . $ OGRFeatureDefn#GetGeomFieldCount(455f465bc33b4cdf).() > 0) |
| 1202 | poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->GetGeomFieldDefncxx . . $ OGRFeatureDefn#GetGeomFieldDefn(39768c424f32bab2).(0)->SetNamecxx . . $ OGRGeomFieldDefn#SetName(85c52e162fed56f9).( |
| 1203 | poSrcFDefn->GetGeomFieldDefncxx . . $ OGRFeatureDefn#GetGeomFieldDefn(39768c424f32bab2).(0)->GetNameRefcxx . . $ OGRGeomFieldDefn#GetNameRef(a9f41ea0e82d88cf).()); |
| 1204 | for (int i = 0; i < poSrcFDefn->GetFieldCountcxx . . $ OGRFeatureDefn#GetFieldCount(455f465bc33b4cdf).(); i++) |
| 1205 | { |
| 1206 | if (!aosPropertyName.empty()) |
| 1207 | { |
| 1208 | if (aosPropertyName.FindString( |
| 1209 | poSrcFDefn->GetFieldDefncxx . . $ OGRFeatureDefn#GetFieldDefn(2ec36f91b6ceefc7).(i)->GetNameRefcxx . . $ OGRFieldDefn#GetNameRef(a9f41ea0e82d88cf).()) >= 0) |
| 1210 | poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->AddFieldDefncxx . . $ OGRFeatureDefn#AddFieldDefn(f8bad7d30df65bbb).(poSrcFDefn->GetFieldDefncxx . . $ OGRFeatureDefn#GetFieldDefn(2ec36f91b6ceefc7).(i)); |
| 1211 | else |
| 1212 | bGotApproximateLayerDefncxx . . $ OGRWFSLayer#bGotApproximateLayerDefn. = true; |
| 1213 | } |
| 1214 | else |
| 1215 | { |
| 1216 | OGRFieldDefncxx . . $ OGRFieldDefn# oFieldDefncxx . . $ OGRFieldDefn#OGRFieldDefn(f8bad7d30df65bbb).(poSrcFDefn->GetFieldDefncxx . . $ OGRFeatureDefn#GetFieldDefn(2ec36f91b6ceefc7).(i)); |
| 1217 | if (bUnsetWidthPrecision) |
| 1218 | { |
| 1219 | oFieldDefn.SetWidthcxx . . $ OGRFieldDefn#SetWidth(d4f767463ce0a6b3).(0); |
| 1220 | oFieldDefn.SetPrecisioncxx . . $ OGRFieldDefn#SetPrecision(d4f767463ce0a6b3).(0); |
| 1221 | } |
| 1222 | poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->AddFieldDefncxx . . $ OGRFeatureDefn#AddFieldDefn(f8bad7d30df65bbb).(&oFieldDefn); |
| 1223 | } |
| 1224 | } |
| 1225 | |
| 1226 | if (l_poDS) |
| 1227 | GDALClosecxx . . $ GDALClose(3d5aeed3fac2555e).(l_poDS); |
| 1228 | else |
| 1229 | delete poSrcFDefn; |
| 1230 | |
| 1231 | return poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.; |
| 1232 | } |
| 1233 | |
| 1234 | /************************************************************************/ |
| 1235 | /* ResetReading() */ |
| 1236 | /************************************************************************/ |
| 1237 | |
| 1238 | void OGRWFSLayercxx . . $ OGRWFSLayer#::ResetReadingcxx . . $ OGRWFSLayer#ResetReading(49f6e7a06ebc5aa8).() |
| 1239 | |
| 1240 | { |
| 1241 | if (poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn. == nullptr) |
| 1242 | return; |
| 1243 | if (bPagingActivecxx . . $ OGRWFSLayer#bPagingActive.) |
| 1244 | bReloadNeededcxx . . $ OGRWFSLayer#bReloadNeeded. = true; |
| 1245 | nPagingStartIndexcxx . . $ OGRWFSLayer#nPagingStartIndex. = 0; |
| 1246 | nFeatureReadcxx . . $ OGRWFSLayer#nFeatureRead. = 0; |
| 1247 | m_nNumberMatchedcxx . . $ OGRWFSLayer#m_nNumberMatched. = -1; |
| 1248 | m_bHasReadAtLeastOneFeatureInThisPagecxx . . $ OGRWFSLayer#m_bHasReadAtLeastOneFeatureInThisPage. = false; |
| 1249 | if (bReloadNeededcxx . . $ OGRWFSLayer#bReloadNeeded.) |
| 1250 | { |
| 1251 | GDALClosecxx . . $ GDALClose(3d5aeed3fac2555e).(poBaseDScxx . . $ OGRWFSLayer#poBaseDS.); |
| 1252 | poBaseDScxx . . $ OGRWFSLayer#poBaseDS. = nullptr; |
| 1253 | poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer. = nullptr; |
| 1254 | bHasFetchedcxx . . $ OGRWFSLayer#bHasFetched. = false; |
| 1255 | bReloadNeededcxx . . $ OGRWFSLayer#bReloadNeeded. = false; |
| 1256 | } |
| 1257 | if (poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer.) |
| 1258 | poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer.->ResetReadingcxx . . $ OGRLayer#ResetReading(49f6e7a06ebc5aa8).(); |
| 1259 | } |
| 1260 | |
| 1261 | /************************************************************************/ |
| 1262 | /* SetIgnoredFields() */ |
| 1263 | /************************************************************************/ |
| 1264 | |
| 1265 | OGRErr OGRWFSLayercxx . . $ OGRWFSLayer#::SetIgnoredFieldscxx . . $ OGRWFSLayer#SetIgnoredFields(e464cedb65a3f4c2).(CSLConstListcxx . . $ CSLConstList# papszFields) |
| 1266 | { |
| 1267 | bReloadNeededcxx . . $ OGRWFSLayer#bReloadNeeded. = true; |
| 1268 | ResetReadingcxx . . $ OGRWFSLayer#ResetReading(49f6e7a06ebc5aa8).(); |
| 1269 | return OGRLayercxx . . $ OGRLayer#::SetIgnoredFieldscxx . . $ OGRLayer#SetIgnoredFields(e464cedb65a3f4c2).(papszFields); |
| 1270 | } |
| 1271 | |
| 1272 | /************************************************************************/ |
| 1273 | /* GetNextFeature() */ |
| 1274 | /************************************************************************/ |
| 1275 | |
| 1276 | OGRFeaturecxx . . $ OGRFeature# *OGRWFSLayercxx . . $ OGRWFSLayer#::GetNextFeaturecxx . . $ OGRWFSLayer#GetNextFeature(ec9eceddec1d9563).() |
| 1277 | { |
| 1278 | GetLayerDefncxx . . $ OGRWFSLayer#GetLayerDefn(448b209f43d15bcc).(); |
| 1279 | |
| 1280 | while (true) |
| 1281 | { |
| 1282 | if (bReloadNeededcxx . . $ OGRWFSLayer#bReloadNeeded.) |
| 1283 | { |
| 1284 | m_bHasReadAtLeastOneFeatureInThisPagecxx . . $ OGRWFSLayer#m_bHasReadAtLeastOneFeatureInThisPage. = false; |
| 1285 | GDALClosecxx . . $ GDALClose(3d5aeed3fac2555e).(poBaseDScxx . . $ OGRWFSLayer#poBaseDS.); |
| 1286 | poBaseDScxx . . $ OGRWFSLayer#poBaseDS. = nullptr; |
| 1287 | poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer. = nullptr; |
| 1288 | bHasFetchedcxx . . $ OGRWFSLayer#bHasFetched. = false; |
| 1289 | bReloadNeededcxx . . $ OGRWFSLayer#bReloadNeeded. = false; |
| 1290 | } |
| 1291 | if (poBaseDScxx . . $ OGRWFSLayer#poBaseDS. == nullptr && !bHasFetchedcxx . . $ OGRWFSLayer#bHasFetched.) |
| 1292 | { |
| 1293 | bHasFetchedcxx . . $ OGRWFSLayer#bHasFetched. = true; |
| 1294 | poBaseDScxx . . $ OGRWFSLayer#poBaseDS. = FetchGetFeaturecxx . . $ OGRWFSLayer#FetchGetFeature(250b47e63605a70e).(0); |
| 1295 | poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer. = nullptr; |
| 1296 | if (poBaseDScxx . . $ OGRWFSLayer#poBaseDS.) |
| 1297 | { |
| 1298 | poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer. = poBaseDScxx . . $ OGRWFSLayer#poBaseDS.->GetLayercxx . . $ GDALDataset#GetLayer(7a9909270c12ab7d).(0); |
| 1299 | if (poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer. == nullptr) |
| 1300 | return nullptr; |
| 1301 | poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer.->ResetReadingcxx . . $ OGRLayer#ResetReading(49f6e7a06ebc5aa8).(); |
| 1302 | |
| 1303 | /* Check that the layer field definition is consistent with the |
| 1304 | * one */ |
| 1305 | /* we got in BuildLayerDefn() */ |
| 1306 | if (poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->GetFieldCountcxx . . $ OGRFeatureDefn#GetFieldCount(455f465bc33b4cdf).() != |
| 1307 | poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer.->GetLayerDefncxx . . $ OGRLayer#GetLayerDefn(407fccde18759965).()->GetFieldCountcxx . . $ OGRFeatureDefn#GetFieldCount(455f465bc33b4cdf).()) |
| 1308 | bGotApproximateLayerDefncxx . . $ OGRWFSLayer#bGotApproximateLayerDefn. = true; |
| 1309 | else |
| 1310 | { |
| 1311 | for (int iField = 0; |
| 1312 | iField < poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->GetFieldCountcxx . . $ OGRFeatureDefn#GetFieldCount(455f465bc33b4cdf).(); iField++) |
| 1313 | { |
| 1314 | OGRFieldDefncxx . . $ OGRFieldDefn# *poFDefn1 = |
| 1315 | poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->GetFieldDefncxx . . $ OGRFeatureDefn#GetFieldDefn(2ec36f91b6ceefc7).(iField); |
| 1316 | OGRFieldDefncxx . . $ OGRFieldDefn# *poFDefn2 = |
| 1317 | poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer.->GetLayerDefncxx . . $ OGRLayer#GetLayerDefn(407fccde18759965).()->GetFieldDefncxx . . $ OGRFeatureDefn#GetFieldDefn(2ec36f91b6ceefc7).(iField); |
| 1318 | if (strcmp(poFDefn1->GetNameRefcxx . . $ OGRFieldDefn#GetNameRef(a9f41ea0e82d88cf).(), |
| 1319 | poFDefn2->GetNameRefcxx . . $ OGRFieldDefn#GetNameRef(a9f41ea0e82d88cf).()) != 0 || |
| 1320 | poFDefn1->GetTypecxx . . $ OGRFieldDefn#GetType(b365ab774e05458e).() != poFDefn2->GetTypecxx . . $ OGRFieldDefn#GetType(b365ab774e05458e).()) |
| 1321 | { |
| 1322 | bGotApproximateLayerDefncxx . . $ OGRWFSLayer#bGotApproximateLayerDefn. = true; |
| 1323 | break; |
| 1324 | } |
| 1325 | } |
| 1326 | } |
| 1327 | } |
| 1328 | } |
| 1329 | if (poBaseDScxx . . $ OGRWFSLayer#poBaseDS. == nullptr || poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer. == nullptr) |
| 1330 | return nullptr; |
| 1331 | |
| 1332 | OGRFeaturecxx . . $ OGRFeature# *poSrcFeature = poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer.->GetNextFeaturecxx . . $ OGRLayer#GetNextFeature(ec9eceddec1d9563).(); |
| 1333 | if (poSrcFeature == nullptr) |
| 1334 | { |
| 1335 | if (bPagingActivecxx . . $ OGRWFSLayer#bPagingActive. && m_bHasReadAtLeastOneFeatureInThisPagecxx . . $ OGRWFSLayer#m_bHasReadAtLeastOneFeatureInThisPage. && |
| 1336 | (m_nNumberMatchedcxx . . $ OGRWFSLayer#m_nNumberMatched. < 0 || nFeatureReadcxx . . $ OGRWFSLayer#nFeatureRead. < m_nNumberMatchedcxx . . $ OGRWFSLayer#m_nNumberMatched.)) |
| 1337 | { |
| 1338 | bReloadNeededcxx . . $ OGRWFSLayer#bReloadNeeded. = true; |
| 1339 | nPagingStartIndexcxx . . $ OGRWFSLayer#nPagingStartIndex. = nFeatureReadcxx . . $ OGRWFSLayer#nFeatureRead.; |
| 1340 | continue; |
| 1341 | } |
| 1342 | return nullptr; |
| 1343 | } |
| 1344 | nFeatureReadcxx . . $ OGRWFSLayer#nFeatureRead.++; |
| 1345 | m_bHasReadAtLeastOneFeatureInThisPagecxx . . $ OGRWFSLayer#m_bHasReadAtLeastOneFeatureInThisPage. = true; |
| 1346 | if (bCountFeaturesInGetNextFeaturecxx . . $ OGRWFSLayer#bCountFeaturesInGetNextFeature.) |
| 1347 | nFeaturescxx . . $ OGRWFSLayer#nFeatures.++; |
| 1348 | |
| 1349 | OGRGeometrycxx . . $ OGRGeometry# *poGeom = poSrcFeature->GetGeometryRefcxx . . $ OGRFeature#GetGeometryRef(3dfc1d32c7db2584).(); |
| 1350 | if (m_poFilterGeomcxx . . $ OGRLayer#m_poFilterGeom. != nullptr && poGeom != nullptr && |
| 1351 | !FilterGeometrycxx . . $ OGRLayer#FilterGeometry(fed901b2566802ff).(poGeom)) |
| 1352 | { |
| 1353 | delete poSrcFeature; |
| 1354 | continue; |
| 1355 | } |
| 1356 | |
| 1357 | /* Client-side attribute filtering with underlying layer defn */ |
| 1358 | /* identical to exposed layer defn. */ |
| 1359 | if (!bGotApproximateLayerDefncxx . . $ OGRWFSLayer#bGotApproximateLayerDefn. && osWFSWherecxx . . $ OGRWFSLayer#osWFSWhere..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).() && |
| 1360 | m_poAttrQuerycxx . . $ OGRLayer#m_poAttrQuery. != nullptr && !m_poAttrQuerycxx . . $ OGRLayer#m_poAttrQuery.->Evaluatecxx . . $ OGRFeatureQuery#Evaluate(2048609adab03aab).(poSrcFeature)) |
| 1361 | { |
| 1362 | delete poSrcFeature; |
| 1363 | continue; |
| 1364 | } |
| 1365 | |
| 1366 | OGRFeaturecxx . . $ OGRFeature# *poNewFeature = new OGRFeaturecxx . . $ OGRFeature#OGRFeature(dc2636911e7adfe).(poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.); |
| 1367 | if (bGotApproximateLayerDefncxx . . $ OGRWFSLayer#bGotApproximateLayerDefn.) |
| 1368 | { |
| 1369 | poNewFeature->SetFromcxx . . $ OGRFeature#SetFrom(325443864107984b).(poSrcFeature); |
| 1370 | poNewFeature->SetFIDcxx . . $ OGRFeature#SetFID(a070d6d14e988596).(poSrcFeature->GetFIDcxx . . $ OGRFeature#GetFID(98833e9ab7de59a4).()); |
| 1371 | |
| 1372 | /* Client-side attribute filtering. */ |
| 1373 | if (m_poAttrQuerycxx . . $ OGRLayer#m_poAttrQuery. != nullptr && osWFSWherecxx . . $ OGRWFSLayer#osWFSWhere..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).() && |
| 1374 | !m_poAttrQuerycxx . . $ OGRLayer#m_poAttrQuery.->Evaluatecxx . . $ OGRFeatureQuery#Evaluate(2048609adab03aab).(poNewFeature)) |
| 1375 | { |
| 1376 | delete poSrcFeature; |
| 1377 | delete poNewFeature; |
| 1378 | continue; |
| 1379 | } |
| 1380 | } |
| 1381 | else |
| 1382 | { |
| 1383 | poNewFeature->SetFIDcxx . . $ OGRFeature#SetFID(a070d6d14e988596).(poSrcFeature->GetFIDcxx . . $ OGRFeature#GetFID(98833e9ab7de59a4).()); |
| 1384 | for (int iField = 0; iField < poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->GetFieldCountcxx . . $ OGRFeatureDefn#GetFieldCount(455f465bc33b4cdf).(); |
| 1385 | iField++) |
| 1386 | { |
| 1387 | poNewFeature->SetFieldcxx . . $ OGRFeature#SetField(7180b68df1666ab2).(iField, |
| 1388 | poSrcFeature->GetRawFieldRefcxx . . $ OGRFeature#GetRawFieldRef(4f12117e0ec8b5e4).(iField)); |
| 1389 | } |
| 1390 | poNewFeature->SetStyleStringcxx . . $ OGRFeature#SetStyleString(85c52e162fed56f9).(poSrcFeature->GetStyleStringcxx . . $ OGRFeature#GetStyleString(a9f41ea0e82d88cf).()); |
| 1391 | poNewFeature->SetGeometryDirectlycxx . . $ OGRFeature#SetGeometryDirectly(cec3429dca426eb8).(poSrcFeature->StealGeometrycxx . . $ OGRFeature#StealGeometry(3dfc1d32c7db2584).()); |
| 1392 | } |
| 1393 | poGeom = poNewFeature->GetGeometryRefcxx . . $ OGRFeature#GetGeometryRef(3dfc1d32c7db2584).(); |
| 1394 | |
| 1395 | /* FIXME? I don't really know what we should do with WFS 1.1.0 */ |
| 1396 | /* and non-GML format !!! I guess 50% WFS servers must do it wrong |
| 1397 | * anyway */ |
| 1398 | /* GeoServer does currently axis inversion for non GML output, but */ |
| 1399 | /* apparently this is not correct : |
| 1400 | * http://jira.codehaus.org/browse/GEOS-3657 */ |
| 1401 | if (poGeom != nullptr && bAxisOrderAlreadyInvertedcxx . . $ OGRWFSLayer#bAxisOrderAlreadyInverted. && |
| 1402 | strcmp(poBaseDScxx . . $ OGRWFSLayer#poBaseDS.->GetDriverNamecxx . . $ GDALDataset#GetDriverName(a9f41ea0e82d88cf).(), "GML") != 0) |
| 1403 | { |
| 1404 | poGeom->swapXYcxx . . $ OGRGeometry#swapXY(49f6e7a06ebc5aa8).(); |
| 1405 | } |
| 1406 | |
| 1407 | if (poGeom && m_poSRScxx . . $ OGRWFSLayer#m_poSRS.) |
| 1408 | poGeom->assignSpatialReferencecxx . . $ OGRGeometry#assignSpatialReference(9ff39b79387a6086).(m_poSRScxx . . $ OGRWFSLayer#m_poSRS.); |
| 1409 | delete poSrcFeature; |
| 1410 | return poNewFeature; |
| 1411 | } |
| 1412 | } |
| 1413 | |
| 1414 | /************************************************************************/ |
| 1415 | /* ISetSpatialFilter() */ |
| 1416 | /************************************************************************/ |
| 1417 | |
| 1418 | OGRErr OGRWFSLayercxx . . $ OGRWFSLayer#::ISetSpatialFiltercxx . . $ OGRWFSLayer#ISetSpatialFilter(896393ecef503097).(int iGeomField, const OGRGeometrycxx . . $ OGRGeometry# *poGeom) |
| 1419 | { |
| 1420 | if (bStreamingDScxx . . $ OGRWFSLayer#bStreamingDS.) |
| 1421 | { |
| 1422 | bReloadNeededcxx . . $ OGRWFSLayer#bReloadNeeded. = true; |
| 1423 | } |
| 1424 | else if (poFetchedFilterGeomcxx . . $ OGRWFSLayer#poFetchedFilterGeom. == nullptr && poBaseDScxx . . $ OGRWFSLayer#poBaseDS. != nullptr) |
| 1425 | { |
| 1426 | /* If there was no filter set, and that we set one */ |
| 1427 | /* the new result set can only be a subset of the whole */ |
| 1428 | /* so no need to reload from source */ |
| 1429 | bReloadNeededcxx . . $ OGRWFSLayer#bReloadNeeded. = false; |
| 1430 | } |
| 1431 | else if (poFetchedFilterGeomcxx . . $ OGRWFSLayer#poFetchedFilterGeom. != nullptr && poGeom != nullptr && |
| 1432 | poBaseDScxx . . $ OGRWFSLayer#poBaseDS. != nullptr) |
| 1433 | { |
| 1434 | OGREnvelope oOldEnvelope, oNewEnvelope; |
| 1435 | poFetchedFilterGeomcxx . . $ OGRWFSLayer#poFetchedFilterGeom.->getEnvelopecxx . . $ OGRGeometry#getEnvelope(e5217c1f2a4fd7ce).(&oOldEnvelope); |
| 1436 | poGeom->getEnvelopecxx . . $ OGRGeometry#getEnvelope(e5217c1f2a4fd7ce).(&oNewEnvelope); |
| 1437 | /* Optimization : we don't need to request the server */ |
| 1438 | /* if the new BBOX is inside the old BBOX as we have */ |
| 1439 | /* already all the features */ |
| 1440 | bReloadNeededcxx . . $ OGRWFSLayer#bReloadNeeded. = !oOldEnvelope.Contains(oNewEnvelope); |
| 1441 | } |
| 1442 | else |
| 1443 | { |
| 1444 | bReloadNeededcxx . . $ OGRWFSLayer#bReloadNeeded. = true; |
| 1445 | } |
| 1446 | nFeaturescxx . . $ OGRWFSLayer#nFeatures. = -1; |
| 1447 | const OGRErr eErr = OGRLayercxx . . $ OGRLayer#::ISetSpatialFiltercxx . . $ OGRLayer#ISetSpatialFilter(896393ecef503097).(iGeomField, poGeom); |
| 1448 | ResetReadingcxx . . $ OGRWFSLayer#ResetReading(49f6e7a06ebc5aa8).(); |
| 1449 | return eErr; |
| 1450 | } |
| 1451 | |
| 1452 | /************************************************************************/ |
| 1453 | /* SetAttributeFilter() */ |
| 1454 | /************************************************************************/ |
| 1455 | |
| 1456 | OGRErr OGRWFSLayercxx . . $ OGRWFSLayer#::SetAttributeFiltercxx . . $ OGRWFSLayer#SetAttributeFilter(5c4306d8553b3696).(const char *pszFilter) |
| 1457 | { |
| 1458 | if (pszFilter != nullptr && pszFilter[0] == 0) |
| 1459 | pszFilter = nullptr; |
| 1460 | |
| 1461 | CPLString osOldWFSWhere(osWFSWherecxx . . $ OGRWFSLayer#osWFSWhere.); |
| 1462 | |
| 1463 | CPLFreecxx . . $ `port/cpl_conv.h:97:9`!(m_pszAttrQueryStringcxx . . $ OGRLayer#m_pszAttrQueryString.); |
| 1464 | m_pszAttrQueryStringcxx . . $ OGRLayer#m_pszAttrQueryString. = (pszFilter) ? CPLStrdup(pszFilter) : nullptr; |
| 1465 | |
| 1466 | delete m_poAttrQuerycxx . . $ OGRLayer#m_poAttrQuery.; |
| 1467 | m_poAttrQuerycxx . . $ OGRLayer#m_poAttrQuery. = nullptr; |
| 1468 | |
| 1469 | if (pszFilter != nullptr) |
| 1470 | { |
| 1471 | m_poAttrQuerycxx . . $ OGRLayer#m_poAttrQuery. = new OGRFeatureQuerycxx . . $ OGRFeatureQuery#(); |
| 1472 | |
| 1473 | OGRErr eErr = m_poAttrQuerycxx . . $ OGRLayer#m_poAttrQuery.->Compilecxx . . $ OGRFeatureQuery#Compile(b32eb537f9be44e1).(GetLayerDefncxx . . $ OGRWFSLayer#GetLayerDefn(448b209f43d15bcc).(), pszFilter, TRUEcxx . . $ `port/cpl_port.h:1184:9`!, |
| 1474 | WFSGetCustomFuncRegistrarcxx . . $ WFSGetCustomFuncRegistrar(77425a55ff89309e).()); |
| 1475 | if (eErr != OGRERR_NONEcxx . . $ `ogr/ogr_core.h:390:9`!) |
| 1476 | { |
| 1477 | delete m_poAttrQuerycxx . . $ OGRLayer#m_poAttrQuery.; |
| 1478 | m_poAttrQuerycxx . . $ OGRLayer#m_poAttrQuery. = nullptr; |
| 1479 | return eErr; |
| 1480 | } |
| 1481 | } |
| 1482 | |
| 1483 | if (poDScxx . . $ OGRWFSLayer#poDS.->HasMinOperatorscxx . . $ OGRWFSDataSource#HasMinOperators(50ce9a9e25b4a850).() && m_poAttrQuerycxx . . $ OGRLayer#m_poAttrQuery. != nullptr) |
| 1484 | { |
| 1485 | swq_expr_nodecxx . . $ swq_expr_node# *poNode = |
| 1486 | static_cast<swq_expr_nodecxx . . $ swq_expr_node# *>(m_poAttrQuerycxx . . $ OGRLayer#m_poAttrQuery.->GetSWQExprcxx . . $ OGRFeatureQuery#GetSWQExpr(50c7df7de5344ebb).()); |
| 1487 | poNode->ReplaceBetweenByGEAndLERecursecxx . . $ swq_expr_node#ReplaceBetweenByGEAndLERecurse(49f6e7a06ebc5aa8).(); |
| 1488 | poNode->ReplaceInByOrRecursecxx . . $ swq_expr_node#ReplaceInByOrRecurse(49f6e7a06ebc5aa8).(); |
| 1489 | |
| 1490 | int bNeedsNullCheck = FALSEcxx . . $ `port/cpl_port.h:1180:9`!; |
| 1491 | int nVersion = (strcmp(poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).(), "1.0.0") == 0) ? 100 |
| 1492 | : (atoicxx . . $ atoi(f5ecf3191ed0cd93).(poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).()) >= 2) ? 200 |
| 1493 | : 110; |
| 1494 | if (poNode->field_typecxx . . $ swq_expr_node#field_type. != SWQ_BOOLEANcxx . . $ SWQ_BOOLEAN.) |
| 1495 | osWFSWherecxx . . $ OGRWFSLayer#osWFSWhere. = ""; |
| 1496 | else |
| 1497 | osWFSWherecxx . . $ OGRWFSLayer#osWFSWhere. = WFS_TurnSQLFilterToOGCFiltercxx . . $ WFS_TurnSQLFilterToOGCFilter(2172a8eb66ee2ad7).( |
| 1498 | poNode, nullptr, GetLayerDefncxx . . $ OGRWFSLayer#GetLayerDefn(448b209f43d15bcc).(), nVersion, |
| 1499 | poDScxx . . $ OGRWFSLayer#poDS.->PropertyIsNotEqualToSupportedcxx . . $ OGRWFSDataSource#PropertyIsNotEqualToSupported(50ce9a9e25b4a850).(), |
| 1500 | poDScxx . . $ OGRWFSLayer#poDS.->UseFeatureIdcxx . . $ OGRWFSDataSource#UseFeatureId(50ce9a9e25b4a850).() || bUseFeatureIdAtLayerLevelcxx . . $ OGRWFSLayer#bUseFeatureIdAtLayerLevel., |
| 1501 | poDScxx . . $ OGRWFSLayer#poDS.->DoesGmlObjectIdNeedGMLPrefixcxx . . $ OGRWFSDataSource#DoesGmlObjectIdNeedGMLPrefix(455f465bc33b4cdf).(), "", &bNeedsNullCheck); |
| 1502 | if (bNeedsNullCheck && !poDScxx . . $ OGRWFSLayer#poDS.->HasNullCheckcxx . . $ OGRWFSDataSource#HasNullCheck(50ce9a9e25b4a850).()) |
| 1503 | osWFSWherecxx . . $ OGRWFSLayer#osWFSWhere. = ""; |
| 1504 | } |
| 1505 | else |
| 1506 | osWFSWherecxx . . $ OGRWFSLayer#osWFSWhere. = ""; |
| 1507 | |
| 1508 | if (m_poAttrQuerycxx . . $ OGRLayer#m_poAttrQuery. != nullptr && osWFSWherecxx . . $ OGRWFSLayer#osWFSWhere..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) |
| 1509 | { |
| 1510 | CPLDebug("WFS", "Using client-side only mode for filter \"%s\"", |
| 1511 | pszFilter); |
| 1512 | OGRErr eErr = OGRLayercxx . . $ OGRLayer#::SetAttributeFiltercxx . . $ OGRLayer#SetAttributeFilter(5c4306d8553b3696).(pszFilter); |
| 1513 | if (eErr != OGRERR_NONEcxx . . $ `ogr/ogr_core.h:390:9`!) |
| 1514 | return eErr; |
| 1515 | } |
| 1516 | ResetReadingcxx . . $ OGRWFSLayer#ResetReading(49f6e7a06ebc5aa8).(); |
| 1517 | |
| 1518 | osSQLWherecxx . . $ OGRWFSLayer#osSQLWhere. = (pszFilter) ? pszFilter : ""; |
| 1519 | |
| 1520 | if (osWFSWherecxx . . $ OGRWFSLayer#osWFSWhere. !=cxx . . $ std/`operator!=`(5ea818b58063a774). osOldWFSWhere) |
| 1521 | bReloadNeededcxx . . $ OGRWFSLayer#bReloadNeeded. = true; |
| 1522 | else |
| 1523 | bReloadNeededcxx . . $ OGRWFSLayer#bReloadNeeded. = false; |
| 1524 | nFeaturescxx . . $ OGRWFSLayer#nFeatures. = -1; |
| 1525 | |
| 1526 | return OGRERR_NONEcxx . . $ `ogr/ogr_core.h:390:9`!; |
| 1527 | } |
| 1528 | |
| 1529 | /************************************************************************/ |
| 1530 | /* TestCapability() */ |
| 1531 | /************************************************************************/ |
| 1532 | |
| 1533 | int OGRWFSLayercxx . . $ OGRWFSLayer#::TestCapabilitycxx . . $ OGRWFSLayer#TestCapability(78f035161ffa9fe2).(const char *pszCap) const |
| 1534 | |
| 1535 | { |
| 1536 | if (EQUALcxx . . $ `port/cpl_port.h:532:9`!(pszCap, OLCFastFeatureCountcxx . . $ `ogr/ogr_core.h:983:9`!)) |
| 1537 | { |
| 1538 | if (nFeaturescxx . . $ OGRWFSLayer#nFeatures. >= 0) |
| 1539 | return TRUEcxx . . $ `port/cpl_port.h:1184:9`!; |
| 1540 | |
| 1541 | return poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer. != nullptr && m_poFilterGeomcxx . . $ OGRLayer#m_poFilterGeom. == nullptr && |
| 1542 | m_poAttrQuerycxx . . $ OGRLayer#m_poAttrQuery. == nullptr && |
| 1543 | poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer.->TestCapabilitycxx . . $ OGRLayer#TestCapability(78f035161ffa9fe2).(pszCap) && |
| 1544 | (!poDScxx . . $ OGRWFSLayer#poDS.->IsPagingAllowedcxx . . $ OGRWFSDataSource#IsPagingAllowed(50ce9a9e25b4a850).() && |
| 1545 | poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer.->GetFeatureCountcxx . . $ OGRLayer#GetFeatureCount(9ccc33c3ebad048d).() < poDScxx . . $ OGRWFSLayer#poDS.->GetPageSizecxx . . $ OGRWFSDataSource#GetPageSize(455f465bc33b4cdf).()); |
| 1546 | } |
| 1547 | |
| 1548 | else if (EQUALcxx . . $ `port/cpl_port.h:532:9`!(pszCap, OLCFastGetExtentcxx . . $ `ogr/ogr_core.h:986:9`!)) |
| 1549 | { |
| 1550 | if (m_oExtentscxx . . $ OGRWFSLayer#m_oExtents..IsInit()) |
| 1551 | return TRUEcxx . . $ `port/cpl_port.h:1184:9`!; |
| 1552 | |
| 1553 | return poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer. != nullptr && poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer.->TestCapabilitycxx . . $ OGRLayer#TestCapability(78f035161ffa9fe2).(pszCap); |
| 1554 | } |
| 1555 | |
| 1556 | else if (EQUALcxx . . $ `port/cpl_port.h:532:9`!(pszCap, OLCStringsAsUTF8cxx . . $ `ogr/ogr_core.h:1016:9`!)) |
| 1557 | return poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer. != nullptr && poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer.->TestCapabilitycxx . . $ OGRLayer#TestCapability(78f035161ffa9fe2).(pszCap); |
| 1558 | |
| 1559 | else if (EQUALcxx . . $ `port/cpl_port.h:532:9`!(pszCap, OLCSequentialWritecxx . . $ `ogr/ogr_core.h:978:9`!) || |
| 1560 | EQUALcxx . . $ `port/cpl_port.h:532:9`!(pszCap, OLCDeleteFeaturecxx . . $ `ogr/ogr_core.h:1006:9`!) || EQUALcxx . . $ `port/cpl_port.h:532:9`!(pszCap, OLCRandomWritecxx . . $ `ogr/ogr_core.h:980:9`!)) |
| 1561 | { |
| 1562 | GetLayerDefncxx . . $ OGRWFSLayer#GetLayerDefn(448b209f43d15bcc).(); |
| 1563 | return poDScxx . . $ OGRWFSLayer#poDS.->SupportTransactionscxx . . $ OGRWFSDataSource#SupportTransactions(50ce9a9e25b4a850).() && poDScxx . . $ OGRWFSLayer#poDS.->UpdateModecxx . . $ OGRWFSDataSource#UpdateMode(50ce9a9e25b4a850).() && |
| 1564 | poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->GetFieldIndexcxx . . $ OGRFeatureDefn#GetFieldIndex(78f035161ffa9fe2).("gml_id") == 0; |
| 1565 | } |
| 1566 | else if (EQUALcxx . . $ `port/cpl_port.h:532:9`!(pszCap, OLCTransactionscxx . . $ `ogr/ogr_core.h:1003:9`!)) |
| 1567 | { |
| 1568 | return poDScxx . . $ OGRWFSLayer#poDS.->SupportTransactionscxx . . $ OGRWFSDataSource#SupportTransactions(50ce9a9e25b4a850).() && poDScxx . . $ OGRWFSLayer#poDS.->UpdateModecxx . . $ OGRWFSDataSource#UpdateMode(50ce9a9e25b4a850).(); |
| 1569 | } |
| 1570 | else if (EQUALcxx . . $ `port/cpl_port.h:532:9`!(pszCap, OLCIgnoreFieldscxx . . $ `ogr/ogr_core.h:1019:9`!)) |
| 1571 | { |
| 1572 | return TRUEcxx . . $ `port/cpl_port.h:1184:9`!; |
| 1573 | } |
| 1574 | |
| 1575 | return FALSEcxx . . $ `port/cpl_port.h:1180:9`!; |
| 1576 | } |
| 1577 | |
| 1578 | /************************************************************************/ |
| 1579 | /* ExecuteGetFeatureResultTypeHits() */ |
| 1580 | /************************************************************************/ |
| 1581 | |
| 1582 | GIntBigcxx . . $ GIntBig# OGRWFSLayercxx . . $ OGRWFSLayer#::ExecuteGetFeatureResultTypeHitscxx . . $ OGRWFSLayer#ExecuteGetFeatureResultTypeHits(a5d9f2bf8849668d).() |
| 1583 | { |
| 1584 | char *pabyData = nullptr; |
| 1585 | CPLString osURL = MakeGetFeatureURLcxx . . $ OGRWFSLayer#MakeGetFeatureURL(c3114674e28cccff).(0, TRUEcxx . . $ `port/cpl_port.h:1184:9`!); |
| 1586 | if (pszRequiredOutputFormatcxx . . $ OGRWFSLayer#pszRequiredOutputFormat.) |
| 1587 | osURL = CPLURLAddKVP(osURL, "OUTPUTFORMAT", |
| 1588 | WFS_EscapeURLcxx . . $ WFS_EscapeURL(a9d72c988d85d6d8).(pszRequiredOutputFormatcxx . . $ OGRWFSLayer#pszRequiredOutputFormat.)); |
| 1589 | CPLDebug("WFS", "%s", osURL.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 1590 | |
| 1591 | CPLHTTPResult *psResult = poDScxx . . $ OGRWFSLayer#poDS.->HTTPFetchcxx . . $ OGRWFSDataSource#HTTPFetch(38e266439c02e448).(osURL, nullptr); |
| 1592 | if (psResult == nullptr) |
| 1593 | { |
| 1594 | return -1; |
| 1595 | } |
| 1596 | |
| 1597 | /* http://demo.snowflakesoftware.com:8080/Obstacle_AIXM_ZIP/GOPublisherWFS |
| 1598 | * returns */ |
| 1599 | /* zip content, including for RESULTTYPE=hits */ |
| 1600 | if (psResult->pszContentType != nullptr && |
| 1601 | strstr(psResult->pszContentType, "application/zip") != nullptr) |
| 1602 | { |
| 1603 | const CPLString osTmpFileName( |
| 1604 | VSIMemGenerateHiddenFilename("wfstemphits.zip")); |
| 1605 | VSILFILE *fp = VSIFileFromMemBuffer(osTmpFileName, psResult->pabyData, |
| 1606 | psResult->nDataLen, FALSEcxx . . $ `port/cpl_port.h:1180:9`!); |
| 1607 | VSIFCloseL(fp); |
| 1608 | |
| 1609 | CPLString osZipTmpFileName("/vsizip/" +cxx . . $ std/operator+(42c652dfebe55ad7). osTmpFileName); |
| 1610 | |
| 1611 | char **papszDirContent = VSIReadDir(osZipTmpFileName); |
| 1612 | if (CSLCount(papszDirContent) != 1) |
| 1613 | { |
| 1614 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 1615 | "Cannot parse result of RESULTTYPE=hits request : more " |
| 1616 | "than one file in zip"); |
| 1617 | CSLDestroy(papszDirContent); |
| 1618 | CPLHTTPDestroyResult(psResult); |
| 1619 | VSIUnlink(osTmpFileName); |
| 1620 | return -1; |
| 1621 | } |
| 1622 | |
| 1623 | CPLString osFileInZipTmpFileName = osZipTmpFileName +cxx . . $ std/operator+(40fc1db9226233c6). "/"; |
| 1624 | osFileInZipTmpFileName +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). papszDirContent[0]; |
| 1625 | |
| 1626 | fp = VSIFOpenL(osFileInZipTmpFileName.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), "rb"); |
| 1627 | VSIStatBufL sBuf; |
| 1628 | if (fp == nullptr || |
| 1629 | VSIStatL(osFileInZipTmpFileName.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), &sBuf) != 0) |
| 1630 | { |
| 1631 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 1632 | "Cannot parse result of RESULTTYPE=hits request : cannot " |
| 1633 | "open one file in zip"); |
| 1634 | CSLDestroy(papszDirContent); |
| 1635 | CPLHTTPDestroyResult(psResult); |
| 1636 | VSIUnlink(osTmpFileName); |
| 1637 | if (fp) |
| 1638 | VSIFCloseL(fp); |
| 1639 | return -1; |
| 1640 | } |
| 1641 | pabyData = static_cast<char *>( |
| 1642 | CPLMalloc(static_cast<size_t>(sBuf.st_size + 1))); |
| 1643 | pabyData[sBuf.st_size] = 0; |
| 1644 | VSIFReadL(pabyData, 1, static_cast<size_t>(sBuf.st_size), fp); |
| 1645 | VSIFCloseL(fp); |
| 1646 | |
| 1647 | CSLDestroy(papszDirContent); |
| 1648 | VSIUnlink(osTmpFileName); |
| 1649 | } |
| 1650 | else |
| 1651 | { |
| 1652 | pabyData = reinterpret_cast<char *>(psResult->pabyData); |
| 1653 | psResult->pabyData = nullptr; |
| 1654 | } |
| 1655 | |
| 1656 | if (strstr(pabyData, "<ServiceExceptionReport") != nullptr || |
| 1657 | strstr(pabyData, "<ows:ExceptionReport") != nullptr) |
| 1658 | { |
| 1659 | if (poDScxx . . $ OGRWFSLayer#poDS.->IsOldDeegreecxx . . $ OGRWFSDataSource#IsOldDeegree(c5f7da30cbc0f4e9).(pabyData)) |
| 1660 | { |
| 1661 | CPLHTTPDestroyResult(psResult); |
| 1662 | return ExecuteGetFeatureResultTypeHitscxx . . $ OGRWFSLayer#ExecuteGetFeatureResultTypeHits(a5d9f2bf8849668d).(); |
| 1663 | } |
| 1664 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Error returned by server : %s", |
| 1665 | pabyData); |
| 1666 | CPLHTTPDestroyResult(psResult); |
| 1667 | CPLFreecxx . . $ `port/cpl_conv.h:97:9`!(pabyData); |
| 1668 | return -1; |
| 1669 | } |
| 1670 | |
| 1671 | CPLXMLNodecxx . . $ CPLXMLNode# *psXML = CPLParseXMLString(pabyData); |
| 1672 | if (psXML == nullptr) |
| 1673 | { |
| 1674 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Invalid XML content : %s", |
| 1675 | pabyData); |
| 1676 | CPLHTTPDestroyResult(psResult); |
| 1677 | CPLFreecxx . . $ `port/cpl_conv.h:97:9`!(pabyData); |
| 1678 | return -1; |
| 1679 | } |
| 1680 | |
| 1681 | CPLStripXMLNamespace(psXML, nullptr, TRUEcxx . . $ `port/cpl_port.h:1184:9`!); |
| 1682 | CPLXMLNodecxx . . $ CPLXMLNode# *psRoot = CPLGetXMLNode(psXML, "=FeatureCollection"); |
| 1683 | if (psRoot == nullptr) |
| 1684 | { |
| 1685 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 1686 | "Cannot find <FeatureCollection>"); |
| 1687 | CPLDestroyXMLNode(psXML); |
| 1688 | CPLHTTPDestroyResult(psResult); |
| 1689 | CPLFreecxx . . $ `port/cpl_conv.h:97:9`!(pabyData); |
| 1690 | return -1; |
| 1691 | } |
| 1692 | |
| 1693 | const char *pszValue = CPLGetXMLValue(psRoot, "numberOfFeatures", nullptr); |
| 1694 | if (pszValue == nullptr) |
| 1695 | pszValue = |
| 1696 | CPLGetXMLValue(psRoot, "numberMatched", nullptr); /* WFS 2.0.0 */ |
| 1697 | if (pszValue == nullptr) |
| 1698 | { |
| 1699 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Cannot find numberOfFeatures"); |
| 1700 | CPLDestroyXMLNode(psXML); |
| 1701 | CPLHTTPDestroyResult(psResult); |
| 1702 | CPLFreecxx . . $ `port/cpl_conv.h:97:9`!(pabyData); |
| 1703 | |
| 1704 | poDScxx . . $ OGRWFSLayer#poDS.->DisableSupportHitscxx . . $ OGRWFSDataSource#DisableSupportHits(49f6e7a06ebc5aa8).(); |
| 1705 | return -1; |
| 1706 | } |
| 1707 | |
| 1708 | GIntBigcxx . . $ GIntBig# l_nFeatures = CPLAtoGIntBig(pszValue); |
| 1709 | /* Hum, |
| 1710 | * http://deegree3-testing.deegree.org:80/deegree-inspire-node/services?MAXFEATURES=10&SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=ad:Address&OUTPUTFORMAT=text/xml;%20subtype=gml/3.2.1&RESULTTYPE=hits |
| 1711 | */ |
| 1712 | /* returns more than MAXFEATURES features... So truncate to MAXFEATURES */ |
| 1713 | CPLString osMaxFeatures = CPLURLGetValue( |
| 1714 | osURL, atoicxx . . $ atoi(f5ecf3191ed0cd93).(poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).()) >= 2 ? "COUNT" : "MAXFEATURES"); |
| 1715 | if (!osMaxFeatures.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) |
| 1716 | { |
| 1717 | GIntBigcxx . . $ GIntBig# nMaxFeatures = CPLAtoGIntBig(osMaxFeatures); |
| 1718 | if (l_nFeatures > nMaxFeatures) |
| 1719 | { |
| 1720 | CPLDebug("WFS", |
| 1721 | "Truncating result from " CPL_FRMT_GIBcxx . . $ `port/cpl_port.h:257:9`! " to " CPL_FRMT_GIBcxx . . $ `port/cpl_port.h:257:9`!, |
| 1722 | l_nFeatures, nMaxFeatures); |
| 1723 | l_nFeatures = nMaxFeatures; |
| 1724 | } |
| 1725 | } |
| 1726 | |
| 1727 | CPLDestroyXMLNode(psXML); |
| 1728 | CPLHTTPDestroyResult(psResult); |
| 1729 | CPLFreecxx . . $ `port/cpl_conv.h:97:9`!(pabyData); |
| 1730 | |
| 1731 | return l_nFeatures; |
| 1732 | } |
| 1733 | |
| 1734 | /************************************************************************/ |
| 1735 | /* CanRunGetFeatureCountAndGetExtentTogether() */ |
| 1736 | /************************************************************************/ |
| 1737 | |
| 1738 | int OGRWFSLayercxx . . $ OGRWFSLayer#::CanRunGetFeatureCountAndGetExtentTogethercxx . . $ OGRWFSLayer#CanRunGetFeatureCountAndGetExtentTogether(b126dc7c1de90089).() |
| 1739 | { |
| 1740 | /* In some cases, we can evaluate the result of GetFeatureCount() */ |
| 1741 | /* and GetExtent() with the same data */ |
| 1742 | CPLString osRequestURL = MakeGetFeatureURLcxx . . $ OGRWFSLayer#MakeGetFeatureURL(c3114674e28cccff).(0, FALSEcxx . . $ `port/cpl_port.h:1180:9`!); |
| 1743 | return (!m_oExtentscxx . . $ OGRWFSLayer#m_oExtents..IsInit() && nFeaturescxx . . $ OGRWFSLayer#nFeatures. < 0 && |
| 1744 | osRequestURL.ifind("FILTER") == stdcxx . . $ std/::string::nposcxx . . $ std/__cxx11/basic_string#npos. && |
| 1745 | osRequestURL.ifind("MAXFEATURES") == stdcxx . . $ std/::string::nposcxx . . $ std/__cxx11/basic_string#npos. && |
| 1746 | osRequestURL.ifind("COUNT") == stdcxx . . $ std/::string::nposcxx . . $ std/__cxx11/basic_string#npos. && |
| 1747 | !(GetLayerDefncxx . . $ OGRWFSLayer#GetLayerDefn(448b209f43d15bcc).()->IsGeometryIgnoredcxx . . $ OGRFeatureDefn#IsGeometryIgnored(455f465bc33b4cdf).())); |
| 1748 | } |
| 1749 | |
| 1750 | /************************************************************************/ |
| 1751 | /* GetFeatureCount() */ |
| 1752 | /************************************************************************/ |
| 1753 | |
| 1754 | GIntBigcxx . . $ GIntBig# OGRWFSLayercxx . . $ OGRWFSLayer#::GetFeatureCountcxx . . $ OGRWFSLayer#GetFeatureCount(9ccc33c3ebad048d).(int bForce) |
| 1755 | { |
| 1756 | if (nFeaturescxx . . $ OGRWFSLayer#nFeatures. >= 0) |
| 1757 | return nFeaturescxx . . $ OGRWFSLayer#nFeatures.; |
| 1758 | |
| 1759 | if (poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer. && TestCapabilitycxx . . $ OGRWFSLayer#TestCapability(78f035161ffa9fe2).(OLCFastFeatureCountcxx . . $ `ogr/ogr_core.h:983:9`!)) |
| 1760 | return poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer.->GetFeatureCountcxx . . $ OGRLayer#GetFeatureCount(9ccc33c3ebad048d).(bForce); |
| 1761 | |
| 1762 | if ((m_poAttrQuerycxx . . $ OGRLayer#m_poAttrQuery. == nullptr || !osWFSWherecxx . . $ OGRWFSLayer#osWFSWhere..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) && |
| 1763 | poDScxx . . $ OGRWFSLayer#poDS.->GetFeatureSupportHitscxx . . $ OGRWFSDataSource#GetFeatureSupportHits(50ce9a9e25b4a850).()) |
| 1764 | { |
| 1765 | nFeaturescxx . . $ OGRWFSLayer#nFeatures. = ExecuteGetFeatureResultTypeHitscxx . . $ OGRWFSLayer#ExecuteGetFeatureResultTypeHits(a5d9f2bf8849668d).(); |
| 1766 | if (nFeaturescxx . . $ OGRWFSLayer#nFeatures. >= 0) |
| 1767 | return nFeaturescxx . . $ OGRWFSLayer#nFeatures.; |
| 1768 | } |
| 1769 | |
| 1770 | /* If we have not yet the base layer, try to read one */ |
| 1771 | /* feature, and then query again OLCFastFeatureCount on the */ |
| 1772 | /* base layer. In case the WFS response would contain the */ |
| 1773 | /* number of features */ |
| 1774 | if (poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer. == nullptr && |
| 1775 | (m_poAttrQuerycxx . . $ OGRLayer#m_poAttrQuery. == nullptr || !osWFSWherecxx . . $ OGRWFSLayer#osWFSWhere..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).())) |
| 1776 | { |
| 1777 | ResetReadingcxx . . $ OGRWFSLayer#ResetReading(49f6e7a06ebc5aa8).(); |
| 1778 | OGRFeaturecxx . . $ OGRFeature# *poFeature = GetNextFeaturecxx . . $ OGRWFSLayer#GetNextFeature(ec9eceddec1d9563).(); |
| 1779 | delete poFeature; |
| 1780 | ResetReadingcxx . . $ OGRWFSLayer#ResetReading(49f6e7a06ebc5aa8).(); |
| 1781 | |
| 1782 | if (nFeaturescxx . . $ OGRWFSLayer#nFeatures. >= 0) |
| 1783 | return nFeaturescxx . . $ OGRWFSLayer#nFeatures.; |
| 1784 | |
| 1785 | if (poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer. && TestCapabilitycxx . . $ OGRWFSLayer#TestCapability(78f035161ffa9fe2).(OLCFastFeatureCountcxx . . $ `ogr/ogr_core.h:983:9`!)) |
| 1786 | return poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer.->GetFeatureCountcxx . . $ OGRLayer#GetFeatureCount(9ccc33c3ebad048d).(bForce); |
| 1787 | } |
| 1788 | |
| 1789 | /* In some cases, we can evaluate the result of GetFeatureCount() */ |
| 1790 | /* and GetExtent() with the same data */ |
| 1791 | if (CanRunGetFeatureCountAndGetExtentTogethercxx . . $ OGRWFSLayer#CanRunGetFeatureCountAndGetExtentTogether(b126dc7c1de90089).()) |
| 1792 | { |
| 1793 | OGREnvelope sDummy; |
| 1794 | CPL_IGNORE_RET_VAL(GetExtentcxx . . $ OGRLayer#GetExtent(9e34be741bca56d4).(&sDummy)); |
| 1795 | } |
| 1796 | |
| 1797 | if (nFeaturescxx . . $ OGRWFSLayer#nFeatures. < 0) |
| 1798 | nFeaturescxx . . $ OGRWFSLayer#nFeatures. = OGRLayercxx . . $ OGRLayer#::GetFeatureCountcxx . . $ OGRLayer#GetFeatureCount(9ccc33c3ebad048d).(bForce); |
| 1799 | |
| 1800 | return nFeaturescxx . . $ OGRWFSLayer#nFeatures.; |
| 1801 | } |
| 1802 | |
| 1803 | /************************************************************************/ |
| 1804 | /* SetExtents() */ |
| 1805 | /************************************************************************/ |
| 1806 | |
| 1807 | void OGRWFSLayercxx . . $ OGRWFSLayer#::SetExtentscxx . . $ OGRWFSLayer#SetExtents(52a61fa14d44b641).(double dfMinXIn, double dfMinYIn, double dfMaxXIn, |
| 1808 | double dfMaxYIn) |
| 1809 | { |
| 1810 | m_oExtentscxx . . $ OGRWFSLayer#m_oExtents..MinX = dfMinXIn; |
| 1811 | m_oExtentscxx . . $ OGRWFSLayer#m_oExtents..MinY = dfMinYIn; |
| 1812 | m_oExtentscxx . . $ OGRWFSLayer#m_oExtents..MaxX = dfMaxXIn; |
| 1813 | m_oExtentscxx . . $ OGRWFSLayer#m_oExtents..MaxY = dfMaxYIn; |
| 1814 | } |
| 1815 | |
| 1816 | /************************************************************************/ |
| 1817 | /* SetWGS84Extents() */ |
| 1818 | /************************************************************************/ |
| 1819 | |
| 1820 | void OGRWFSLayercxx . . $ OGRWFSLayer#::SetWGS84Extentscxx . . $ OGRWFSLayer#SetWGS84Extents(52a61fa14d44b641).(double dfMinXIn, double dfMinYIn, |
| 1821 | double dfMaxXIn, double dfMaxYIn) |
| 1822 | { |
| 1823 | m_oWGS84Extentscxx . . $ OGRWFSLayer#m_oWGS84Extents..MinX = dfMinXIn; |
| 1824 | m_oWGS84Extentscxx . . $ OGRWFSLayer#m_oWGS84Extents..MinY = dfMinYIn; |
| 1825 | m_oWGS84Extentscxx . . $ OGRWFSLayer#m_oWGS84Extents..MaxX = dfMaxXIn; |
| 1826 | m_oWGS84Extentscxx . . $ OGRWFSLayer#m_oWGS84Extents..MaxY = dfMaxYIn; |
| 1827 | } |
| 1828 | |
| 1829 | /************************************************************************/ |
| 1830 | /* IGetExtent() */ |
| 1831 | /************************************************************************/ |
| 1832 | |
| 1833 | OGRErr OGRWFSLayercxx . . $ OGRWFSLayer#::IGetExtentcxx . . $ OGRWFSLayer#IGetExtent(ee9c866093418aa0).(int iGeomField, OGREnvelope *psExtent, |
| 1834 | bool bForce) |
| 1835 | { |
| 1836 | if (m_oExtentscxx . . $ OGRWFSLayer#m_oExtents..IsInit()) |
| 1837 | { |
| 1838 | *psExtent = m_oExtentscxx . . $ OGRWFSLayer#m_oExtents.; |
| 1839 | return OGRERR_NONEcxx . . $ `ogr/ogr_core.h:390:9`!; |
| 1840 | } |
| 1841 | |
| 1842 | /* If we have not yet the base layer, try to read one */ |
| 1843 | /* feature, and then query again OLCFastGetExtent on the */ |
| 1844 | /* base layer. In case the WFS response would contain the */ |
| 1845 | /* global extent */ |
| 1846 | if (poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer. == nullptr) |
| 1847 | { |
| 1848 | ResetReadingcxx . . $ OGRWFSLayer#ResetReading(49f6e7a06ebc5aa8).(); |
| 1849 | OGRFeaturecxx . . $ OGRFeature# *poFeature = GetNextFeaturecxx . . $ OGRWFSLayer#GetNextFeature(ec9eceddec1d9563).(); |
| 1850 | delete poFeature; |
| 1851 | ResetReadingcxx . . $ OGRWFSLayer#ResetReading(49f6e7a06ebc5aa8).(); |
| 1852 | } |
| 1853 | |
| 1854 | if (TestCapabilitycxx . . $ OGRWFSLayer#TestCapability(78f035161ffa9fe2).(OLCFastGetExtentcxx . . $ `ogr/ogr_core.h:986:9`!)) |
| 1855 | return poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer.->GetExtentcxx . . $ OGRLayer#GetExtent(ee9c866093418aa0).(iGeomField, psExtent, bForce); |
| 1856 | |
| 1857 | /* In some cases, we can evaluate the result of GetFeatureCount() */ |
| 1858 | /* and GetExtent() with the same data */ |
| 1859 | if (CanRunGetFeatureCountAndGetExtentTogethercxx . . $ OGRWFSLayer#CanRunGetFeatureCountAndGetExtentTogether(b126dc7c1de90089).()) |
| 1860 | { |
| 1861 | bCountFeaturesInGetNextFeaturecxx . . $ OGRWFSLayer#bCountFeaturesInGetNextFeature. = true; |
| 1862 | nFeaturescxx . . $ OGRWFSLayer#nFeatures. = 0; |
| 1863 | } |
| 1864 | |
| 1865 | OGRErr eErr = OGRLayercxx . . $ OGRLayer#::IGetExtentcxx . . $ OGRLayer#IGetExtent(ee9c866093418aa0).(iGeomField, psExtent, bForce); |
| 1866 | |
| 1867 | if (bCountFeaturesInGetNextFeaturecxx . . $ OGRWFSLayer#bCountFeaturesInGetNextFeature.) |
| 1868 | { |
| 1869 | if (eErr == OGRERR_NONEcxx . . $ `ogr/ogr_core.h:390:9`!) |
| 1870 | { |
| 1871 | m_oExtentscxx . . $ OGRWFSLayer#m_oExtents. = *psExtent; |
| 1872 | } |
| 1873 | else |
| 1874 | { |
| 1875 | nFeaturescxx . . $ OGRWFSLayer#nFeatures. = -1; |
| 1876 | } |
| 1877 | bCountFeaturesInGetNextFeaturecxx . . $ OGRWFSLayer#bCountFeaturesInGetNextFeature. = false; |
| 1878 | } |
| 1879 | |
| 1880 | return eErr; |
| 1881 | } |
| 1882 | |
| 1883 | /************************************************************************/ |
| 1884 | /* GetShortName() */ |
| 1885 | /************************************************************************/ |
| 1886 | |
| 1887 | const char *OGRWFSLayercxx . . $ OGRWFSLayer#::GetShortNamecxx . . $ OGRWFSLayer#GetShortName(33a1f659e94feb42).() |
| 1888 | { |
| 1889 | const char *pszShortName = strchr(pszNamecxx . . $ OGRWFSLayer#pszName., ':'); |
| 1890 | if (pszShortName == nullptr) |
| 1891 | pszShortName = pszNamecxx . . $ OGRWFSLayer#pszName.; |
| 1892 | else |
| 1893 | pszShortName++; |
| 1894 | return pszShortName; |
| 1895 | } |
| 1896 | |
| 1897 | /************************************************************************/ |
| 1898 | /* GetPostHeader() */ |
| 1899 | /************************************************************************/ |
| 1900 | |
| 1901 | CPLString OGRWFSLayercxx . . $ OGRWFSLayer#::GetPostHeadercxx . . $ OGRWFSLayer#GetPostHeader(cdfd1e859161399b).() |
| 1902 | { |
| 1903 | CPLString osPost; |
| 1904 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "<?xml version=\"1.0\"?>\n"; |
| 1905 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "<wfs:Transaction xmlns:wfs=\"http://www.opengis.net/wfs\"\n"; |
| 1906 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " " |
| 1907 | "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"; |
| 1908 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " service=\"WFS\" version=\""; |
| 1909 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).(); |
| 1910 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "\"\n"; |
| 1911 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " xmlns:gml=\"http://www.opengis.net/gml\"\n"; |
| 1912 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " xmlns:ogc=\"http://www.opengis.net/ogc\"\n"; |
| 1913 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). |
| 1914 | " xsi:schemaLocation=\"http://www.opengis.net/wfs " |
| 1915 | "http://schemas.opengis.net/wfs/"; |
| 1916 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).(); |
| 1917 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "/wfs.xsd "; |
| 1918 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). osTargetNamespacecxx . . $ OGRWFSLayer#osTargetNamespace.; |
| 1919 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " "; |
| 1920 | |
| 1921 | char *pszXMLEncoded = |
| 1922 | CPLEscapeString(GetDescribeFeatureTypeURLcxx . . $ OGRWFSLayer#GetDescribeFeatureTypeURL(aa6080b2436c07ab).(FALSEcxx . . $ `port/cpl_port.h:1180:9`!), -1, CPLES_XMLcxx . . $ `port/cpl_string.h:155:9`!); |
| 1923 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). pszXMLEncoded; |
| 1924 | CPLFreecxx . . $ `port/cpl_conv.h:97:9`!(pszXMLEncoded); |
| 1925 | |
| 1926 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "\">\n"; |
| 1927 | |
| 1928 | return osPost; |
| 1929 | } |
| 1930 | |
| 1931 | /************************************************************************/ |
| 1932 | /* SerializeFieldValueAsXML() */ |
| 1933 | /************************************************************************/ |
| 1934 | |
| 1935 | static stdcxx . . $ std/::string SerializeFieldValueAsXMLcxx . . $ SerializeFieldValueAsXML(2750d15cf4c79bba).(const OGRFeaturecxx . . $ OGRFeature# *poFeature, int i, |
| 1936 | const OGRFieldDefncxx . . $ OGRFieldDefn# *poFDefn) |
| 1937 | { |
| 1938 | switch (poFDefn->GetTypecxx . . $ OGRFieldDefn#GetType(b365ab774e05458e).()) |
| 1939 | { |
| 1940 | case OFTInteger: |
| 1941 | { |
| 1942 | if (poFDefn->GetSubTypecxx . . $ OGRFieldDefn#GetSubType(4db5e065ad90bc77).() == OFSTBoolean) |
| 1943 | return poFeaturecxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).->GetFieldAsIntegercxx . . $ OGRFeature#GetFieldAsInteger(7ccb52b1bfe01045).(i) ? "true" : "false"; |
| 1944 | else |
| 1945 | return CPLSPrintfcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).("%d", poFeature->GetFieldAsIntegercxx . . $ OGRFeature#GetFieldAsInteger(7ccb52b1bfe01045).(i)); |
| 1946 | } |
| 1947 | |
| 1948 | case OFTInteger64: |
| 1949 | return CPLSPrintfcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).(CPL_FRMT_GIBcxx . . $ `port/cpl_port.h:257:9`!, poFeature->GetFieldAsInteger64cxx . . $ OGRFeature#GetFieldAsInteger64(f3f16611d465c84c).(i)); |
| 1950 | |
| 1951 | case OFTReal: |
| 1952 | return CPLSPrintfcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).("%.17g", poFeature->GetFieldAsDoublecxx . . $ OGRFeature#GetFieldAsDouble(8bbae5fb2e9ef7ac).(i)); |
| 1953 | |
| 1954 | case OFTDateTime: |
| 1955 | return poFeaturecxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).->GetFieldAsISO8601DateTimecxx . . $ OGRFeature#GetFieldAsISO8601DateTime(b26466700d93d122).(i, nullptr); |
| 1956 | |
| 1957 | case OFTDate: |
| 1958 | { |
| 1959 | const auto poRawValue = poFeature->GetRawFieldRefcxx . . $ OGRFeature#GetRawFieldRef(ec58713283601c73).(i); |
| 1960 | return CPLSPrintfcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).("%04d-%02d-%02d", poRawValue->Date.Year, |
| 1961 | poRawValue->Date.Month, poRawValue->Date.Day); |
| 1962 | } |
| 1963 | |
| 1964 | case OFTString: |
| 1965 | case OFTIntegerList: |
| 1966 | case OFTInteger64List: |
| 1967 | case OFTRealList: |
| 1968 | case OFTStringList: |
| 1969 | case OFTWideString: |
| 1970 | case OFTWideStringList: |
| 1971 | case OFTBinary: |
| 1972 | case OFTTime: |
| 1973 | break; |
| 1974 | } |
| 1975 | |
| 1976 | char *pszXMLEncoded = |
| 1977 | CPLEscapeString(poFeature->GetFieldAsStringcxx . . $ OGRFeature#GetFieldAsString(afbf07f2bc1a9437).(i), -1, CPLES_XMLcxx . . $ `port/cpl_string.h:155:9`!); |
| 1978 | stdcxx . . $ std/::string retcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).(pszXMLEncoded); |
| 1979 | CPLFreecxx . . $ `port/cpl_conv.h:97:9`!(pszXMLEncoded); |
| 1980 | return retcxx . . $ std/__cxx11/basic_string#basic_string(8f3aaafa33d05d0b).; |
| 1981 | } |
| 1982 | |
| 1983 | /************************************************************************/ |
| 1984 | /* ICreateFeature() */ |
| 1985 | /************************************************************************/ |
| 1986 | |
| 1987 | OGRErr OGRWFSLayercxx . . $ OGRWFSLayer#::ICreateFeaturecxx . . $ OGRWFSLayer#ICreateFeature(2048609adab03aab).(OGRFeaturecxx . . $ OGRFeature# *poFeature) |
| 1988 | { |
| 1989 | if (!TestCapabilitycxx . . $ OGRWFSLayer#TestCapability(78f035161ffa9fe2).(OLCSequentialWritecxx . . $ `ogr/ogr_core.h:978:9`!)) |
| 1990 | { |
| 1991 | if (!poDScxx . . $ OGRWFSLayer#poDS.->SupportTransactionscxx . . $ OGRWFSDataSource#SupportTransactions(50ce9a9e25b4a850).()) |
| 1992 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 1993 | "CreateFeature() not supported: no WMS-T features " |
| 1994 | "advertized by server"); |
| 1995 | else if (!poDScxx . . $ OGRWFSLayer#poDS.->UpdateModecxx . . $ OGRWFSDataSource#UpdateMode(50ce9a9e25b4a850).()) |
| 1996 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 1997 | "CreateFeature() not supported: datasource opened as " |
| 1998 | "read-only"); |
| 1999 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2000 | } |
| 2001 | |
| 2002 | if (poGMLFeatureClasscxx . . $ OGRWFSLayer#poGMLFeatureClass. == nullptr) |
| 2003 | { |
| 2004 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2005 | "Cannot insert feature because we didn't manage to parse the " |
| 2006 | ".XSD schema"); |
| 2007 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2008 | } |
| 2009 | |
| 2010 | if (poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->GetFieldIndexcxx . . $ OGRFeatureDefn#GetFieldIndex(78f035161ffa9fe2).("gml_id") != 0) |
| 2011 | { |
| 2012 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Cannot find gml_id field"); |
| 2013 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2014 | } |
| 2015 | |
| 2016 | if (poFeature->IsFieldSetAndNotNullcxx . . $ OGRFeature#IsFieldSetAndNotNull(4a668f6de69bf818).(0)) |
| 2017 | { |
| 2018 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2019 | "Cannot insert a feature when gml_id field is already set"); |
| 2020 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2021 | } |
| 2022 | |
| 2023 | CPLString osPost; |
| 2024 | |
| 2025 | const char *pszShortName = GetShortNamecxx . . $ OGRWFSLayer#GetShortName(33a1f659e94feb42).(); |
| 2026 | |
| 2027 | if (!bInTransactioncxx . . $ OGRWFSLayer#bInTransaction.) |
| 2028 | { |
| 2029 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). GetPostHeadercxx . . $ OGRWFSLayer#GetPostHeader(cdfd1e859161399b).(); |
| 2030 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " <wfs:Insert>\n"; |
| 2031 | } |
| 2032 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " <feature:"; |
| 2033 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). pszShortName; |
| 2034 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " xmlns:feature=\""; |
| 2035 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). osTargetNamespacecxx . . $ OGRWFSLayer#osTargetNamespace.; |
| 2036 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "\">\n"; |
| 2037 | |
| 2038 | for (int i = 1; i <= poFeature->GetFieldCountcxx . . $ OGRFeature#GetFieldCount(455f465bc33b4cdf).(); i++) |
| 2039 | { |
| 2040 | if (poGMLFeatureClasscxx . . $ OGRWFSLayer#poGMLFeatureClass.->GetGeometryPropertyCountcxx . . $ GMLFeatureClass#GetGeometryPropertyCount(455f465bc33b4cdf).() == 1 && |
| 2041 | poGMLFeatureClasscxx . . $ OGRWFSLayer#poGMLFeatureClass.->GetGeometryPropertycxx . . $ GMLFeatureClass#GetGeometryProperty(d57792ed8f30a1b4).(0)->GetAttributeIndexcxx . . $ GMLGeometryPropertyDefn#GetAttributeIndex(455f465bc33b4cdf).() == |
| 2042 | i - 1) |
| 2043 | { |
| 2044 | OGRGeometrycxx . . $ OGRGeometry# *poGeom = poFeature->GetGeometryRefcxx . . $ OGRFeature#GetGeometryRef(3dfc1d32c7db2584).(); |
| 2045 | if (poGeom != nullptr && !osGeometryColumnNamecxx . . $ OGRWFSLayer#osGeometryColumnName..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) |
| 2046 | { |
| 2047 | if (poGeom->getSpatialReferencecxx . . $ OGRGeometry#getSpatialReference(8a5496c2eeefaeaf).() == nullptr) |
| 2048 | poGeom->assignSpatialReferencecxx . . $ OGRGeometry#assignSpatialReference(9ff39b79387a6086).(m_poSRScxx . . $ OGRWFSLayer#m_poSRS.); |
| 2049 | char *pszGML = nullptr; |
| 2050 | if (strcmp(poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).(), "1.1.0") == 0 || |
| 2051 | atoicxx . . $ atoi(f5ecf3191ed0cd93).(poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).()) >= 2) |
| 2052 | { |
| 2053 | char **papszOptions = CSLAddString(nullptr, "FORMAT=GML3"); |
| 2054 | pszGML = OGR_G_ExportToGMLEx(OGRGeometrycxx . . $ OGRGeometry#::ToHandlecxx . . $ OGRGeometry#ToHandle(76b24ad94dcfe536).(poGeom), |
| 2055 | papszOptions); |
| 2056 | CSLDestroy(papszOptions); |
| 2057 | } |
| 2058 | else |
| 2059 | pszGML = OGR_G_ExportToGML(OGRGeometrycxx . . $ OGRGeometry#::ToHandlecxx . . $ OGRGeometry#ToHandle(76b24ad94dcfe536).(poGeom)); |
| 2060 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " <feature:"; |
| 2061 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). osGeometryColumnNamecxx . . $ OGRWFSLayer#osGeometryColumnName.; |
| 2062 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). ">"; |
| 2063 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). pszGML; |
| 2064 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "</feature:"; |
| 2065 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). osGeometryColumnNamecxx . . $ OGRWFSLayer#osGeometryColumnName.; |
| 2066 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). ">\n"; |
| 2067 | CPLFreecxx . . $ `port/cpl_conv.h:97:9`!(pszGML); |
| 2068 | } |
| 2069 | } |
| 2070 | if (i == poFeature->GetFieldCountcxx . . $ OGRFeature#GetFieldCount(455f465bc33b4cdf).()) |
| 2071 | break; |
| 2072 | |
| 2073 | #ifdef notdef |
| 2074 | if (poFeature->IsFieldNull(i)) |
| 2075 | { |
| 2076 | const OGRFieldDefn *poFDefn = poFeature->GetFieldDefnRef(i); |
| 2077 | osPost += " <feature:"; |
| 2078 | osPost += poFDefn->GetNameRef(); |
| 2079 | osPost += " xsi:nil=\"true\" />\n"; |
| 2080 | } |
| 2081 | else |
| 2082 | #endif |
| 2083 | if (poFeature->IsFieldSetcxx . . $ OGRFeature#IsFieldSet(7ccb52b1bfe01045).(i) && !poFeature->IsFieldNullcxx . . $ OGRFeature#IsFieldNull(4a668f6de69bf818).(i)) |
| 2084 | { |
| 2085 | const OGRFieldDefncxx . . $ OGRFieldDefn# *poFDefn = poFeature->GetFieldDefnRefcxx . . $ OGRFeature#GetFieldDefnRef(53a8093e6b73def).(i); |
| 2086 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " <feature:"; |
| 2087 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). poFDefn->GetNameRefcxx . . $ OGRFieldDefn#GetNameRef(a9f41ea0e82d88cf).(); |
| 2088 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). ">"; |
| 2089 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). SerializeFieldValueAsXMLcxx . . $ SerializeFieldValueAsXML(2750d15cf4c79bba).(poFeature, i, poFDefn); |
| 2090 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "</feature:"; |
| 2091 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). poFDefn->GetNameRefcxx . . $ OGRFieldDefn#GetNameRef(a9f41ea0e82d88cf).(); |
| 2092 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). ">\n"; |
| 2093 | } |
| 2094 | } |
| 2095 | |
| 2096 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " </feature:"; |
| 2097 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). pszShortName; |
| 2098 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). ">\n"; |
| 2099 | |
| 2100 | if (!bInTransactioncxx . . $ OGRWFSLayer#bInTransaction.) |
| 2101 | { |
| 2102 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " </wfs:Insert>\n"; |
| 2103 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "</wfs:Transaction>\n"; |
| 2104 | } |
| 2105 | else |
| 2106 | { |
| 2107 | osGlobalInsertcxx . . $ OGRWFSLayer#osGlobalInsert. +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). osPost; |
| 2108 | nExpectedInsertscxx . . $ OGRWFSLayer#nExpectedInserts.++; |
| 2109 | return OGRERR_NONEcxx . . $ `ogr/ogr_core.h:390:9`!; |
| 2110 | } |
| 2111 | |
| 2112 | CPLDebug("WFS", "Post : %s", osPost.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 2113 | |
| 2114 | char **papszOptions = nullptr; |
| 2115 | papszOptions = CSLAddNameValue(papszOptions, "POSTFIELDS", osPost.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 2116 | papszOptions = |
| 2117 | CSLAddNameValue(papszOptions, "HEADERS", |
| 2118 | "Content-Type: application/xml; charset=UTF-8"); |
| 2119 | |
| 2120 | CPLHTTPResult *psResult = |
| 2121 | poDScxx . . $ OGRWFSLayer#poDS.->HTTPFetchcxx . . $ OGRWFSDataSource#HTTPFetch(38e266439c02e448).(poDScxx . . $ OGRWFSLayer#poDS.->GetPostTransactionURLcxx . . $ OGRWFSDataSource#GetPostTransactionURL(cdfd1e859161399b).(), papszOptions); |
| 2122 | CSLDestroy(papszOptions); |
| 2123 | |
| 2124 | if (psResult == nullptr) |
| 2125 | { |
| 2126 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2127 | } |
| 2128 | |
| 2129 | if (strstr(reinterpret_cast<const char *>(psResult->pabyData), |
| 2130 | "<ServiceExceptionReport") != nullptr || |
| 2131 | strstr(reinterpret_cast<const char *>(psResult->pabyData), |
| 2132 | "<ows:ExceptionReport") != nullptr) |
| 2133 | { |
| 2134 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Error returned by server : %s", |
| 2135 | psResult->pabyData); |
| 2136 | CPLHTTPDestroyResult(psResult); |
| 2137 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2138 | } |
| 2139 | |
| 2140 | CPLDebug("WFS", "Response: %s", psResult->pabyData); |
| 2141 | |
| 2142 | CPLXMLNodecxx . . $ CPLXMLNode# *psXML = |
| 2143 | CPLParseXMLString(reinterpret_cast<const char *>(psResult->pabyData)); |
| 2144 | if (psXML == nullptr) |
| 2145 | { |
| 2146 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Invalid XML content : %s", |
| 2147 | psResult->pabyData); |
| 2148 | CPLHTTPDestroyResult(psResult); |
| 2149 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2150 | } |
| 2151 | |
| 2152 | CPLStripXMLNamespace(psXML, nullptr, TRUEcxx . . $ `port/cpl_port.h:1184:9`!); |
| 2153 | bool bUse100Schema = false; |
| 2154 | CPLXMLNodecxx . . $ CPLXMLNode# *psRoot = CPLGetXMLNode(psXML, "=TransactionResponse"); |
| 2155 | if (psRoot == nullptr) |
| 2156 | { |
| 2157 | psRoot = CPLGetXMLNode(psXML, "=WFS_TransactionResponse"); |
| 2158 | if (psRoot) |
| 2159 | bUse100Schema = true; |
| 2160 | } |
| 2161 | |
| 2162 | if (psRoot == nullptr) |
| 2163 | { |
| 2164 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2165 | "Cannot find <TransactionResponse>"); |
| 2166 | CPLDestroyXMLNode(psXML); |
| 2167 | CPLHTTPDestroyResult(psResult); |
| 2168 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2169 | } |
| 2170 | |
| 2171 | CPLXMLNodecxx . . $ CPLXMLNode# *psFeatureID = nullptr; |
| 2172 | |
| 2173 | if (bUse100Schema) |
| 2174 | { |
| 2175 | if (CPLGetXMLNode(psRoot, "TransactionResult.Status.FAILED")) |
| 2176 | { |
| 2177 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Insert failed : %s", |
| 2178 | psResult->pabyData); |
| 2179 | CPLDestroyXMLNode(psXML); |
| 2180 | CPLHTTPDestroyResult(psResult); |
| 2181 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2182 | } |
| 2183 | |
| 2184 | psFeatureID = CPLGetXMLNode(psRoot, "InsertResult.FeatureId"); |
| 2185 | if (psFeatureID == nullptr) |
| 2186 | { |
| 2187 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2188 | "Cannot find InsertResult.FeatureId"); |
| 2189 | CPLDestroyXMLNode(psXML); |
| 2190 | CPLHTTPDestroyResult(psResult); |
| 2191 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2192 | } |
| 2193 | } |
| 2194 | else |
| 2195 | { |
| 2196 | const char *pszFeatureIdElt = atoicxx . . $ atoi(f5ecf3191ed0cd93).(poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).()) >= 2 |
| 2197 | ? "InsertResults.Feature.ResourceId" |
| 2198 | : "InsertResults.Feature.FeatureId"; |
| 2199 | psFeatureID = CPLGetXMLNode(psRoot, pszFeatureIdElt); |
| 2200 | if (psFeatureID == nullptr) |
| 2201 | { |
| 2202 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Cannot find %s", |
| 2203 | pszFeatureIdElt); |
| 2204 | CPLDestroyXMLNode(psXML); |
| 2205 | CPLHTTPDestroyResult(psResult); |
| 2206 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2207 | } |
| 2208 | } |
| 2209 | |
| 2210 | const char *pszFIDAttr = atoicxx . . $ atoi(f5ecf3191ed0cd93).(poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).()) >= 2 ? "rid" : "fid"; |
| 2211 | const char *pszFID = CPLGetXMLValue(psFeatureID, pszFIDAttr, nullptr); |
| 2212 | if (pszFID == nullptr) |
| 2213 | { |
| 2214 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Cannot find %s", pszFIDAttr); |
| 2215 | CPLDestroyXMLNode(psXML); |
| 2216 | CPLHTTPDestroyResult(psResult); |
| 2217 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2218 | } |
| 2219 | |
| 2220 | poFeature->SetFieldcxx . . $ OGRFeature#SetField(2fa786934fe80e24).("gml_id", pszFID); |
| 2221 | |
| 2222 | /* If the returned fid is of the form layer_name.num, then use */ |
| 2223 | /* num as the OGR FID */ |
| 2224 | if (strncmp(pszFID, pszShortName, strlen(pszShortName)) == 0 && |
| 2225 | pszFID[strlen(pszShortName)] == '.') |
| 2226 | { |
| 2227 | GIntBigcxx . . $ GIntBig# nFID = CPLAtoGIntBig(pszFID + strlen(pszShortName) + 1); |
| 2228 | poFeature->SetFIDcxx . . $ OGRFeature#SetFID(a070d6d14e988596).(nFID); |
| 2229 | } |
| 2230 | |
| 2231 | CPLDebug("WFS", "Got FID = " CPL_FRMT_GIBcxx . . $ `port/cpl_port.h:257:9`!, poFeature->GetFIDcxx . . $ OGRFeature#GetFID(98833e9ab7de59a4).()); |
| 2232 | |
| 2233 | CPLDestroyXMLNode(psXML); |
| 2234 | CPLHTTPDestroyResult(psResult); |
| 2235 | |
| 2236 | /* Invalidate layer */ |
| 2237 | bReloadNeededcxx . . $ OGRWFSLayer#bReloadNeeded. = true; |
| 2238 | nFeaturescxx . . $ OGRWFSLayer#nFeatures. = -1; |
| 2239 | m_oExtentscxx . . $ OGRWFSLayer#m_oExtents. = OGREnvelope(); |
| 2240 | |
| 2241 | return OGRERR_NONEcxx . . $ `ogr/ogr_core.h:390:9`!; |
| 2242 | } |
| 2243 | |
| 2244 | /************************************************************************/ |
| 2245 | /* ISetFeature() */ |
| 2246 | /************************************************************************/ |
| 2247 | |
| 2248 | OGRErr OGRWFSLayercxx . . $ OGRWFSLayer#::ISetFeaturecxx . . $ OGRWFSLayer#ISetFeature(2048609adab03aab).(OGRFeaturecxx . . $ OGRFeature# *poFeature) |
| 2249 | { |
| 2250 | if (!TestCapabilitycxx . . $ OGRWFSLayer#TestCapability(78f035161ffa9fe2).(OLCRandomWritecxx . . $ `ogr/ogr_core.h:980:9`!)) |
| 2251 | { |
| 2252 | if (!poDScxx . . $ OGRWFSLayer#poDS.->SupportTransactionscxx . . $ OGRWFSDataSource#SupportTransactions(50ce9a9e25b4a850).()) |
| 2253 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2254 | "SetFeature() not supported: no WMS-T features advertized " |
| 2255 | "by server"); |
| 2256 | else if (!poDScxx . . $ OGRWFSLayer#poDS.->UpdateModecxx . . $ OGRWFSDataSource#UpdateMode(50ce9a9e25b4a850).()) |
| 2257 | CPLError( |
| 2258 | CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2259 | "SetFeature() not supported: datasource opened as read-only"); |
| 2260 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2261 | } |
| 2262 | |
| 2263 | if (poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->GetFieldIndexcxx . . $ OGRFeatureDefn#GetFieldIndex(78f035161ffa9fe2).("gml_id") != 0) |
| 2264 | { |
| 2265 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Cannot find gml_id field"); |
| 2266 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2267 | } |
| 2268 | |
| 2269 | if (poFeature->IsFieldSetAndNotNullcxx . . $ OGRFeature#IsFieldSetAndNotNull(4a668f6de69bf818).(0) == FALSEcxx . . $ `port/cpl_port.h:1180:9`!) |
| 2270 | { |
| 2271 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2272 | "Cannot update a feature when gml_id field is not set"); |
| 2273 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2274 | } |
| 2275 | |
| 2276 | if (bInTransactioncxx . . $ OGRWFSLayer#bInTransaction.) |
| 2277 | { |
| 2278 | CPLError( |
| 2279 | CE_Warning, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2280 | "SetFeature() not yet dealt in transaction. Issued immediately"); |
| 2281 | } |
| 2282 | |
| 2283 | const char *pszShortName = GetShortNamecxx . . $ OGRWFSLayer#GetShortName(33a1f659e94feb42).(); |
| 2284 | |
| 2285 | CPLString osPost; |
| 2286 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). GetPostHeadercxx . . $ OGRWFSLayer#GetPostHeader(cdfd1e859161399b).(); |
| 2287 | |
| 2288 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " <wfs:Update typeName=\"feature:"; |
| 2289 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). pszShortName; |
| 2290 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "\" xmlns:feature=\""; |
| 2291 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). osTargetNamespacecxx . . $ OGRWFSLayer#osTargetNamespace.; |
| 2292 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "\">\n"; |
| 2293 | |
| 2294 | OGRGeometrycxx . . $ OGRGeometry# *poGeom = poFeature->GetGeometryRefcxx . . $ OGRFeature#GetGeometryRef(3dfc1d32c7db2584).(); |
| 2295 | if (!osGeometryColumnNamecxx . . $ OGRWFSLayer#osGeometryColumnName..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) |
| 2296 | { |
| 2297 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " <wfs:Property>\n"; |
| 2298 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " <wfs:Name>"; |
| 2299 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). osGeometryColumnNamecxx . . $ OGRWFSLayer#osGeometryColumnName.; |
| 2300 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "</wfs:Name>\n"; |
| 2301 | if (poGeom != nullptr) |
| 2302 | { |
| 2303 | if (poGeom->getSpatialReferencecxx . . $ OGRGeometry#getSpatialReference(8a5496c2eeefaeaf).() == nullptr) |
| 2304 | poGeom->assignSpatialReferencecxx . . $ OGRGeometry#assignSpatialReference(9ff39b79387a6086).(m_poSRScxx . . $ OGRWFSLayer#m_poSRS.); |
| 2305 | char *pszGML = nullptr; |
| 2306 | if (strcmp(poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).(), "1.1.0") == 0 || |
| 2307 | atoicxx . . $ atoi(f5ecf3191ed0cd93).(poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).()) >= 2) |
| 2308 | { |
| 2309 | char **papszOptions = CSLAddString(nullptr, "FORMAT=GML3"); |
| 2310 | pszGML = OGR_G_ExportToGMLEx(OGRGeometrycxx . . $ OGRGeometry#::ToHandlecxx . . $ OGRGeometry#ToHandle(76b24ad94dcfe536).(poGeom), |
| 2311 | papszOptions); |
| 2312 | CSLDestroy(papszOptions); |
| 2313 | } |
| 2314 | else |
| 2315 | pszGML = OGR_G_ExportToGML(OGRGeometrycxx . . $ OGRGeometry#::ToHandlecxx . . $ OGRGeometry#ToHandle(76b24ad94dcfe536).(poGeom)); |
| 2316 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " <wfs:Value>"; |
| 2317 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). pszGML; |
| 2318 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "</wfs:Value>\n"; |
| 2319 | CPLFreecxx . . $ `port/cpl_conv.h:97:9`!(pszGML); |
| 2320 | } |
| 2321 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " </wfs:Property>\n"; |
| 2322 | } |
| 2323 | |
| 2324 | for (int i = 1; i < poFeature->GetFieldCountcxx . . $ OGRFeature#GetFieldCount(455f465bc33b4cdf).(); i++) |
| 2325 | { |
| 2326 | const OGRFieldDefncxx . . $ OGRFieldDefn# *poFDefn = poFeature->GetFieldDefnRefcxx . . $ OGRFeature#GetFieldDefnRef(53a8093e6b73def).(i); |
| 2327 | |
| 2328 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " <wfs:Property>\n"; |
| 2329 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " <wfs:Name>"; |
| 2330 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). poFDefn->GetNameRefcxx . . $ OGRFieldDefn#GetNameRef(a9f41ea0e82d88cf).(); |
| 2331 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "</wfs:Name>\n"; |
| 2332 | if (poFeature->IsFieldSetAndNotNullcxx . . $ OGRFeature#IsFieldSetAndNotNull(4a668f6de69bf818).(i)) |
| 2333 | { |
| 2334 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " <wfs:Value>"; |
| 2335 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). SerializeFieldValueAsXMLcxx . . $ SerializeFieldValueAsXML(2750d15cf4c79bba).(poFeature, i, poFDefn); |
| 2336 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "</wfs:Value>\n"; |
| 2337 | } |
| 2338 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " </wfs:Property>\n"; |
| 2339 | } |
| 2340 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " <ogc:Filter>\n"; |
| 2341 | if (poDScxx . . $ OGRWFSLayer#poDS.->UseFeatureIdcxx . . $ OGRWFSDataSource#UseFeatureId(50ce9a9e25b4a850).() || bUseFeatureIdAtLayerLevelcxx . . $ OGRWFSLayer#bUseFeatureIdAtLayerLevel.) |
| 2342 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " <ogc:FeatureId fid=\""; |
| 2343 | else if (atoicxx . . $ atoi(f5ecf3191ed0cd93).(poDScxx . . $ OGRWFSLayer#poDS.->GetVersioncxx . . $ OGRWFSDataSource#GetVersion(33a1f659e94feb42).()) >= 2) |
| 2344 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " <ogc:ResourceId rid=\""; |
| 2345 | else |
| 2346 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " <ogc:GmlObjectId gml:id=\""; |
| 2347 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). poFeature->GetFieldAsStringcxx . . $ OGRFeature#GetFieldAsString(afbf07f2bc1a9437).(0); |
| 2348 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "\"/>\n"; |
| 2349 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " </ogc:Filter>\n"; |
| 2350 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " </wfs:Update>\n"; |
| 2351 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "</wfs:Transaction>\n"; |
| 2352 | |
| 2353 | CPLDebug("WFS", "Post : %s", osPost.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 2354 | |
| 2355 | char **papszOptions = nullptr; |
| 2356 | papszOptions = CSLAddNameValue(papszOptions, "POSTFIELDS", osPost.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 2357 | papszOptions = |
| 2358 | CSLAddNameValue(papszOptions, "HEADERS", |
| 2359 | "Content-Type: application/xml; charset=UTF-8"); |
| 2360 | |
| 2361 | CPLHTTPResult *psResult = |
| 2362 | poDScxx . . $ OGRWFSLayer#poDS.->HTTPFetchcxx . . $ OGRWFSDataSource#HTTPFetch(38e266439c02e448).(poDScxx . . $ OGRWFSLayer#poDS.->GetPostTransactionURLcxx . . $ OGRWFSDataSource#GetPostTransactionURL(cdfd1e859161399b).(), papszOptions); |
| 2363 | CSLDestroy(papszOptions); |
| 2364 | |
| 2365 | if (psResult == nullptr) |
| 2366 | { |
| 2367 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2368 | } |
| 2369 | |
| 2370 | if (strstr(reinterpret_cast<const char *>(psResult->pabyData), |
| 2371 | "<ServiceExceptionReport") != nullptr || |
| 2372 | strstr(reinterpret_cast<const char *>(psResult->pabyData), |
| 2373 | "<ows:ExceptionReport") != nullptr) |
| 2374 | { |
| 2375 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Error returned by server : %s", |
| 2376 | psResult->pabyData); |
| 2377 | CPLHTTPDestroyResult(psResult); |
| 2378 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2379 | } |
| 2380 | |
| 2381 | CPLDebug("WFS", "Response: %s", psResult->pabyData); |
| 2382 | |
| 2383 | CPLXMLNodecxx . . $ CPLXMLNode# *psXML = |
| 2384 | CPLParseXMLString(reinterpret_cast<const char *>(psResult->pabyData)); |
| 2385 | if (psXML == nullptr) |
| 2386 | { |
| 2387 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Invalid XML content : %s", |
| 2388 | psResult->pabyData); |
| 2389 | CPLHTTPDestroyResult(psResult); |
| 2390 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2391 | } |
| 2392 | |
| 2393 | CPLStripXMLNamespace(psXML, nullptr, TRUEcxx . . $ `port/cpl_port.h:1184:9`!); |
| 2394 | int bUse100Schema = false; |
| 2395 | CPLXMLNodecxx . . $ CPLXMLNode# *psRoot = CPLGetXMLNode(psXML, "=TransactionResponse"); |
| 2396 | if (psRoot == nullptr) |
| 2397 | { |
| 2398 | psRoot = CPLGetXMLNode(psXML, "=WFS_TransactionResponse"); |
| 2399 | if (psRoot) |
| 2400 | bUse100Schema = true; |
| 2401 | } |
| 2402 | if (psRoot == nullptr) |
| 2403 | { |
| 2404 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2405 | "Cannot find <TransactionResponse>"); |
| 2406 | CPLDestroyXMLNode(psXML); |
| 2407 | CPLHTTPDestroyResult(psResult); |
| 2408 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2409 | } |
| 2410 | |
| 2411 | if (bUse100Schema) |
| 2412 | { |
| 2413 | if (CPLGetXMLNode(psRoot, "TransactionResult.Status.FAILED")) |
| 2414 | { |
| 2415 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Update failed : %s", |
| 2416 | psResult->pabyData); |
| 2417 | CPLDestroyXMLNode(psXML); |
| 2418 | CPLHTTPDestroyResult(psResult); |
| 2419 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2420 | } |
| 2421 | } |
| 2422 | |
| 2423 | CPLDestroyXMLNode(psXML); |
| 2424 | CPLHTTPDestroyResult(psResult); |
| 2425 | |
| 2426 | /* Invalidate layer */ |
| 2427 | bReloadNeededcxx . . $ OGRWFSLayer#bReloadNeeded. = true; |
| 2428 | nFeaturescxx . . $ OGRWFSLayer#nFeatures. = -1; |
| 2429 | m_oExtentscxx . . $ OGRWFSLayer#m_oExtents. = OGREnvelope(); |
| 2430 | |
| 2431 | return OGRERR_NONEcxx . . $ `ogr/ogr_core.h:390:9`!; |
| 2432 | } |
| 2433 | |
| 2434 | /************************************************************************/ |
| 2435 | /* GetFeature() */ |
| 2436 | /************************************************************************/ |
| 2437 | |
| 2438 | OGRFeaturecxx . . $ OGRFeature# *OGRWFSLayercxx . . $ OGRWFSLayer#::GetFeaturecxx . . $ OGRWFSLayer#GetFeature(86ac52c37891ada7).(GIntBigcxx . . $ GIntBig# nFID) |
| 2439 | { |
| 2440 | GetLayerDefncxx . . $ OGRWFSLayer#GetLayerDefn(448b209f43d15bcc).(); |
| 2441 | if (poBaseLayercxx . . $ OGRWFSLayer#poBaseLayer. == nullptr && poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->GetFieldIndexcxx . . $ OGRFeatureDefn#GetFieldIndex(78f035161ffa9fe2).("gml_id") == 0) |
| 2442 | { |
| 2443 | /* This is lovely hackish. We assume that then gml_id will be */ |
| 2444 | /* layer_name.number. This is actually what we can observe with */ |
| 2445 | /* GeoServer and TinyOWS */ |
| 2446 | CPLString osVal = |
| 2447 | CPLSPrintf("gml_id = '%s." CPL_FRMT_GIBcxx . . $ `port/cpl_port.h:257:9`! "'", GetShortNamecxx . . $ OGRWFSLayer#GetShortName(33a1f659e94feb42).(), nFID); |
| 2448 | CPLString osOldSQLWhere(osSQLWherecxx . . $ OGRWFSLayer#osSQLWhere.); |
| 2449 | SetAttributeFiltercxx . . $ OGRWFSLayer#SetAttributeFilter(5c4306d8553b3696).(osVal); |
| 2450 | OGRFeaturecxx . . $ OGRFeature# *poFeature = GetNextFeaturecxx . . $ OGRWFSLayer#GetNextFeature(ec9eceddec1d9563).(); |
| 2451 | const char *pszOldFilter = |
| 2452 | osOldSQLWhere.sizecxx . . $ std/__cxx11/basic_string#size(6f8bd5c0ea8fb29a).() ? osOldSQLWhere.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).() : nullptr; |
| 2453 | SetAttributeFiltercxx . . $ OGRWFSLayer#SetAttributeFilter(5c4306d8553b3696).(pszOldFilter); |
| 2454 | if (poFeature) |
| 2455 | return poFeature; |
| 2456 | } |
| 2457 | |
| 2458 | return OGRLayercxx . . $ OGRLayer#::GetFeaturecxx . . $ OGRLayer#GetFeature(86ac52c37891ada7).(nFID); |
| 2459 | } |
| 2460 | |
| 2461 | /************************************************************************/ |
| 2462 | /* DeleteFromFilter() */ |
| 2463 | /************************************************************************/ |
| 2464 | |
| 2465 | OGRErr OGRWFSLayercxx . . $ OGRWFSLayer#::DeleteFromFiltercxx . . $ OGRWFSLayer#DeleteFromFilter(7787e0c995c81e02).(const stdcxx . . $ std/::string &osOGCFilter) |
| 2466 | { |
| 2467 | if (!TestCapabilitycxx . . $ OGRWFSLayer#TestCapability(78f035161ffa9fe2).(OLCDeleteFeaturecxx . . $ `ogr/ogr_core.h:1006:9`!)) |
| 2468 | { |
| 2469 | if (!poDScxx . . $ OGRWFSLayer#poDS.->SupportTransactionscxx . . $ OGRWFSDataSource#SupportTransactions(50ce9a9e25b4a850).()) |
| 2470 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2471 | "DeleteFromFilter() not supported: no WMS-T features " |
| 2472 | "advertized by server"); |
| 2473 | else if (!poDScxx . . $ OGRWFSLayer#poDS.->UpdateModecxx . . $ OGRWFSDataSource#UpdateMode(50ce9a9e25b4a850).()) |
| 2474 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2475 | "DeleteFromFilter() not supported: datasource opened as " |
| 2476 | "read-only"); |
| 2477 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2478 | } |
| 2479 | |
| 2480 | if (poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->GetFieldIndexcxx . . $ OGRFeatureDefn#GetFieldIndex(78f035161ffa9fe2).("gml_id") != 0) |
| 2481 | { |
| 2482 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Cannot find gml_id field"); |
| 2483 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2484 | } |
| 2485 | const char *pszShortName = GetShortNamecxx . . $ OGRWFSLayer#GetShortName(33a1f659e94feb42).(); |
| 2486 | |
| 2487 | CPLString osPost; |
| 2488 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). GetPostHeadercxx . . $ OGRWFSLayer#GetPostHeader(cdfd1e859161399b).(); |
| 2489 | |
| 2490 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " <wfs:Delete xmlns:feature=\""; |
| 2491 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). osTargetNamespacecxx . . $ OGRWFSLayer#osTargetNamespace.; |
| 2492 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "\" typeName=\"feature:"; |
| 2493 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). pszShortName; |
| 2494 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "\">\n"; |
| 2495 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " <ogc:Filter>\n"; |
| 2496 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). osOGCFilter; |
| 2497 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " </ogc:Filter>\n"; |
| 2498 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " </wfs:Delete>\n"; |
| 2499 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "</wfs:Transaction>\n"; |
| 2500 | |
| 2501 | CPLDebug("WFS", "Post : %s", osPost.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 2502 | |
| 2503 | char **papszOptions = nullptr; |
| 2504 | papszOptions = CSLAddNameValue(papszOptions, "POSTFIELDS", osPost.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 2505 | papszOptions = |
| 2506 | CSLAddNameValue(papszOptions, "HEADERS", |
| 2507 | "Content-Type: application/xml; charset=UTF-8"); |
| 2508 | |
| 2509 | CPLHTTPResult *psResult = |
| 2510 | poDScxx . . $ OGRWFSLayer#poDS.->HTTPFetchcxx . . $ OGRWFSDataSource#HTTPFetch(38e266439c02e448).(poDScxx . . $ OGRWFSLayer#poDS.->GetPostTransactionURLcxx . . $ OGRWFSDataSource#GetPostTransactionURL(cdfd1e859161399b).(), papszOptions); |
| 2511 | CSLDestroy(papszOptions); |
| 2512 | |
| 2513 | if (psResult == nullptr) |
| 2514 | { |
| 2515 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2516 | } |
| 2517 | |
| 2518 | if (strstr(reinterpret_cast<const char *>(psResult->pabyData), |
| 2519 | "<ServiceExceptionReport") != nullptr || |
| 2520 | strstr(reinterpret_cast<const char *>(psResult->pabyData), |
| 2521 | "<ows:ExceptionReport") != nullptr) |
| 2522 | { |
| 2523 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Error returned by server : %s", |
| 2524 | psResult->pabyData); |
| 2525 | CPLHTTPDestroyResult(psResult); |
| 2526 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2527 | } |
| 2528 | |
| 2529 | CPLDebug("WFS", "Response: %s", psResult->pabyData); |
| 2530 | |
| 2531 | CPLXMLNodecxx . . $ CPLXMLNode# *psXML = |
| 2532 | CPLParseXMLString(reinterpret_cast<const char *>(psResult->pabyData)); |
| 2533 | if (psXML == nullptr) |
| 2534 | { |
| 2535 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Invalid XML content : %s", |
| 2536 | psResult->pabyData); |
| 2537 | CPLHTTPDestroyResult(psResult); |
| 2538 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2539 | } |
| 2540 | |
| 2541 | CPLStripXMLNamespace(psXML, nullptr, TRUEcxx . . $ `port/cpl_port.h:1184:9`!); |
| 2542 | bool bUse100Schema = false; |
| 2543 | CPLXMLNodecxx . . $ CPLXMLNode# *psRoot = CPLGetXMLNode(psXML, "=TransactionResponse"); |
| 2544 | if (psRoot == nullptr) |
| 2545 | { |
| 2546 | psRoot = CPLGetXMLNode(psXML, "=WFS_TransactionResponse"); |
| 2547 | if (psRoot) |
| 2548 | bUse100Schema = true; |
| 2549 | } |
| 2550 | if (psRoot == nullptr) |
| 2551 | { |
| 2552 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2553 | "Cannot find <TransactionResponse>"); |
| 2554 | CPLDestroyXMLNode(psXML); |
| 2555 | CPLHTTPDestroyResult(psResult); |
| 2556 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2557 | } |
| 2558 | |
| 2559 | if (bUse100Schema) |
| 2560 | { |
| 2561 | if (CPLGetXMLNode(psRoot, "TransactionResult.Status.FAILED")) |
| 2562 | { |
| 2563 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Delete failed : %s", |
| 2564 | psResult->pabyData); |
| 2565 | CPLDestroyXMLNode(psXML); |
| 2566 | CPLHTTPDestroyResult(psResult); |
| 2567 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2568 | } |
| 2569 | } |
| 2570 | |
| 2571 | CPLDestroyXMLNode(psXML); |
| 2572 | CPLHTTPDestroyResult(psResult); |
| 2573 | |
| 2574 | /* Invalidate layer */ |
| 2575 | bReloadNeededcxx . . $ OGRWFSLayer#bReloadNeeded. = true; |
| 2576 | nFeaturescxx . . $ OGRWFSLayer#nFeatures. = -1; |
| 2577 | m_oExtentscxx . . $ OGRWFSLayer#m_oExtents. = OGREnvelope(); |
| 2578 | |
| 2579 | return OGRERR_NONEcxx . . $ `ogr/ogr_core.h:390:9`!; |
| 2580 | } |
| 2581 | |
| 2582 | /************************************************************************/ |
| 2583 | /* DeleteFeature() */ |
| 2584 | /************************************************************************/ |
| 2585 | |
| 2586 | OGRErr OGRWFSLayercxx . . $ OGRWFSLayer#::DeleteFeaturecxx . . $ OGRWFSLayer#DeleteFeature(a070d6d14e988596).(GIntBigcxx . . $ GIntBig# nFID) |
| 2587 | { |
| 2588 | if (!TestCapabilitycxx . . $ OGRWFSLayer#TestCapability(78f035161ffa9fe2).(OLCDeleteFeaturecxx . . $ `ogr/ogr_core.h:1006:9`!)) |
| 2589 | { |
| 2590 | if (!poDScxx . . $ OGRWFSLayer#poDS.->SupportTransactionscxx . . $ OGRWFSDataSource#SupportTransactions(50ce9a9e25b4a850).()) |
| 2591 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2592 | "DeleteFeature() not supported: no WMS-T features " |
| 2593 | "advertized by server"); |
| 2594 | else if (!poDScxx . . $ OGRWFSLayer#poDS.->UpdateModecxx . . $ OGRWFSDataSource#UpdateMode(50ce9a9e25b4a850).()) |
| 2595 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2596 | "DeleteFeature() not supported: datasource opened as " |
| 2597 | "read-only"); |
| 2598 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2599 | } |
| 2600 | |
| 2601 | if (poFeatureDefncxx . . $ OGRWFSLayer#poFeatureDefn.->GetFieldIndexcxx . . $ OGRFeatureDefn#GetFieldIndex(78f035161ffa9fe2).("gml_id") != 0) |
| 2602 | { |
| 2603 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Cannot find gml_id field"); |
| 2604 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2605 | } |
| 2606 | |
| 2607 | OGRFeaturecxx . . $ OGRFeature# *poFeature = GetFeaturecxx . . $ OGRWFSLayer#GetFeature(86ac52c37891ada7).(nFID); |
| 2608 | if (poFeature == nullptr) |
| 2609 | { |
| 2610 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2611 | "Cannot find feature " CPL_FRMT_GIBcxx . . $ `port/cpl_port.h:257:9`!, nFID); |
| 2612 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2613 | } |
| 2614 | |
| 2615 | const char *pszGMLID = poFeature->GetFieldAsStringcxx . . $ OGRFeature#GetFieldAsString(865ea18671f48fc1).("gml_id"); |
| 2616 | if (pszGMLID == nullptr) |
| 2617 | { |
| 2618 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2619 | "Cannot delete a feature with gml_id unset"); |
| 2620 | delete poFeature; |
| 2621 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2622 | } |
| 2623 | |
| 2624 | if (bInTransactioncxx . . $ OGRWFSLayer#bInTransaction.) |
| 2625 | { |
| 2626 | CPLError( |
| 2627 | CE_Warning, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2628 | "DeleteFeature() not yet dealt in transaction. Issued immediately"); |
| 2629 | } |
| 2630 | |
| 2631 | CPLString osGMLID = pszGMLID; |
| 2632 | pszGMLID = nullptr; |
| 2633 | delete poFeature; |
| 2634 | poFeature = nullptr; |
| 2635 | |
| 2636 | CPLString osFilter; |
| 2637 | osFilter = "<ogc:FeatureId fid=\""; |
| 2638 | osFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). osGMLID; |
| 2639 | osFilter +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "\"/>\n"; |
| 2640 | return DeleteFromFiltercxx . . $ OGRWFSLayer#DeleteFromFilter(7787e0c995c81e02).(osFilter); |
| 2641 | } |
| 2642 | |
| 2643 | /************************************************************************/ |
| 2644 | /* StartTransaction() */ |
| 2645 | /************************************************************************/ |
| 2646 | |
| 2647 | OGRErr OGRWFSLayercxx . . $ OGRWFSLayer#::StartTransactioncxx . . $ OGRWFSLayer#StartTransaction(b126dc7c1de90089).() |
| 2648 | { |
| 2649 | if (!TestCapabilitycxx . . $ OGRWFSLayer#TestCapability(78f035161ffa9fe2).(OLCTransactionscxx . . $ `ogr/ogr_core.h:1003:9`!)) |
| 2650 | { |
| 2651 | if (!poDScxx . . $ OGRWFSLayer#poDS.->SupportTransactionscxx . . $ OGRWFSDataSource#SupportTransactions(50ce9a9e25b4a850).()) |
| 2652 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2653 | "StartTransaction() not supported: no WMS-T features " |
| 2654 | "advertized by server"); |
| 2655 | else if (!poDScxx . . $ OGRWFSLayer#poDS.->UpdateModecxx . . $ OGRWFSDataSource#UpdateMode(50ce9a9e25b4a850).()) |
| 2656 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2657 | "StartTransaction() not supported: datasource opened as " |
| 2658 | "read-only"); |
| 2659 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2660 | } |
| 2661 | |
| 2662 | if (bInTransactioncxx . . $ OGRWFSLayer#bInTransaction.) |
| 2663 | { |
| 2664 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2665 | "StartTransaction() has already been called"); |
| 2666 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2667 | } |
| 2668 | |
| 2669 | bInTransactioncxx . . $ OGRWFSLayer#bInTransaction. = true; |
| 2670 | osGlobalInsertcxx . . $ OGRWFSLayer#osGlobalInsert. = ""; |
| 2671 | nExpectedInsertscxx . . $ OGRWFSLayer#nExpectedInserts. = 0; |
| 2672 | aosFIDListcxx . . $ OGRWFSLayer#aosFIDList..resizecxx . . $ std/vector#resize(2c44cd906ae4e829).(0); |
| 2673 | |
| 2674 | return OGRERR_NONEcxx . . $ `ogr/ogr_core.h:390:9`!; |
| 2675 | } |
| 2676 | |
| 2677 | /************************************************************************/ |
| 2678 | /* CommitTransaction() */ |
| 2679 | /************************************************************************/ |
| 2680 | |
| 2681 | OGRErr OGRWFSLayercxx . . $ OGRWFSLayer#::CommitTransactioncxx . . $ OGRWFSLayer#CommitTransaction(b126dc7c1de90089).() |
| 2682 | { |
| 2683 | if (!TestCapabilitycxx . . $ OGRWFSLayer#TestCapability(78f035161ffa9fe2).(OLCTransactionscxx . . $ `ogr/ogr_core.h:1003:9`!)) |
| 2684 | { |
| 2685 | if (!poDScxx . . $ OGRWFSLayer#poDS.->SupportTransactionscxx . . $ OGRWFSDataSource#SupportTransactions(50ce9a9e25b4a850).()) |
| 2686 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2687 | "CommitTransaction() not supported: no WMS-T features " |
| 2688 | "advertized by server"); |
| 2689 | else if (!poDScxx . . $ OGRWFSLayer#poDS.->UpdateModecxx . . $ OGRWFSDataSource#UpdateMode(50ce9a9e25b4a850).()) |
| 2690 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2691 | "CommitTransaction() not supported: datasource opened as " |
| 2692 | "read-only"); |
| 2693 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2694 | } |
| 2695 | |
| 2696 | if (!bInTransactioncxx . . $ OGRWFSLayer#bInTransaction.) |
| 2697 | { |
| 2698 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2699 | "StartTransaction() has not yet been called"); |
| 2700 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2701 | } |
| 2702 | |
| 2703 | if (!osGlobalInsertcxx . . $ OGRWFSLayer#osGlobalInsert..emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) |
| 2704 | { |
| 2705 | CPLString osPost = GetPostHeadercxx . . $ OGRWFSLayer#GetPostHeader(cdfd1e859161399b).(); |
| 2706 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " <wfs:Insert>\n"; |
| 2707 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). osGlobalInsertcxx . . $ OGRWFSLayer#osGlobalInsert.; |
| 2708 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " </wfs:Insert>\n"; |
| 2709 | osPost +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). "</wfs:Transaction>\n"; |
| 2710 | |
| 2711 | bInTransactioncxx . . $ OGRWFSLayer#bInTransaction. = false; |
| 2712 | osGlobalInsertcxx . . $ OGRWFSLayer#osGlobalInsert. = ""; |
| 2713 | int l_nExpectedInserts = nExpectedInsertscxx . . $ OGRWFSLayer#nExpectedInserts.; |
| 2714 | nExpectedInsertscxx . . $ OGRWFSLayer#nExpectedInserts. = 0; |
| 2715 | |
| 2716 | CPLDebug("WFS", "Post : %s", osPost.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 2717 | |
| 2718 | char **papszOptions = nullptr; |
| 2719 | papszOptions = |
| 2720 | CSLAddNameValue(papszOptions, "POSTFIELDS", osPost.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 2721 | papszOptions = |
| 2722 | CSLAddNameValue(papszOptions, "HEADERS", |
| 2723 | "Content-Type: application/xml; charset=UTF-8"); |
| 2724 | |
| 2725 | CPLHTTPResult *psResult = |
| 2726 | poDScxx . . $ OGRWFSLayer#poDS.->HTTPFetchcxx . . $ OGRWFSDataSource#HTTPFetch(38e266439c02e448).(poDScxx . . $ OGRWFSLayer#poDS.->GetPostTransactionURLcxx . . $ OGRWFSDataSource#GetPostTransactionURL(cdfd1e859161399b).(), papszOptions); |
| 2727 | CSLDestroy(papszOptions); |
| 2728 | |
| 2729 | if (psResult == nullptr) |
| 2730 | { |
| 2731 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2732 | } |
| 2733 | |
| 2734 | if (strstr(reinterpret_cast<const char *>(psResult->pabyData), |
| 2735 | "<ServiceExceptionReport") != nullptr || |
| 2736 | strstr(reinterpret_cast<const char *>(psResult->pabyData), |
| 2737 | "<ows:ExceptionReport") != nullptr) |
| 2738 | { |
| 2739 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2740 | "Error returned by server : %s", psResult->pabyData); |
| 2741 | CPLHTTPDestroyResult(psResult); |
| 2742 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2743 | } |
| 2744 | |
| 2745 | CPLDebug("WFS", "Response: %s", psResult->pabyData); |
| 2746 | |
| 2747 | CPLXMLNodecxx . . $ CPLXMLNode# *psXML = CPLParseXMLString( |
| 2748 | reinterpret_cast<const char *>(psResult->pabyData)); |
| 2749 | if (psXML == nullptr) |
| 2750 | { |
| 2751 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Invalid XML content : %s", |
| 2752 | psResult->pabyData); |
| 2753 | CPLHTTPDestroyResult(psResult); |
| 2754 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2755 | } |
| 2756 | |
| 2757 | CPLStripXMLNamespace(psXML, nullptr, TRUEcxx . . $ `port/cpl_port.h:1184:9`!); |
| 2758 | bool bUse100Schema = false; |
| 2759 | CPLXMLNodecxx . . $ CPLXMLNode# *psRoot = CPLGetXMLNode(psXML, "=TransactionResponse"); |
| 2760 | if (psRoot == nullptr) |
| 2761 | { |
| 2762 | psRoot = CPLGetXMLNode(psXML, "=WFS_TransactionResponse"); |
| 2763 | if (psRoot) |
| 2764 | bUse100Schema = true; |
| 2765 | } |
| 2766 | |
| 2767 | if (psRoot == nullptr) |
| 2768 | { |
| 2769 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2770 | "Cannot find <TransactionResponse>"); |
| 2771 | CPLDestroyXMLNode(psXML); |
| 2772 | CPLHTTPDestroyResult(psResult); |
| 2773 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2774 | } |
| 2775 | |
| 2776 | if (bUse100Schema) |
| 2777 | { |
| 2778 | if (CPLGetXMLNode(psRoot, "TransactionResult.Status.FAILED")) |
| 2779 | { |
| 2780 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Insert failed : %s", |
| 2781 | psResult->pabyData); |
| 2782 | CPLDestroyXMLNode(psXML); |
| 2783 | CPLHTTPDestroyResult(psResult); |
| 2784 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2785 | } |
| 2786 | |
| 2787 | /* TODO */ |
| 2788 | } |
| 2789 | else |
| 2790 | { |
| 2791 | int nGotInserted = atoicxx . . $ atoi(f5ecf3191ed0cd93).( |
| 2792 | CPLGetXMLValue(psRoot, "TransactionSummary.totalInserted", "")); |
| 2793 | if (nGotInserted != l_nExpectedInserts) |
| 2794 | { |
| 2795 | CPLError( |
| 2796 | CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2797 | "Only %d features were inserted whereas %d where expected", |
| 2798 | nGotInserted, l_nExpectedInserts); |
| 2799 | CPLDestroyXMLNode(psXML); |
| 2800 | CPLHTTPDestroyResult(psResult); |
| 2801 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2802 | } |
| 2803 | |
| 2804 | CPLXMLNodecxx . . $ CPLXMLNode# *psInsertResults = |
| 2805 | CPLGetXMLNode(psRoot, "InsertResults"); |
| 2806 | if (psInsertResults == nullptr) |
| 2807 | { |
| 2808 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2809 | "Cannot find node InsertResults"); |
| 2810 | CPLDestroyXMLNode(psXML); |
| 2811 | CPLHTTPDestroyResult(psResult); |
| 2812 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2813 | } |
| 2814 | |
| 2815 | aosFIDListcxx . . $ OGRWFSLayer#aosFIDList..resizecxx . . $ std/vector#resize(2c44cd906ae4e829).(0); |
| 2816 | |
| 2817 | CPLXMLNodecxx . . $ CPLXMLNode# *psChild = psInsertResults->psChildcxx . . $ CPLXMLNode#psChild.; |
| 2818 | while (psChild) |
| 2819 | { |
| 2820 | const char *pszFID = |
| 2821 | CPLGetXMLValue(psChild, "FeatureId.fid", nullptr); |
| 2822 | if (pszFID == nullptr) |
| 2823 | { |
| 2824 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Cannot find fid"); |
| 2825 | CPLDestroyXMLNode(psXML); |
| 2826 | CPLHTTPDestroyResult(psResult); |
| 2827 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2828 | } |
| 2829 | aosFIDListcxx . . $ OGRWFSLayer#aosFIDList..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(pszFID); |
| 2830 | |
| 2831 | psChild = psChild->psNextcxx . . $ CPLXMLNode#psNext.; |
| 2832 | } |
| 2833 | |
| 2834 | if (static_cast<int>(aosFIDListcxx . . $ OGRWFSLayer#aosFIDList..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).()) != nGotInserted) |
| 2835 | { |
| 2836 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2837 | "Inconsistent InsertResults: did not get expected FID " |
| 2838 | "count"); |
| 2839 | CPLDestroyXMLNode(psXML); |
| 2840 | CPLHTTPDestroyResult(psResult); |
| 2841 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2842 | } |
| 2843 | } |
| 2844 | |
| 2845 | CPLDestroyXMLNode(psXML); |
| 2846 | CPLHTTPDestroyResult(psResult); |
| 2847 | } |
| 2848 | |
| 2849 | bInTransactioncxx . . $ OGRWFSLayer#bInTransaction. = false; |
| 2850 | osGlobalInsertcxx . . $ OGRWFSLayer#osGlobalInsert. = ""; |
| 2851 | nExpectedInsertscxx . . $ OGRWFSLayer#nExpectedInserts. = 0; |
| 2852 | |
| 2853 | return OGRERR_NONEcxx . . $ `ogr/ogr_core.h:390:9`!; |
| 2854 | } |
| 2855 | |
| 2856 | /************************************************************************/ |
| 2857 | /* RollbackTransaction() */ |
| 2858 | /************************************************************************/ |
| 2859 | |
| 2860 | OGRErr OGRWFSLayercxx . . $ OGRWFSLayer#::RollbackTransactioncxx . . $ OGRWFSLayer#RollbackTransaction(b126dc7c1de90089).() |
| 2861 | { |
| 2862 | if (!TestCapabilitycxx . . $ OGRWFSLayer#TestCapability(78f035161ffa9fe2).(OLCTransactionscxx . . $ `ogr/ogr_core.h:1003:9`!)) |
| 2863 | { |
| 2864 | if (!poDScxx . . $ OGRWFSLayer#poDS.->SupportTransactionscxx . . $ OGRWFSDataSource#SupportTransactions(50ce9a9e25b4a850).()) |
| 2865 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2866 | "RollbackTransaction() not supported: no WMS-T features " |
| 2867 | "advertized by server"); |
| 2868 | else if (!poDScxx . . $ OGRWFSLayer#poDS.->UpdateModecxx . . $ OGRWFSDataSource#UpdateMode(50ce9a9e25b4a850).()) |
| 2869 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2870 | "RollbackTransaction() not supported: datasource opened " |
| 2871 | "as read-only"); |
| 2872 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2873 | } |
| 2874 | |
| 2875 | if (!bInTransactioncxx . . $ OGRWFSLayer#bInTransaction.) |
| 2876 | { |
| 2877 | CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, |
| 2878 | "StartTransaction() has not yet been called"); |
| 2879 | return OGRERR_FAILUREcxx . . $ `ogr/ogr_core.h:396:9`!; |
| 2880 | } |
| 2881 | |
| 2882 | bInTransactioncxx . . $ OGRWFSLayer#bInTransaction. = false; |
| 2883 | osGlobalInsertcxx . . $ OGRWFSLayer#osGlobalInsert. = ""; |
| 2884 | nExpectedInsertscxx . . $ OGRWFSLayer#nExpectedInserts. = 0; |
| 2885 | |
| 2886 | return OGRERR_NONEcxx . . $ `ogr/ogr_core.h:390:9`!; |
| 2887 | } |
| 2888 | |
| 2889 | /************************************************************************/ |
| 2890 | /* SetRequiredOutputFormat() */ |
| 2891 | /************************************************************************/ |
| 2892 | |
| 2893 | void OGRWFSLayercxx . . $ OGRWFSLayer#::SetRequiredOutputFormatcxx . . $ OGRWFSLayer#SetRequiredOutputFormat(85c52e162fed56f9).(const char *pszRequiredOutputFormatIn) |
| 2894 | { |
| 2895 | CPLFreecxx . . $ `port/cpl_conv.h:97:9`!(pszRequiredOutputFormatcxx . . $ OGRWFSLayer#pszRequiredOutputFormat.); |
| 2896 | if (pszRequiredOutputFormatIn) |
| 2897 | { |
| 2898 | pszRequiredOutputFormatcxx . . $ OGRWFSLayer#pszRequiredOutputFormat. = CPLStrdup(pszRequiredOutputFormatIn); |
| 2899 | } |
| 2900 | else |
| 2901 | { |
| 2902 | pszRequiredOutputFormatcxx . . $ OGRWFSLayer#pszRequiredOutputFormat. = nullptr; |
| 2903 | } |
| 2904 | } |
| 2905 | |
| 2906 | /************************************************************************/ |
| 2907 | /* SetOrderBy() */ |
| 2908 | /************************************************************************/ |
| 2909 | |
| 2910 | void OGRWFSLayercxx . . $ OGRWFSLayer#::SetOrderBycxx . . $ OGRWFSLayer#SetOrderBy(5c6e251d6fc92618).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<OGRWFSSortDesccxx . . $ OGRWFSSortDesc#> &aoSortColumnsIn) |
| 2911 | { |
| 2912 | aoSortColumnscxx . . $ OGRWFSLayer#aoSortColumns. =cxx . . $ std/vector#`operator=`(e6b68e61becad66f). aoSortColumnsIn; |
| 2913 | } |