diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2021-03-04 11:39:22 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-04 11:39:22 +0100 |
| commit | da406335b35b3751eed6c0a8dea6fd820c50dccf (patch) | |
| tree | f87b70f0394460ab605b541265b62fdd539c5d14 | |
| parent | d7d5e48de5d6775f72fcfec67a077a47618da313 (diff) | |
| parent | d5e07c53993d73cdc85c6cbe48694aa9cc3872f4 (diff) | |
| download | PROJ-da406335b35b3751eed6c0a8dea6fd820c50dccf.tar.gz PROJ-da406335b35b3751eed6c0a8dea6fd820c50dccf.zip | |
Merge pull request #2553 from rouault/backport_8.0_clang_format
[Backport 8.0] Reformat code with clang-format-10 from ubuntu 20.04
32 files changed, 871 insertions, 763 deletions
diff --git a/include/proj/common.hpp b/include/proj/common.hpp index cedb94c9..fa957c93 100644 --- a/include/proj/common.hpp +++ b/include/proj/common.hpp @@ -344,8 +344,9 @@ class PROJ_GCC_DLL IdentifiedObject : public util::BaseObject, const io::DatabaseContextPtr &dbContext = nullptr) const override; PROJ_INTERNAL bool _isEquivalentTo( - const IdentifiedObject *other, util::IComparable::Criterion criterion = - util::IComparable::Criterion::STRICT, + const IdentifiedObject *other, + util::IComparable::Criterion criterion = + util::IComparable::Criterion::STRICT, const io::DatabaseContextPtr &dbContext = nullptr) PROJ_PURE_DECL; //! @endcond diff --git a/include/proj/coordinateoperation.hpp b/include/proj/coordinateoperation.hpp index 7868de4d..ede55fed 100644 --- a/include/proj/coordinateoperation.hpp +++ b/include/proj/coordinateoperation.hpp @@ -583,18 +583,18 @@ class PROJ_GCC_DLL SingleOperation : virtual public CoordinateOperation { PROJ_DLL const OperationMethodNNPtr &method() PROJ_PURE_DECL; PROJ_DLL const ParameterValuePtr & - parameterValue(const std::string ¶mName, int epsg_code = 0) const - noexcept; + parameterValue(const std::string ¶mName, + int epsg_code = 0) const noexcept; - PROJ_DLL const ParameterValuePtr ¶meterValue(int epsg_code) const - noexcept; + PROJ_DLL const ParameterValuePtr & + parameterValue(int epsg_code) const noexcept; PROJ_DLL const common::Measure & - parameterValueMeasure(const std::string ¶mName, int epsg_code = 0) const - noexcept; + parameterValueMeasure(const std::string ¶mName, + int epsg_code = 0) const noexcept; - PROJ_DLL const common::Measure ¶meterValueMeasure(int epsg_code) const - noexcept; + PROJ_DLL const common::Measure & + parameterValueMeasure(int epsg_code) const noexcept; PROJ_DLL static SingleOperationNNPtr createPROJBased( const util::PropertyMap &properties, const std::string &PROJString, @@ -612,17 +612,16 @@ class PROJ_GCC_DLL SingleOperation : virtual public CoordinateOperation { //! @cond Doxygen_Suppress PROJ_DLL double - parameterValueNumeric(int epsg_code, - const common::UnitOfMeasure &targetUnit) const - noexcept; + parameterValueNumeric( + int epsg_code, + const common::UnitOfMeasure &targetUnit) const noexcept; - PROJ_INTERNAL double - parameterValueNumeric(const char *param_name, - const common::UnitOfMeasure &targetUnit) const - noexcept; + PROJ_INTERNAL double parameterValueNumeric( + const char *param_name, + const common::UnitOfMeasure &targetUnit) const noexcept; - PROJ_INTERNAL double parameterValueNumericAsSI(int epsg_code) const - noexcept; + PROJ_INTERNAL double + parameterValueNumericAsSI(int epsg_code) const noexcept; PROJ_INTERNAL bool _isEquivalentTo( const util::IComparable *other, @@ -1828,9 +1827,9 @@ class PROJ_GCC_DLL CoordinateOperationContext { IGNORE_GRID_AVAILABILITY, /** Results will be presented as if grids known to PROJ (that is - * registered in the grid_alternatives table of its database) were - * available. Used typically when networking is enabled. - */ + * registered in the grid_alternatives table of its database) were + * available. Used typically when networking is enabled. + */ KNOWN_AVAILABLE, }; diff --git a/include/proj/io.hpp b/include/proj/io.hpp index bc11c220..2f935a0c 100644 --- a/include/proj/io.hpp +++ b/include/proj/io.hpp @@ -711,8 +711,8 @@ class PROJ_GCC_DLL WKTNode { PROJ_DLL void addChild(WKTNodeNNPtr &&child); PROJ_DLL const WKTNodePtr &lookForChild(const std::string &childName, int occurrence = 0) const noexcept; - PROJ_DLL int countChildrenOfName(const std::string &childName) const - noexcept; + PROJ_DLL int + countChildrenOfName(const std::string &childName) const noexcept; PROJ_DLL std::string toString() const; diff --git a/include/proj/util.hpp b/include/proj/util.hpp index 2ada4f79..78115aa1 100644 --- a/include/proj/util.hpp +++ b/include/proj/util.hpp @@ -180,7 +180,7 @@ NS_PROJ_START namespace io { class DatabaseContext; using DatabaseContextPtr = std::shared_ptr<DatabaseContext>; -} +} // namespace io //! @endcond /** osgeo.proj.util namespace. diff --git a/src/apps/projinfo.cpp b/src/apps/projinfo.cpp index 8d389019..8c266e94 100644 --- a/src/apps/projinfo.cpp +++ b/src/apps/projinfo.cpp @@ -187,8 +187,8 @@ static BaseObjectNNPtr buildObject( try { auto tokens = split(l_user_string, ':'); if (kind == "operation" && tokens.size() == 2) { - auto urn = "urn:ogc:def:coordinateOperation:" + tokens[0] + "::" + - tokens[1]; + auto urn = "urn:ogc:def:coordinateOperation:" + tokens[0] + + "::" + tokens[1]; obj = createFromUserInput(urn, dbContext).as_nullable(); } else if ((kind == "ellipsoid" || kind == "datum" || kind == "ensemble") && @@ -1214,11 +1214,10 @@ int main(int argc, char **argv) { if (crs) { try { auto res = crs->identify( - dbContext - ? AuthorityFactory::create( - NN_NO_CHECK(dbContext), authority) - .as_nullable() - : nullptr); + dbContext ? AuthorityFactory::create( + NN_NO_CHECK(dbContext), authority) + .as_nullable() + : nullptr); std::cout << std::endl; std::cout << "Identification match count: " << res.size() diff --git a/src/apps/projsync.cpp b/src/apps/projsync.cpp index 7f3d5e56..ec4d00fd 100644 --- a/src/apps/projsync.cpp +++ b/src/apps/projsync.cpp @@ -55,7 +55,7 @@ class ParsingException : public std::exception { explicit ParsingException(const char *msg) : msg_(msg) {} const char *what() const noexcept override { return msg_.c_str(); } }; -} +} // namespace // --------------------------------------------------------------------------- @@ -514,9 +514,8 @@ int main(int argc, char *argv[]) { std::cout << url << "... (" << i + 1 << " / " << to_download.size() << ")" << std::endl; } - if (!dryRun && - !proj_download_file(ctx, url.c_str(), false, nullptr, - nullptr)) { + if (!dryRun && !proj_download_file(ctx, url.c_str(), false, nullptr, + nullptr)) { std::cerr << "Cannot download " << url << std::endl; std::exit(1); } diff --git a/src/filemanager.cpp b/src/filemanager.cpp index 121a4b3a..43a705fc 100644 --- a/src/filemanager.cpp +++ b/src/filemanager.cpp @@ -1110,7 +1110,7 @@ void proj_context_set_sqlite3_vfs_name(PJ_CONTEXT *ctx, const char *name) { * already. * @return The path to the PROJ user writable directory. * @since 7.1 -*/ + */ const char *proj_context_get_user_writable_directory(PJ_CONTEXT *ctx, int create) { @@ -1181,12 +1181,12 @@ const char *proj_context_get_user_writable_directory(PJ_CONTEXT *ctx, } /** Get the URL endpoint to query for remote grids. -* -* @param ctx PROJ context, or NULL -* @return Endpoint URL. The returned pointer would be invalidated -* by a later call to proj_context_set_url_endpoint() -* @since 7.1 -*/ + * + * @param ctx PROJ context, or NULL + * @return Endpoint URL. The returned pointer would be invalidated + * by a later call to proj_context_set_url_endpoint() + * @since 7.1 + */ const char *proj_context_get_url_endpoint(PJ_CONTEXT *ctx) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); diff --git a/src/grids.cpp b/src/grids.cpp index b7ab526a..f67ae42d 100644 --- a/src/grids.cpp +++ b/src/grids.cpp @@ -897,8 +897,9 @@ std::unique_ptr<GTiffGrid> GTiffDataset::nextGrid() { else if (sampleFormat == SAMPLEFORMAT_IEEEFP && bitsPerSample == 64) dt = TIFFDataType::Float64; else { - pj_log(m_ctx, PJ_LOG_ERROR, _("Unsupported combination of SampleFormat " - "and BitsPerSample values")); + pj_log(m_ctx, PJ_LOG_ERROR, + _("Unsupported combination of SampleFormat " + "and BitsPerSample values")); return nullptr; } @@ -998,8 +999,9 @@ std::unique_ptr<GTiffGrid> GTiffDataset::nextGrid() { // a GeoTransformationMatrix, since negative values in GeoPixelScale // have historically been implementation bugs. if (matrix[1] != 0 || matrix[4] != 0) { - pj_log(m_ctx, PJ_LOG_ERROR, _("Rotational terms not supported in " - "GeoTransformationMatrix tag")); + pj_log(m_ctx, PJ_LOG_ERROR, + _("Rotational terms not supported in " + "GeoTransformationMatrix tag")); return nullptr; } @@ -1833,10 +1835,9 @@ bool NTv2Grid::valueAt(int x, int y, bool compensateNTConvention, float two_float[2]; // NTv2 is organized from east to west ! // there are 4 components: lat shift, lon shift, lat error, lon error - m_fp->seek( - m_offset + - 4 * sizeof(float) * - (static_cast<unsigned long long>(y) * m_width + m_width - 1 - x)); + m_fp->seek(m_offset + 4 * sizeof(float) * + (static_cast<unsigned long long>(y) * m_width + + m_width - 1 - x)); if (m_fp->read(&two_float[0], sizeof(two_float)) != sizeof(two_float)) { proj_context_errno_set(m_ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); @@ -2893,7 +2894,9 @@ ListOfHGrids pj_hgrid_init(PJ *P, const char *gridkey) { // --------------------------------------------------------------------------- -typedef struct { pj_int32 lam, phi; } ILP; +typedef struct { + pj_int32 lam, phi; +} ILP; // Apply bilinear interpolation for horizontal shift grids static PJ_LP pj_hgrid_interpolate(PJ_LP t, const HorizontalShiftGrid *grid, diff --git a/src/iso19111/c_api.cpp b/src/iso19111/c_api.cpp index c3e428d2..0d386e6b 100644 --- a/src/iso19111/c_api.cpp +++ b/src/iso19111/c_api.cpp @@ -8323,9 +8323,10 @@ double proj_dynamic_datum_get_frame_reference_epoch(PJ_CONTEXT *ctx, auto dvrf = dynamic_cast<const DynamicVerticalReferenceFrame *>( datum->iso_obj.get()); if (!dgrf && !dvrf) { - proj_log_error(ctx, __FUNCTION__, "Object is not a " - "DynamicGeodeticReferenceFrame or " - "DynamicVerticalReferenceFrame"); + proj_log_error(ctx, __FUNCTION__, + "Object is not a " + "DynamicGeodeticReferenceFrame or " + "DynamicVerticalReferenceFrame"); return -1; } const auto &frameReferenceEpoch = @@ -8592,9 +8593,10 @@ PJ *proj_normalize_for_visualization(PJ_CONTEXT *ctx, const PJ *obj) { auto co = dynamic_cast<const CoordinateOperation *>(obj->iso_obj.get()); if (!co) { - proj_log_error(ctx, __FUNCTION__, "Object is not a CoordinateOperation " - "created with " - "proj_create_crs_to_crs"); + proj_log_error(ctx, __FUNCTION__, + "Object is not a CoordinateOperation " + "created with " + "proj_create_crs_to_crs"); return nullptr; } try { diff --git a/src/iso19111/crs.cpp b/src/iso19111/crs.cpp index 1ac60d88..9c4c04c3 100644 --- a/src/iso19111/crs.cpp +++ b/src/iso19111/crs.cpp @@ -586,9 +586,8 @@ CRSNNPtr CRS::createBoundCRSToWGS84IfPossible( firstOpIsConversion)) { transf = util::nn_dynamic_pointer_cast< operation::Transformation>(subops[1]); - if (transf && - !starts_with(transf->nameStr(), - "Ballpark geo")) { + if (transf && !starts_with(transf->nameStr(), + "Ballpark geo")) { try { transf->getTOWGS84Parameters(); } catch (const std::exception &) { @@ -2128,23 +2127,25 @@ GeodeticCRS::identify(const io::AuthorityFactoryPtr &authorityFactory) const { const auto thisDatum(datumNonNull(dbContext)); - auto searchByDatumCode = [this, &authorityFactory, &res, - &geodetic_crs_type, crsCriterion, &dbContext]( - const common::IdentifiedObjectNNPtr &l_datum) { - for (const auto &id : l_datum->identifiers()) { - try { - auto tempRes = authorityFactory->createGeodeticCRSFromDatum( - *id->codeSpace(), id->code(), geodetic_crs_type); - for (const auto &crs : tempRes) { - if (_isEquivalentTo(crs.get(), crsCriterion, - dbContext)) { - res.emplace_back(crs, 70); + auto searchByDatumCode = + [this, &authorityFactory, &res, &geodetic_crs_type, crsCriterion, + &dbContext](const common::IdentifiedObjectNNPtr &l_datum) { + for (const auto &id : l_datum->identifiers()) { + try { + auto tempRes = + authorityFactory->createGeodeticCRSFromDatum( + *id->codeSpace(), id->code(), + geodetic_crs_type); + for (const auto &crs : tempRes) { + if (_isEquivalentTo(crs.get(), crsCriterion, + dbContext)) { + res.emplace_back(crs, 70); + } } + } catch (const std::exception &) { } - } catch (const std::exception &) { } - } - }; + }; auto searchByEllipsoid = [this, &authorityFactory, &res, &thisDatum, &geodetic_crs_type, l_implicitCS, @@ -2193,8 +2194,9 @@ GeodeticCRS::identify(const io::AuthorityFactoryPtr &authorityFactory) const { searchByDatumCode(thisDatum); } else { auto candidateDatums = authorityFactory->createObjectsFromName( - thisDatum->nameStr(), {io::AuthorityFactory::ObjectType:: - GEODETIC_REFERENCE_FRAME}, + thisDatum->nameStr(), + {io::AuthorityFactory::ObjectType:: + GEODETIC_REFERENCE_FRAME}, false); const size_t sizeBefore = res.size(); for (const auto &candidateDatum : candidateDatums) { @@ -2682,9 +2684,8 @@ GeographicCRS::demoteTo2D(const std::string &newName, const auto &firstRes = res.front(); auto firstResAsGeogCRS = util::nn_dynamic_pointer_cast<GeographicCRS>(firstRes); - if (firstResAsGeogCRS && - firstResAsGeogCRS->is2DPartOf3D(NN_NO_CHECK(this), - dbContext)) { + if (firstResAsGeogCRS && firstResAsGeogCRS->is2DPartOf3D( + NN_NO_CHECK(this), dbContext)) { return NN_NO_CHECK(firstResAsGeogCRS); } } @@ -4132,9 +4133,8 @@ ProjectedCRS::identify(const io::AuthorityFactoryPtr &authorityFactory) const { l_datum->nameStr() != "unnamed"; const auto &ellipsoid = l_baseCRS->ellipsoid(); auto geogCRS = dynamic_cast<const GeographicCRS *>(l_baseCRS.get()); - if (geogCRS && - geogCRS->coordinateSystem()->axisOrder() == - cs::EllipsoidalCS::AxisOrder::LONG_EAST_LAT_NORTH) { + if (geogCRS && geogCRS->coordinateSystem()->axisOrder() == + cs::EllipsoidalCS::AxisOrder::LONG_EAST_LAT_NORTH) { baseRes = GeographicCRS::create( util::PropertyMap().set(common::IdentifiedObject::NAME_KEY, @@ -4218,16 +4218,18 @@ ProjectedCRS::identify(const io::AuthorityFactoryPtr &authorityFactory) const { const bool l_implicitCS = hasImplicitCS(); const auto addCRS = [&](const ProjectedCRSNNPtr &crs, const bool eqName) { const auto &l_unit = cs->axisList()[0]->unit(); - if (_isEquivalentTo(crs.get(), util::IComparable::Criterion:: - EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS, + if (_isEquivalentTo(crs.get(), + util::IComparable::Criterion:: + EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS, dbContext) || (l_implicitCS && l_unit._isEquivalentTo( crs->coordinateSystem()->axisList()[0]->unit(), util::IComparable::Criterion::EQUIVALENT) && l_baseCRS->_isEquivalentTo( - crs->baseCRS().get(), util::IComparable::Criterion:: - EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS, + crs->baseCRS().get(), + util::IComparable::Criterion:: + EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS, dbContext) && derivingConversionRef()->_isEquivalentTo( crs->derivingConversionRef().get(), @@ -4285,8 +4287,9 @@ ProjectedCRS::identify(const io::AuthorityFactoryPtr &authorityFactory) const { *id->codeSpace()) ->createProjectedCRS(id->code()); bool match = _isEquivalentTo( - crs.get(), util::IComparable::Criterion:: - EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS, + crs.get(), + util::IComparable::Criterion:: + EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS, dbContext); res.emplace_back(crs, match ? 100 : 25); return res; @@ -4961,8 +4964,8 @@ CompoundCRS::identify(const io::AuthorityFactoryPtr &authorityFactory) const { thisName.c_str(), newCRS->nameStr().c_str()); res.emplace_back( newCRS, - std::min(thisName == newCRS->nameStr() ? 100 : eqName ? 90 - : 70, + std::min(thisName == newCRS->nameStr() ? 100 + : eqName ? 90 : 70, std::min(candidatesHorizCRS.front().second, candidatesVertCRS.front().second))); } @@ -5433,10 +5436,11 @@ BoundCRS::_identify(const io::AuthorityFactoryPtr &authorityFactory) const { opTransfPROJString = opNormalized->exportToPROJString( io::PROJStringFormatter::create().get()); opTransfPROJStringValid = true; - opTransfPROJString = replaceAll( - opTransfPROJString, " +rx=0 +ry=0 +rz=0 +s=0 " - "+convention=position_vector", - ""); + opTransfPROJString = + replaceAll(opTransfPROJString, + " +rx=0 +ry=0 +rz=0 +s=0 " + "+convention=position_vector", + ""); } catch (const std::exception &) { } if ((refTransfPROJStringValid && opTransfPROJStringValid && diff --git a/src/iso19111/datum.cpp b/src/iso19111/datum.cpp index 8e1b8257..96952866 100644 --- a/src/iso19111/datum.cpp +++ b/src/iso19111/datum.cpp @@ -835,9 +835,8 @@ void Ellipsoid::_exportToWKT( } formatter->add(computedInverseFlattening()); const auto &unit = semiMajor.unit(); - if (isWKT2 && - !(formatter->ellipsoidUnitOmittedIfMetre() && - unit == common::UnitOfMeasure::METRE)) { + if (isWKT2 && !(formatter->ellipsoidUnitOmittedIfMetre() && + unit == common::UnitOfMeasure::METRE)) { unit._exportToWKT(formatter, io::WKTConstants::LENGTHUNIT); } if (formatter->outputId()) { @@ -1269,8 +1268,9 @@ void GeodeticReferenceFrame::_exportToWKT( // as to trigger the caching done in createObjectsFromName() // in that case. auto matches = factory->createObjectsFromName( - l_name, {io::AuthorityFactory::ObjectType:: - GEODETIC_REFERENCE_FRAME}, + l_name, + {io::AuthorityFactory::ObjectType:: + GEODETIC_REFERENCE_FRAME}, true, 2); if (matches.size() == 1) { const auto &match = matches.front(); @@ -1870,8 +1870,8 @@ RealizationMethod::RealizationMethod(const std::string &nameIn) // --------------------------------------------------------------------------- -RealizationMethod &RealizationMethod:: -operator=(const RealizationMethod &other) { +RealizationMethod & +RealizationMethod::operator=(const RealizationMethod &other) { CodeList::operator=(other); return *this; } diff --git a/src/iso19111/factory.cpp b/src/iso19111/factory.cpp index 0a5f58a4..49d2a737 100644 --- a/src/iso19111/factory.cpp +++ b/src/iso19111/factory.cpp @@ -193,28 +193,28 @@ struct DatabaseContext::Private { void cache(const std::string &code, const crs::CRSNNPtr &crs); datum::GeodeticReferenceFramePtr - // cppcheck-suppress functionStatic - getGeodeticDatumFromCache(const std::string &code); + // cppcheck-suppress functionStatic + getGeodeticDatumFromCache(const std::string &code); // cppcheck-suppress functionStatic void cache(const std::string &code, const datum::GeodeticReferenceFrameNNPtr &datum); datum::DatumEnsemblePtr - // cppcheck-suppress functionStatic - getDatumEnsembleFromCache(const std::string &code); + // cppcheck-suppress functionStatic + getDatumEnsembleFromCache(const std::string &code); // cppcheck-suppress functionStatic void cache(const std::string &code, const datum::DatumEnsembleNNPtr &datumEnsemble); datum::EllipsoidPtr - // cppcheck-suppress functionStatic - getEllipsoidFromCache(const std::string &code); + // cppcheck-suppress functionStatic + getEllipsoidFromCache(const std::string &code); // cppcheck-suppress functionStatic void cache(const std::string &code, const datum::EllipsoidNNPtr &ellipsoid); datum::PrimeMeridianPtr - // cppcheck-suppress functionStatic - getPrimeMeridianFromCache(const std::string &code); + // cppcheck-suppress functionStatic + getPrimeMeridianFromCache(const std::string &code); // cppcheck-suppress functionStatic void cache(const std::string &code, const datum::PrimeMeridianNNPtr &pm); @@ -617,20 +617,20 @@ void DatabaseContext::Private::checkDatabaseLayout() { } } if (nMajor != DATABASE_LAYOUT_VERSION_MAJOR) { - throw FactoryException(databasePath_ + - " contains DATABASE.LAYOUT.VERSION.MAJOR = " + - toString(nMajor) + " whereas " + - toString(DATABASE_LAYOUT_VERSION_MAJOR) + - " is expected. " - "It comes from another PROJ installation."); + throw FactoryException( + databasePath_ + + " contains DATABASE.LAYOUT.VERSION.MAJOR = " + toString(nMajor) + + " whereas " + toString(DATABASE_LAYOUT_VERSION_MAJOR) + + " is expected. " + "It comes from another PROJ installation."); } if (nMinor < DATABASE_LAYOUT_VERSION_MINOR) { - throw FactoryException(databasePath_ + - " contains DATABASE.LAYOUT.VERSION.MINOR = " + - toString(nMinor) + " whereas a number >= " + - toString(DATABASE_LAYOUT_VERSION_MINOR) + - " is expected. " - "It comes from another PROJ installation."); + throw FactoryException( + databasePath_ + + " contains DATABASE.LAYOUT.VERSION.MINOR = " + toString(nMinor) + + " whereas a number >= " + toString(DATABASE_LAYOUT_VERSION_MINOR) + + " is expected. " + "It comes from another PROJ installation."); } } @@ -4322,8 +4322,9 @@ AuthorityFactory::createFromCRSCodesWithIntermediates( // Case (source->intermediate) and (intermediate->target) std::string sql( - sqlProlog + "ON v1.target_crs_auth_name = v2.source_crs_auth_name " - "AND v1.target_crs_code = v2.source_crs_code " + + sqlProlog + + "ON v1.target_crs_auth_name = v2.source_crs_auth_name " + "AND v1.target_crs_code = v2.source_crs_code " + joinArea + "WHERE v1.source_crs_auth_name = ? AND v1.source_crs_code = ? " "AND v2.target_crs_auth_name = ? AND v2.target_crs_code = ? "); @@ -4432,24 +4433,25 @@ AuthorityFactory::createFromCRSCodesWithIntermediates( } } - const auto buildIntermediateWhere = [&intermediateCRSAuthCodes]( - const std::string &first_field, const std::string &second_field) { - if (intermediateCRSAuthCodes.empty()) { - return std::string(); - } - std::string l_sql(" AND ("); - for (size_t i = 0; i < intermediateCRSAuthCodes.size(); ++i) { - if (i > 0) { - l_sql += " OR"; + const auto buildIntermediateWhere = + [&intermediateCRSAuthCodes](const std::string &first_field, + const std::string &second_field) { + if (intermediateCRSAuthCodes.empty()) { + return std::string(); } - l_sql += "(v1." + first_field + "_crs_auth_name = ? AND "; - l_sql += "v1." + first_field + "_crs_code = ? AND "; - l_sql += "v2." + second_field + "_crs_auth_name = ? AND "; - l_sql += "v2." + second_field + "_crs_code = ?) "; - } - l_sql += ')'; - return l_sql; - }; + std::string l_sql(" AND ("); + for (size_t i = 0; i < intermediateCRSAuthCodes.size(); ++i) { + if (i > 0) { + l_sql += " OR"; + } + l_sql += "(v1." + first_field + "_crs_auth_name = ? AND "; + l_sql += "v1." + first_field + "_crs_code = ? AND "; + l_sql += "v2." + second_field + "_crs_auth_name = ? AND "; + l_sql += "v2." + second_field + "_crs_code = ?) "; + } + l_sql += ')'; + return l_sql; + }; std::string intermediateWhere = buildIntermediateWhere("target", "source"); for (const auto &pair : intermediateCRSAuthCodes) { @@ -4537,8 +4539,9 @@ AuthorityFactory::createFromCRSCodesWithIntermediates( } // Case (source->intermediate) and (target->intermediate) - sql = sqlProlog + "ON v1.target_crs_auth_name = v2.target_crs_auth_name " - "AND v1.target_crs_code = v2.target_crs_code " + + sql = sqlProlog + + "ON v1.target_crs_auth_name = v2.target_crs_auth_name " + "AND v1.target_crs_code = v2.target_crs_code " + joinArea + "WHERE v1.source_crs_auth_name = ? AND v1.source_crs_code = ? " "AND v2.source_crs_auth_name = ? AND v2.source_crs_code = ? "; @@ -4580,8 +4583,9 @@ AuthorityFactory::createFromCRSCodesWithIntermediates( } // Case (intermediate->source) and (intermediate->target) - sql = sqlProlog + "ON v1.source_crs_auth_name = v2.source_crs_auth_name " - "AND v1.source_crs_code = v2.source_crs_code " + + sql = sqlProlog + + "ON v1.source_crs_auth_name = v2.source_crs_auth_name " + "AND v1.source_crs_code = v2.source_crs_code " + joinArea + "WHERE v1.target_crs_auth_name = ? AND v1.target_crs_code = ? " "AND v2.target_crs_auth_name = ? AND v2.target_crs_code = ? "; @@ -4644,8 +4648,9 @@ AuthorityFactory::createFromCRSCodesWithIntermediates( } // Case (intermediate->source) and (target->intermediate) - sql = sqlProlog + "ON v1.source_crs_auth_name = v2.target_crs_auth_name " - "AND v1.source_crs_code = v2.target_crs_code " + + sql = sqlProlog + + "ON v1.source_crs_auth_name = v2.target_crs_auth_name " + "AND v1.source_crs_code = v2.target_crs_code " + joinArea + "WHERE v1.target_crs_auth_name = ? AND v1.target_crs_code = ? " "AND v2.source_crs_auth_name = ? AND v2.source_crs_code = ? "; @@ -4871,7 +4876,6 @@ AuthorityFactory::createBetweenGeodeticCRSWithDatumBasedIntermediates( const auto filterDeprecatedAndNotMatchingAuth = [&](SQLResultSet &&resultSet) { - SQLResultSet filteredResultSet; for (const auto &row : resultSet) { const auto &deprecated1 = row[3]; @@ -4930,9 +4934,11 @@ AuthorityFactory::createBetweenGeodeticCRSWithDatumBasedIntermediates( ListOfParams findSupersededParams; std::set<std::string> setAlreadyAsked; - const auto keyMapSupersession = []( - const std::string &table_name, const std::string &auth_name, - const std::string &code) { return table_name + auth_name + code; }; + const auto keyMapSupersession = [](const std::string &table_name, + const std::string &auth_name, + const std::string &code) { + return table_name + auth_name + code; + }; for (const auto &row : resultSet) { const auto &table1 = row[0]; @@ -5588,12 +5594,13 @@ std::list<AuthorityFactory::CRSInfo> AuthorityFactory::getCRSInfoList() const { const auto getSqlArea = [](const std::string &table_name) { return "JOIN usage u ON " "u.object_table_name = '" + - table_name + "' AND " - "u.object_auth_name = c.auth_name AND " - "u.object_code = c.code " - "JOIN extent a " - "ON a.auth_name = u.extent_auth_name AND " - "a.code = u.extent_code "; + table_name + + "' AND " + "u.object_auth_name = c.auth_name AND " + "u.object_code = c.code " + "JOIN extent a " + "ON a.auth_name = u.extent_auth_name AND " + "a.code = u.extent_code "; }; std::string sql = "SELECT c.auth_name, c.code, c.name, c.type, " @@ -6258,8 +6265,9 @@ AuthorityFactory::createObjectsFromNameEx( } auto factory = d->createFactory(auth_name); auto getObject = [&factory, datumEnsembleAllowed]( - const std::string &l_table_name, - const std::string &l_code) -> common::IdentifiedObjectNNPtr { + const std::string &l_table_name, + const std::string &l_code) + -> common::IdentifiedObjectNNPtr { if (l_table_name == "prime_meridian") { return factory->createPrimeMeridian(l_code); } else if (l_table_name == "ellipsoid") { diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp index 6ea6316c..51162365 100644 --- a/src/iso19111/io.cpp +++ b/src/iso19111/io.cpp @@ -916,9 +916,9 @@ struct WKTNode::Private { // --------------------------------------------------------------------------- -const WKTNodeNNPtr &WKTNode::Private::lookForChild(const std::string &childName, - int occurrence) const - noexcept { +const WKTNodeNNPtr & +WKTNode::Private::lookForChild(const std::string &childName, + int occurrence) const noexcept { int occCount = 0; for (const auto &child : children_) { if (ci_equal(child->GP()->value(), childName)) { @@ -3408,8 +3408,8 @@ ConversionNNPtr WKTParser::Private::buildProjectionFromESRI( } struct ci_less_struct { - bool operator()(const std::string &lhs, const std::string &rhs) const - noexcept { + bool operator()(const std::string &lhs, + const std::string &rhs) const noexcept { return ci_less(lhs, rhs); } }; @@ -3750,14 +3750,12 @@ ConversionNNPtr WKTParser::Private::buildProjectionStandard( // Krovak East-North Oriented methods if (ci_equal(projectionName, "Krovak") && projCRSNode->countChildrenOfName(WKTConstants::AXIS) == 2 && - &buildAxis( - projCRSNode->GP()->lookForChild(WKTConstants::AXIS, 0), - defaultLinearUnit, UnitOfMeasure::Type::LINEAR, false, - 1)->direction() == &AxisDirection::SOUTH && - &buildAxis( - projCRSNode->GP()->lookForChild(WKTConstants::AXIS, 1), - defaultLinearUnit, UnitOfMeasure::Type::LINEAR, false, - 2)->direction() == &AxisDirection::WEST) { + &buildAxis(projCRSNode->GP()->lookForChild(WKTConstants::AXIS, 0), + defaultLinearUnit, UnitOfMeasure::Type::LINEAR, false, 1) + ->direction() == &AxisDirection::SOUTH && + &buildAxis(projCRSNode->GP()->lookForChild(WKTConstants::AXIS, 1), + defaultLinearUnit, UnitOfMeasure::Type::LINEAR, false, 2) + ->direction() == &AxisDirection::WEST) { mapping = getMapping(EPSG_CODE_METHOD_KROVAK); } @@ -6442,50 +6440,52 @@ static BaseObjectNNPtr createFromUserInput(const std::string &text, auto factory = AuthorityFactory::create(NN_NO_CHECK(dbContext), std::string()); - const auto searchObject = [&factory]( - const std::string &objectName, bool approximateMatch, - const std::vector<AuthorityFactory::ObjectType> &objectTypes, - bool &goOn) { - constexpr size_t limitResultCount = 10; - auto res = factory->createObjectsFromName( - objectName, objectTypes, approximateMatch, limitResultCount); - if (res.size() == 1) { - return res.front(); - } - if (res.size() > 1) { - if (objectTypes.size() == 1 && - objectTypes[0] == AuthorityFactory::ObjectType::CRS) { - for (size_t ndim = 2; ndim <= 3; ndim++) { - for (const auto &obj : res) { - auto crs = - dynamic_cast<crs::GeographicCRS *>(obj.get()); - if (crs && - crs->coordinateSystem()->axisList().size() == - ndim) { - return obj; + const auto searchObject = + [&factory]( + const std::string &objectName, bool approximateMatch, + const std::vector<AuthorityFactory::ObjectType> &objectTypes, + bool &goOn) { + constexpr size_t limitResultCount = 10; + auto res = factory->createObjectsFromName( + objectName, objectTypes, approximateMatch, + limitResultCount); + if (res.size() == 1) { + return res.front(); + } + if (res.size() > 1) { + if (objectTypes.size() == 1 && + objectTypes[0] == AuthorityFactory::ObjectType::CRS) { + for (size_t ndim = 2; ndim <= 3; ndim++) { + for (const auto &obj : res) { + auto crs = dynamic_cast<crs::GeographicCRS *>( + obj.get()); + if (crs && crs->coordinateSystem() + ->axisList() + .size() == ndim) { + return obj; + } } } } - } - std::string msg("several objects matching this name: "); - bool first = true; - for (const auto &obj : res) { - if (msg.size() > 200) { - msg += ", ..."; - break; - } - if (!first) { - msg += ", "; + std::string msg("several objects matching this name: "); + bool first = true; + for (const auto &obj : res) { + if (msg.size() > 200) { + msg += ", ..."; + break; + } + if (!first) { + msg += ", "; + } + first = false; + msg += obj->nameStr(); } - first = false; - msg += obj->nameStr(); + throw ParsingException(msg); } - throw ParsingException(msg); - } - goOn = true; - throw ParsingException("dummy"); - }; + goOn = true; + throw ParsingException("dummy"); + }; const auto searchCRS = [&searchObject](const std::string &objectName) { bool goOn = false; @@ -6808,7 +6808,9 @@ WKTParser::guessDialect(const std::string &wkt) noexcept { } } static const char *const wkt2_2019_only_substrings[] = { - "CS[TemporalDateTime,", "CS[TemporalCount,", "CS[TemporalMeasure,", + "CS[TemporalDateTime,", + "CS[TemporalCount,", + "CS[TemporalMeasure,", }; for (const auto &substrings : wkt2_2019_only_substrings) { if (ci_find(wkt, substrings) != std::string::npos) { @@ -9086,7 +9088,7 @@ static double getNumericValue(const std::string ¶mValue, // --------------------------------------------------------------------------- namespace { template <class T> inline void ignoreRetVal(T) {} -} +} // namespace GeographicCRSNNPtr PROJStringParser::Private::buildGeographicCRS( int iStep, int iUnitConvert, int iAxisSwap, bool ignorePROJAxis) { @@ -10097,9 +10099,8 @@ PROJStringParser::createFromPROJString(const std::string &projString) { } else { for (auto cur = pj->params; cur; cur = cur->next) { const char *equal = strchr(cur->param, '='); - if (equal && - static_cast<size_t>(equal - cur->param) == - kv.key.size()) { + if (equal && static_cast<size_t>(equal - cur->param) == + kv.key.size()) { if (memcmp(cur->param, kv.key.c_str(), kv.key.size()) == 0) { recognizedByPROJ = (cur->used == 1); @@ -10197,13 +10198,14 @@ PROJStringParser::createFromPROJString(const std::string &projString) { iProjStep, d->buildProjectedCRS( iProjStep, - d->buildGeographicCRS( - iFirstGeogStep, iFirstUnitConvert < iFirstGeogStep - ? iFirstUnitConvert - : -1, - iFirstAxisSwap < iFirstGeogStep ? iFirstAxisSwap - : -1, - true), + d->buildGeographicCRS(iFirstGeogStep, + iFirstUnitConvert < iFirstGeogStep + ? iFirstUnitConvert + : -1, + iFirstAxisSwap < iFirstGeogStep + ? iFirstAxisSwap + : -1, + true), iFirstUnitConvert < iFirstGeogStep ? iSecondUnitConvert : iFirstUnitConvert, iFirstAxisSwap < iFirstGeogStep ? iSecondAxisSwap diff --git a/src/iso19111/operation/conversion.cpp b/src/iso19111/operation/conversion.cpp index 1808dbe7..e9d688b7 100644 --- a/src/iso19111/operation/conversion.cpp +++ b/src/iso19111/operation/conversion.cpp @@ -2238,15 +2238,16 @@ ConversionNNPtr Conversion::createPoleRotationGRIBConvention( ConversionNNPtr Conversion::createChangeVerticalUnit(const util::PropertyMap &properties, const common::Scale &factor) { - return create(properties, createMethodMapNameEPSGCode( - EPSG_CODE_METHOD_CHANGE_VERTICAL_UNIT), - VectorOfParameters{ - createOpParamNameEPSGCode( - EPSG_CODE_PARAMETER_UNIT_CONVERSION_SCALAR), - }, - VectorOfValues{ - factor, - }); + return create( + properties, + createMethodMapNameEPSGCode(EPSG_CODE_METHOD_CHANGE_VERTICAL_UNIT), + VectorOfParameters{ + createOpParamNameEPSGCode( + EPSG_CODE_PARAMETER_UNIT_CONVERSION_SCALAR), + }, + VectorOfValues{ + factor, + }); } // --------------------------------------------------------------------------- @@ -2264,9 +2265,10 @@ Conversion::createChangeVerticalUnit(const util::PropertyMap &properties, */ ConversionNNPtr Conversion::createHeightDepthReversal(const util::PropertyMap &properties) { - return create(properties, createMethodMapNameEPSGCode( - EPSG_CODE_METHOD_HEIGHT_DEPTH_REVERSAL), - {}, {}); + return create( + properties, + createMethodMapNameEPSGCode(EPSG_CODE_METHOD_HEIGHT_DEPTH_REVERSAL), {}, + {}); } // --------------------------------------------------------------------------- @@ -2310,9 +2312,10 @@ ConversionNNPtr Conversion::createAxisOrderReversal(bool is3D) { */ ConversionNNPtr Conversion::createGeographicGeocentric(const util::PropertyMap &properties) { - return create(properties, createMethodMapNameEPSGCode( - EPSG_CODE_METHOD_GEOGRAPHIC_GEOCENTRIC), - {}, {}); + return create( + properties, + createMethodMapNameEPSGCode(EPSG_CODE_METHOD_GEOGRAPHIC_GEOCENTRIC), {}, + {}); } // --------------------------------------------------------------------------- @@ -2458,9 +2461,10 @@ static double lcc_1sp_to_2sp_f(double sinphi, double K, double ec, double n) { const double x = sinphi; const double ecx = ec * x; return (1 - x * x) / (1 - ecx * ecx) - - K * K * std::pow((1.0 - x) / (1.0 + x) * - std::pow((1.0 + ecx) / (1.0 - ecx), ec), - n); + K * K * + std::pow((1.0 - x) / (1.0 + x) * + std::pow((1.0 + ecx) / (1.0 - ecx), ec), + n); } // --------------------------------------------------------------------------- @@ -2748,8 +2752,9 @@ ConversionPtr Conversion::convertToOtherMethod(int targetEPSGCode) const { common::Angle(phi0Deg, common::UnitOfMeasure::DEGREE), common::Angle(parameterValueMeasure( EPSG_CODE_PARAMETER_LONGITUDE_FALSE_ORIGIN)), - common::Scale(k0), common::Length(parameterValueMeasure( - EPSG_CODE_PARAMETER_EASTING_FALSE_ORIGIN)), + common::Scale(k0), + common::Length(parameterValueMeasure( + EPSG_CODE_PARAMETER_EASTING_FALSE_ORIGIN)), common::Length( parameterValueNumericAsSI( EPSG_CODE_PARAMETER_NORTHING_FALSE_ORIGIN) + diff --git a/src/iso19111/operation/coordinateoperationfactory.cpp b/src/iso19111/operation/coordinateoperationfactory.cpp index e4b989c8..44d9b570 100644 --- a/src/iso19111/operation/coordinateoperationfactory.cpp +++ b/src/iso19111/operation/coordinateoperationfactory.cpp @@ -30,8 +30,8 @@ #define FROM_PROJ_CPP #endif -#include "proj/coordinateoperation.hpp" #include "proj/common.hpp" +#include "proj/coordinateoperation.hpp" #include "proj/crs.hpp" #include "proj/io.hpp" #include "proj/metadata.hpp" @@ -1892,8 +1892,8 @@ struct MyPROJStringExportableGeodToGeod final ~MyPROJStringExportableGeodToGeod() override; void - // cppcheck-suppress functionStatic - _exportToPROJString(io::PROJStringFormatter *formatter) const override { + // cppcheck-suppress functionStatic + _exportToPROJString(io::PROJStringFormatter *formatter) const override { formatter->startInversion(); geodSrc->_exportToPROJString(formatter); @@ -1922,8 +1922,8 @@ struct MyPROJStringExportableHorizVertical final ~MyPROJStringExportableHorizVertical() override; void - // cppcheck-suppress functionStatic - _exportToPROJString(io::PROJStringFormatter *formatter) const override { + // cppcheck-suppress functionStatic + _exportToPROJString(io::PROJStringFormatter *formatter) const override { formatter->pushOmitZUnitConversion(); @@ -1970,8 +1970,8 @@ struct MyPROJStringExportableHorizVerticalHorizPROJBased final ~MyPROJStringExportableHorizVerticalHorizPROJBased() override; void - // cppcheck-suppress functionStatic - _exportToPROJString(io::PROJStringFormatter *formatter) const override { + // cppcheck-suppress functionStatic + _exportToPROJString(io::PROJStringFormatter *formatter) const override { formatter->pushOmitZUnitConversion(); @@ -2321,10 +2321,9 @@ CoordinateOperationFactory::Private::createOperationsGeogToGeog( } // Do they differ by vertical units ? - if (vconvSrc != vconvDst && - geogSrc->ellipsoid()->_isEquivalentTo( - geogDst->ellipsoid().get(), - util::IComparable::Criterion::EQUIVALENT)) { + if (vconvSrc != vconvDst && geogSrc->ellipsoid()->_isEquivalentTo( + geogDst->ellipsoid().get(), + util::IComparable::Criterion::EQUIVALENT)) { if (offset_pm.value() == 0 && !axisReversal2D && !axisReversal3D) { // If only by vertical units, use a Change of Vertical // Unit @@ -3267,7 +3266,6 @@ CoordinateOperationFactory::Private::createOperationsGeogToVertFromGeoid( const auto useTransf = [&sourceCRS, &targetCRS, &context, vertDst](const CoordinateOperationNNPtr &op) { - // If the source geographic CRS has a non-metre vertical unit, we need // to create an intermediate and operation to do the vertical unit // conversion from that vertical unit to the one of the geographic CRS @@ -3324,85 +3322,86 @@ CoordinateOperationFactory::Private::createOperationsGeogToVertFromGeoid( return ret; }; - const auto getProjGeoidTransformation = [&sourceCRS, &targetCRS, &vertDst, - &context]( - const CoordinateOperationNNPtr &model, - const std::string &projFilename) { - - const auto getNameVertCRSMetre = [](const std::string &name) { - if (name.empty()) - return std::string("unnamed"); - auto ret(name); - bool haveOriginalUnit = false; - if (name.back() == ')') { - const auto pos = ret.rfind(" ("); + const auto getProjGeoidTransformation = + [&sourceCRS, &targetCRS, &vertDst, + &context](const CoordinateOperationNNPtr &model, + const std::string &projFilename) { + const auto getNameVertCRSMetre = [](const std::string &name) { + if (name.empty()) + return std::string("unnamed"); + auto ret(name); + bool haveOriginalUnit = false; + if (name.back() == ')') { + const auto pos = ret.rfind(" ("); + if (pos != std::string::npos) { + haveOriginalUnit = true; + ret = ret.substr(0, pos); + } + } + const auto pos = ret.rfind(" depth"); if (pos != std::string::npos) { - haveOriginalUnit = true; - ret = ret.substr(0, pos); + ret = ret.substr(0, pos) + " height"; } - } - const auto pos = ret.rfind(" depth"); - if (pos != std::string::npos) { - ret = ret.substr(0, pos) + " height"; - } - if (!haveOriginalUnit) { - ret += " (metre)"; - } - return ret; - }; + if (!haveOriginalUnit) { + ret += " (metre)"; + } + return ret; + }; - const auto &axis = vertDst->coordinateSystem()->axisList()[0]; - const auto &authFactory = context.context->getAuthorityFactory(); - const auto dbContext = - authFactory ? authFactory->databaseContext().as_nullable() - : nullptr; + const auto &axis = vertDst->coordinateSystem()->axisList()[0]; + const auto &authFactory = context.context->getAuthorityFactory(); + const auto dbContext = + authFactory ? authFactory->databaseContext().as_nullable() + : nullptr; - const auto geogSrcCRS = - dynamic_cast<crs::GeographicCRS *>(model->interpolationCRS().get()) - ? NN_NO_CHECK(model->interpolationCRS()) - : sourceCRS->demoteTo2D(std::string(), dbContext) - ->promoteTo3D(std::string(), dbContext); - const auto vertCRSMetre = - axis->unit() == common::UnitOfMeasure::METRE && - axis->direction() == cs::AxisDirection::UP - ? targetCRS - : util::nn_static_pointer_cast<crs::CRS>( - crs::VerticalCRS::create( - util::PropertyMap().set( - common::IdentifiedObject::NAME_KEY, - getNameVertCRSMetre(targetCRS->nameStr())), - vertDst->datum(), vertDst->datumEnsemble(), - cs::VerticalCS::createGravityRelatedHeight( - common::UnitOfMeasure::METRE))); - const auto properties = util::PropertyMap().set( - common::IdentifiedObject::NAME_KEY, - buildOpName("Transformation", vertCRSMetre, geogSrcCRS)); - - // Try to find a representative value for the accuracy of this grid - // from the registered transformations. - std::vector<metadata::PositionalAccuracyNNPtr> accuracies; - const auto &modelAccuracies = model->coordinateOperationAccuracies(); - if (modelAccuracies.empty()) { - if (authFactory) { - const auto transformationsForGrid = - io::DatabaseContext::getTransformationsForGridName( - authFactory->databaseContext(), projFilename); - double accuracy = -1; - for (const auto &transf : transformationsForGrid) { - accuracy = std::max(accuracy, getAccuracy(transf)); - } - if (accuracy >= 0) { - accuracies.emplace_back( - metadata::PositionalAccuracy::create( - toString(accuracy))); + const auto geogSrcCRS = + dynamic_cast<crs::GeographicCRS *>( + model->interpolationCRS().get()) + ? NN_NO_CHECK(model->interpolationCRS()) + : sourceCRS->demoteTo2D(std::string(), dbContext) + ->promoteTo3D(std::string(), dbContext); + const auto vertCRSMetre = + axis->unit() == common::UnitOfMeasure::METRE && + axis->direction() == cs::AxisDirection::UP + ? targetCRS + : util::nn_static_pointer_cast<crs::CRS>( + crs::VerticalCRS::create( + util::PropertyMap().set( + common::IdentifiedObject::NAME_KEY, + getNameVertCRSMetre(targetCRS->nameStr())), + vertDst->datum(), vertDst->datumEnsemble(), + cs::VerticalCS::createGravityRelatedHeight( + common::UnitOfMeasure::METRE))); + const auto properties = util::PropertyMap().set( + common::IdentifiedObject::NAME_KEY, + buildOpName("Transformation", vertCRSMetre, geogSrcCRS)); + + // Try to find a representative value for the accuracy of this grid + // from the registered transformations. + std::vector<metadata::PositionalAccuracyNNPtr> accuracies; + const auto &modelAccuracies = + model->coordinateOperationAccuracies(); + if (modelAccuracies.empty()) { + if (authFactory) { + const auto transformationsForGrid = + io::DatabaseContext::getTransformationsForGridName( + authFactory->databaseContext(), projFilename); + double accuracy = -1; + for (const auto &transf : transformationsForGrid) { + accuracy = std::max(accuracy, getAccuracy(transf)); + } + if (accuracy >= 0) { + accuracies.emplace_back( + metadata::PositionalAccuracy::create( + toString(accuracy))); + } } } - } - return Transformation::createGravityRelatedHeightToGeographic3D( - properties, vertCRSMetre, geogSrcCRS, nullptr, projFilename, - !modelAccuracies.empty() ? modelAccuracies : accuracies); - }; + return Transformation::createGravityRelatedHeightToGeographic3D( + properties, vertCRSMetre, geogSrcCRS, nullptr, projFilename, + !modelAccuracies.empty() ? modelAccuracies : accuracies); + }; std::vector<CoordinateOperationNNPtr> res; const auto &authFactory = context.context->getAuthorityFactory(); @@ -3593,35 +3592,38 @@ void CoordinateOperationFactory::Private:: // NAD83 only exists in 2D version in EPSG, so if it has been // promoted to 3D, when researching a vertical to geog // transformation, try to down cast to 2D. - const auto geog3DToVertTryThroughGeog2D = [&res, &context]( - const crs::GeographicCRS *geogSrcIn, const crs::VerticalCRS *vertDstIn, - const crs::CRSNNPtr &targetCRSIn) { - if (res.empty() && geogSrcIn && vertDstIn && - geogSrcIn->coordinateSystem()->axisList().size() == 3) { - const auto &authFactory = context.context->getAuthorityFactory(); - const auto dbContext = - authFactory ? authFactory->databaseContext().as_nullable() - : nullptr; - const auto candidatesSrcGeod(findCandidateGeodCRSForDatum( - authFactory, geogSrcIn, - geogSrcIn->datumNonNull(dbContext).get())); - for (const auto &candidate : candidatesSrcGeod) { - auto geogCandidate = - util::nn_dynamic_pointer_cast<crs::GeographicCRS>( - candidate); - if (geogCandidate && - geogCandidate->coordinateSystem()->axisList().size() == 2) { - bool ignored; - res = - findOpsInRegistryDirect(NN_NO_CHECK(geogCandidate), - targetCRSIn, context, ignored); - break; + const auto geog3DToVertTryThroughGeog2D = + [&res, &context](const crs::GeographicCRS *geogSrcIn, + const crs::VerticalCRS *vertDstIn, + const crs::CRSNNPtr &targetCRSIn) { + if (res.empty() && geogSrcIn && vertDstIn && + geogSrcIn->coordinateSystem()->axisList().size() == 3) { + const auto &authFactory = + context.context->getAuthorityFactory(); + const auto dbContext = + authFactory ? authFactory->databaseContext().as_nullable() + : nullptr; + const auto candidatesSrcGeod(findCandidateGeodCRSForDatum( + authFactory, geogSrcIn, + geogSrcIn->datumNonNull(dbContext).get())); + for (const auto &candidate : candidatesSrcGeod) { + auto geogCandidate = + util::nn_dynamic_pointer_cast<crs::GeographicCRS>( + candidate); + if (geogCandidate && + geogCandidate->coordinateSystem()->axisList().size() == + 2) { + bool ignored; + res = findOpsInRegistryDirect( + NN_NO_CHECK(geogCandidate), targetCRSIn, context, + ignored); + break; + } } + return true; } - return true; - } - return false; - }; + return false; + }; if (geog3DToVertTryThroughGeog2D(geogSrc, vertDst, targetCRS)) { // do nothing @@ -5169,26 +5171,27 @@ crs::CRSNNPtr CRS::getResolvedCRS(const crs::CRSNNPtr &crs, // Even if they aren't equivalent, we update extentOut with the one of the // identified CRS if our input one is absent/not reliable. - const auto tryToIdentifyByName = [&crs, &name, &authFactory, approxExtent, - &extentOut]( - io::AuthorityFactory::ObjectType objectType) { - if (name != "unknown" && name != "unnamed") { - auto matches = authFactory->createObjectsFromName( - name, {objectType}, false, 2); - if (matches.size() == 1) { - const auto match = - util::nn_static_pointer_cast<crs::CRS>(matches.front()); - if (approxExtent || !extentOut) { - extentOut = operation::getExtent(match); - } - if (match->isEquivalentTo( - crs.get(), util::IComparable::Criterion::EQUIVALENT)) { - return match; + const auto tryToIdentifyByName = + [&crs, &name, &authFactory, approxExtent, + &extentOut](io::AuthorityFactory::ObjectType objectType) { + if (name != "unknown" && name != "unnamed") { + auto matches = authFactory->createObjectsFromName( + name, {objectType}, false, 2); + if (matches.size() == 1) { + const auto match = + util::nn_static_pointer_cast<crs::CRS>(matches.front()); + if (approxExtent || !extentOut) { + extentOut = operation::getExtent(match); + } + if (match->isEquivalentTo( + crs.get(), + util::IComparable::Criterion::EQUIVALENT)) { + return match; + } } } - } - return crs; - }; + return crs; + }; auto geogCRS = dynamic_cast<crs::GeographicCRS *>(crs.get()); if (geogCRS && authFactory) { diff --git a/src/iso19111/operation/parammappings.cpp b/src/iso19111/operation/parammappings.cpp index de5f4c7e..03200468 100644 --- a/src/iso19111/operation/parammappings.cpp +++ b/src/iso19111/operation/parammappings.cpp @@ -760,8 +760,11 @@ static const MethodMapping projectionMethodMappings[] = { { EPSG_NAME_METHOD_OBLIQUE_STEREOGRAPHIC, - EPSG_CODE_METHOD_OBLIQUE_STEREOGRAPHIC, "Oblique_Stereographic", - "sterea", nullptr, paramsObliqueStereo, + EPSG_CODE_METHOD_OBLIQUE_STEREOGRAPHIC, + "Oblique_Stereographic", + "sterea", + nullptr, + paramsObliqueStereo, }, {EPSG_NAME_METHOD_ORTHOGRAPHIC, EPSG_CODE_METHOD_ORTHOGRAPHIC, @@ -884,13 +887,16 @@ const struct MethodNameCode methodNameCodes[] = { // Projection methods METHOD_NAME_CODE(TRANSVERSE_MERCATOR), METHOD_NAME_CODE(TRANSVERSE_MERCATOR_SOUTH_ORIENTATED), - METHOD_NAME_CODE(LAMBERT_CONIC_CONFORMAL_1SP), METHOD_NAME_CODE(NZMG), - METHOD_NAME_CODE(TUNISIA_MAPPING_GRID), METHOD_NAME_CODE(ALBERS_EQUAL_AREA), + METHOD_NAME_CODE(LAMBERT_CONIC_CONFORMAL_1SP), + METHOD_NAME_CODE(NZMG), + METHOD_NAME_CODE(TUNISIA_MAPPING_GRID), + METHOD_NAME_CODE(ALBERS_EQUAL_AREA), METHOD_NAME_CODE(LAMBERT_CONIC_CONFORMAL_2SP), METHOD_NAME_CODE(LAMBERT_CONIC_CONFORMAL_2SP_BELGIUM), METHOD_NAME_CODE(LAMBERT_CONIC_CONFORMAL_2SP_MICHIGAN), METHOD_NAME_CODE(MODIFIED_AZIMUTHAL_EQUIDISTANT), - METHOD_NAME_CODE(GUAM_PROJECTION), METHOD_NAME_CODE(BONNE), + METHOD_NAME_CODE(GUAM_PROJECTION), + METHOD_NAME_CODE(BONNE), METHOD_NAME_CODE(LAMBERT_CYLINDRICAL_EQUAL_AREA_SPHERICAL), METHOD_NAME_CODE(LAMBERT_CYLINDRICAL_EQUAL_AREA), METHOD_NAME_CODE(CASSINI_SOLDNER), @@ -898,16 +904,20 @@ const struct MethodNameCode methodNameCodes[] = { METHOD_NAME_CODE(EQUIDISTANT_CYLINDRICAL_SPHERICAL), METHOD_NAME_CODE(HOTINE_OBLIQUE_MERCATOR_VARIANT_A), METHOD_NAME_CODE(HOTINE_OBLIQUE_MERCATOR_VARIANT_B), - METHOD_NAME_CODE(KROVAK_NORTH_ORIENTED), METHOD_NAME_CODE(KROVAK), + METHOD_NAME_CODE(KROVAK_NORTH_ORIENTED), + METHOD_NAME_CODE(KROVAK), METHOD_NAME_CODE(LAMBERT_AZIMUTHAL_EQUAL_AREA), METHOD_NAME_CODE(POPULAR_VISUALISATION_PSEUDO_MERCATOR), - METHOD_NAME_CODE(MERCATOR_VARIANT_A), METHOD_NAME_CODE(MERCATOR_VARIANT_B), + METHOD_NAME_CODE(MERCATOR_VARIANT_A), + METHOD_NAME_CODE(MERCATOR_VARIANT_B), METHOD_NAME_CODE(OBLIQUE_STEREOGRAPHIC), METHOD_NAME_CODE(AMERICAN_POLYCONIC), METHOD_NAME_CODE(POLAR_STEREOGRAPHIC_VARIANT_A), METHOD_NAME_CODE(POLAR_STEREOGRAPHIC_VARIANT_B), - METHOD_NAME_CODE(EQUAL_EARTH), METHOD_NAME_CODE(LABORDE_OBLIQUE_MERCATOR), - METHOD_NAME_CODE(VERTICAL_PERSPECTIVE), METHOD_NAME_CODE(COLOMBIA_URBAN), + METHOD_NAME_CODE(EQUAL_EARTH), + METHOD_NAME_CODE(LABORDE_OBLIQUE_MERCATOR), + METHOD_NAME_CODE(VERTICAL_PERSPECTIVE), + METHOD_NAME_CODE(COLOMBIA_URBAN), // Other conversions METHOD_NAME_CODE(CHANGE_VERTICAL_UNIT), METHOD_NAME_CODE(HEIGHT_DEPTH_REVERSAL), @@ -940,11 +950,15 @@ const struct MethodNameCode methodNameCodes[] = { METHOD_NAME_CODE(MOLODENSKY_BADEKAS_PV_GEOCENTRIC), METHOD_NAME_CODE(MOLODENSKY_BADEKAS_PV_GEOGRAPHIC_2D), METHOD_NAME_CODE(MOLODENSKY_BADEKAS_PV_GEOGRAPHIC_3D), - METHOD_NAME_CODE(MOLODENSKY), METHOD_NAME_CODE(ABRIDGED_MOLODENSKY), + METHOD_NAME_CODE(MOLODENSKY), + METHOD_NAME_CODE(ABRIDGED_MOLODENSKY), METHOD_NAME_CODE(GEOGRAPHIC2D_OFFSETS), METHOD_NAME_CODE(GEOGRAPHIC2D_WITH_HEIGHT_OFFSETS), - METHOD_NAME_CODE(GEOGRAPHIC3D_OFFSETS), METHOD_NAME_CODE(VERTICAL_OFFSET), - METHOD_NAME_CODE(NTV2), METHOD_NAME_CODE(NTV1), METHOD_NAME_CODE(NADCON), + METHOD_NAME_CODE(GEOGRAPHIC3D_OFFSETS), + METHOD_NAME_CODE(VERTICAL_OFFSET), + METHOD_NAME_CODE(NTV2), + METHOD_NAME_CODE(NTV1), + METHOD_NAME_CODE(NADCON), METHOD_NAME_CODE(VERTCON), METHOD_NAME_CODE(GEOCENTRIC_TRANSLATION_BY_GRID_INTERPOLATION_IGN), }; @@ -963,7 +977,8 @@ const struct ParamNameCode paramNameCodes[] = { PARAM_NAME_CODE(LATITUDE_OF_NATURAL_ORIGIN), PARAM_NAME_CODE(LONGITUDE_OF_NATURAL_ORIGIN), PARAM_NAME_CODE(SCALE_FACTOR_AT_NATURAL_ORIGIN), - PARAM_NAME_CODE(FALSE_EASTING), PARAM_NAME_CODE(FALSE_NORTHING), + PARAM_NAME_CODE(FALSE_EASTING), + PARAM_NAME_CODE(FALSE_NORTHING), PARAM_NAME_CODE(LATITUDE_PROJECTION_CENTRE), PARAM_NAME_CODE(LONGITUDE_PROJECTION_CENTRE), PARAM_NAME_CODE(AZIMUTH_INITIAL_LINE), @@ -994,21 +1009,32 @@ const struct ParamNameCode paramNameCodes[] = { PARAM_NAME_CODE(VERTICAL_OFFSET_FILE), PARAM_NAME_CODE(LATITUDE_DIFFERENCE_FILE), PARAM_NAME_CODE(LONGITUDE_DIFFERENCE_FILE), - PARAM_NAME_CODE(UNIT_CONVERSION_SCALAR), PARAM_NAME_CODE(LATITUDE_OFFSET), - PARAM_NAME_CODE(LONGITUDE_OFFSET), PARAM_NAME_CODE(VERTICAL_OFFSET), - PARAM_NAME_CODE(GEOID_UNDULATION), PARAM_NAME_CODE(A0), PARAM_NAME_CODE(A1), - PARAM_NAME_CODE(A2), PARAM_NAME_CODE(B0), PARAM_NAME_CODE(B1), - PARAM_NAME_CODE(B2), PARAM_NAME_CODE(X_AXIS_TRANSLATION), - PARAM_NAME_CODE(Y_AXIS_TRANSLATION), PARAM_NAME_CODE(Z_AXIS_TRANSLATION), - PARAM_NAME_CODE(X_AXIS_ROTATION), PARAM_NAME_CODE(Y_AXIS_ROTATION), - PARAM_NAME_CODE(Z_AXIS_ROTATION), PARAM_NAME_CODE(SCALE_DIFFERENCE), + PARAM_NAME_CODE(UNIT_CONVERSION_SCALAR), + PARAM_NAME_CODE(LATITUDE_OFFSET), + PARAM_NAME_CODE(LONGITUDE_OFFSET), + PARAM_NAME_CODE(VERTICAL_OFFSET), + PARAM_NAME_CODE(GEOID_UNDULATION), + PARAM_NAME_CODE(A0), + PARAM_NAME_CODE(A1), + PARAM_NAME_CODE(A2), + PARAM_NAME_CODE(B0), + PARAM_NAME_CODE(B1), + PARAM_NAME_CODE(B2), + PARAM_NAME_CODE(X_AXIS_TRANSLATION), + PARAM_NAME_CODE(Y_AXIS_TRANSLATION), + PARAM_NAME_CODE(Z_AXIS_TRANSLATION), + PARAM_NAME_CODE(X_AXIS_ROTATION), + PARAM_NAME_CODE(Y_AXIS_ROTATION), + PARAM_NAME_CODE(Z_AXIS_ROTATION), + PARAM_NAME_CODE(SCALE_DIFFERENCE), PARAM_NAME_CODE(RATE_X_AXIS_TRANSLATION), PARAM_NAME_CODE(RATE_Y_AXIS_TRANSLATION), PARAM_NAME_CODE(RATE_Z_AXIS_TRANSLATION), PARAM_NAME_CODE(RATE_X_AXIS_ROTATION), PARAM_NAME_CODE(RATE_Y_AXIS_ROTATION), PARAM_NAME_CODE(RATE_Z_AXIS_ROTATION), - PARAM_NAME_CODE(RATE_SCALE_DIFFERENCE), PARAM_NAME_CODE(REFERENCE_EPOCH), + PARAM_NAME_CODE(RATE_SCALE_DIFFERENCE), + PARAM_NAME_CODE(REFERENCE_EPOCH), PARAM_NAME_CODE(TRANSFORMATION_REFERENCE_EPOCH), PARAM_NAME_CODE(ORDINATE_1_EVAL_POINT), PARAM_NAME_CODE(ORDINATE_2_EVAL_POINT), diff --git a/src/iso19111/operation/singleoperation.cpp b/src/iso19111/operation/singleoperation.cpp index b32b61cd..6812819c 100644 --- a/src/iso19111/operation/singleoperation.cpp +++ b/src/iso19111/operation/singleoperation.cpp @@ -103,10 +103,8 @@ GridDescription::GridDescription(const GridDescription &) = default; GridDescription::GridDescription(GridDescription &&other) noexcept : shortName(std::move(other.shortName)), fullName(std::move(other.fullName)), - packageName(std::move(other.packageName)), - url(std::move(other.url)), - directDownload(other.directDownload), - openLicense(other.openLicense), + packageName(std::move(other.packageName)), url(std::move(other.url)), + directDownload(other.directDownload), openLicense(other.openLicense), available(other.available) {} //! @endcond @@ -1108,8 +1106,8 @@ SingleOperation::parameterValue(const std::string ¶mName, * @param epsg_code the parameter EPSG code * @return the value, or nullptr if not found. */ -const ParameterValuePtr &SingleOperation::parameterValue(int epsg_code) const - noexcept { +const ParameterValuePtr & +SingleOperation::parameterValue(int epsg_code) const noexcept { for (const auto &genOpParamvalue : parameterValues()) { auto opParamvalue = dynamic_cast<const OperationParameterValue *>( genOpParamvalue.get()); @@ -1160,8 +1158,8 @@ SingleOperation::parameterValueMeasure(int epsg_code) const noexcept { //! @cond Doxygen_Suppress -double SingleOperation::parameterValueNumericAsSI(int epsg_code) const - noexcept { +double +SingleOperation::parameterValueNumericAsSI(int epsg_code) const noexcept { const auto &val = parameterValue(epsg_code); if (val && val->type() == ParameterValue::Type::MEASURE) { return val->value().getSIValue(); @@ -1179,8 +1177,8 @@ double SingleOperation::parameterValueNumeric( } double SingleOperation::parameterValueNumeric( - const char *param_name, const common::UnitOfMeasure &targetUnit) const - noexcept { + const char *param_name, + const common::UnitOfMeasure &targetUnit) const noexcept { const auto &val = parameterValue(param_name, 0); if (val && val->type() == ParameterValue::Type::MEASURE) { return val->value().convertToUnit(targetUnit); diff --git a/src/iso19111/operation/transformation.cpp b/src/iso19111/operation/transformation.cpp index 932b9e4e..984f2756 100644 --- a/src/iso19111/operation/transformation.cpp +++ b/src/iso19111/operation/transformation.cpp @@ -268,23 +268,20 @@ Transformation::getTOWGS84Parameters() const // throw(io::FormattingException) } else if (epsg_code == EPSG_CODE_PARAMETER_X_AXIS_ROTATION) { params[3] = fixNegativeZero( - rotSign * - measure.convertToUnit( - common::UnitOfMeasure::ARC_SECOND)); + rotSign * measure.convertToUnit( + common::UnitOfMeasure::ARC_SECOND)); foundRotX = true; } else if (epsg_code == EPSG_CODE_PARAMETER_Y_AXIS_ROTATION) { params[4] = fixNegativeZero( - rotSign * - measure.convertToUnit( - common::UnitOfMeasure::ARC_SECOND)); + rotSign * measure.convertToUnit( + common::UnitOfMeasure::ARC_SECOND)); foundRotY = true; } else if (epsg_code == EPSG_CODE_PARAMETER_Z_AXIS_ROTATION) { params[5] = fixNegativeZero( - rotSign * - measure.convertToUnit( - common::UnitOfMeasure::ARC_SECOND)); + rotSign * measure.convertToUnit( + common::UnitOfMeasure::ARC_SECOND)); foundRotZ = true; } else if (epsg_code == EPSG_CODE_PARAMETER_SCALE_DIFFERENCE) { @@ -2178,14 +2175,13 @@ TransformationNNPtr Transformation::substitutePROJAlternativeGridNames( } } const auto &horizontalGridName = - !NTv1Filename.empty() ? NTv1Filename : !NTv2Filename.empty() - ? NTv2Filename - : lasFilename; + !NTv1Filename.empty() + ? NTv1Filename + : !NTv2Filename.empty() ? NTv2Filename : lasFilename; - if (!horizontalGridName.empty() && - databaseContext->lookForGridAlternative(horizontalGridName, - projFilename, projGridFormat, - inverseDirection)) { + if (!horizontalGridName.empty() && databaseContext->lookForGridAlternative( + horizontalGridName, projFilename, + projGridFormat, inverseDirection)) { if (horizontalGridName == projFilename) { if (inverseDirection) { @@ -2296,13 +2292,14 @@ TransformationNNPtr Transformation::substitutePROJAlternativeGridNames( EPSG_CODE_PARAMETER_GEOID_CORRECTION_FILENAME)}; #ifdef disabled_for_now if (inverseDirection) { - return create(createPropertiesForInverse( - self.as_nullable().get(), true, false), - targetCRS(), sourceCRS(), nullptr, - createSimilarPropertiesMethod(method()), - parameters, {ParameterValue::createFilename( - projFilename)}, - coordinateOperationAccuracies()) + return create( + createPropertiesForInverse( + self.as_nullable().get(), true, false), + targetCRS(), sourceCRS(), nullptr, + createSimilarPropertiesMethod(method()), + parameters, + {ParameterValue::createFilename(projFilename)}, + coordinateOperationAccuracies()) ->inverseAsTransformation(); } else #endif @@ -2373,13 +2370,14 @@ TransformationNNPtr Transformation::substitutePROJAlternativeGridNames( createOpParamNameEPSGCode( EPSG_CODE_PARAMETER_VERTICAL_OFFSET_FILE)}; if (inverseDirection) { - return create(createPropertiesForInverse( - self.as_nullable().get(), true, false), - targetCRS(), sourceCRS(), nullptr, - createSimilarPropertiesMethod(method()), - parameters, {ParameterValue::createFilename( - projFilename)}, - coordinateOperationAccuracies()) + return create( + createPropertiesForInverse( + self.as_nullable().get(), true, false), + targetCRS(), sourceCRS(), nullptr, + createSimilarPropertiesMethod(method()), + parameters, + {ParameterValue::createFilename(projFilename)}, + coordinateOperationAccuracies()) ->inverseAsTransformation(); } else { return create( @@ -2985,9 +2983,9 @@ void Transformation::_exportToPROJString( const auto &hGridShiftFilename = !HorizontalShiftGTIFFFilename.empty() ? HorizontalShiftGTIFFFilename - : !NTv1Filename.empty() ? NTv1Filename : !NTv2Filename.empty() - ? NTv2Filename - : CTABLE2Filename; + : !NTv1Filename.empty() + ? NTv1Filename + : !NTv2Filename.empty() ? NTv2Filename : CTABLE2Filename; if (!hGridShiftFilename.empty()) { auto sourceCRSGeog = extractGeographicCRSIfGeographicCRSOrEquivalent(sourceCRS()); @@ -3282,5 +3280,5 @@ void Transformation::_exportToPROJString( throw io::FormattingException("Unimplemented"); } -} // namespace crs +} // namespace operation NS_PROJ_END diff --git a/src/networkfilemanager.cpp b/src/networkfilemanager.cpp index 102d3d15..b68a60a3 100644 --- a/src/networkfilemanager.cpp +++ b/src/networkfilemanager.cpp @@ -53,7 +53,7 @@ class MyMutex { // cppcheck-suppress functionStatic void unlock() { pj_release_lock(); } }; -} +} // namespace #else #include <mutex> #define MyMutex std::mutex @@ -839,50 +839,51 @@ void NetworkChunkCache::insert(PJ_CONTEXT *ctx, const std::string &url, // Lambda to recycle an existing entry that was either invalidated, or // least recently used. - const auto reuseExistingEntry = [ctx, &blob, &diskCache, hDB, &url, - chunkIdx, &dataPtr]( - std::unique_ptr<SQLiteStatement> &stmtIn) { - const auto chunk_id = stmtIn->getInt64(); - const auto data_id = stmtIn->getInt64(); - if (data_id <= 0) { - pj_log(ctx, PJ_LOG_ERROR, "data_id <= 0"); - return; - } + const auto reuseExistingEntry = + [ctx, &blob, &diskCache, hDB, &url, chunkIdx, + &dataPtr](std::unique_ptr<SQLiteStatement> &stmtIn) { + const auto chunk_id = stmtIn->getInt64(); + const auto data_id = stmtIn->getInt64(); + if (data_id <= 0) { + pj_log(ctx, PJ_LOG_ERROR, "data_id <= 0"); + return; + } - auto l_stmt = - diskCache->prepare("UPDATE chunk_data SET data = ? WHERE id = ?"); - if (!l_stmt) - return; - l_stmt->bindBlob(blob.data(), blob.size()); - l_stmt->bindInt64(data_id); - { - const auto ret2 = l_stmt->execute(); - if (ret2 != SQLITE_DONE) { - pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); + auto l_stmt = diskCache->prepare( + "UPDATE chunk_data SET data = ? WHERE id = ?"); + if (!l_stmt) return; + l_stmt->bindBlob(blob.data(), blob.size()); + l_stmt->bindInt64(data_id); + { + const auto ret2 = l_stmt->execute(); + if (ret2 != SQLITE_DONE) { + pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); + return; + } } - } - l_stmt = diskCache->prepare("UPDATE chunks SET url = ?, " - "offset = ?, data_size = ?, data_id = ? " - "WHERE id = ?"); - if (!l_stmt) - return; - l_stmt->bindText(url.c_str()); - l_stmt->bindInt64(chunkIdx * DOWNLOAD_CHUNK_SIZE); - l_stmt->bindInt64(dataPtr->size()); - l_stmt->bindInt64(data_id); - l_stmt->bindInt64(chunk_id); - { - const auto ret2 = l_stmt->execute(); - if (ret2 != SQLITE_DONE) { - pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); + l_stmt = + diskCache->prepare("UPDATE chunks SET url = ?, " + "offset = ?, data_size = ?, data_id = ? " + "WHERE id = ?"); + if (!l_stmt) return; + l_stmt->bindText(url.c_str()); + l_stmt->bindInt64(chunkIdx * DOWNLOAD_CHUNK_SIZE); + l_stmt->bindInt64(dataPtr->size()); + l_stmt->bindInt64(data_id); + l_stmt->bindInt64(chunk_id); + { + const auto ret2 = l_stmt->execute(); + if (ret2 != SQLITE_DONE) { + pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); + return; + } } - } - diskCache->move_to_head(chunk_id); - }; + diskCache->move_to_head(chunk_id); + }; // Find if there is an invalidated chunk we can reuse stmt = diskCache->prepare( @@ -2017,16 +2018,16 @@ int proj_context_set_network_callbacks( // --------------------------------------------------------------------------- /** Enable or disable network access. -* -* This overrides the default endpoint in the PROJ configuration file or with -* the PROJ_NETWORK environment variable. -* -* @param ctx PROJ context, or NULL -* @param enable TRUE if network access is allowed. -* @return TRUE if network access is possible. That is either libcurl is -* available, or an alternate interface has been set. -* @since 7.0 -*/ + * + * This overrides the default endpoint in the PROJ configuration file or with + * the PROJ_NETWORK environment variable. + * + * @param ctx PROJ context, or NULL + * @param enable TRUE if network access is allowed. + * @return TRUE if network access is possible. That is either libcurl is + * available, or an alternate interface has been set. + * @since 7.0 + */ int proj_context_set_enable_network(PJ_CONTEXT *ctx, int enable) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); @@ -2046,11 +2047,11 @@ int proj_context_set_enable_network(PJ_CONTEXT *ctx, int enable) { // --------------------------------------------------------------------------- /** Return if network access is enabled. -* -* @param ctx PROJ context, or NULL -* @return TRUE if network access has been enabled -* @since 7.0 -*/ + * + * @param ctx PROJ context, or NULL + * @return TRUE if network access has been enabled + * @since 7.0 + */ int proj_context_is_network_enabled(PJ_CONTEXT *ctx) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); @@ -2074,14 +2075,14 @@ int proj_context_is_network_enabled(PJ_CONTEXT *ctx) { // --------------------------------------------------------------------------- /** Define the URL endpoint to query for remote grids. -* -* This overrides the default endpoint in the PROJ configuration file or with -* the PROJ_NETWORK_ENDPOINT environment variable. -* -* @param ctx PROJ context, or NULL -* @param url Endpoint URL. Must NOT be NULL. -* @since 7.0 -*/ + * + * This overrides the default endpoint in the PROJ configuration file or with + * the PROJ_NETWORK_ENDPOINT environment variable. + * + * @param ctx PROJ context, or NULL + * @param url Endpoint URL. Must NOT be NULL. + * @since 7.0 + */ void proj_context_set_url_endpoint(PJ_CONTEXT *ctx, const char *url) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); @@ -2094,13 +2095,13 @@ void proj_context_set_url_endpoint(PJ_CONTEXT *ctx, const char *url) { // --------------------------------------------------------------------------- /** Enable or disable the local cache of grid chunks -* -* This overrides the setting in the PROJ configuration file. -* -* @param ctx PROJ context, or NULL -* @param enabled TRUE if the cache is enabled. -* @since 7.0 -*/ + * + * This overrides the setting in the PROJ configuration file. + * + * @param ctx PROJ context, or NULL + * @param enabled TRUE if the cache is enabled. + * @since 7.0 + */ void proj_grid_cache_set_enable(PJ_CONTEXT *ctx, int enabled) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); @@ -2113,13 +2114,13 @@ void proj_grid_cache_set_enable(PJ_CONTEXT *ctx, int enabled) { // --------------------------------------------------------------------------- /** Override, for the considered context, the path and file of the local -* cache of grid chunks. -* -* @param ctx PROJ context, or NULL -* @param fullname Full name to the cache (encoded in UTF-8). If set to NULL, -* caching will be disabled. -* @since 7.0 -*/ + * cache of grid chunks. + * + * @param ctx PROJ context, or NULL + * @param fullname Full name to the cache (encoded in UTF-8). If set to NULL, + * caching will be disabled. + * @since 7.0 + */ void proj_grid_cache_set_filename(PJ_CONTEXT *ctx, const char *fullname) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); @@ -2132,13 +2133,13 @@ void proj_grid_cache_set_filename(PJ_CONTEXT *ctx, const char *fullname) { // --------------------------------------------------------------------------- /** Override, for the considered context, the maximum size of the local -* cache of grid chunks. -* -* @param ctx PROJ context, or NULL -* @param max_size_MB Maximum size, in mega-bytes (1024*1024 bytes), or -* negative value to set unlimited size. -* @since 7.0 -*/ + * cache of grid chunks. + * + * @param ctx PROJ context, or NULL + * @param max_size_MB Maximum size, in mega-bytes (1024*1024 bytes), or + * negative value to set unlimited size. + * @since 7.0 + */ void proj_grid_cache_set_max_size(PJ_CONTEXT *ctx, int max_size_MB) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); @@ -2160,12 +2161,12 @@ void proj_grid_cache_set_max_size(PJ_CONTEXT *ctx, int max_size_MB) { // --------------------------------------------------------------------------- /** Override, for the considered context, the time-to-live delay for -* re-checking if the cached properties of files are still up-to-date. -* -* @param ctx PROJ context, or NULL -* @param ttl_seconds Delay in seconds. Use negative value for no expiration. -* @since 7.0 -*/ + * re-checking if the cached properties of files are still up-to-date. + * + * @param ctx PROJ context, or NULL + * @param ttl_seconds Delay in seconds. Use negative value for no expiration. + * @since 7.0 + */ void proj_grid_cache_set_ttl(PJ_CONTEXT *ctx, int ttl_seconds) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); @@ -2178,10 +2179,10 @@ void proj_grid_cache_set_ttl(PJ_CONTEXT *ctx, int ttl_seconds) { // --------------------------------------------------------------------------- /** Clear the local cache of grid chunks. -* -* @param ctx PROJ context, or NULL -* @since 7.0 -*/ + * + * @param ctx PROJ context, or NULL + * @since 7.0 + */ void proj_grid_cache_clear(PJ_CONTEXT *ctx) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); diff --git a/src/quadtree.hpp b/src/quadtree.hpp index b744c83d..6c67b30e 100644 --- a/src/quadtree.hpp +++ b/src/quadtree.hpp @@ -101,7 +101,7 @@ template <class Feature> class QuadTree { public: /** Construct a new quadtree with the global bounds of all objects to be - * inserted */ + * inserted */ explicit QuadTree(const RectObj &globalBounds) : root(globalBounds) {} /** Add a new feature, with its bounds specified in featureBounds */ diff --git a/src/transformations/defmodel.cpp b/src/transformations/defmodel.cpp index 0d9f6690..443660c9 100644 --- a/src/transformations/defmodel.cpp +++ b/src/transformations/defmodel.cpp @@ -89,15 +89,17 @@ struct Grid : public GridPrototype { } } if (foundDesc && (!foundDescX || !foundDescY)) { - pj_log(ctx, PJ_LOG_ERROR, "grid %s : Found band description, " - "but not the ones expected", + pj_log(ctx, PJ_LOG_ERROR, + "grid %s : Found band description, " + "but not the ones expected", realGrid->name().c_str()); return false; } const auto unit = realGrid->unit(sampleX); if (!unit.empty() && unit != expectedUnit) { - pj_log(ctx, PJ_LOG_ERROR, "grid %s : Only unit=%s " - "currently handled for this mode", + pj_log(ctx, PJ_LOG_ERROR, + "grid %s : Only unit=%s " + "currently handled for this mode", realGrid->name().c_str(), expectedUnit.c_str()); return false; } @@ -145,15 +147,17 @@ struct Grid : public GridPrototype { } } if (foundDesc && !foundDescZ) { - pj_log(ctx, PJ_LOG_ERROR, "grid %s : Found band description, " - "but not the ones expected", + pj_log(ctx, PJ_LOG_ERROR, + "grid %s : Found band description, " + "but not the ones expected", realGrid->name().c_str()); return false; } const auto unit = realGrid->unit(sampleZ); if (!unit.empty() && unit != STR_METRE) { - pj_log(ctx, PJ_LOG_ERROR, "grid %s : Only unit=metre currently " - "handled for this mode", + pj_log(ctx, PJ_LOG_ERROR, + "grid %s : Only unit=metre currently " + "handled for this mode", realGrid->name().c_str()); return false; } diff --git a/src/transformations/defmodel.hpp b/src/transformations/defmodel.hpp index 6bf37d8b..7b511495 100644 --- a/src/transformations/defmodel.hpp +++ b/src/transformations/defmodel.hpp @@ -66,9 +66,9 @@ using json = nlohmann::json; class SpatialExtent { public: /** Parse the provided object as an extent. - * - * @throws ParsingException - */ + * + * @throws ParsingException + */ static SpatialExtent parse(const json &j); double minx() const { return mMinx; } @@ -130,9 +130,9 @@ class Epoch { class Component { public: /** Parse the provided object as a component. - * - * @throws ParsingException - */ + * + * @throws ParsingException + */ static Component parse(const json &j); /** Get a text description of the component. */ @@ -630,7 +630,7 @@ class Evaluator { // --------------------------------------------------------------------------- -} // namespace DeformationModel +} // namespace DEFORMATON_MODEL_NAMESPACE // --------------------------------------------------------------------------- diff --git a/src/transformations/defmodel_impl.hpp b/src/transformations/defmodel_impl.hpp index abd07286..afbf15ce 100644 --- a/src/transformations/defmodel_impl.hpp +++ b/src/transformations/defmodel_impl.hpp @@ -246,9 +246,8 @@ static double ISO8601ToDecimalYear(const std::string &dt) { throw ParsingException("Wrong formatting / invalid date-time for " + dt); } - return year + - (dayInYear * 86400 + hour * 3600 + min * 60 + sec) / - (isLeapYear ? 86400. * 366 : 86400. * 365); + return year + (dayInYear * 86400 + hour * 3600 + min * 60 + sec) / + (isLeapYear ? 86400. * 366 : 86400. * 365); } // --------------------------------------------------------------------------- @@ -1004,7 +1003,9 @@ bool Evaluator<Grid, GridSet, EvaluatorIface>::forward( !grid->getLonLatOffset(ix1, iy1, dx11, dy11)) { return false; } - } else /* if (compEx->displacementType == DisplacementType::THREE_D) */ { + } else /* if (compEx->displacementType == DisplacementType::THREE_D) + */ + { double dz00 = 0; double dz01 = 0; double dz10 = 0; @@ -1051,7 +1052,9 @@ bool Evaluator<Grid, GridSet, EvaluatorIface>::forward( !grid->getEastingNorthingOffset(ix1, iy1, de11, dn11)) { return false; } - } else /* if (compEx->displacementType == DisplacementType::THREE_D) */ { + } else /* if (compEx->displacementType == DisplacementType::THREE_D) + */ + { double dz00 = 0; double dz01 = 0; double dz10 = 0; @@ -1117,14 +1120,12 @@ bool Evaluator<Grid, GridSet, EvaluatorIface>::forward( const double sinlam = gridwithCacheRef.smallResx ? lam_rel_to_cell_center * - (1 - - (1. / 6) * (lam_rel_to_cell_center * - lam_rel_to_cell_center)) + (1 - (1. / 6) * (lam_rel_to_cell_center * + lam_rel_to_cell_center)) : sin(lam_rel_to_cell_center); const double coslam = gridwithCacheRef.smallResx - ? (1 - - 0.5 * (lam_rel_to_cell_center * - lam_rel_to_cell_center)) + ? (1 - 0.5 * (lam_rel_to_cell_center * + lam_rel_to_cell_center)) : cos(lam_rel_to_cell_center); // Convert back from geocentric deltas to easting, northing @@ -1243,8 +1244,8 @@ bool Evaluator<Grid, GridSet, EvaluatorIface>::inverse( return false; } #ifdef DEBUG_DEFMODEL - iface.log("After forward: x=" + toString(x_new) + ", y=" + - toString(y_new)); + iface.log("After forward: x=" + toString(x_new) + + ", y=" + toString(y_new)); #endif const double dx = x_new - x; const double dy = y_new - y; diff --git a/src/transformations/tinshift_exceptions.hpp b/src/transformations/tinshift_exceptions.hpp index d6d71302..1d13c2b1 100644 --- a/src/transformations/tinshift_exceptions.hpp +++ b/src/transformations/tinshift_exceptions.hpp @@ -49,4 +49,4 @@ const char *ParsingException::what() const noexcept { return msg_.c_str(); } // --------------------------------------------------------------------------- -} // namespace DEFORMATON_MODEL_NAMESPACE +} // namespace TINSHIFT_NAMESPACE diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp index b67ff6d1..26e4eae2 100644 --- a/test/unit/test_c_api.cpp +++ b/test/unit/test_c_api.cpp @@ -298,15 +298,16 @@ TEST_F(CApi, proj_create_from_wkt) { PROJ_STRING_LIST warningList = nullptr; PROJ_STRING_LIST errorList = nullptr; auto obj = proj_create_from_wkt( - m_ctxt, "PROJCS[\"test\",\n" - " GEOGCS[\"WGS 84\",\n" - " DATUM[\"WGS_1984\",\n" - " SPHEROID[\"WGS 84\",6378137,298.257223563]],\n" - " PRIMEM[\"Greenwich\",0],\n" - " UNIT[\"degree\",0.0174532925199433]],\n" - " PROJECTION[\"Transverse_Mercator\"],\n" - " PARAMETER[\"latitude_of_origin\",31],\n" - " UNIT[\"metre\",1]]", + m_ctxt, + "PROJCS[\"test\",\n" + " GEOGCS[\"WGS 84\",\n" + " DATUM[\"WGS_1984\",\n" + " SPHEROID[\"WGS 84\",6378137,298.257223563]],\n" + " PRIMEM[\"Greenwich\",0],\n" + " UNIT[\"degree\",0.0174532925199433]],\n" + " PROJECTION[\"Transverse_Mercator\"],\n" + " PARAMETER[\"latitude_of_origin\",31],\n" + " UNIT[\"metre\",1]]", nullptr, &warningList, &errorList); ObjectKeeper keeper(obj); EXPECT_NE(obj, nullptr); @@ -317,15 +318,16 @@ TEST_F(CApi, proj_create_from_wkt) { } { auto obj = proj_create_from_wkt( - m_ctxt, "PROJCS[\"test\",\n" - " GEOGCS[\"WGS 84\",\n" - " DATUM[\"WGS_1984\",\n" - " SPHEROID[\"WGS 84\",6378137,298.257223563]],\n" - " PRIMEM[\"Greenwich\",0],\n" - " UNIT[\"degree\",0.0174532925199433]],\n" - " PROJECTION[\"Transverse_Mercator\"],\n" - " PARAMETER[\"latitude_of_origin\",31],\n" - " UNIT[\"metre\",1]]", + m_ctxt, + "PROJCS[\"test\",\n" + " GEOGCS[\"WGS 84\",\n" + " DATUM[\"WGS_1984\",\n" + " SPHEROID[\"WGS 84\",6378137,298.257223563]],\n" + " PRIMEM[\"Greenwich\",0],\n" + " UNIT[\"degree\",0.0174532925199433]],\n" + " PROJECTION[\"Transverse_Mercator\"],\n" + " PARAMETER[\"latitude_of_origin\",31],\n" + " UNIT[\"metre\",1]]", nullptr, nullptr, nullptr); ObjectKeeper keeper(obj); EXPECT_NE(obj, nullptr); @@ -466,9 +468,10 @@ TEST_F(CApi, proj_as_wkt) { TEST_F(CApi, proj_as_wkt_check_db_use) { auto obj = proj_create_from_wkt( - m_ctxt, "GEOGCS[\"AGD66\",DATUM[\"Australian_Geodetic_Datum_1966\"," - "SPHEROID[\"Australian National Spheroid\",6378160,298.25]]," - "PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433]]", + m_ctxt, + "GEOGCS[\"AGD66\",DATUM[\"Australian_Geodetic_Datum_1966\"," + "SPHEROID[\"Australian National Spheroid\",6378160,298.25]]," + "PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433]]", nullptr, nullptr, nullptr); ObjectKeeper keeper(obj); ASSERT_NE(obj, nullptr); @@ -691,41 +694,45 @@ TEST_F(CApi, proj_get_type) { EXPECT_EQ(proj_get_type(obj), PJ_TYPE_GEOCENTRIC_CRS); } { - auto obj = proj_create_from_wkt( - m_ctxt, GeographicCRS::EPSG_4326->datum() - ->exportToWKT(WKTFormatter::create().get()) - .c_str(), - nullptr, nullptr, nullptr); + auto obj = + proj_create_from_wkt(m_ctxt, + GeographicCRS::EPSG_4326->datum() + ->exportToWKT(WKTFormatter::create().get()) + .c_str(), + nullptr, nullptr, nullptr); ObjectKeeper keeper(obj); ASSERT_NE(obj, nullptr); EXPECT_EQ(proj_get_type(obj), PJ_TYPE_GEODETIC_REFERENCE_FRAME); } { - auto obj = proj_create_from_wkt( - m_ctxt, GeographicCRS::EPSG_4326->ellipsoid() - ->exportToWKT(WKTFormatter::create().get()) - .c_str(), - nullptr, nullptr, nullptr); + auto obj = + proj_create_from_wkt(m_ctxt, + GeographicCRS::EPSG_4326->ellipsoid() + ->exportToWKT(WKTFormatter::create().get()) + .c_str(), + nullptr, nullptr, nullptr); ObjectKeeper keeper(obj); ASSERT_NE(obj, nullptr); EXPECT_EQ(proj_get_type(obj), PJ_TYPE_ELLIPSOID); } { - auto obj = proj_create_from_wkt( - m_ctxt, createProjectedCRS() - ->exportToWKT(WKTFormatter::create().get()) - .c_str(), - nullptr, nullptr, nullptr); + auto obj = + proj_create_from_wkt(m_ctxt, + createProjectedCRS() + ->exportToWKT(WKTFormatter::create().get()) + .c_str(), + nullptr, nullptr, nullptr); ObjectKeeper keeper(obj); ASSERT_NE(obj, nullptr); EXPECT_EQ(proj_get_type(obj), PJ_TYPE_PROJECTED_CRS); } { - auto obj = proj_create_from_wkt( - m_ctxt, createVerticalCRS() - ->exportToWKT(WKTFormatter::create().get()) - .c_str(), - nullptr, nullptr, nullptr); + auto obj = + proj_create_from_wkt(m_ctxt, + createVerticalCRS() + ->exportToWKT(WKTFormatter::create().get()) + .c_str(), + nullptr, nullptr, nullptr); ObjectKeeper keeper(obj); ASSERT_NE(obj, nullptr); EXPECT_EQ(proj_get_type(obj), PJ_TYPE_VERTICAL_CRS); @@ -756,23 +763,25 @@ TEST_F(CApi, proj_get_type) { EXPECT_EQ(proj_get_type(datum), PJ_TYPE_PARAMETRIC_DATUM); } { - auto obj = proj_create_from_wkt( - m_ctxt, createVerticalCRS() - ->datum() - ->exportToWKT(WKTFormatter::create().get()) - .c_str(), - nullptr, nullptr, nullptr); + auto obj = + proj_create_from_wkt(m_ctxt, + createVerticalCRS() + ->datum() + ->exportToWKT(WKTFormatter::create().get()) + .c_str(), + nullptr, nullptr, nullptr); ObjectKeeper keeper(obj); ASSERT_NE(obj, nullptr); EXPECT_EQ(proj_get_type(obj), PJ_TYPE_VERTICAL_REFERENCE_FRAME); } { - auto obj = proj_create_from_wkt( - m_ctxt, createProjectedCRS() - ->derivingConversion() - ->exportToWKT(WKTFormatter::create().get()) - .c_str(), - nullptr, nullptr, nullptr); + auto obj = + proj_create_from_wkt(m_ctxt, + createProjectedCRS() + ->derivingConversion() + ->exportToWKT(WKTFormatter::create().get()) + .c_str(), + nullptr, nullptr, nullptr); ObjectKeeper keeper(obj); ASSERT_NE(obj, nullptr); EXPECT_EQ(proj_get_type(obj), PJ_TYPE_CONVERSION); @@ -787,12 +796,13 @@ TEST_F(CApi, proj_get_type) { EXPECT_EQ(proj_get_type(obj), PJ_TYPE_BOUND_CRS); } { - auto obj = proj_create_from_wkt( - m_ctxt, createBoundCRS() - ->transformation() - ->exportToWKT(WKTFormatter::create().get()) - .c_str(), - nullptr, nullptr, nullptr); + auto obj = + proj_create_from_wkt(m_ctxt, + createBoundCRS() + ->transformation() + ->exportToWKT(WKTFormatter::create().get()) + .c_str(), + nullptr, nullptr, nullptr); ObjectKeeper keeper(obj); ASSERT_NE(obj, nullptr); EXPECT_EQ(proj_get_type(obj), PJ_TYPE_TRANSFORMATION); @@ -1092,12 +1102,13 @@ TEST_F(CApi, proj_get_source_target_crs_bound_crs) { // --------------------------------------------------------------------------- TEST_F(CApi, proj_get_source_target_crs_transformation) { - auto obj = proj_create_from_wkt( - m_ctxt, createBoundCRS() - ->transformation() - ->exportToWKT(WKTFormatter::create().get()) - .c_str(), - nullptr, nullptr, nullptr); + auto obj = + proj_create_from_wkt(m_ctxt, + createBoundCRS() + ->transformation() + ->exportToWKT(WKTFormatter::create().get()) + .c_str(), + nullptr, nullptr, nullptr); ASSERT_NE(obj, nullptr); ObjectKeeper keeper(obj); @@ -3975,8 +3986,8 @@ TEST_F(CApi, proj_as_projjson) { "}"); } { - const char *const options[] = {"INDENTATION_WIDTH=4", "SCHEMA=", - nullptr}; + const char *const options[] = {"INDENTATION_WIDTH=4", + "SCHEMA=", nullptr}; auto projjson = proj_as_projjson(m_ctxt, obj, options); ASSERT_NE(projjson, nullptr); EXPECT_EQ(std::string(projjson), @@ -4046,9 +4057,10 @@ struct Fixture_proj_context_set_autoclose_database : public CApi { sqlite3_open_v2(tmp_filename.c_str(), &db, SQLITE_OPEN_READWRITE, nullptr); ASSERT_NE(db, nullptr); - ASSERT_TRUE(sqlite3_exec(db, "UPDATE geodetic_crs SET name = 'foo' " - "WHERE auth_name = 'EPSG' and code = " - "'4326'", + ASSERT_TRUE(sqlite3_exec(db, + "UPDATE geodetic_crs SET name = 'foo' " + "WHERE auth_name = 'EPSG' and code = " + "'4326'", nullptr, nullptr, nullptr) == SQLITE_OK); sqlite3_close(db); } @@ -4068,9 +4080,10 @@ struct Fixture_proj_context_set_autoclose_database : public CApi { sqlite3_open_v2(tmp_filename.c_str(), &db, SQLITE_OPEN_READWRITE, nullptr); ASSERT_NE(db, nullptr); - ASSERT_TRUE(sqlite3_exec(db, "UPDATE geodetic_crs SET name = 'bar' " - "WHERE auth_name = 'EPSG' and code = " - "'4326'", + ASSERT_TRUE(sqlite3_exec(db, + "UPDATE geodetic_crs SET name = 'bar' " + "WHERE auth_name = 'EPSG' and code = " + "'4326'", nullptr, nullptr, nullptr) == SQLITE_OK); sqlite3_close(db); } diff --git a/test/unit/test_crs.cpp b/test/unit/test_crs.cpp index 3d0a108a..5ff4dd2d 100644 --- a/test/unit/test_crs.cpp +++ b/test/unit/test_crs.cpp @@ -5511,8 +5511,9 @@ static ParametricCSNNPtr createParametricCS() { PropertyMap(), CoordinateSystemAxis::create( PropertyMap().set(IdentifiedObject::NAME_KEY, "pressure"), "hPa", - AxisDirection::UP, UnitOfMeasure("HectoPascal", 100, - UnitOfMeasure::Type::PARAMETRIC))); + AxisDirection::UP, + UnitOfMeasure("HectoPascal", 100, + UnitOfMeasure::Type::PARAMETRIC))); } // --------------------------------------------------------------------------- diff --git a/test/unit/test_defmodel.cpp b/test/unit/test_defmodel.cpp index ac9da818..16bffcf3 100644 --- a/test/unit/test_defmodel.cpp +++ b/test/unit/test_defmodel.cpp @@ -63,8 +63,8 @@ static json getMinValidContent() { j["target_crs"] = "EPSG:7907"; j["definition_crs"] = "EPSG:4959"; j["extent"]["type"] = "bbox"; - j["extent"] - ["parameters"] = {{"bbox", {modelMinX, modelMinY, modelMaxX, modelMaxY}}}; + j["extent"]["parameters"] = { + {"bbox", {modelMinX, modelMinY, modelMaxX, modelMaxY}}}; j["time_extent"]["first"] = "1900-01-01T00:00:00Z"; j["time_extent"]["last"] = "2050-01-01T00:00:00Z"; j["components"] = json::array(); @@ -124,7 +124,8 @@ static json getFullValidContent() { }}, {"time_function", { - {"type", "constant"}, {"parameters", json::object()}, + {"type", "constant"}, + {"parameters", json::object()}, }}, }}; @@ -848,15 +849,13 @@ TEST(defmodel, evaluator_horizontal_unit_degree) { tValid, newLon, newLat, newZ)); EXPECT_NEAR( RadToDeg(newLon), - lon + - tFactor * (lonOffsetQueriedX + - alphaX * (lonOffsetQueriedXp1 - lonOffsetQueriedX)), + lon + tFactor * (lonOffsetQueriedX + alphaX * (lonOffsetQueriedXp1 - + lonOffsetQueriedX)), EPS); EXPECT_NEAR( RadToDeg(newLat), - lat + - tFactor * (latOffsetQueriedY + - alphaY * (latOffsetQueriedYp1 - latOffsetQueriedY)), + lat + tFactor * (latOffsetQueriedY + alphaY * (latOffsetQueriedYp1 - + latOffsetQueriedY)), EPS); EXPECT_EQ(newZ, zVal); } @@ -1002,15 +1001,13 @@ TEST(defmodel, evaluator_horizontal_unit_degree) { tValid, newLon, newLat, newZ)); EXPECT_NEAR( RadToDeg(newLon), - lon + - tFactor * (lonOffsetQueriedX + - alphaX * (lonOffsetQueriedXp1 - lonOffsetQueriedX)), + lon + tFactor * (lonOffsetQueriedX + alphaX * (lonOffsetQueriedXp1 - + lonOffsetQueriedX)), EPS); EXPECT_NEAR( RadToDeg(newLat), - lat + - tFactor * (latOffsetQueriedY + - alphaY * (latOffsetQueriedYp1 - latOffsetQueriedY)), + lat + tFactor * (latOffsetQueriedY + alphaY * (latOffsetQueriedYp1 - + latOffsetQueriedY)), EPS); const double zBottom = @@ -1391,8 +1388,8 @@ TEST(defmodel, evaluator_projected_crs) { constexpr double gridResX = gridMaxX - gridMinX; constexpr double gridResY = gridMaxY - gridMinY; - j["extent"] - ["parameters"] = {{"bbox", {gridMinX, gridMinY, gridMaxX, gridMaxY}}}; + j["extent"]["parameters"] = { + {"bbox", {gridMinX, gridMinY, gridMaxX, gridMaxY}}}; j["components"] = { {{"displacement_type", "horizontal"}, {"uncertainty_type", "none"}, diff --git a/test/unit/test_factory.cpp b/test/unit/test_factory.cpp index 7f474dcf..a9bb4e86 100644 --- a/test/unit/test_factory.cpp +++ b/test/unit/test_factory.cpp @@ -1794,11 +1794,13 @@ class FactoryWithTmpDatabase : public ::testing::Test { << last_error(); ASSERT_TRUE(execute("INSERT INTO usage VALUES('FOO'," "'geodetic_datum_" + - val + "_usage'," - "'geodetic_datum'," - "'FOO','" + - val + "'," - "'EPSG','1262','EPSG','1024');")) + val + + "_usage'," + "'geodetic_datum'," + "'FOO','" + + val + + "'," + "'EPSG','1262','EPSG','1024');")) << last_error(); ASSERT_TRUE(execute("INSERT INTO geodetic_crs " @@ -1810,9 +1812,10 @@ class FactoryWithTmpDatabase : public ::testing::Test { << last_error(); ASSERT_TRUE(execute("INSERT INTO usage VALUES('FOO'," "'geodetic_crs_" + - val + "_usage'," - "'geodetic_crs'," - "'NS_" + + val + + "_usage'," + "'geodetic_crs'," + "'NS_" + val + "','" + val + "','EPSG','1262','EPSG','1024');")) << last_error(); @@ -1835,11 +1838,13 @@ class FactoryWithTmpDatabase : public ::testing::Test { << last_error(); ASSERT_TRUE(execute("INSERT INTO usage VALUES('OTHER'," "'helmert_transformation" + - src + '_' + dst + "_usage'," - "'helmert_transformation'," - "'OTHER','" + - src + "_" + dst + "'," - "'EPSG','1262','EPSG','1024');")) + src + '_' + dst + + "_usage'," + "'helmert_transformation'," + "'OTHER','" + + src + "_" + dst + + "'," + "'EPSG','1262','EPSG','1024');")) << last_error(); } @@ -1856,16 +1861,18 @@ class FactoryWithTmpDatabase : public ::testing::Test { res = factoryOTHER->createFromCRSCodesWithIntermediates( "NS_SOURCE", "SOURCE", "NS_TARGET", "TARGET", false, false, - false, false, {std::make_pair(std::string("NS_PIVOT"), - std::string("PIVOT"))}); + false, false, + {std::make_pair(std::string("NS_PIVOT"), + std::string("PIVOT"))}); EXPECT_EQ(res.size(), 1U); EXPECT_TRUE(res.empty() || nn_dynamic_pointer_cast<ConcatenatedOperation>(res[0])); res = factoryOTHER->createFromCRSCodesWithIntermediates( "NS_SOURCE", "SOURCE", "NS_TARGET", "TARGET", false, false, - false, false, {std::make_pair(std::string("NS_PIVOT"), - std::string("NOT_EXISTING"))}); + false, false, + {std::make_pair(std::string("NS_PIVOT"), + std::string("NOT_EXISTING"))}); EXPECT_EQ(res.size(), 0U); res = factoryOTHER->createFromCRSCodesWithIntermediates( diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp index 84999b07..f97e6618 100644 --- a/test/unit/test_io.cpp +++ b/test/unit/test_io.cpp @@ -3009,8 +3009,9 @@ TEST(wkt_parse, COORDINATEOPERATION) { auto wkt = "COORDINATEOPERATION[\"transformationName\",\n" " SOURCECRS[" + - src_wkt + "],\n" - " TARGETCRS[" + + src_wkt + + "],\n" + " TARGETCRS[" + dst_wkt + "],\n" " METHOD[\"operationMethodName\",\n" @@ -3083,8 +3084,9 @@ TEST(wkt_parse, COORDINATEOPERATION_wkt2_2019) { "COORDINATEOPERATION[\"transformationName\",\n" " VERSION[\"my version\"],\n" " SOURCECRS[" + - src_wkt + "],\n" - " TARGETCRS[" + + src_wkt + + "],\n" + " TARGETCRS[" + dst_wkt + "],\n" " METHOD[\"operationMethodName\",\n" @@ -6836,11 +6838,13 @@ TEST(wkt_parse, invalid_COORDINATEOPERATION) { { auto wkt = "COORDINATEOPERATION[\"transformationName\",\n" " SOURCECRS[" + - src_wkt + "],\n" - " TARGETCRS[" + - dst_wkt + "],\n" - " METHOD[\"operationMethodName\"],\n" - " PARAMETERFILE[\"paramName\",\"foo.bin\"]]"; + src_wkt + + "],\n" + " TARGETCRS[" + + dst_wkt + + "],\n" + " METHOD[\"operationMethodName\"],\n" + " PARAMETERFILE[\"paramName\",\"foo.bin\"]]"; EXPECT_NO_THROW(WKTParser().createFromWKT(wkt)); } @@ -6849,9 +6853,10 @@ TEST(wkt_parse, invalid_COORDINATEOPERATION) { { auto wkt = "COORDINATEOPERATION[\"transformationName\",\n" " TARGETCRS[" + - dst_wkt + "],\n" - " METHOD[\"operationMethodName\"],\n" - " PARAMETERFILE[\"paramName\",\"foo.bin\"]]"; + dst_wkt + + "],\n" + " METHOD[\"operationMethodName\"],\n" + " PARAMETERFILE[\"paramName\",\"foo.bin\"]]"; EXPECT_THROW(WKTParser().createFromWKT(wkt), ParsingException); } @@ -6861,9 +6866,10 @@ TEST(wkt_parse, invalid_COORDINATEOPERATION) { auto wkt = "COORDINATEOPERATION[\"transformationName\",\n" " SOURCECRS[FOO],\n" " TARGETCRS[" + - dst_wkt + "],\n" - " METHOD[\"operationMethodName\"],\n" - " PARAMETERFILE[\"paramName\",\"foo.bin\"]]"; + dst_wkt + + "],\n" + " METHOD[\"operationMethodName\"],\n" + " PARAMETERFILE[\"paramName\",\"foo.bin\"]]"; EXPECT_THROW(WKTParser().createFromWKT(wkt), ParsingException); } @@ -6872,9 +6878,10 @@ TEST(wkt_parse, invalid_COORDINATEOPERATION) { { auto wkt = "COORDINATEOPERATION[\"transformationName\",\n" " SOURCECRS[" + - src_wkt + "],\n" - " METHOD[\"operationMethodName\"],\n" - " PARAMETERFILE[\"paramName\",\"foo.bin\"]]"; + src_wkt + + "],\n" + " METHOD[\"operationMethodName\"],\n" + " PARAMETERFILE[\"paramName\",\"foo.bin\"]]"; EXPECT_THROW(WKTParser().createFromWKT(wkt), ParsingException); } @@ -6883,10 +6890,11 @@ TEST(wkt_parse, invalid_COORDINATEOPERATION) { { auto wkt = "COORDINATEOPERATION[\"transformationName\",\n" " SOURCECRS[" + - src_wkt + "],\n" - " TARGETCRS[FOO],\n" - " METHOD[\"operationMethodName\"],\n" - " PARAMETERFILE[\"paramName\",\"foo.bin\"]]"; + src_wkt + + "],\n" + " TARGETCRS[FOO],\n" + " METHOD[\"operationMethodName\"],\n" + " PARAMETERFILE[\"paramName\",\"foo.bin\"]]"; EXPECT_THROW(WKTParser().createFromWKT(wkt), ParsingException); } @@ -6895,8 +6903,9 @@ TEST(wkt_parse, invalid_COORDINATEOPERATION) { { auto wkt = "COORDINATEOPERATION[\"transformationName\",\n" " SOURCECRS[" + - src_wkt + "],\n" - " TARGETCRS[" + + src_wkt + + "],\n" + " TARGETCRS[" + dst_wkt + "]]"; EXPECT_THROW(WKTParser().createFromWKT(wkt), ParsingException); @@ -6906,11 +6915,13 @@ TEST(wkt_parse, invalid_COORDINATEOPERATION) { { auto wkt = "COORDINATEOPERATION[\"transformationName\",\n" " SOURCECRS[" + - src_wkt + "],\n" - " TARGETCRS[" + - dst_wkt + "],\n" - " METHOD[],\n" - " PARAMETERFILE[\"paramName\",\"foo.bin\"]]"; + src_wkt + + "],\n" + " TARGETCRS[" + + dst_wkt + + "],\n" + " METHOD[],\n" + " PARAMETERFILE[\"paramName\",\"foo.bin\"]]"; EXPECT_THROW(WKTParser().createFromWKT(wkt), ParsingException); } diff --git a/test/unit/test_network.cpp b/test/unit/test_network.cpp index db3e987f..8edb7c8c 100644 --- a/test/unit/test_network.cpp +++ b/test/unit/test_network.cpp @@ -275,8 +275,9 @@ static PROJ_NETWORK_HANDLE *open_cbk(PJ_CONTEXT *ctx, const char *url, auto openEvent = dynamic_cast<OpenEvent *>(exchange->events[exchange->nextEvent].get()); if (!openEvent) { - fprintf(stderr, "unexpected call to open(%s, %ld, %ld). " - "Was expecting a %s event\n", + fprintf(stderr, + "unexpected call to open(%s, %ld, %ld). " + "Was expecting a %s event\n", url, (long)offset, (long)size_to_read, exchange->events[exchange->nextEvent]->type.c_str()); exchange->error = true; @@ -286,8 +287,9 @@ static PROJ_NETWORK_HANDLE *open_cbk(PJ_CONTEXT *ctx, const char *url, if (openEvent->ctx != ctx || openEvent->url != url || openEvent->offset != offset || openEvent->size_to_read != size_to_read) { - fprintf(stderr, "wrong call to open(%s, %ld, %ld). Was expecting " - "open(%s, %ld, %ld)\n", + fprintf(stderr, + "wrong call to open(%s, %ld, %ld). Was expecting " + "open(%s, %ld, %ld)\n", url, (long)offset, (long)size_to_read, openEvent->url.c_str(), (long)openEvent->offset, (long)openEvent->size_to_read); exchange->error = true; @@ -319,8 +321,9 @@ static void close_cbk(PJ_CONTEXT *ctx, PROJ_NETWORK_HANDLE *handle, auto closeEvent = dynamic_cast<CloseEvent *>(exchange->events[exchange->nextEvent].get()); if (!closeEvent) { - fprintf(stderr, "unexpected call to close(). " - "Was expecting a %s event\n", + fprintf(stderr, + "unexpected call to close(). " + "Was expecting a %s event\n", exchange->events[exchange->nextEvent]->type.c_str()); exchange->error = true; return; @@ -354,8 +357,9 @@ static const char *get_header_value_cbk(PJ_CONTEXT *ctx, auto getHeaderValueEvent = dynamic_cast<GetHeaderValueEvent *>( exchange->events[exchange->nextEvent].get()); if (!getHeaderValueEvent) { - fprintf(stderr, "unexpected call to get_header_value(). " - "Was expecting a %s event\n", + fprintf(stderr, + "unexpected call to get_header_value(). " + "Was expecting a %s event\n", exchange->events[exchange->nextEvent]->type.c_str()); exchange->error = true; return nullptr; @@ -366,8 +370,9 @@ static const char *get_header_value_cbk(PJ_CONTEXT *ctx, return nullptr; } if (getHeaderValueEvent->key != header_name) { - fprintf(stderr, "wrong call to get_header_value(%s). Was expecting " - "get_header_value(%s)\n", + fprintf(stderr, + "wrong call to get_header_value(%s). Was expecting " + "get_header_value(%s)\n", header_name, getHeaderValueEvent->key.c_str()); exchange->error = true; return nullptr; @@ -397,8 +402,9 @@ static size_t read_range_cbk(PJ_CONTEXT *ctx, PROJ_NETWORK_HANDLE *handle, auto readRangeEvent = dynamic_cast<ReadRangeEvent *>( exchange->events[exchange->nextEvent].get()); if (!readRangeEvent) { - fprintf(stderr, "unexpected call to read_range(). " - "Was expecting a %s event\n", + fprintf(stderr, + "unexpected call to read_range(). " + "Was expecting a %s event\n", exchange->events[exchange->nextEvent]->type.c_str()); exchange->error = true; return 0; @@ -410,8 +416,9 @@ static size_t read_range_cbk(PJ_CONTEXT *ctx, PROJ_NETWORK_HANDLE *handle, } if (readRangeEvent->ctx != ctx || readRangeEvent->offset != offset || readRangeEvent->size_to_read != size_to_read) { - fprintf(stderr, "wrong call to read_range(%ld, %ld). Was expecting " - "read_range(%ld, %ld)\n", + fprintf(stderr, + "wrong call to read_range(%ld, %ld). Was expecting " + "read_range(%ld, %ld)\n", (long)offset, (long)size_to_read, (long)readRangeEvent->offset, (long)readRangeEvent->size_to_read); exchange->error = true; @@ -1308,9 +1315,10 @@ TEST(networking, cache_basic) { SQLITE_OPEN_READONLY, nullptr); ASSERT_NE(hDB, nullptr); sqlite3_stmt *hStmt = nullptr; - sqlite3_prepare_v2(hDB, "SELECT url, offset FROM chunks WHERE id = (" - "SELECT chunk_id FROM linked_chunks WHERE id = (" - "SELECT head FROM linked_chunks_head_tail))", + sqlite3_prepare_v2(hDB, + "SELECT url, offset FROM chunks WHERE id = (" + "SELECT chunk_id FROM linked_chunks WHERE id = (" + "SELECT head FROM linked_chunks_head_tail))", -1, &hStmt, nullptr); ASSERT_NE(hStmt, nullptr); ASSERT_EQ(sqlite3_step(hStmt), SQLITE_ROW); @@ -1429,9 +1437,10 @@ TEST(networking, cache_saturation) { ASSERT_NE(hDB, nullptr); sqlite3_stmt *hStmt = nullptr; - sqlite3_prepare_v2(hDB, "SELECT COUNT(*) FROM chunk_data UNION ALL " - "SELECT COUNT(*) FROM chunks UNION ALL " - "SELECT COUNT(*) FROM linked_chunks", + sqlite3_prepare_v2(hDB, + "SELECT COUNT(*) FROM chunk_data UNION ALL " + "SELECT COUNT(*) FROM chunks UNION ALL " + "SELECT COUNT(*) FROM linked_chunks", -1, &hStmt, nullptr); ASSERT_NE(hStmt, nullptr); ASSERT_EQ(sqlite3_step(hStmt), SQLITE_ROW); @@ -1487,8 +1496,9 @@ TEST(networking, cache_ttl) { // Force lastChecked to the Epoch so that data is expired. sqlite3_stmt *hStmt = nullptr; - sqlite3_prepare_v2(hDB, "UPDATE properties SET lastChecked = 0, " - "lastModified = 'foo', etag = 'bar'", + sqlite3_prepare_v2(hDB, + "UPDATE properties SET lastChecked = 0, " + "lastModified = 'foo', etag = 'bar'", -1, &hStmt, nullptr); ASSERT_NE(hStmt, nullptr); ASSERT_EQ(sqlite3_step(hStmt), SQLITE_DONE); @@ -1724,8 +1734,9 @@ TEST(networking, download_whole_files) { // Now invalid lastModified. This should trigger a new download sqlite3_prepare_v2( - hDB, "UPDATE downloaded_file_properties SET lastChecked = 0, " - "lastModified = 'foo'", + hDB, + "UPDATE downloaded_file_properties SET lastChecked = 0, " + "lastModified = 'foo'", -1, &hStmt, nullptr); ASSERT_NE(hStmt, nullptr); ASSERT_EQ(sqlite3_step(hStmt), SQLITE_DONE); diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp index 74bddee8..6ddbd9f4 100644 --- a/test/unit/test_operation.cpp +++ b/test/unit/test_operation.cpp @@ -370,8 +370,9 @@ TEST(operation, transformation_to_wkt) { auto expected = "COORDINATEOPERATION[\"transformationName\",\n" " SOURCECRS[" + - src_wkt + "],\n" - " TARGETCRS[" + + src_wkt + + "],\n" + " TARGETCRS[" + dst_wkt + "],\n" " METHOD[\"operationMethodName\",\n" @@ -472,15 +473,19 @@ TEST(operation, concatenated_operation) { auto expected = "CONCATENATEDOPERATION[\"name\",\n" " SOURCECRS[" + - src_wkt + "],\n" - " TARGETCRS[" + - dst_wkt + "],\n" - " STEP[" + - step1_wkt + "],\n" - " STEP[" + - step2_wkt + "],\n" - " ID[\"codeSpace\",\"code\"],\n" - " REMARK[\"my remarks\"]]"; + src_wkt + + "],\n" + " TARGETCRS[" + + dst_wkt + + "],\n" + " STEP[" + + step1_wkt + + "],\n" + " STEP[" + + step2_wkt + + "],\n" + " ID[\"codeSpace\",\"code\"],\n" + " REMARK[\"my remarks\"]]"; EXPECT_EQ(replaceAll(replaceAll(concat->exportToWKT( WKTFormatter::create( @@ -663,8 +668,9 @@ TEST(operation, transformation_createPositionVector) { auto transf = Transformation::createPositionVector( PropertyMap(), GeographicCRS::EPSG_4269, GeographicCRS::EPSG_4326, 1.0, - 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, std::vector<PositionalAccuracyNNPtr>{ - PositionalAccuracy::create("100")}); + 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, + std::vector<PositionalAccuracyNNPtr>{ + PositionalAccuracy::create("100")}); EXPECT_TRUE(transf->validateParameters().empty()); ASSERT_EQ(transf->coordinateOperationAccuracies().size(), 1U); @@ -4494,8 +4500,9 @@ static GeographicCRSNNPtr geographicCRSInvalidEccentricity() { return GeographicCRS::create( PropertyMap(), GeodeticReferenceFrame::create( - PropertyMap(), Ellipsoid::createFlattenedSphere( - PropertyMap(), Length(6378137), Scale(0.1)), + PropertyMap(), + Ellipsoid::createFlattenedSphere(PropertyMap(), Length(6378137), + Scale(0.1)), optional<std::string>(), PrimeMeridian::GREENWICH), EllipsoidalCS::createLatitudeLongitude(UnitOfMeasure::DEGREE)); } @@ -5300,10 +5307,11 @@ TEST(operation, validateParameters) { } { - auto conv = Conversion::create( - PropertyMap(), PropertyMap().set(IdentifiedObject::NAME_KEY, - "change of vertical unit"), - {}, {}); + auto conv = + Conversion::create(PropertyMap(), + PropertyMap().set(IdentifiedObject::NAME_KEY, + "change of vertical unit"), + {}, {}); auto validation = conv->validateParameters(); auto expected = std::list<std::string>{ "Method name change of vertical unit is equivalent to official " @@ -5314,11 +5322,12 @@ TEST(operation, validateParameters) { { auto conv = Conversion::create( - PropertyMap(), PropertyMap() - .set(IdentifiedObject::NAME_KEY, - EPSG_NAME_METHOD_CHANGE_VERTICAL_UNIT) - .set(Identifier::CODESPACE_KEY, Identifier::EPSG) - .set(Identifier::CODE_KEY, "1234"), + PropertyMap(), + PropertyMap() + .set(IdentifiedObject::NAME_KEY, + EPSG_NAME_METHOD_CHANGE_VERTICAL_UNIT) + .set(Identifier::CODESPACE_KEY, Identifier::EPSG) + .set(Identifier::CODE_KEY, "1234"), {}, {}); auto validation = conv->validateParameters(); auto expected = std::list<std::string>{ diff --git a/test/unit/test_operationfactory.cpp b/test/unit/test_operationfactory.cpp index a64959a8..a91d1906 100644 --- a/test/unit/test_operationfactory.cpp +++ b/test/unit/test_operationfactory.cpp @@ -211,8 +211,9 @@ TEST(operation, geogCRS_to_geogCRS_context_filter_bbox) { } { auto ctxt = CoordinateOperationContext::create( - authFactory, Extent::createFromBBOX(20.26 + .1, 43.44 + .1, - 31.41 - .1, 48.27 - .1), + authFactory, + Extent::createFromBBOX(20.26 + .1, 43.44 + .1, 31.41 - .1, + 48.27 - .1), 0.0); auto list = CoordinateOperationFactory::create()->createOperations( authFactory->createCoordinateReferenceSystem("4179"), @@ -222,8 +223,9 @@ TEST(operation, geogCRS_to_geogCRS_context_filter_bbox) { } { auto ctxt = CoordinateOperationContext::create( - authFactory, Extent::createFromBBOX(20.26 - .1, 43.44 - .1, - 31.41 + .1, 48.27 + .1), + authFactory, + Extent::createFromBBOX(20.26 - .1, 43.44 - .1, 31.41 + .1, + 48.27 + .1), 0.0); auto list = CoordinateOperationFactory::create()->createOperations( authFactory->createCoordinateReferenceSystem("4179"), @@ -2953,14 +2955,16 @@ TEST(operation, transformation_BEV_AT_to_PROJ_string) { TEST(operation, transformation_longitude_rotation_to_PROJ_string) { auto src = GeographicCRS::create( - PropertyMap(), GeodeticReferenceFrame::create( - PropertyMap(), Ellipsoid::WGS84, - optional<std::string>(), PrimeMeridian::GREENWICH), + PropertyMap(), + GeodeticReferenceFrame::create(PropertyMap(), Ellipsoid::WGS84, + optional<std::string>(), + PrimeMeridian::GREENWICH), EllipsoidalCS::createLatitudeLongitude(UnitOfMeasure::DEGREE)); auto dest = GeographicCRS::create( - PropertyMap(), GeodeticReferenceFrame::create( - PropertyMap(), Ellipsoid::WGS84, - optional<std::string>(), PrimeMeridian::PARIS), + PropertyMap(), + GeodeticReferenceFrame::create(PropertyMap(), Ellipsoid::WGS84, + optional<std::string>(), + PrimeMeridian::PARIS), EllipsoidalCS::createLatitudeLongitude(UnitOfMeasure::DEGREE)); auto transformation = Transformation::createLongitudeRotation( PropertyMap(), src, dest, Angle(10)); @@ -3090,9 +3094,10 @@ TEST(operation, compoundCRS_with_boundVerticalCRS_to_geogCRS) { TEST(operation, compoundCRS_with_boundGeogCRS_to_geogCRS) { auto geogCRS = GeographicCRS::create( - PropertyMap(), GeodeticReferenceFrame::create( - PropertyMap(), Ellipsoid::WGS84, - optional<std::string>(), PrimeMeridian::GREENWICH), + PropertyMap(), + GeodeticReferenceFrame::create(PropertyMap(), Ellipsoid::WGS84, + optional<std::string>(), + PrimeMeridian::GREENWICH), EllipsoidalCS::createLatitudeLongitude(UnitOfMeasure::DEGREE)); auto horizBoundCRS = BoundCRS::createFromTOWGS84( geogCRS, std::vector<double>{1, 2, 3, 4, 5, 6, 7}); @@ -5391,8 +5396,8 @@ TEST(operation, compoundCRS_from_WKT2_no_id_to_geogCRS_3D_context) { op->exportToPROJString(PROJStringFormatter::create().get()); auto op2_proj = op2->exportToPROJString(PROJStringFormatter::create().get()); - EXPECT_EQ(op_proj, op2_proj) << "op=" << op->nameStr() - << " op2=" << op2->nameStr(); + EXPECT_EQ(op_proj, op2_proj) + << "op=" << op->nameStr() << " op2=" << op2->nameStr(); } } @@ -5469,7 +5474,7 @@ TEST(operation, compoundCRS_with_non_meter_horiz_and_vertical_to_geog) { " LENGTHUNIT[\"US survey foot\",0.304800609601219,\n" " ID[\"EPSG\",9003]]]]]" - ); + ); auto src = nn_dynamic_pointer_cast<CRS>(objSrc); ASSERT_TRUE(src != nullptr); auto authFactory = @@ -5627,8 +5632,9 @@ TEST(operation, isPROJInstantiable) { { auto transformation = Transformation::create( PropertyMap(), GeographicCRS::EPSG_4269, GeographicCRS::EPSG_4326, - nullptr, OperationMethod::create( - PropertyMap(), std::vector<OperationParameterNNPtr>{}), + nullptr, + OperationMethod::create(PropertyMap(), + std::vector<OperationParameterNNPtr>{}), std::vector<GeneralParameterValueNNPtr>{}, std::vector<PositionalAccuracyNNPtr>{}); EXPECT_FALSE(transformation->isPROJInstantiable( |
