MCPcopy Create free account
hub / github.com/OSGeo/PROJ / createEngineeringDatum

Method createEngineeringDatum

src/iso19111/factory.cpp:5108–5143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5106 */
5107
5108datum::EngineeringDatumNNPtr
5109AuthorityFactory::createEngineeringDatum(const std::string &code) const {
5110 auto res = d->runWithCodeParam(
5111 "SELECT name, publication_date, "
5112 "anchor, anchor_epoch, deprecated FROM "
5113 "engineering_datum WHERE auth_name = ? AND code = ?",
5114 code);
5115 if (res.empty()) {
5116 throw NoSuchAuthorityCodeException("engineering datum not found",
5117 d->authority(), code);
5118 }
5119 try {
5120 const auto &row = res.front();
5121 const auto &name = row[0];
5122 const auto &publication_date = row[1];
5123 const auto &anchor = row[2];
5124 const auto &anchor_epoch = row[3];
5125 const bool deprecated = row[4] == "1";
5126 auto props = d->createPropertiesSearchUsages("engineering_datum", code,
5127 name, deprecated);
5128
5129 if (!publication_date.empty()) {
5130 props.set("PUBLICATION_DATE", publication_date);
5131 }
5132 if (!anchor_epoch.empty()) {
5133 props.set("ANCHOR_EPOCH", anchor_epoch);
5134 }
5135 auto anchorOpt = util::optional<std::string>();
5136 if (!anchor.empty())
5137 anchorOpt = anchor;
5138 return datum::EngineeringDatum::create(props, anchorOpt);
5139 } catch (const std::exception &ex) {
5140 throw buildFactoryException("engineering datum", d->authority(), code,
5141 ex);
5142 }
5143}
5144
5145// ---------------------------------------------------------------------------
5146

Callers 3

TESTFunction · 0.80
createEngineeringCRSMethod · 0.80

Calls 5

buildFactoryExceptionFunction · 0.85
runWithCodeParamMethod · 0.80
setMethod · 0.80
emptyMethod · 0.45

Tested by 1

TESTFunction · 0.64