25 #include <boost/algorithm/string.hpp> 28 #include "../../../../core/uri/URI.h" 29 #include "../../../../common/StringUtils.h" 30 #include "../../../core/Exception.h" 41 reader->setValidationScheme(
false);
42 reader->setDoSchema(
false);
43 reader->setIgnoreWhiteSpaces(
true);
47 reader->read(xmlPath);
61 if(!boost::iequals(reader->getElementLocalName(),
"Capabilities"))
71 if(boost::iequals(reader->getElementLocalName(),
"OperationsMetadata"))
73 while(reader->next() && !(
te::xml::END_ELEMENT && boost::iequals(reader->getElementLocalName(),
"OperationsMetadata")))
75 if(reader->getNodeType() ==
te::xml::START_ELEMENT && boost::iequals(reader->getElementLocalName(),
"Operation") && reader->hasAttrs())
77 capabilities.
operations.push_back(reader->getAttr(0));
81 else if(boost::iequals(reader->getElementLocalName(),
"Contents"))
83 while(reader->next() && !(
te::xml::END_ELEMENT && boost::iequals(reader->getElementLocalName(),
"Contents")))
85 if(boost::iequals(reader->getElementLocalName(),
"CoverageSummary"))
87 while(reader->next() && !(
te::xml::END_ELEMENT && boost::iequals(reader->getElementLocalName(),
"CoverageSummary")))
89 if(reader->getNodeType() ==
te::xml::VALUE && boost::iequals(reader->getElementLocalName(),
"CoverageId"))
91 capabilities.
coverages.push_back(reader->getElementValue());
106 reader->setValidationScheme(
false);
107 reader->setDoSchema(
false);
108 reader->setIgnoreWhiteSpaces(
true);
110 reader->read(xmlPath);
118 if(!boost::algorithm::iequals(reader->getElementLocalName(),
"CoverageDescriptions"))
127 std::vector< std::string > fieldNames;
130 while(reader->next())
134 if(boost::iequals(reader->getElementLocalName(),
"CoverageId"))
136 while(reader->next() && !(reader->getNodeType() ==
te::xml::END_ELEMENT && boost::iequals(reader->getElementLocalName(),
"CoverageId")))
140 if(boost::iequals(reader->getElementLocalName(),
"CoverageId"))
141 coverageDescription.
coverageId = reader->getElementValue();
145 else if(boost::algorithm::iequals(reader->getElementLocalName(),
"boundedBy"))
147 while(reader->next() && !(reader->getNodeType() ==
te::xml::END_ELEMENT && boost::iequals(reader->getElementLocalName(),
"boundedBy")))
149 if((boost::iequals(reader->getElementLocalName(),
"Envelope") || boost::iequals(reader->getElementLocalName(),
"EnvelopeWithTimePeriod")) && reader->hasAttrs())
151 std::stringstream axis, uom;
152 for(
unsigned int i = 0; i < reader->getNumberOfAttrs(); i++)
154 if(boost::iequals(reader->getAttrLocalName(i),
"srsName"))
156 envelope.
srsName = reader->getAttr(i);
162 std::string path = url.
path();
165 std::string code = elements.back();
168 std::string auth = elements.back();
170 envelope.
srsName = auth +
":" + code;
175 else if(boost::iequals(reader->getAttrLocalName(i),
"axisLabels"))
176 axis.str(reader->getAttr(i));
177 else if(boost::iequals(reader->getAttrLocalName(i),
"uomLabels"))
178 uom.str(reader->getAttr(i));
179 else if(boost::iequals(reader->getAttrLocalName(i),
"srsDimension"))
209 std::stringstream lower, upper;
212 && (boost::iequals(reader->getElementLocalName(),
"Envelope")
213 || boost::iequals(reader->getElementLocalName(),
"EnvelopeWithTimePeriod"))))
218 if(boost::iequals(reader->getElementLocalName(),
"lowerCorner"))
219 lower.str(reader->getElementValue());
220 else if(boost::iequals(reader->getElementLocalName(),
"upperCorner"))
221 upper.str(reader->getElementValue());
222 else if(boost::iequals(reader->getElementLocalName(),
"beginPosition"))
224 else if(boost::iequals(reader->getElementLocalName(),
"endPosition"))
257 else if(boost::iequals(reader->getElementLocalName(),
"metadata"))
261 if(boost::iequals(reader->getElementLocalName(),
"Extension"))
265 if(boost::iequals(reader->getElementLocalName(),
"TimeDomain"))
271 else if(boost::iequals(reader->getElementLocalName(),
"domainSet"))
273 std::stringstream axis;
274 std::stringstream low;
275 std::stringstream high;
277 while(reader->next() && !(reader->getNodeType() ==
te::xml::END_ELEMENT && boost::iequals(reader->getElementLocalName(),
"domainSet")))
281 if(boost::iequals(reader->getElementLocalName(),
"axisLabels"))
282 axis.str(reader->getElementValue());
283 else if(boost::iequals(reader->getElementLocalName(),
"low"))
284 low.str(reader->getElementValue());
285 else if(boost::iequals(reader->getElementLocalName(),
"high"))
286 high.str(reader->getElementValue());
296 subSet.
axis = element;
302 subSet.
min = element;
309 subSet.
max = element;
312 domainSet.
subSet.push_back(subSet);
315 else if(boost::iequals(reader->getElementLocalName(),
"rangeType"))
317 while(reader->next() && !(reader->getNodeType() ==
te::xml::END_ELEMENT && boost::iequals(reader->getElementLocalName(),
"rangeType")))
319 if(boost::iequals(reader->getElementLocalName(),
"field") && reader->hasAttrs())
321 for(
unsigned int i = 0; i < reader->getNumberOfAttrs(); i++)
323 if(boost::iequals(reader->getAttrLocalName(i),
"name"))
324 fieldNames.push_back(reader->getAttr(i));
329 else if(boost::iequals(reader->getElementLocalName(),
"ServiceParameters"))
331 while(reader->next() && !(reader->getNodeType() ==
te::xml::END_ELEMENT && boost::iequals(reader->getElementLocalName(),
"ServiceParameters")))
335 if(boost::iequals(reader->getElementLocalName(),
"CoverageSubtype"))
337 else if(boost::iequals(reader->getElementLocalName(),
"coverageSubtypeParent"))
339 else if(boost::iequals(reader->getElementLocalName(),
"nativeFormat"))
340 serviceParameters.
nativeFormat = reader->getElementValue();
341 else if(boost::iequals(reader->getElementLocalName(),
"extension"))
342 serviceParameters.
extension = reader->getElementValue();
349 coverageDescription.
envelope = envelope;
350 coverageDescription.
domainSet = domainSet;
355 return coverageDescription;
362 if(reader->hasAttrs())
364 timeDomain.
defaultTime = reader->getAttr(
"default");
367 std::vector<TimeInstant> timeInstant;
369 while(reader->next() && !(reader->getNodeType() ==
te::xml::END_ELEMENT && boost::iequals(reader->getElementLocalName(),
"TimeDomain")))
371 if(boost::iequals(reader->getElementLocalName(),
"TimeInstant"))
375 if(reader->hasAttrs())
377 time.
id = reader->getAttr(
"gml:id");
380 while(reader->next() && !(reader->getNodeType() ==
te::xml::END_ELEMENT && boost::iequals(reader->getElementLocalName(),
"TimeInstant")))
384 if(boost::iequals(reader->getElementLocalName(),
"timePosition"))
389 timeInstant.push_back(time);
TimeDomain parseTimeDomain(const std::unique_ptr< te::xml::Reader > &reader)
std::vector< std::string > uomLabels
std::string path() const
Retrieving the path.
TECOMMONEXPORT std::vector< std::string > SplitString(const std::string &str, const char &delimiter)
CoverageDescription parseDescribeCoverage(const std::string &xmlPath)
std::string lowerCorner_Y
std::string coverageSubtype
bool isValid() const
Return if the given URI is valid or not.
std::vector< std::string > fieldNames
static te::xml::Reader * make()
It creates a new XML reader using the dafault implementation.
#define TE_TR(message)
It marks a string in order to get translated.
std::vector< std::string > coverages
The TimeDomain GeoServer WCS 2.0.1 struct.
std::string upperCorner_X
boost::error_info< struct tag_error_description, std::string > ErrorDescription
The base type for error report messages.
std::vector< TimeInstant > timeInstant
std::vector< SubSet > subSet
std::string coverageSubtypeParent
te::da::DataSourceCapabilities capabilities
std::vector< std::string > operations
EnvelopeWithTimePeriod envelope
Base exception class for WS Core Runtime Library.
std::string upperCorner_Y
A class for representing an Uniform Resource Identifier (URI).
Capabilities parseCapabilities(const std::string &xmlPath)
std::string lowerCorner_X
Parse the WCS XML to a WCS struct.
ServiceParameters serviceParameters
std::string beginPosition
The TimeInstant GML 3.2.1 struct.