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

Method createCompoundCRSFromExisting

src/iso19111/factory.cpp:10314–10364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10312// ---------------------------------------------------------------------------
10313
10314std::list<crs::CompoundCRSNNPtr>
10315AuthorityFactory::createCompoundCRSFromExisting(
10316 const crs::CompoundCRSNNPtr &crs) const {
10317 std::list<crs::CompoundCRSNNPtr> res;
10318
10319 auto lockedThisFactory(d->getSharedFromThis());
10320 assert(lockedThisFactory);
10321
10322 const auto &components = crs->componentReferenceSystems();
10323 if (components.size() != 2) {
10324 return res;
10325 }
10326 auto candidatesHorizCRS = components[0]->identify(lockedThisFactory);
10327 auto candidatesVertCRS = components[1]->identify(lockedThisFactory);
10328 if (candidatesHorizCRS.empty() && candidatesVertCRS.empty()) {
10329 return res;
10330 }
10331
10332 std::string sql("SELECT auth_name, code FROM compound_crs WHERE "
10333 "deprecated = 0 AND ");
10334 ListOfParams params;
10335 bool addAnd = false;
10336 if (!candidatesHorizCRS.empty()) {
10337 sql += buildSqlLookForAuthNameCode(candidatesHorizCRS, params,
10338 "horiz_crs_");
10339 addAnd = true;
10340 }
10341 if (!candidatesVertCRS.empty()) {
10342 if (addAnd) {
10343 sql += " AND ";
10344 }
10345 sql += buildSqlLookForAuthNameCode(candidatesVertCRS, params,
10346 "vertical_crs_");
10347 addAnd = true;
10348 }
10349 if (d->hasAuthorityRestriction()) {
10350 if (addAnd) {
10351 sql += " AND ";
10352 }
10353 sql += "auth_name = ?";
10354 params.emplace_back(d->authority());
10355 }
10356
10357 auto sqlRes = d->run(sql, params);
10358 for (const auto &row : sqlRes) {
10359 const auto &auth_name = row[0];
10360 const auto &code = row[1];
10361 res.emplace_back(d->createFactory(auth_name)->createCompoundCRS(code));
10362 }
10363 return res;
10364}
10365
10366// ---------------------------------------------------------------------------
10367

Callers 1

identifyMethod · 0.80

Calls 9

getSharedFromThisMethod · 0.80
sizeMethod · 0.80
createFactoryMethod · 0.80
identifyMethod · 0.45
emptyMethod · 0.45
runMethod · 0.45
createCompoundCRSMethod · 0.45

Tested by

no test coverage detected