diff --git a/include/proj/internal/internal.hpp b/include/proj/internal/internal.hpp index 6d6bedff0f..22351c5f23 100644 --- a/include/proj/internal/internal.hpp +++ b/include/proj/internal/internal.hpp @@ -95,12 +95,6 @@ template inline To down_cast(From *f) { return static_cast(f); } -/* Borrowed from C++14 */ -template -std::unique_ptr make_unique(Args &&...args) { - return std::unique_ptr(new T(std::forward(args)...)); -} - PROJ_FOR_TEST std::string replaceAll(const std::string &str, const std::string &before, const std::string &after); diff --git a/src/filemanager.cpp b/src/filemanager.cpp index f6931a59e3..90d16d6134 100644 --- a/src/filemanager.cpp +++ b/src/filemanager.cpp @@ -1985,12 +1985,11 @@ void pj_load_ini(PJ_CONTEXT *ctx) { } const char *native_ca = getenv("PROJ_NATIVE_CA"); - if (native_ca && native_ca[0] != '\0'){ + if (native_ca && native_ca[0] != '\0') { ctx->native_ca = ci_equal(native_ca, "ON") || - ci_equal(native_ca, "YES") || - ci_equal(native_ca, "TRUE"); - } - else { + ci_equal(native_ca, "YES") || + ci_equal(native_ca, "TRUE"); + } else { native_ca = nullptr; } @@ -2059,11 +2058,10 @@ void pj_load_ini(PJ_CONTEXT *ctx) { ctx->errorIfBestTransformationNotAvailableDefault = ci_equal(value, "ON") || ci_equal(value, "YES") || ci_equal(value, "TRUE"); - } - else if (native_ca == nullptr && key == "native_ca"){ - ctx->native_ca = - ci_equal(value, "ON") || ci_equal(value, "YES") || - ci_equal(value, "TRUE"); + } else if (native_ca == nullptr && key == "native_ca") { + ctx->native_ca = ci_equal(value, "ON") || + ci_equal(value, "YES") || + ci_equal(value, "TRUE"); } } diff --git a/src/grids.cpp b/src/grids.cpp index a3cd5c3659..624f2dfa13 100644 --- a/src/grids.cpp +++ b/src/grids.cpp @@ -306,7 +306,7 @@ GTXVerticalShiftGrid *GTXVerticalShiftGrid::open(PJ_CONTEXT *ctx, // Cache up to 1 megapixel per GTX file const int maxLinesInCache = 1024 * 1024 / columns; - auto cache = internal::make_unique(maxLinesInCache); + auto cache = std::make_unique(maxLinesInCache); return new GTXVerticalShiftGrid(ctx, std::move(fp), name, columns, rows, extent, std::move(cache)); } @@ -1588,8 +1588,7 @@ GTiffVGridShiftSet::open(PJ_CONTEXT *ctx, std::unique_ptr fp, const std::string &gridName = grid->metadataItem("grid_name"); const std::string &parentName = grid->metadataItem("parent_grid_name"); - auto vgrid = - internal::make_unique(std::move(grid), idxSample); + auto vgrid = std::make_unique(std::move(grid), idxSample); insertIntoHierarchy(ctx, std::move(vgrid), gridName, parentName, set->m_grids, mapGrids); @@ -2324,7 +2323,7 @@ std::unique_ptr NTv2GridSet::open(PJ_CONTEXT *ctx, // Cache up to 1 megapixel per NTv2 file const int maxLinesInCache = 1024 * 1024 / largestLine; - set->m_cache = internal::make_unique(maxLinesInCache); + set->m_cache = std::make_unique(maxLinesInCache); for (const auto &kv : mapGrids) { kv.second->setCache(set->m_cache.get()); } @@ -2633,7 +2632,7 @@ GTiffHGridShiftSet::open(PJ_CONTEXT *ctx, std::unique_ptr fp, const std::string &gridName = grid->metadataItem("grid_name"); const std::string &parentName = grid->metadataItem("parent_grid_name"); - auto hgrid = internal::make_unique( + auto hgrid = std::make_unique( std::move(grid), idxLatShift, idxLongShift, convFactorToRadian, positiveEast); @@ -3030,7 +3029,7 @@ GTiffGenericGridShiftSet::open(PJ_CONTEXT *ctx, std::unique_ptr fp, const std::string &gridName = grid->metadataItem("grid_name"); const std::string &parentName = grid->metadataItem("parent_grid_name"); - auto ggrid = internal::make_unique(std::move(grid)); + auto ggrid = std::make_unique(std::move(grid)); if (!set->m_grids.empty() && ggrid->metadataItem("TYPE").empty() && !set->m_grids[0]->metadataItem("TYPE").empty()) { ggrid->setFirstGrid(set->m_grids[0].get()); diff --git a/src/iso19111/c_api.cpp b/src/iso19111/c_api.cpp index 5d1180d875..dbf1cfb738 100644 --- a/src/iso19111/c_api.cpp +++ b/src/iso19111/c_api.cpp @@ -2751,7 +2751,7 @@ PJ_OBJ_LIST *proj_identify(PJ_CONTEXT *ctx, const PJ *obj, ++i; } } - auto ret = internal::make_unique(std::move(objects)); + auto ret = std::make_unique(std::move(objects)); if (out_confidence) { *out_confidence = confidenceTemp; confidenceTemp = nullptr; diff --git a/src/iso19111/common.cpp b/src/iso19111/common.cpp index 02bb376959..70f240493c 100644 --- a/src/iso19111/common.cpp +++ b/src/iso19111/common.cpp @@ -91,13 +91,13 @@ UnitOfMeasure::UnitOfMeasure(const std::string &nameIn, double toSIIn, UnitOfMeasure::Type typeIn, const std::string &codeSpaceIn, const std::string &codeIn) - : d(internal::make_unique(nameIn, toSIIn, typeIn, codeSpaceIn, - codeIn)) {} + : d(std::make_unique(nameIn, toSIIn, typeIn, codeSpaceIn, + codeIn)) {} // --------------------------------------------------------------------------- UnitOfMeasure::UnitOfMeasure(const UnitOfMeasure &other) - : d(internal::make_unique(*(other.d))) {} + : d(std::make_unique(*(other.d))) {} // --------------------------------------------------------------------------- @@ -376,12 +376,12 @@ struct Measure::Private { /** \brief Instantiate a Measure. */ Measure::Measure(double valueIn, const UnitOfMeasure &unitIn) - : d(internal::make_unique(valueIn, unitIn)) {} + : d(std::make_unique(valueIn, unitIn)) {} // --------------------------------------------------------------------------- Measure::Measure(const Measure &other) - : d(internal::make_unique(*(other.d))) {} + : d(std::make_unique(*(other.d))) {} // --------------------------------------------------------------------------- @@ -555,18 +555,18 @@ struct DateTime::Private { // --------------------------------------------------------------------------- -DateTime::DateTime() : d(internal::make_unique(std::string())) {} +DateTime::DateTime() : d(std::make_unique(std::string())) {} // --------------------------------------------------------------------------- DateTime::DateTime(const std::string &str) - : d(internal::make_unique(str)) {} + : d(std::make_unique(str)) {} // --------------------------------------------------------------------------- //! @cond Doxygen_Suppress DateTime::DateTime(const DateTime &other) - : d(internal::make_unique(*(other.d))) {} + : d(std::make_unique(*(other.d))) {} //! @endcond // --------------------------------------------------------------------------- @@ -626,12 +626,12 @@ struct IdentifiedObject::Private { // --------------------------------------------------------------------------- -IdentifiedObject::IdentifiedObject() : d(internal::make_unique()) {} +IdentifiedObject::IdentifiedObject() : d(std::make_unique()) {} // --------------------------------------------------------------------------- IdentifiedObject::IdentifiedObject(const IdentifiedObject &other) - : d(internal::make_unique(*(other.d))) {} + : d(std::make_unique(*(other.d))) {} // --------------------------------------------------------------------------- @@ -975,13 +975,13 @@ struct ObjectDomain::Private { //! @cond Doxygen_Suppress ObjectDomain::ObjectDomain(const optional &scopeIn, const ExtentPtr &extent) - : d(internal::make_unique(scopeIn, extent)) {} + : d(std::make_unique(scopeIn, extent)) {} //! @endcond // --------------------------------------------------------------------------- ObjectDomain::ObjectDomain(const ObjectDomain &other) - : d(internal::make_unique(*(other.d))) {} + : d(std::make_unique(*(other.d))) {} // --------------------------------------------------------------------------- @@ -1167,12 +1167,12 @@ struct ObjectUsage::Private { // --------------------------------------------------------------------------- -ObjectUsage::ObjectUsage() : d(internal::make_unique()) {} +ObjectUsage::ObjectUsage() : d(std::make_unique()) {} // --------------------------------------------------------------------------- ObjectUsage::ObjectUsage(const ObjectUsage &other) - : IdentifiedObject(other), d(internal::make_unique(*(other.d))) {} + : IdentifiedObject(other), d(std::make_unique(*(other.d))) {} // --------------------------------------------------------------------------- @@ -1320,17 +1320,17 @@ struct DataEpoch::Private { // --------------------------------------------------------------------------- -DataEpoch::DataEpoch() : d(internal::make_unique(Measure())) {} +DataEpoch::DataEpoch() : d(std::make_unique(Measure())) {} // --------------------------------------------------------------------------- DataEpoch::DataEpoch(const Measure &coordinateEpochIn) - : d(internal::make_unique(coordinateEpochIn)) {} + : d(std::make_unique(coordinateEpochIn)) {} // --------------------------------------------------------------------------- DataEpoch::DataEpoch(const DataEpoch &other) - : d(internal::make_unique(*(other.d))) {} + : d(std::make_unique(*(other.d))) {} // --------------------------------------------------------------------------- diff --git a/src/iso19111/coordinates.cpp b/src/iso19111/coordinates.cpp index 21751f294a..6f26f75d58 100644 --- a/src/iso19111/coordinates.cpp +++ b/src/iso19111/coordinates.cpp @@ -65,16 +65,15 @@ struct CoordinateMetadata::Private { // --------------------------------------------------------------------------- CoordinateMetadata::CoordinateMetadata(const crs::CRSNNPtr &crsIn) - : d(internal::make_unique(crsIn)) {} + : d(std::make_unique(crsIn)) {} // --------------------------------------------------------------------------- CoordinateMetadata::CoordinateMetadata(const crs::CRSNNPtr &crsIn, double coordinateEpochAsDecimalYearIn) - : d(internal::make_unique( - crsIn, - common::DataEpoch(common::Measure(coordinateEpochAsDecimalYearIn, - common::UnitOfMeasure::YEAR)))) {} + : d(std::make_unique(crsIn, common::DataEpoch(common::Measure( + coordinateEpochAsDecimalYearIn, + common::UnitOfMeasure::YEAR)))) {} // --------------------------------------------------------------------------- diff --git a/src/iso19111/coordinatesystem.cpp b/src/iso19111/coordinatesystem.cpp index 15a0ba6010..459a1c155d 100644 --- a/src/iso19111/coordinatesystem.cpp +++ b/src/iso19111/coordinatesystem.cpp @@ -84,13 +84,13 @@ struct Meridian::Private { // --------------------------------------------------------------------------- Meridian::Meridian(const common::Angle &longitudeIn) - : d(internal::make_unique(longitudeIn)) {} + : d(std::make_unique(longitudeIn)) {} // --------------------------------------------------------------------------- #ifdef notdef Meridian::Meridian(const Meridian &other) - : IdentifiedObject(other), d(internal::make_unique(*other.d)) {} + : IdentifiedObject(other), d(std::make_unique(*other.d)) {} #endif // --------------------------------------------------------------------------- @@ -182,14 +182,13 @@ struct CoordinateSystemAxis::Private { // --------------------------------------------------------------------------- -CoordinateSystemAxis::CoordinateSystemAxis() - : d(internal::make_unique()) {} +CoordinateSystemAxis::CoordinateSystemAxis() : d(std::make_unique()) {} // --------------------------------------------------------------------------- #ifdef notdef CoordinateSystemAxis::CoordinateSystemAxis(const CoordinateSystemAxis &other) - : IdentifiedObject(other), d(internal::make_unique(*other.d)) {} + : IdentifiedObject(other), d(std::make_unique(*other.d)) {} #endif // --------------------------------------------------------------------------- @@ -599,13 +598,13 @@ struct CoordinateSystem::Private { CoordinateSystem::CoordinateSystem( const std::vector &axisIn) - : d(internal::make_unique(axisIn)) {} + : d(std::make_unique(axisIn)) {} // --------------------------------------------------------------------------- #ifdef notdef CoordinateSystem::CoordinateSystem(const CoordinateSystem &other) - : IdentifiedObject(other), d(internal::make_unique(*other.d)) {} + : IdentifiedObject(other), d(std::make_unique(*other.d)) {} #endif // --------------------------------------------------------------------------- diff --git a/src/iso19111/crs.cpp b/src/iso19111/crs.cpp index e304669e52..7a0ac45bf0 100644 --- a/src/iso19111/crs.cpp +++ b/src/iso19111/crs.cpp @@ -142,12 +142,12 @@ struct CRS::Private { // --------------------------------------------------------------------------- -CRS::CRS() : d(internal::make_unique()) {} +CRS::CRS() : d(std::make_unique()) {} // --------------------------------------------------------------------------- CRS::CRS(const CRS &other) - : ObjectUsage(other), d(internal::make_unique(*(other.d))) {} + : ObjectUsage(other), d(std::make_unique(*(other.d))) {} // --------------------------------------------------------------------------- @@ -1574,12 +1574,12 @@ struct SingleCRS::Private { SingleCRS::SingleCRS(const datum::DatumPtr &datumIn, const datum::DatumEnsemblePtr &datumEnsembleIn, const cs::CoordinateSystemNNPtr &csIn) - : d(internal::make_unique(datumIn, datumEnsembleIn, csIn)) {} + : d(std::make_unique(datumIn, datumEnsembleIn, csIn)) {} // --------------------------------------------------------------------------- SingleCRS::SingleCRS(const SingleCRS &other) - : CRS(other), d(internal::make_unique(*other.d)) {} + : CRS(other), d(std::make_unique(*other.d)) {} // --------------------------------------------------------------------------- @@ -1768,7 +1768,7 @@ GeodeticCRS::GeodeticCRS(const datum::GeodeticReferenceFramePtr &datumIn, const cs::EllipsoidalCSNNPtr &csIn) : SingleCRS(datumIn, checkEnsembleForGeodeticCRS(datumIn, datumEnsembleIn), csIn), - d(internal::make_unique(datumIn)) {} + d(std::make_unique(datumIn)) {} // --------------------------------------------------------------------------- @@ -1777,7 +1777,7 @@ GeodeticCRS::GeodeticCRS(const datum::GeodeticReferenceFramePtr &datumIn, const cs::SphericalCSNNPtr &csIn) : SingleCRS(datumIn, checkEnsembleForGeodeticCRS(datumIn, datumEnsembleIn), csIn), - d(internal::make_unique(datumIn)) {} + d(std::make_unique(datumIn)) {} // --------------------------------------------------------------------------- @@ -1786,12 +1786,12 @@ GeodeticCRS::GeodeticCRS(const datum::GeodeticReferenceFramePtr &datumIn, const cs::CartesianCSNNPtr &csIn) : SingleCRS(datumIn, checkEnsembleForGeodeticCRS(datumIn, datumEnsembleIn), csIn), - d(internal::make_unique(datumIn)) {} + d(std::make_unique(datumIn)) {} // --------------------------------------------------------------------------- GeodeticCRS::GeodeticCRS(const GeodeticCRS &other) - : SingleCRS(other), d(internal::make_unique(*other.d)) {} + : SingleCRS(other), d(std::make_unique(*other.d)) {} // --------------------------------------------------------------------------- @@ -3027,13 +3027,13 @@ GeographicCRS::GeographicCRS(const datum::GeodeticReferenceFramePtr &datumIn, : SingleCRS(datumIn, datumEnsembleIn, csIn), GeodeticCRS(datumIn, checkEnsembleForGeodeticCRS(datumIn, datumEnsembleIn), csIn), - d(internal::make_unique(csIn)) {} + d(std::make_unique(csIn)) {} // --------------------------------------------------------------------------- GeographicCRS::GeographicCRS(const GeographicCRS &other) : SingleCRS(other), GeodeticCRS(other), - d(internal::make_unique(*other.d)) {} + d(std::make_unique(*other.d)) {} // --------------------------------------------------------------------------- @@ -3437,12 +3437,12 @@ VerticalCRS::VerticalCRS(const datum::VerticalReferenceFramePtr &datumIn, const cs::VerticalCSNNPtr &csIn) : SingleCRS(datumIn, checkEnsembleForVerticalCRS(datumIn, datumEnsembleIn), csIn), - d(internal::make_unique()) {} + d(std::make_unique()) {} // --------------------------------------------------------------------------- VerticalCRS::VerticalCRS(const VerticalCRS &other) - : SingleCRS(other), d(internal::make_unique(*other.d)) {} + : SingleCRS(other), d(std::make_unique(*other.d)) {} // --------------------------------------------------------------------------- @@ -4024,7 +4024,7 @@ DerivedCRS::DerivedCRS(const SingleCRSNNPtr &baseCRSIn, #if !defined(COMPILER_WARNS_ABOUT_ABSTRACT_VBASE_INIT) SingleCRS(baseCRSIn->datum(), baseCRSIn->datumEnsemble(), cs), #endif - d(internal::make_unique(baseCRSIn, derivingConversionIn)) { + d(std::make_unique(baseCRSIn, derivingConversionIn)) { } // --------------------------------------------------------------------------- @@ -4034,7 +4034,7 @@ DerivedCRS::DerivedCRS(const DerivedCRS &other) #if !defined(COMPILER_WARNS_ABOUT_ABSTRACT_VBASE_INIT) SingleCRS(other), #endif - d(internal::make_unique(*other.d)) { + d(std::make_unique(*other.d)) { } // --------------------------------------------------------------------------- @@ -4182,14 +4182,13 @@ ProjectedCRS::ProjectedCRS( const cs::CartesianCSNNPtr &csIn) : SingleCRS(baseCRSIn->datum(), baseCRSIn->datumEnsemble(), csIn), DerivedCRS(baseCRSIn, derivingConversionIn, csIn), - d(internal::make_unique(baseCRSIn, csIn)) {} + d(std::make_unique(baseCRSIn, csIn)) {} // --------------------------------------------------------------------------- ProjectedCRS::ProjectedCRS(const ProjectedCRS &other) : SingleCRS(other), DerivedCRS(other), - d(internal::make_unique(other.baseCRS(), - other.coordinateSystem())) {} + d(std::make_unique(other.baseCRS(), other.coordinateSystem())) {} // --------------------------------------------------------------------------- @@ -5154,14 +5153,14 @@ struct CompoundCRS::Private { // --------------------------------------------------------------------------- CompoundCRS::CompoundCRS(const std::vector &components) - : CRS(), d(internal::make_unique()) { + : CRS(), d(std::make_unique()) { d->components_ = components; } // --------------------------------------------------------------------------- CompoundCRS::CompoundCRS(const CompoundCRS &other) - : CRS(other), d(internal::make_unique(*other.d)) {} + : CRS(other), d(std::make_unique(*other.d)) {} // --------------------------------------------------------------------------- @@ -5735,15 +5734,14 @@ BoundCRS::Private::Private( BoundCRS::BoundCRS(const CRSNNPtr &baseCRSIn, const CRSNNPtr &hubCRSIn, const operation::TransformationNNPtr &transformationIn) - : d(internal::make_unique(baseCRSIn, hubCRSIn, transformationIn)) { -} + : d(std::make_unique(baseCRSIn, hubCRSIn, transformationIn)) {} // --------------------------------------------------------------------------- BoundCRS::BoundCRS(const BoundCRS &other) : CRS(other), - d(internal::make_unique(other.d->baseCRS(), other.d->hubCRS(), - other.d->transformation())) {} + d(std::make_unique(other.d->baseCRS(), other.d->hubCRS(), + other.d->transformation())) {} // --------------------------------------------------------------------------- @@ -6977,12 +6975,12 @@ EngineeringCRS::~EngineeringCRS() = default; EngineeringCRS::EngineeringCRS(const datum::EngineeringDatumNNPtr &datumIn, const cs::CoordinateSystemNNPtr &csIn) : SingleCRS(datumIn.as_nullable(), nullptr, csIn), - d(internal::make_unique()) {} + d(std::make_unique()) {} // --------------------------------------------------------------------------- EngineeringCRS::EngineeringCRS(const EngineeringCRS &other) - : SingleCRS(other), d(internal::make_unique(*(other.d))) {} + : SingleCRS(other), d(std::make_unique(*(other.d))) {} // --------------------------------------------------------------------------- diff --git a/src/iso19111/datum.cpp b/src/iso19111/datum.cpp index 9baa1d0faf..02d3356fdb 100644 --- a/src/iso19111/datum.cpp +++ b/src/iso19111/datum.cpp @@ -157,13 +157,13 @@ void Datum::Private::exportAnchorEpoch(io::JSONFormatter *formatter) const { // --------------------------------------------------------------------------- -Datum::Datum() : d(internal::make_unique()) {} +Datum::Datum() : d(std::make_unique()) {} // --------------------------------------------------------------------------- #ifdef notdef Datum::Datum(const Datum &other) - : ObjectUsage(other), d(internal::make_unique(*other.d)) {} + : ObjectUsage(other), d(std::make_unique(*other.d)) {} #endif // --------------------------------------------------------------------------- @@ -341,14 +341,13 @@ struct PrimeMeridian::Private { // --------------------------------------------------------------------------- PrimeMeridian::PrimeMeridian(const common::Angle &longitudeIn) - : d(internal::make_unique(longitudeIn)) {} + : d(std::make_unique(longitudeIn)) {} // --------------------------------------------------------------------------- #ifdef notdef PrimeMeridian::PrimeMeridian(const PrimeMeridian &other) - : common::IdentifiedObject(other), - d(internal::make_unique(*other.d)) {} + : common::IdentifiedObject(other), d(std::make_unique(*other.d)) {} #endif // --------------------------------------------------------------------------- @@ -598,30 +597,29 @@ struct Ellipsoid::Private { Ellipsoid::Ellipsoid(const common::Length &radius, const std::string &celestialBodyIn) - : d(internal::make_unique(radius, celestialBodyIn)) {} + : d(std::make_unique(radius, celestialBodyIn)) {} // --------------------------------------------------------------------------- Ellipsoid::Ellipsoid(const common::Length &semiMajorAxisIn, const common::Scale &invFlattening, const std::string &celestialBodyIn) - : d(internal::make_unique(semiMajorAxisIn, invFlattening, - celestialBodyIn)) {} + : d(std::make_unique(semiMajorAxisIn, invFlattening, + celestialBodyIn)) {} // --------------------------------------------------------------------------- Ellipsoid::Ellipsoid(const common::Length &semiMajorAxisIn, const common::Length &semiMinorAxisIn, const std::string &celestialBodyIn) - : d(internal::make_unique(semiMajorAxisIn, semiMinorAxisIn, - celestialBodyIn)) {} + : d(std::make_unique(semiMajorAxisIn, semiMinorAxisIn, + celestialBodyIn)) {} // --------------------------------------------------------------------------- #ifdef notdef Ellipsoid::Ellipsoid(const Ellipsoid &other) - : common::IdentifiedObject(other), - d(internal::make_unique(*other.d)) {} + : common::IdentifiedObject(other), d(std::make_unique(*other.d)) {} #endif // --------------------------------------------------------------------------- @@ -630,7 +628,7 @@ Ellipsoid::Ellipsoid(const Ellipsoid &other) Ellipsoid::~Ellipsoid() = default; Ellipsoid::Ellipsoid(const Ellipsoid &other) - : IdentifiedObject(other), d(internal::make_unique(*(other.d))) {} + : IdentifiedObject(other), d(std::make_unique(*(other.d))) {} //! @endcond @@ -1232,14 +1230,14 @@ struct GeodeticReferenceFrame::Private { GeodeticReferenceFrame::GeodeticReferenceFrame( const EllipsoidNNPtr &ellipsoidIn, const PrimeMeridianNNPtr &primeMeridianIn) - : d(internal::make_unique(ellipsoidIn, primeMeridianIn)) {} + : d(std::make_unique(ellipsoidIn, primeMeridianIn)) {} // --------------------------------------------------------------------------- #ifdef notdef GeodeticReferenceFrame::GeodeticReferenceFrame( const GeodeticReferenceFrame &other) - : Datum(other), d(internal::make_unique(*other.d)) {} + : Datum(other), d(std::make_unique(*other.d)) {} #endif // --------------------------------------------------------------------------- @@ -1640,7 +1638,7 @@ DynamicGeodeticReferenceFrame::DynamicGeodeticReferenceFrame( const common::Measure &frameReferenceEpochIn, const util::optional &deformationModelNameIn) : GeodeticReferenceFrame(ellipsoidIn, primeMeridianIn), - d(internal::make_unique(frameReferenceEpochIn)) { + d(std::make_unique(frameReferenceEpochIn)) { d->deformationModelName = deformationModelNameIn; } @@ -1649,8 +1647,7 @@ DynamicGeodeticReferenceFrame::DynamicGeodeticReferenceFrame( #ifdef notdef DynamicGeodeticReferenceFrame::DynamicGeodeticReferenceFrame( const DynamicGeodeticReferenceFrame &other) - : GeodeticReferenceFrame(other), - d(internal::make_unique(*other.d)) {} + : GeodeticReferenceFrame(other), d(std::make_unique(*other.d)) {} #endif // --------------------------------------------------------------------------- @@ -1786,13 +1783,13 @@ struct DatumEnsemble::Private { DatumEnsemble::DatumEnsemble(const std::vector &datumsIn, const metadata::PositionalAccuracyNNPtr &accuracy) - : d(internal::make_unique(datumsIn, accuracy)) {} + : d(std::make_unique(datumsIn, accuracy)) {} // --------------------------------------------------------------------------- #ifdef notdef DatumEnsemble::DatumEnsemble(const DatumEnsemble &other) - : common::ObjectUsage(other), d(internal::make_unique(*other.d)) {} + : common::ObjectUsage(other), d(std::make_unique(*other.d)) {} #endif // --------------------------------------------------------------------------- @@ -2086,7 +2083,7 @@ struct VerticalReferenceFrame::Private { VerticalReferenceFrame::VerticalReferenceFrame( const util::optional &realizationMethodIn) - : d(internal::make_unique()) { + : d(std::make_unique()) { if (!realizationMethodIn->toString().empty()) { d->realizationMethod_ = *realizationMethodIn; } @@ -2323,7 +2320,7 @@ DynamicVerticalReferenceFrame::DynamicVerticalReferenceFrame( const common::Measure &frameReferenceEpochIn, const util::optional &deformationModelNameIn) : VerticalReferenceFrame(realizationMethodIn), - d(internal::make_unique(frameReferenceEpochIn)) { + d(std::make_unique(frameReferenceEpochIn)) { d->deformationModelName = deformationModelNameIn; } @@ -2332,8 +2329,7 @@ DynamicVerticalReferenceFrame::DynamicVerticalReferenceFrame( #ifdef notdef DynamicVerticalReferenceFrame::DynamicVerticalReferenceFrame( const DynamicVerticalReferenceFrame &other) - : VerticalReferenceFrame(other), - d(internal::make_unique(*other.d)) {} + : VerticalReferenceFrame(other), d(std::make_unique(*other.d)) {} #endif // --------------------------------------------------------------------------- @@ -2467,7 +2463,7 @@ struct TemporalDatum::Private { TemporalDatum::TemporalDatum(const common::DateTime &temporalOriginIn, const std::string &calendarIn) - : d(internal::make_unique(temporalOriginIn, calendarIn)) {} + : d(std::make_unique(temporalOriginIn, calendarIn)) {} // --------------------------------------------------------------------------- diff --git a/src/iso19111/factory.cpp b/src/iso19111/factory.cpp index 29059b83ca..793bffae58 100644 --- a/src/iso19111/factory.cpp +++ b/src/iso19111/factory.cpp @@ -2942,7 +2942,7 @@ DatabaseContext::~DatabaseContext() { // --------------------------------------------------------------------------- -DatabaseContext::DatabaseContext() : d(internal::make_unique()) {} +DatabaseContext::DatabaseContext() : d(std::make_unique()) {} // --------------------------------------------------------------------------- @@ -4308,7 +4308,7 @@ AuthorityFactory::~AuthorityFactory() = default; AuthorityFactory::AuthorityFactory(const DatabaseContextNNPtr &context, const std::string &authorityName) - : d(internal::make_unique(context, authorityName)) {} + : d(std::make_unique(context, authorityName)) {} // --------------------------------------------------------------------------- @@ -10175,8 +10175,8 @@ struct NoSuchAuthorityCodeException::Private { NoSuchAuthorityCodeException::NoSuchAuthorityCodeException( const std::string &message, const std::string &authority, const std::string &code) - : FactoryException(message), - d(internal::make_unique(authority, code)) {} + : FactoryException(message), d(std::make_unique(authority, code)) { +} // --------------------------------------------------------------------------- @@ -10186,7 +10186,7 @@ NoSuchAuthorityCodeException::~NoSuchAuthorityCodeException() = default; NoSuchAuthorityCodeException::NoSuchAuthorityCodeException( const NoSuchAuthorityCodeException &other) - : FactoryException(other), d(internal::make_unique(*(other.d))) {} + : FactoryException(other), d(std::make_unique(*(other.d))) {} //! @endcond // --------------------------------------------------------------------------- diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp index a7ac827049..1bf35eae9e 100644 --- a/src/iso19111/io.cpp +++ b/src/iso19111/io.cpp @@ -356,7 +356,7 @@ const std::string &WKTFormatter::toString() const { // --------------------------------------------------------------------------- WKTFormatter::WKTFormatter(Convention convention) - : d(internal::make_unique()) { + : d(std::make_unique()) { d->params_.convention_ = convention; switch (convention) { case Convention::WKT2_2019: @@ -895,7 +895,7 @@ void WKTFormatter::ingestWKTNode(const WKTNodeNNPtr &node) { //! @cond Doxygen_Suppress static WKTNodeNNPtr - null_node(NN_NO_CHECK(internal::make_unique(std::string()))); + null_node(NN_NO_CHECK(std::make_unique(std::string()))); static inline bool isNull(const WKTNodeNNPtr &node) { return &node == &null_node; @@ -1018,7 +1018,7 @@ const WKTNodeNNPtr &WKTNode::Private::lookForChild( * @param valueIn the name of the node. */ WKTNode::WKTNode(const std::string &valueIn) - : d(internal::make_unique(valueIn)) {} + : d(std::make_unique(valueIn)) {} // --------------------------------------------------------------------------- @@ -1168,7 +1168,7 @@ WKTNodeNNPtr WKTNode::createFrom(const std::string &wkt, size_t indexStart, } } - auto node = NN_NO_CHECK(internal::make_unique(value)); + auto node = NN_NO_CHECK(std::make_unique(value)); if (indexStart > 0) { if (wkt[i] == ',') { @@ -1470,7 +1470,7 @@ struct WKTParser::Private { // --------------------------------------------------------------------------- -WKTParser::WKTParser() : d(internal::make_unique()) {} +WKTParser::WKTParser() : d(std::make_unique()) {} // --------------------------------------------------------------------------- @@ -1704,7 +1704,7 @@ PropertyMap &WKTParser::Private::buildProperties(const WKTNodeNNPtr &node, if (properties_.size() >= MAX_PROPERTY_SIZE) { throw ParsingException("MAX_PROPERTY_SIZE reached"); } - properties_.push_back(internal::make_unique()); + properties_.push_back(std::make_unique()); auto properties = properties_.back().get(); std::string authNameFromAlias; @@ -8579,7 +8579,7 @@ struct PROJStringFormatter::Private { //! @cond Doxygen_Suppress PROJStringFormatter::PROJStringFormatter(Convention conventionIn, const DatabaseContextPtr &dbContext) - : d(internal::make_unique()) { + : d(std::make_unique()) { d->convention_ = conventionIn; d->dbContext_ = dbContext; } @@ -10537,7 +10537,7 @@ struct PROJStringParser::Private { // --------------------------------------------------------------------------- -PROJStringParser::PROJStringParser() : d(internal::make_unique()) {} +PROJStringParser::PROJStringParser() : d(std::make_unique()) {} // --------------------------------------------------------------------------- @@ -12774,7 +12774,7 @@ JSONFormatter &JSONFormatter::setSchema(const std::string &schema) noexcept { //! @cond Doxygen_Suppress -JSONFormatter::JSONFormatter() : d(internal::make_unique()) {} +JSONFormatter::JSONFormatter() : d(std::make_unique()) {} // --------------------------------------------------------------------------- diff --git a/src/iso19111/metadata.cpp b/src/iso19111/metadata.cpp index 0c51aafd54..998ef863a5 100644 --- a/src/iso19111/metadata.cpp +++ b/src/iso19111/metadata.cpp @@ -78,14 +78,14 @@ struct Citation::Private { // --------------------------------------------------------------------------- //! @cond Doxygen_Suppress -Citation::Citation() : d(internal::make_unique()) {} +Citation::Citation() : d(std::make_unique()) {} //! @endcond // --------------------------------------------------------------------------- /** \brief Constructs a citation by its title. */ Citation::Citation(const std::string &titleIn) - : d(internal::make_unique()) { + : d(std::make_unique()) { d->title = titleIn; } @@ -93,7 +93,7 @@ Citation::Citation(const std::string &titleIn) //! @cond Doxygen_Suppress Citation::Citation(const Citation &other) - : d(internal::make_unique(*(other.d))) {} + : d(std::make_unique(*(other.d))) {} // --------------------------------------------------------------------------- @@ -124,7 +124,7 @@ struct GeographicExtent::Private {}; // --------------------------------------------------------------------------- -GeographicExtent::GeographicExtent() : d(internal::make_unique()) {} +GeographicExtent::GeographicExtent() : d(std::make_unique()) {} // --------------------------------------------------------------------------- @@ -155,7 +155,7 @@ struct GeographicBoundingBox::Private { GeographicBoundingBox::GeographicBoundingBox(double west, double south, double east, double north) : GeographicExtent(), - d(internal::make_unique(west, south, east, north)) {} + d(std::make_unique(west, south, east, north)) {} // --------------------------------------------------------------------------- @@ -438,15 +438,15 @@ GeographicBoundingBox::Private::intersection(const Private &otherExtent) const { // Check world coverage of this bbox, and other bbox overlapping // antimeridian (e.g. oW=175 and oE=-175) if (W == -180.0 && E == 180.0 && oW > oE) { - return internal::make_unique(oW, std::max(S, oS), oE, - std::min(N, oN)); + return std::make_unique(oW, std::max(S, oS), oE, + std::min(N, oN)); } // Check world coverage of other bbox, and this bbox overlapping // antimeridian (e.g. W=175 and E=-175) if (oW == -180.0 && oE == 180.0 && W > E) { - return internal::make_unique(W, std::max(S, oS), E, - std::min(N, oN)); + return std::make_unique(W, std::max(S, oS), E, + std::min(N, oN)); } // Normal bounding box ? @@ -455,8 +455,8 @@ GeographicBoundingBox::Private::intersection(const Private &otherExtent) const { const double resW = std::max(W, oW); const double resE = std::min(E, oE); if (resW < resE) { - return internal::make_unique(resW, std::max(S, oS), - resE, std::min(N, oN)); + return std::make_unique(resW, std::max(S, oS), resE, + std::min(N, oN)); } return nullptr; } @@ -487,8 +487,8 @@ GeographicBoundingBox::Private::intersection(const Private &otherExtent) const { return otherExtent.intersection(*this); } - return internal::make_unique(std::max(W, oW), std::max(S, oS), - std::min(E, oE), std::min(N, oN)); + return std::make_unique(std::max(W, oW), std::max(S, oS), + std::min(E, oE), std::min(N, oN)); } } //! @endcond @@ -511,7 +511,7 @@ struct VerticalExtent::Private { VerticalExtent::VerticalExtent(double minimumIn, double maximumIn, const common::UnitOfMeasureNNPtr &unitIn) - : d(internal::make_unique(minimumIn, maximumIn, unitIn)) {} + : d(std::make_unique(minimumIn, maximumIn, unitIn)) {} // --------------------------------------------------------------------------- @@ -608,7 +608,7 @@ struct TemporalExtent::Private { TemporalExtent::TemporalExtent(const std::string &startIn, const std::string &stopIn) - : d(internal::make_unique(startIn, stopIn)) {} + : d(std::make_unique(startIn, stopIn)) {} // --------------------------------------------------------------------------- @@ -684,12 +684,11 @@ struct Extent::Private { // --------------------------------------------------------------------------- //! @cond Doxygen_Suppress -Extent::Extent() : d(internal::make_unique()) {} +Extent::Extent() : d(std::make_unique()) {} // --------------------------------------------------------------------------- -Extent::Extent(const Extent &other) - : d(internal::make_unique(*other.d)) {} +Extent::Extent(const Extent &other) : d(std::make_unique(*other.d)) {} // --------------------------------------------------------------------------- @@ -991,7 +990,7 @@ void Identifier::Private::setProperties( Identifier::Identifier(const std::string &codeIn, const util::PropertyMap &properties) - : d(internal::make_unique(codeIn, properties)) {} + : d(std::make_unique(codeIn, properties)) {} // --------------------------------------------------------------------------- @@ -999,12 +998,12 @@ Identifier::Identifier(const std::string &codeIn, // --------------------------------------------------------------------------- -Identifier::Identifier() : d(internal::make_unique()) {} +Identifier::Identifier() : d(std::make_unique()) {} // --------------------------------------------------------------------------- Identifier::Identifier(const Identifier &other) - : d(internal::make_unique(*(other.d))) {} + : d(std::make_unique(*(other.d))) {} // --------------------------------------------------------------------------- @@ -1511,7 +1510,7 @@ struct PositionalAccuracy::Private { // --------------------------------------------------------------------------- PositionalAccuracy::PositionalAccuracy(const std::string &valueIn) - : d(internal::make_unique()) { + : d(std::make_unique()) { d->value_ = valueIn; } diff --git a/src/iso19111/operation/concatenatedoperation.cpp b/src/iso19111/operation/concatenatedoperation.cpp index c003a0456c..112ed75878 100644 --- a/src/iso19111/operation/concatenatedoperation.cpp +++ b/src/iso19111/operation/concatenatedoperation.cpp @@ -92,15 +92,14 @@ ConcatenatedOperation::~ConcatenatedOperation() = default; //! @cond Doxygen_Suppress ConcatenatedOperation::ConcatenatedOperation(const ConcatenatedOperation &other) - : CoordinateOperation(other), - d(internal::make_unique(*(other.d))) {} + : CoordinateOperation(other), d(std::make_unique(*(other.d))) {} //! @endcond // --------------------------------------------------------------------------- ConcatenatedOperation::ConcatenatedOperation( const std::vector &operationsIn) - : CoordinateOperation(), d(internal::make_unique(operationsIn)) { + : CoordinateOperation(), d(std::make_unique(operationsIn)) { for (const auto &op : operationsIn) { if (op->requiresPerCoordinateInputTime()) { setRequiresPerCoordinateInputTime(true); diff --git a/src/iso19111/operation/coordinateoperation_private.hpp b/src/iso19111/operation/coordinateoperation_private.hpp index dd11a21d94..a2eaddb704 100644 --- a/src/iso19111/operation/coordinateoperation_private.hpp +++ b/src/iso19111/operation/coordinateoperation_private.hpp @@ -76,9 +76,9 @@ struct CoordinateOperation::Private { hasBallparkTransformation_(other.hasBallparkTransformation_), requiresPerCoordinateInputTime_( other.requiresPerCoordinateInputTime_), - strongRef_(other.strongRef_ ? internal::make_unique( - *(other.strongRef_)) - : nullptr) {} + strongRef_(other.strongRef_ + ? std::make_unique(*(other.strongRef_)) + : nullptr) {} Private &operator=(const Private &) = delete; }; diff --git a/src/iso19111/operation/coordinateoperationfactory.cpp b/src/iso19111/operation/coordinateoperationfactory.cpp index 869470fb51..b36dcd5e04 100644 --- a/src/iso19111/operation/coordinateoperationfactory.cpp +++ b/src/iso19111/operation/coordinateoperationfactory.cpp @@ -199,13 +199,13 @@ CoordinateOperationContext::~CoordinateOperationContext() = default; // --------------------------------------------------------------------------- CoordinateOperationContext::CoordinateOperationContext() - : d(internal::make_unique()) {} + : d(std::make_unique()) {} // --------------------------------------------------------------------------- CoordinateOperationContext::CoordinateOperationContext( const CoordinateOperationContext &other) - : d(internal::make_unique(*(other.d))) {} + : d(std::make_unique(*(other.d))) {} // --------------------------------------------------------------------------- diff --git a/src/iso19111/operation/parametervalue.cpp b/src/iso19111/operation/parametervalue.cpp index 33f907fe7c..c1e4fc711c 100644 --- a/src/iso19111/operation/parametervalue.cpp +++ b/src/iso19111/operation/parametervalue.cpp @@ -61,11 +61,11 @@ struct ParameterValue::Private { explicit Private(const common::Measure &valueIn) : type_(ParameterValue::Type::MEASURE), - measure_(internal::make_unique(valueIn)) {} + measure_(std::make_unique(valueIn)) {} Private(const std::string &stringValueIn, ParameterValue::Type typeIn) : type_(typeIn), - stringValue_(internal::make_unique(stringValueIn)) {} + stringValue_(std::make_unique(stringValueIn)) {} explicit Private(int integerValueIn) : type_(ParameterValue::Type::INTEGER), integerValue_(integerValueIn) {} @@ -84,23 +84,23 @@ ParameterValue::~ParameterValue() = default; // --------------------------------------------------------------------------- ParameterValue::ParameterValue(const common::Measure &measureIn) - : d(internal::make_unique(measureIn)) {} + : d(std::make_unique(measureIn)) {} // --------------------------------------------------------------------------- ParameterValue::ParameterValue(const std::string &stringValueIn, ParameterValue::Type typeIn) - : d(internal::make_unique(stringValueIn, typeIn)) {} + : d(std::make_unique(stringValueIn, typeIn)) {} // --------------------------------------------------------------------------- ParameterValue::ParameterValue(int integerValueIn) - : d(internal::make_unique(integerValueIn)) {} + : d(std::make_unique(integerValueIn)) {} // --------------------------------------------------------------------------- ParameterValue::ParameterValue(bool booleanValueIn) - : d(internal::make_unique(booleanValueIn)) {} + : d(std::make_unique(booleanValueIn)) {} // --------------------------------------------------------------------------- diff --git a/src/iso19111/operation/singleoperation.cpp b/src/iso19111/operation/singleoperation.cpp index 48fee7090b..fc13b4bd28 100644 --- a/src/iso19111/operation/singleoperation.cpp +++ b/src/iso19111/operation/singleoperation.cpp @@ -112,13 +112,12 @@ GridDescription::GridDescription(GridDescription &&other) noexcept // --------------------------------------------------------------------------- -CoordinateOperation::CoordinateOperation() - : d(internal::make_unique()) {} +CoordinateOperation::CoordinateOperation() : d(std::make_unique()) {} // --------------------------------------------------------------------------- CoordinateOperation::CoordinateOperation(const CoordinateOperation &other) - : ObjectUsage(other), d(internal::make_unique(*other.d)) {} + : ObjectUsage(other), d(std::make_unique(*other.d)) {} // --------------------------------------------------------------------------- @@ -229,7 +228,7 @@ void CoordinateOperation::setCRSs(const crs::CRSNNPtr &sourceCRSIn, const crs::CRSNNPtr &targetCRSIn, const crs::CRSPtr &interpolationCRSIn) { d->strongRef_ = - internal::make_unique(sourceCRSIn, targetCRSIn); + std::make_unique(sourceCRSIn, targetCRSIn); d->sourceCRSWeak_ = sourceCRSIn.as_nullable(); d->targetCRSWeak_ = targetCRSIn.as_nullable(); d->interpolationCRS_ = interpolationCRSIn; @@ -479,7 +478,7 @@ struct CoordinateTransformer::Private { // --------------------------------------------------------------------------- CoordinateTransformer::CoordinateTransformer() - : d(internal::make_unique()) {} + : d(std::make_unique()) {} // --------------------------------------------------------------------------- @@ -559,12 +558,12 @@ PJ_COORD CoordinateTransformer::transform(PJ_COORD coord) { // --------------------------------------------------------------------------- -OperationMethod::OperationMethod() : d(internal::make_unique()) {} +OperationMethod::OperationMethod() : d(std::make_unique()) {} // --------------------------------------------------------------------------- OperationMethod::OperationMethod(const OperationMethod &other) - : IdentifiedObject(other), d(internal::make_unique(*other.d)) {} + : IdentifiedObject(other), d(std::make_unique(*other.d)) {} // --------------------------------------------------------------------------- @@ -821,8 +820,7 @@ struct OperationParameterValue::Private { OperationParameterValue::OperationParameterValue( const OperationParameterValue &other) - : GeneralParameterValue(other), - d(internal::make_unique(*other.d)) {} + : GeneralParameterValue(other), d(std::make_unique(*other.d)) {} // --------------------------------------------------------------------------- @@ -830,7 +828,7 @@ OperationParameterValue::OperationParameterValue( const OperationParameterNNPtr ¶meterIn, const ParameterValueNNPtr &valueIn) : GeneralParameterValue(), - d(internal::make_unique(parameterIn, valueIn)) {} + d(std::make_unique(parameterIn, valueIn)) {} // --------------------------------------------------------------------------- @@ -1204,7 +1202,7 @@ struct SingleOperation::Private { // --------------------------------------------------------------------------- SingleOperation::SingleOperation(const OperationMethodNNPtr &methodIn) - : d(internal::make_unique(methodIn)) { + : d(std::make_unique(methodIn)) { const int methodEPSGCode = d->method_->getEPSGCode(); const auto &methodName = d->method_->nameStr(); @@ -1231,7 +1229,7 @@ SingleOperation::SingleOperation(const SingleOperation &other) #if !defined(COMPILER_WARNS_ABOUT_ABSTRACT_VBASE_INIT) CoordinateOperation(other), #endif - d(internal::make_unique(*other.d)) { + d(std::make_unique(*other.d)) { } // --------------------------------------------------------------------------- diff --git a/src/iso19111/operation/transformation.cpp b/src/iso19111/operation/transformation.cpp index ab3af1f99b..4ed5198a84 100644 --- a/src/iso19111/operation/transformation.cpp +++ b/src/iso19111/operation/transformation.cpp @@ -91,7 +91,7 @@ Transformation::Transformation( const crs::CRSPtr &interpolationCRSIn, const OperationMethodNNPtr &methodIn, const std::vector &values, const std::vector &accuracies) - : SingleOperation(methodIn), d(internal::make_unique()) { + : SingleOperation(methodIn), d(std::make_unique()) { setParameterValues(values); setCRSs(sourceCRSIn, targetCRSIn, interpolationCRSIn); setAccuracies(accuracies); @@ -107,7 +107,7 @@ Transformation::~Transformation() = default; Transformation::Transformation(const Transformation &other) : CoordinateOperation(other), SingleOperation(other), - d(internal::make_unique(*other.d)) {} + d(std::make_unique(*other.d)) {} // --------------------------------------------------------------------------- diff --git a/src/iso19111/util.cpp b/src/iso19111/util.cpp index e72f3af7b0..8d1fa36ba9 100644 --- a/src/iso19111/util.cpp +++ b/src/iso19111/util.cpp @@ -67,7 +67,7 @@ struct BaseObject::Private { // --------------------------------------------------------------------------- -BaseObject::BaseObject() : d(internal::make_unique()) {} +BaseObject::BaseObject() : d(std::make_unique()) {} // --------------------------------------------------------------------------- @@ -133,14 +133,14 @@ struct BoxedValue::Private { // --------------------------------------------------------------------------- -BoxedValue::BoxedValue() : d(internal::make_unique(std::string())) {} +BoxedValue::BoxedValue() : d(std::make_unique(std::string())) {} // --------------------------------------------------------------------------- /** \brief Constructs a BoxedValue from a string. */ BoxedValue::BoxedValue(const char *stringValueIn) - : d(internal::make_unique( + : d(std::make_unique( std::string(stringValueIn ? stringValueIn : ""))) {} // --------------------------------------------------------------------------- @@ -148,27 +148,27 @@ BoxedValue::BoxedValue(const char *stringValueIn) /** \brief Constructs a BoxedValue from a string. */ BoxedValue::BoxedValue(const std::string &stringValueIn) - : d(internal::make_unique(stringValueIn)) {} + : d(std::make_unique(stringValueIn)) {} // --------------------------------------------------------------------------- /** \brief Constructs a BoxedValue from an integer. */ BoxedValue::BoxedValue(int integerValueIn) - : d(internal::make_unique(integerValueIn)) {} + : d(std::make_unique(integerValueIn)) {} // --------------------------------------------------------------------------- /** \brief Constructs a BoxedValue from a boolean. */ BoxedValue::BoxedValue(bool booleanValueIn) - : d(internal::make_unique(booleanValueIn)) {} + : d(std::make_unique(booleanValueIn)) {} // --------------------------------------------------------------------------- //! @cond Doxygen_Suppress BoxedValue::BoxedValue(const BoxedValue &other) - : d(internal::make_unique(*other.d)) {} + : d(std::make_unique(*other.d)) {} // --------------------------------------------------------------------------- @@ -201,7 +201,7 @@ struct ArrayOfBaseObject::Private { // --------------------------------------------------------------------------- //! @cond Doxygen_Suppress -ArrayOfBaseObject::ArrayOfBaseObject() : d(internal::make_unique()) {} +ArrayOfBaseObject::ArrayOfBaseObject() : d(std::make_unique()) {} // --------------------------------------------------------------------------- @@ -267,13 +267,13 @@ struct PropertyMap::Private { // --------------------------------------------------------------------------- -PropertyMap::PropertyMap() : d(internal::make_unique()) {} +PropertyMap::PropertyMap() : d(std::make_unique()) {} // --------------------------------------------------------------------------- //! @cond Doxygen_Suppress PropertyMap::PropertyMap(const PropertyMap &other) - : d(internal::make_unique(*(other.d))) {} + : d(std::make_unique(*(other.d))) {} //! @endcond // --------------------------------------------------------------------------- @@ -418,12 +418,12 @@ struct GenericName::Private {}; // --------------------------------------------------------------------------- -GenericName::GenericName() : d(internal::make_unique()) {} +GenericName::GenericName() : d(std::make_unique()) {} // --------------------------------------------------------------------------- GenericName::GenericName(const GenericName &other) - : d(internal::make_unique(*other.d)) {} + : d(std::make_unique(*other.d)) {} // --------------------------------------------------------------------------- @@ -445,14 +445,14 @@ struct NameSpace::Private { // --------------------------------------------------------------------------- NameSpace::NameSpace(const GenericNamePtr &nameIn) - : d(internal::make_unique()) { + : d(std::make_unique()) { d->name = nameIn; } // --------------------------------------------------------------------------- NameSpace::NameSpace(const NameSpace &other) - : d(internal::make_unique(*other.d)) {} + : d(std::make_unique(*other.d)) {} // --------------------------------------------------------------------------- @@ -503,15 +503,14 @@ struct LocalName::Private { // --------------------------------------------------------------------------- -LocalName::LocalName(const std::string &name) - : d(internal::make_unique()) { +LocalName::LocalName(const std::string &name) : d(std::make_unique()) { d->name = name; } // --------------------------------------------------------------------------- LocalName::LocalName(const NameSpacePtr &ns, const std::string &name) - : d(internal::make_unique()) { + : d(std::make_unique()) { d->scope = ns ? ns : static_cast(NameSpace::GLOBAL); d->name = name; } @@ -519,7 +518,7 @@ LocalName::LocalName(const NameSpacePtr &ns, const std::string &name) // --------------------------------------------------------------------------- LocalName::LocalName(const LocalName &other) - : GenericName(other), d(internal::make_unique(*other.d)) {} + : GenericName(other), d(std::make_unique(*other.d)) {} // --------------------------------------------------------------------------- diff --git a/src/networkfilemanager.cpp b/src/networkfilemanager.cpp index 472d2b81b8..e02aa7f962 100644 --- a/src/networkfilemanager.cpp +++ b/src/networkfilemanager.cpp @@ -1637,7 +1637,7 @@ CurlFileHandle::CurlFileHandle(PJ_CONTEXT *ctx, const char *url, CURL *handle) CHECK_RET(ctx, curl_easy_setopt(handle, CURLOPT_SSL_OPTIONS, ssl_options)); #else #if CURL_AT_LEAST_VERSION(7, 71, 0) - if (pj_context_get_native_ca(ctx)){ + if (pj_context_get_native_ca(ctx)) { CHECK_RET(ctx, curl_easy_setopt(handle, CURLOPT_SSL_OPTIONS, (long)CURLSSLOPT_NATIVE_CA)); } diff --git a/src/proj_internal.h b/src/proj_internal.h index b11c3cb072..e06e2e23e2 100644 --- a/src/proj_internal.h +++ b/src/proj_internal.h @@ -820,7 +820,7 @@ struct pj_ctx { std::string endpoint{}; projNetworkCallbacksAndData networking{}; std::string ca_bundle_path{}; - bool native_ca=false; + bool native_ca = false; projGridChunkCache gridChunkCache{}; TMercAlgo defaultTmercAlgo = TMercAlgo::PODER_ENGSAGER; // can be overridden by content of proj.ini diff --git a/src/projections/airocean.cpp b/src/projections/airocean.cpp index 970e4f777f..2630e1e146 100644 --- a/src/projections/airocean.cpp +++ b/src/projections/airocean.cpp @@ -14,44 +14,227 @@ PROJ_HEAD(airocean, "Airocean") "\n\tMisc, Sph&Ell"; - namespace { // anonymous namespace - struct pj_face { - PJ_XYZ p1; - PJ_XYZ p2; - PJ_XYZ p3; - }; -} - +struct pj_face { + PJ_XYZ p1; + PJ_XYZ p2; + PJ_XYZ p3; +}; +} // namespace /* - The vertices of the faces of the icosahedron are inspired by those used by Robert W. Gray. + The vertices of the faces of the icosahedron are inspired by those used by + Robert W. Gray. Original Reference: Robert W. Gray (1995) Exact Transformation Equations for Fuller's World Map, Vol. 32. Autumn, 1995, pp. 17-25. - To accomodate for land parts that would be interrupted by using a mere icosahedron, - some faces are split in two (Australia) and 3 (Japan) subfaces. + To accomodate for land parts that would be interrupted by using a mere + icosahedron, some faces are split in two (Australia) and 3 (Japan) subfaces. The parameters below were computed using the script located at: scripts/build_airocean_parameters.py (relative to the root of the project) */ // Define the 23 faces and subfaces -constexpr pj_face base_ico_faces[23] = {{{0.42015242670871, 0.07814524940278296, 0.9040825506150193}, {0.5188367303273644, 0.8354203803782358, 0.18133183755726245}, {0.9950094394362416, -0.09134779527642793, 0.040147175877166645}}, {{0.42015242670871, 0.07814524940278296, 0.9040825506150193}, {-0.4146822253203352, 0.6559624054348008, 0.6306758078914754}, {0.5188367303273644, 0.8354203803782358, 0.18133183755726245}}, {{0.42015242670871, 0.07814524940278296, 0.9040825506150193}, {-0.5154559599440418, -0.381716898287133, 0.7672009925177475}, {-0.4146822253203352, 0.6559624054348008, 0.6306758078914754}}, {{0.42015242670871, 0.07814524940278296, 0.9040825506150193}, {0.3557814025329447, -0.8435800024661781, 0.40223422660292557}, {-0.5154559599440418, -0.381716898287133, 0.7672009925177475}}, {{0.42015242670871, 0.07814524940278296, 0.9040825506150193}, {0.9950094394362416, -0.09134779527642793, 0.040147175877166645}, {0.3557814025329447, -0.8435800024661781, 0.40223422660292557}}, {{0.9950094394362416, -0.09134779527642793, 0.040147175877166645}, {0.5188367303273644, 0.8354203803782358, 0.18133183755726245}, {0.5154559599440418, 0.381716898287133, -0.7672009925177475}}, {{0.5154559599440418, 0.381716898287133, -0.7672009925177475}, {0.5188367303273644, 0.8354203803782358, 0.18133183755726245}, {-0.3557814025329447, 0.8435800024661781, -0.40223422660292557}}, {{-0.3557814025329447, 0.8435800024661781, -0.40223422660292557}, {0.5188367303273644, 0.8354203803782358, 0.18133183755726245}, {-0.4146822253203352, 0.6559624054348008, 0.6306758078914754}}, {{-0.5154559599440418, -0.381716898287133, 0.7672009925177475}, {-0.9950094394362416, 0.09134779527642793, -0.040147175877166645}, {-0.4146822253203352, 0.6559624054348008, 0.6306758078914754}}, {{-0.5154559599440418, -0.381716898287133, 0.7672009925177475}, {-0.5188367303273644, -0.8354203803782358, -0.18133183755726245}, {-0.9950094394362416, 0.09134779527642793, -0.040147175877166645}}, {{-0.5154559599440418, -0.381716898287133, 0.7672009925177475}, {0.3557814025329447, -0.8435800024661781, 0.40223422660292557}, {-0.5188367303273644, -0.8354203803782358, -0.18133183755726245}}, {{-0.5188367303273644, -0.8354203803782358, -0.18133183755726245}, {0.3557814025329447, -0.8435800024661781, 0.40223422660292557}, {0.4146822253203352, -0.6559624054348008, -0.6306758078914754}}, {{0.4146822253203352, -0.6559624054348008, -0.6306758078914754}, {0.3557814025329447, -0.8435800024661781, 0.40223422660292557}, {0.9950094394362416, -0.09134779527642793, 0.040147175877166645}}, {{0.5154559599440418, 0.381716898287133, -0.7672009925177475}, {0.4146822253203352, -0.6559624054348008, -0.6306758078914754}, {0.9950094394362416, -0.09134779527642793, 0.040147175877166645}}, {{-0.42015242670871, -0.07814524940278296, -0.9040825506150193}, {-0.3557814025329447, 0.8435800024661781, -0.40223422660292557}, {-0.9950094394362416, 0.09134779527642793, -0.040147175877166645}}, {{-0.42015242670871, -0.07814524940278296, -0.9040825506150193}, {-0.9950094394362416, 0.09134779527642793, -0.040147175877166645}, {-0.5188367303273644, -0.8354203803782358, -0.18133183755726245}}, {{-0.42015242670871, -0.07814524940278296, -0.9040825506150193}, {-0.5188367303273644, -0.8354203803782358, -0.18133183755726245}, {0.4146822253203352, -0.6559624054348008, -0.6306758078914754}}, {{-0.42015242670871, -0.07814524940278296, -0.9040825506150193}, {0.4146822253203352, -0.6559624054348008, -0.6306758078914754}, {0.5154559599440418, 0.381716898287133, -0.7672009925177475}}, {{-0.3557814025329447, 0.8435800024661781, -0.40223422660292557}, {-0.38796691462082733, 0.3827173765316976, -0.6531583886089725}, {0.5154559599440418, 0.381716898287133, -0.7672009925177475}}, {{-0.42015242670871, -0.07814524940278296, -0.9040825506150193}, {0.5154559599440418, 0.381716898287133, -0.7672009925177475}, {-0.38796691462082733, 0.3827173765316976, -0.6531583886089725}}, {{-0.9950094394362416, 0.09134779527642793, -0.040147175877166645}, {-0.3557814025329447, 0.8435800024661781, -0.40223422660292557}, {-0.5884910224298405, 0.5302967343924689, 0.06276480180379439}}, {{-0.3557814025329447, 0.8435800024661781, -0.40223422660292557}, {-0.4146822253203352, 0.6559624054348008, 0.6306758078914754}, {-0.5884910224298405, 0.5302967343924689, 0.06276480180379439}}, {{-0.9950094394362416, 0.09134779527642793, -0.040147175877166645}, {-0.5884910224298405, 0.5302967343924689, 0.06276480180379439}, {-0.4146822253203352, 0.6559624054348008, 0.6306758078914754}}}; +constexpr pj_face base_ico_faces[23] = { + {{0.42015242670871, 0.07814524940278296, 0.9040825506150193}, + {0.5188367303273644, 0.8354203803782358, 0.18133183755726245}, + {0.9950094394362416, -0.09134779527642793, 0.040147175877166645}}, + {{0.42015242670871, 0.07814524940278296, 0.9040825506150193}, + {-0.4146822253203352, 0.6559624054348008, 0.6306758078914754}, + {0.5188367303273644, 0.8354203803782358, 0.18133183755726245}}, + {{0.42015242670871, 0.07814524940278296, 0.9040825506150193}, + {-0.5154559599440418, -0.381716898287133, 0.7672009925177475}, + {-0.4146822253203352, 0.6559624054348008, 0.6306758078914754}}, + {{0.42015242670871, 0.07814524940278296, 0.9040825506150193}, + {0.3557814025329447, -0.8435800024661781, 0.40223422660292557}, + {-0.5154559599440418, -0.381716898287133, 0.7672009925177475}}, + {{0.42015242670871, 0.07814524940278296, 0.9040825506150193}, + {0.9950094394362416, -0.09134779527642793, 0.040147175877166645}, + {0.3557814025329447, -0.8435800024661781, 0.40223422660292557}}, + {{0.9950094394362416, -0.09134779527642793, 0.040147175877166645}, + {0.5188367303273644, 0.8354203803782358, 0.18133183755726245}, + {0.5154559599440418, 0.381716898287133, -0.7672009925177475}}, + {{0.5154559599440418, 0.381716898287133, -0.7672009925177475}, + {0.5188367303273644, 0.8354203803782358, 0.18133183755726245}, + {-0.3557814025329447, 0.8435800024661781, -0.40223422660292557}}, + {{-0.3557814025329447, 0.8435800024661781, -0.40223422660292557}, + {0.5188367303273644, 0.8354203803782358, 0.18133183755726245}, + {-0.4146822253203352, 0.6559624054348008, 0.6306758078914754}}, + {{-0.5154559599440418, -0.381716898287133, 0.7672009925177475}, + {-0.9950094394362416, 0.09134779527642793, -0.040147175877166645}, + {-0.4146822253203352, 0.6559624054348008, 0.6306758078914754}}, + {{-0.5154559599440418, -0.381716898287133, 0.7672009925177475}, + {-0.5188367303273644, -0.8354203803782358, -0.18133183755726245}, + {-0.9950094394362416, 0.09134779527642793, -0.040147175877166645}}, + {{-0.5154559599440418, -0.381716898287133, 0.7672009925177475}, + {0.3557814025329447, -0.8435800024661781, 0.40223422660292557}, + {-0.5188367303273644, -0.8354203803782358, -0.18133183755726245}}, + {{-0.5188367303273644, -0.8354203803782358, -0.18133183755726245}, + {0.3557814025329447, -0.8435800024661781, 0.40223422660292557}, + {0.4146822253203352, -0.6559624054348008, -0.6306758078914754}}, + {{0.4146822253203352, -0.6559624054348008, -0.6306758078914754}, + {0.3557814025329447, -0.8435800024661781, 0.40223422660292557}, + {0.9950094394362416, -0.09134779527642793, 0.040147175877166645}}, + {{0.5154559599440418, 0.381716898287133, -0.7672009925177475}, + {0.4146822253203352, -0.6559624054348008, -0.6306758078914754}, + {0.9950094394362416, -0.09134779527642793, 0.040147175877166645}}, + {{-0.42015242670871, -0.07814524940278296, -0.9040825506150193}, + {-0.3557814025329447, 0.8435800024661781, -0.40223422660292557}, + {-0.9950094394362416, 0.09134779527642793, -0.040147175877166645}}, + {{-0.42015242670871, -0.07814524940278296, -0.9040825506150193}, + {-0.9950094394362416, 0.09134779527642793, -0.040147175877166645}, + {-0.5188367303273644, -0.8354203803782358, -0.18133183755726245}}, + {{-0.42015242670871, -0.07814524940278296, -0.9040825506150193}, + {-0.5188367303273644, -0.8354203803782358, -0.18133183755726245}, + {0.4146822253203352, -0.6559624054348008, -0.6306758078914754}}, + {{-0.42015242670871, -0.07814524940278296, -0.9040825506150193}, + {0.4146822253203352, -0.6559624054348008, -0.6306758078914754}, + {0.5154559599440418, 0.381716898287133, -0.7672009925177475}}, + {{-0.3557814025329447, 0.8435800024661781, -0.40223422660292557}, + {-0.38796691462082733, 0.3827173765316976, -0.6531583886089725}, + {0.5154559599440418, 0.381716898287133, -0.7672009925177475}}, + {{-0.42015242670871, -0.07814524940278296, -0.9040825506150193}, + {0.5154559599440418, 0.381716898287133, -0.7672009925177475}, + {-0.38796691462082733, 0.3827173765316976, -0.6531583886089725}}, + {{-0.9950094394362416, 0.09134779527642793, -0.040147175877166645}, + {-0.3557814025329447, 0.8435800024661781, -0.40223422660292557}, + {-0.5884910224298405, 0.5302967343924689, 0.06276480180379439}}, + {{-0.3557814025329447, 0.8435800024661781, -0.40223422660292557}, + {-0.4146822253203352, 0.6559624054348008, 0.6306758078914754}, + {-0.5884910224298405, 0.5302967343924689, 0.06276480180379439}}, + {{-0.9950094394362416, 0.09134779527642793, -0.040147175877166645}, + {-0.5884910224298405, 0.5302967343924689, 0.06276480180379439}, + {-0.4146822253203352, 0.6559624054348008, 0.6306758078914754}}}; // // Define the centers for each face or subface -constexpr PJ_XYZ base_ico_centers[23] = {{0.6446661988241054, 0.27407261150153034, 0.37518718801648276}, {0.17476897723857973, 0.5231760117386065, 0.5720300653545857}, {-0.16999525285188902, 0.1174635855168169, 0.7673197836747474}, {0.08682595643253761, -0.3823838837835094, 0.6911725899118975}, {0.5903144228926321, -0.28559418277994103, 0.44882131769837047}, {0.6764340432358825, 0.375263161129647, -0.18190732636110615}, {0.22617042924615385, 0.6869057603771823, -0.3293677938544702}, {-0.0838756325086385, 0.778320929426405, 0.13659113961527075}, {-0.6417158749002062, 0.12186443414136523, 0.45257654151068544}, {-0.6764340432358825, -0.375263161129647, 0.18190732636110615}, {-0.22617042924615385, -0.6869057603771823, 0.32936779385447024}, {0.0838756325086385, -0.778320929426405, -0.13659113961527075}, {0.5884910224298405, -0.5302967343924689, -0.06276480180379439}, {0.6417158749002062, -0.12186443414136523, -0.4525765415106855}, {-0.5903144228926321, 0.28559418277994103, -0.44882131769837047}, {-0.6446661988241054, -0.2740726115015303, -0.37518718801648276}, {-0.17476897723857973, -0.5231760117386065, -0.5720300653545857}, {0.16999525285188902, -0.11746358551681692, -0.7673197836747474}, {-0.07609745240324339, 0.5360047590950029, -0.6075312025765486}, {-0.09755446046183185, 0.2287630084720159, -0.7748139772472463}, {-0.646427288133009, 0.48840817737835834, -0.12653886689209928}, {-0.4529848834277068, 0.6766130474311494, 0.09706879436411474}, {-0.6660608957288058, 0.4258689783678992, 0.2177644779393677}}; +constexpr PJ_XYZ base_ico_centers[23] = { + {0.6446661988241054, 0.27407261150153034, 0.37518718801648276}, + {0.17476897723857973, 0.5231760117386065, 0.5720300653545857}, + {-0.16999525285188902, 0.1174635855168169, 0.7673197836747474}, + {0.08682595643253761, -0.3823838837835094, 0.6911725899118975}, + {0.5903144228926321, -0.28559418277994103, 0.44882131769837047}, + {0.6764340432358825, 0.375263161129647, -0.18190732636110615}, + {0.22617042924615385, 0.6869057603771823, -0.3293677938544702}, + {-0.0838756325086385, 0.778320929426405, 0.13659113961527075}, + {-0.6417158749002062, 0.12186443414136523, 0.45257654151068544}, + {-0.6764340432358825, -0.375263161129647, 0.18190732636110615}, + {-0.22617042924615385, -0.6869057603771823, 0.32936779385447024}, + {0.0838756325086385, -0.778320929426405, -0.13659113961527075}, + {0.5884910224298405, -0.5302967343924689, -0.06276480180379439}, + {0.6417158749002062, -0.12186443414136523, -0.4525765415106855}, + {-0.5903144228926321, 0.28559418277994103, -0.44882131769837047}, + {-0.6446661988241054, -0.2740726115015303, -0.37518718801648276}, + {-0.17476897723857973, -0.5231760117386065, -0.5720300653545857}, + {0.16999525285188902, -0.11746358551681692, -0.7673197836747474}, + {-0.07609745240324339, 0.5360047590950029, -0.6075312025765486}, + {-0.09755446046183185, 0.2287630084720159, -0.7748139772472463}, + {-0.646427288133009, 0.48840817737835834, -0.12653886689209928}, + {-0.4529848834277068, 0.6766130474311494, 0.09706879436411474}, + {-0.6660608957288058, 0.4258689783678992, 0.2177644779393677}}; // // Define the normals for each face and subface -constexpr PJ_XYZ base_ico_normals[23] = {{0.8112534709140969, 0.34489532376393844, 0.47213877364139306}, {0.21993077914046083, 0.6583691780274996, 0.7198475378926182}, {-0.21392348345014195, 0.1478171829550702, 0.9656017935214206}, {0.10926252787847963, -0.4811951572873208, 0.8697775121287253}, {0.7428567301586793, -0.35939416782780276, 0.5648005936517034}, {0.8512303986474292, 0.4722343788582682, -0.2289137388687808}, {0.2846148069787909, 0.8644080972654203, -0.4144792552473538}, {-0.10554981496139187, 0.9794457296411412, 0.17188746100093646}, {-0.8075407579970092, 0.15335524858988167, 0.5695261994882688}, {-0.8512303986474292, -0.4722343788582682, 0.22891373886878083}, {-0.2846148069787909, -0.8644080972654203, 0.4144792552473538}, {0.10554981496139185, -0.9794457296411412, -0.17188746100093638}, {0.7405621473854482, -0.6673299564565524, -0.07898376463267347}, {0.8075407579970092, -0.15335524858988167, -0.5695261994882688}, {-0.7428567301586793, 0.35939416782780276, -0.5648005936517034}, {-0.8112534709140969, -0.34489532376393844, -0.47213877364139306}, {-0.21993077914046083, -0.6583691780274996, -0.7198475378926182}, {0.21392348345014195, -0.1478171829550702, -0.9656017935214206}, {-0.10926252787847963, 0.4811951572873209, -0.8697775121287253}, {-0.10926252787847968, 0.4811951572873209, -0.8697775121287253}, {-0.740562147385448, 0.6673299564565524, 0.07898376463267354}, {-0.7405621473854481, 0.6673299564565524, 0.07898376463267347}, {-0.7405621473854481, 0.6673299564565525, 0.07898376463267329}}; +constexpr PJ_XYZ base_ico_normals[23] = { + {0.8112534709140969, 0.34489532376393844, 0.47213877364139306}, + {0.21993077914046083, 0.6583691780274996, 0.7198475378926182}, + {-0.21392348345014195, 0.1478171829550702, 0.9656017935214206}, + {0.10926252787847963, -0.4811951572873208, 0.8697775121287253}, + {0.7428567301586793, -0.35939416782780276, 0.5648005936517034}, + {0.8512303986474292, 0.4722343788582682, -0.2289137388687808}, + {0.2846148069787909, 0.8644080972654203, -0.4144792552473538}, + {-0.10554981496139187, 0.9794457296411412, 0.17188746100093646}, + {-0.8075407579970092, 0.15335524858988167, 0.5695261994882688}, + {-0.8512303986474292, -0.4722343788582682, 0.22891373886878083}, + {-0.2846148069787909, -0.8644080972654203, 0.4144792552473538}, + {0.10554981496139185, -0.9794457296411412, -0.17188746100093638}, + {0.7405621473854482, -0.6673299564565524, -0.07898376463267347}, + {0.8075407579970092, -0.15335524858988167, -0.5695261994882688}, + {-0.7428567301586793, 0.35939416782780276, -0.5648005936517034}, + {-0.8112534709140969, -0.34489532376393844, -0.47213877364139306}, + {-0.21993077914046083, -0.6583691780274996, -0.7198475378926182}, + {0.21392348345014195, -0.1478171829550702, -0.9656017935214206}, + {-0.10926252787847963, 0.4811951572873209, -0.8697775121287253}, + {-0.10926252787847968, 0.4811951572873209, -0.8697775121287253}, + {-0.740562147385448, 0.6673299564565524, 0.07898376463267354}, + {-0.7405621473854481, 0.6673299564565524, 0.07898376463267347}, + {-0.7405621473854481, 0.6673299564565525, 0.07898376463267329}}; // /* -// The points of the Airocean projection map are deduced from the unfolded net -// of the altered icosahedron defined above. -// The distances in the projected 2d space are expressed in meter. +// The points of the Airocean projection map are deduced from the unfolded +// net of the altered icosahedron defined above. The distances in the +// projected 2d space are expressed in meter. // */ // // Define the 23 unfolded surfaces used (from icosahedron + split faces) -constexpr pj_face base_airocean_faces[23] = {{{1.8211859946200586, 3.1543866727148018, 1.0}, {1.8211859946200586, 4.205848896953069, 1.0}, {2.7317789919300877, 3.6801177848339353, 1.0}}, {{1.8211859946200586, 3.1543866727148018, 1.0}, {0.9105929973100293, 3.6801177848339353, 1.0}, {1.8211859946200586, 4.205848896953069, 1.0}}, {{1.8211859946200586, 3.1543866727148018, 1.0}, {0.9105929973100293, 2.628655560595668, 1.0}, {0.9105929973100293, 3.6801177848339353, 1.0}}, {{1.8211859946200586, 3.1543866727148018, 1.0}, {1.8211859946200586, 2.1029244484765344, 1.0}, {0.9105929973100293, 2.628655560595668, 1.0}}, {{1.8211859946200586, 3.1543866727148018, 1.0}, {2.7317789919300877, 3.6801177848339353, 1.0}, {2.7317789919300877, 2.628655560595668, 1.0}}, {{2.7317789919300877, 3.6801177848339353, 1.0}, {1.8211859946200586, 4.205848896953069, 1.0}, {2.7317789919300877, 4.731580009072203, 1.0}}, {{1.8211859946200586, 5.257311121191336, 1.0}, {1.8211859946200586, 4.205848896953069, 1.0}, {0.9105929973100293, 4.731580009072203, 1.0}}, {{0.9105929973100293, 4.731580009072203, 1.0}, {1.8211859946200586, 4.205848896953069, 1.0}, {0.9105929973100293, 3.6801177848339353, 1.0}}, {{0.9105929973100293, 2.628655560595668, 1.0}, {0.0, 3.1543866727148018, 1.0}, {0.9105929973100293, 3.6801177848339353, 1.0}}, {{0.9105929973100293, 2.628655560595668, 1.0}, {0.9105929973100293, 1.5771933363574009, 1.0}, {0.0, 2.1029244484765344, 1.0}}, {{0.9105929973100293, 2.628655560595668, 1.0}, {1.8211859946200586, 2.1029244484765344, 1.0}, {0.9105929973100293, 1.5771933363574009, 1.0}}, {{0.9105929973100293, 1.5771933363574009, 1.0}, {1.8211859946200586, 2.1029244484765344, 1.0}, {1.8211859946200586, 1.0514622242382672, 1.0}}, {{1.8211859946200586, 1.0514622242382672, 1.0}, {1.8211859946200586, 2.1029244484765344, 1.0}, {2.7317789919300877, 1.5771933363574009, 1.0}}, {{1.8211859946200586, 0.0, 1.0}, {1.8211859946200586, 1.0514622242382672, 1.0}, {2.7317789919300877, 0.5257311121191336, 1.0}}, {{0.0, 5.257311121191336, 1.0}, {0.9105929973100293, 4.731580009072203, 1.0}, {0.0, 4.205848896953069, 1.0}}, {{0.0, 1.0514622242382672, 1.0}, {0.0, 2.1029244484765344, 1.0}, {0.9105929973100293, 1.5771933363574009, 1.0}}, {{0.9105929973100293, 0.5257311121191336, 1.0}, {0.9105929973100293, 1.5771933363574009, 1.0}, {1.8211859946200586, 1.0514622242382672, 1.0}}, {{0.9105929973100293, 0.5257311121191336, 1.0}, {1.8211859946200586, 1.0514622242382672, 1.0}, {1.8211859946200586, 0.0, 1.0}}, {{0.9105929973100293, 4.731580009072203, 1.0}, {0.45529649865501465, 4.994445565131769, 1.0}, {0.9105929973100293, 5.78304223331047, 1.0}}, {{0.9105929973100293, 0.5257311121191336, 1.0}, {1.8211859946200586, 0.0, 1.0}, {0.9105929973100293, 0.0, 1.0}}, {{0.0, 4.205848896953069, 1.0}, {0.9105929973100293, 4.731580009072203, 1.0}, {0.6070619982066862, 4.205848896953069, 1.0}}, {{0.9105929973100293, 4.731580009072203, 1.0}, {0.9105929973100293, 3.6801177848339353, 1.0}, {0.6070619982066862, 4.205848896953069, 1.0}}, {{0.0, 3.1543866727148018, 1.0}, {0.3035309991033431, 3.6801177848339353, 1.0}, {0.9105929973100293, 3.6801177848339353, 1.0}}}; +constexpr pj_face base_airocean_faces[23] = { + {{1.8211859946200586, 3.1543866727148018, 1.0}, + {1.8211859946200586, 4.205848896953069, 1.0}, + {2.7317789919300877, 3.6801177848339353, 1.0}}, + {{1.8211859946200586, 3.1543866727148018, 1.0}, + {0.9105929973100293, 3.6801177848339353, 1.0}, + {1.8211859946200586, 4.205848896953069, 1.0}}, + {{1.8211859946200586, 3.1543866727148018, 1.0}, + {0.9105929973100293, 2.628655560595668, 1.0}, + {0.9105929973100293, 3.6801177848339353, 1.0}}, + {{1.8211859946200586, 3.1543866727148018, 1.0}, + {1.8211859946200586, 2.1029244484765344, 1.0}, + {0.9105929973100293, 2.628655560595668, 1.0}}, + {{1.8211859946200586, 3.1543866727148018, 1.0}, + {2.7317789919300877, 3.6801177848339353, 1.0}, + {2.7317789919300877, 2.628655560595668, 1.0}}, + {{2.7317789919300877, 3.6801177848339353, 1.0}, + {1.8211859946200586, 4.205848896953069, 1.0}, + {2.7317789919300877, 4.731580009072203, 1.0}}, + {{1.8211859946200586, 5.257311121191336, 1.0}, + {1.8211859946200586, 4.205848896953069, 1.0}, + {0.9105929973100293, 4.731580009072203, 1.0}}, + {{0.9105929973100293, 4.731580009072203, 1.0}, + {1.8211859946200586, 4.205848896953069, 1.0}, + {0.9105929973100293, 3.6801177848339353, 1.0}}, + {{0.9105929973100293, 2.628655560595668, 1.0}, + {0.0, 3.1543866727148018, 1.0}, + {0.9105929973100293, 3.6801177848339353, 1.0}}, + {{0.9105929973100293, 2.628655560595668, 1.0}, + {0.9105929973100293, 1.5771933363574009, 1.0}, + {0.0, 2.1029244484765344, 1.0}}, + {{0.9105929973100293, 2.628655560595668, 1.0}, + {1.8211859946200586, 2.1029244484765344, 1.0}, + {0.9105929973100293, 1.5771933363574009, 1.0}}, + {{0.9105929973100293, 1.5771933363574009, 1.0}, + {1.8211859946200586, 2.1029244484765344, 1.0}, + {1.8211859946200586, 1.0514622242382672, 1.0}}, + {{1.8211859946200586, 1.0514622242382672, 1.0}, + {1.8211859946200586, 2.1029244484765344, 1.0}, + {2.7317789919300877, 1.5771933363574009, 1.0}}, + {{1.8211859946200586, 0.0, 1.0}, + {1.8211859946200586, 1.0514622242382672, 1.0}, + {2.7317789919300877, 0.5257311121191336, 1.0}}, + {{0.0, 5.257311121191336, 1.0}, + {0.9105929973100293, 4.731580009072203, 1.0}, + {0.0, 4.205848896953069, 1.0}}, + {{0.0, 1.0514622242382672, 1.0}, + {0.0, 2.1029244484765344, 1.0}, + {0.9105929973100293, 1.5771933363574009, 1.0}}, + {{0.9105929973100293, 0.5257311121191336, 1.0}, + {0.9105929973100293, 1.5771933363574009, 1.0}, + {1.8211859946200586, 1.0514622242382672, 1.0}}, + {{0.9105929973100293, 0.5257311121191336, 1.0}, + {1.8211859946200586, 1.0514622242382672, 1.0}, + {1.8211859946200586, 0.0, 1.0}}, + {{0.9105929973100293, 4.731580009072203, 1.0}, + {0.45529649865501465, 4.994445565131769, 1.0}, + {0.9105929973100293, 5.78304223331047, 1.0}}, + {{0.9105929973100293, 0.5257311121191336, 1.0}, + {1.8211859946200586, 0.0, 1.0}, + {0.9105929973100293, 0.0, 1.0}}, + {{0.0, 4.205848896953069, 1.0}, + {0.9105929973100293, 4.731580009072203, 1.0}, + {0.6070619982066862, 4.205848896953069, 1.0}}, + {{0.9105929973100293, 4.731580009072203, 1.0}, + {0.9105929973100293, 3.6801177848339353, 1.0}, + {0.6070619982066862, 4.205848896953069, 1.0}}, + {{0.0, 3.1543866727148018, 1.0}, + {0.3035309991033431, 3.6801177848339353, 1.0}, + {0.9105929973100293, 3.6801177848339353, 1.0}}}; // /* // The parameters here are extracted from the transition matrices @@ -61,95 +244,413 @@ constexpr pj_face base_airocean_faces[23] = {{{1.8211859946200586, 3.15438667271 // the irrelevant ones has been discarded. // */ // // Icosahedron to Airocean (forward) -constexpr double base_ico_air_trans[23][4][4] = {{{0.5771127852625935, -0.6019490725122667, -0.5519041105011566, 2.1247169937234016}, {0.09385435001257117, 0.7202114479424703, -0.6873767753105484, 3.6801177848339357}, {0.8112534709140967, 0.3448953237639384, 0.4721387736413929, -0.7946544722917659}, {0.0, 0.0, 0.0, 1.0}}, {{0.9709901201198636, -0.2187361325341673, -0.09660585361978567, 1.5176549955167156}, {0.09385435001257089, 0.7202114479424708, -0.687376775310548, 3.6801177848339353}, {0.21993077914046077, 0.6583691780274995, 0.7198475378926181, -0.7946544722917659}, {0.0, 0.0, 0.0, 1.0}}, {{0.9721374115064793, -0.06476823821979226, 0.2252863255224028, 1.2141239964133725}, {0.09584151698527507, 0.9868916636293633, -0.12984316647721492, 3.1543866727148013}, {-0.21392348345014195, 0.1478171829550702, 0.9656017935214207, -0.7946544722917663}, {0.0, 0.0, 0.0, 1.0}}, {{0.9921258753731454, -0.0010987106726278763, -0.1252399307326839, 1.5176549955167151}, {0.06122048200295415, 0.8766128070237673, 0.47728611874350335, 2.6286555605956674}, {0.10926252787847969, -0.4811951572873209, 0.8697775121287256, -0.7946544722917663}, {0.0, 0.0, 0.0, 1.0}}, {{0.28030414798915965, -0.5991800396948614, -0.7499419075177327, 2.428247992826745}, {0.6079419898954396, 0.7154153424148981, -0.34436524905882676, 3.1543866727148013}, {0.742856730158679, -0.3593941678278027, 0.5648005936517032, -0.794654472291766}, {0.0, 0.0, 0.0, 1.0}}, {{0.25960661905056537, -0.7580069591045613, -0.5983559586852888, 2.428247992826744}, {-0.4560824615830708, 0.4499112594427941, -0.7678337364709403, 4.205848896953069}, {0.8512303986474292, 0.47223437885826813, -0.22891373886878083, -0.7946544722917661}, {0.0, 0.0, 0.0, 1.0}}, {{0.958636570067365, -0.258086064605963, 0.12003128669511368, 1.5176549955167158}, {-0.003215303703157293, -0.43149765310854393, -0.9021083289627215, 4.731580009072202}, {0.2846148069787908, 0.8644080972654206, -0.41447925524735385, -0.7946544722917662}, {0.0, 0.0, 0.0, 1.0}}, {{0.992834940445074, 0.09405868118990741, 0.07370037668995856, 1.2141239964133723}, {0.056018011327093935, 0.17843493822832973, -0.982355819052552, 4.205848896953068}, {-0.10554981496139189, 0.9794457296411413, 0.17188746100093644, -0.7946544722917662}, {0.0, 0.0, 0.0, 1.0}}, {{0.5819727895662967, 0.05026939415592827, 0.8116530417706931, 0.6070619982066865}, {0.09584151698527442, 0.9868916636293634, -0.1298431664772149, 3.1543866727148013}, {-0.8075407579970093, 0.1533552485898817, 0.5695261994882689, -0.7946544722917663}, {0.0, 0.0, 0.0, 1.0}}, {{0.5247823074767625, -0.7686380596783918, 0.36578554232391575, 0.6070619982066867}, {0.0032153037031566203, 0.4314976531085445, 0.9021083289627214, 2.102924448476535}, {-0.8512303986474292, -0.47223437885826813, 0.22891373886878078, -0.7946544722917661}, {0.0, 0.0, 0.0, 1.0}}, {{0.9586365700673652, -0.2580860646059632, 0.12003128669511379, 1.2141239964133719}, {0.003215303703156878, 0.43149765310854465, 0.9021083289627218, 2.1029244484765344}, {-0.2846148069787909, -0.8644080972654204, 0.4144792552473538, -0.7946544722917662}, {0.0, 0.0, 0.0, 1.0}}, {{0.9928349404450738, 0.0940586811899076, 0.07370037668995869, 1.5176549955167153}, {-0.05601801132709388, -0.17843493822832968, 0.9823558190525513, 1.5771933363574009}, {0.10554981496139189, -0.9794457296411413, -0.17188746100093644, -0.7946544722917662}, {0.0, 0.0, 0.0, 1.0}}, {{0.6696489291164518, 0.7230710214322986, 0.1695246580826539, 2.1247169937234016}, {-0.05601801132709365, -0.17843493822832943, 0.9823558190525516, 1.5771933363574009}, {0.7405621473854482, -0.6673299564565524, -0.07898376463267347, -0.7946544722917662}, {0.0, 0.0, 0.0, 1.0}}, {{0.5819727895662965, 0.050269394155928314, 0.811653041770693, 2.1247169937234016}, {-0.09584151698527484, -0.9868916636293626, 0.129843166477215, 0.5257311121191333}, {0.8075407579970093, -0.1533552485898817, -0.5695261994882689, -0.7946544722917663}, {0.0, 0.0, 0.0, 1.0}}, {{0.3863411332821331, 0.9191578806358752, 0.07674189989336716, 0.30353099910334314}, {0.5467215078924839, -0.16119746460886833, -0.8216513678023304, 4.731580009072203}, {-0.742856730158679, 0.35939416782780265, -0.5648005936517032, -0.794654472291766}, {0.0, 0.0, 0.0, 1.0}}, {{0.20727614126473407, -0.9246959462706865, 0.31933369413978446, 0.303530999103343}, {-0.5467215078924849, 0.1611974646088691, 0.8216513678023303, 1.5771933363574007}, {-0.8112534709140967, -0.34489532376393833, -0.47213877364139295, -0.794654472291766}, {0.0, 0.0, 0.0, 1.0}}, {{0.9709901201198639, -0.21873613253416718, -0.09660585361978535, 1.2141239964133725}, {-0.09385435001257073, -0.7202114479424704, 0.6873767753105484, 1.0514622242382674}, {-0.21993077914046086, -0.6583691780274995, -0.719847537892618, -0.794654472291766}, {0.0, 0.0, 0.0, 1.0}}, {{0.9721374115064794, -0.0647682382197923, 0.2252863255224031, 1.5176549955167156}, {-0.09584151698527477, -0.9868916636293626, 0.12984316647721514, 0.5257311121191336}, {0.21392348345014198, -0.1478171829550702, -0.9656017935214205, -0.7946544722917661}, {0.0, 0.0, 0.0, 1.0}}, {{0.5490814303330593, 0.7586196048290541, 0.350721938339208, 0.6070619982066862}, {0.8285959708235409, -0.43925791486578636, -0.3471040209544599, 5.257311121191335}, {-0.10926252787847968, 0.48119515728732093, -0.8697775121287254, -0.7946544722917663}, {0.0, 0.0, 0.0, 1.0}}, {{0.9921258753731453, -0.0010987106726278503, -0.125239930732684, 1.2141239964133725}, {-0.061220482002954366, -0.8766128070237673, -0.4772861187435034, 0.0}, {-0.10926252787847965, 0.48119515728732093, -0.8697775121287254, -0.7946544722917663}, {0.0, 0.0, 0.0, 1.0}}, {{0.6696489291164521, 0.7230710214322988, 0.169524658082654, 0.607061998206686}, {0.05601801132709396, 0.17843493822832968, -0.9823558190525518, 4.205848896953069}, {-0.7405621473854482, 0.6673299564565525, 0.07898376463267334, -0.7946544722917662}, {0.0, 0.0, 0.0, 1.0}}, {{0.6696489291164525, 0.7230710214322987, 0.1695246580826538, 0.6070619982066863}, {0.05601801132709517, 0.1784349382283307, -0.9823558190525518, 4.205848896953069}, {-0.7405621473854483, 0.6673299564565526, 0.07898376463267348, -0.7946544722917663}, {0.0, 0.0, 0.0, 1.0}}, {{0.28631144367947836, 0.20700632128770896, 0.9355074238963061, 0.3035309991033428}, {0.6079419898954391, 0.7154153424148978, -0.3443652490588263, 3.6801177848339357}, {-0.7405621473854481, 0.6673299564565525, 0.07898376463267341, -0.7946544722917661}, {0.0, 0.0, 0.0, 1.0}}}; +constexpr double base_ico_air_trans[23][4][4] = { + {{0.5771127852625935, -0.6019490725122667, -0.5519041105011566, + 2.1247169937234016}, + {0.09385435001257117, 0.7202114479424703, -0.6873767753105484, + 3.6801177848339357}, + {0.8112534709140967, 0.3448953237639384, 0.4721387736413929, + -0.7946544722917659}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.9709901201198636, -0.2187361325341673, -0.09660585361978567, + 1.5176549955167156}, + {0.09385435001257089, 0.7202114479424708, -0.687376775310548, + 3.6801177848339353}, + {0.21993077914046077, 0.6583691780274995, 0.7198475378926181, + -0.7946544722917659}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.9721374115064793, -0.06476823821979226, 0.2252863255224028, + 1.2141239964133725}, + {0.09584151698527507, 0.9868916636293633, -0.12984316647721492, + 3.1543866727148013}, + {-0.21392348345014195, 0.1478171829550702, 0.9656017935214207, + -0.7946544722917663}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.9921258753731454, -0.0010987106726278763, -0.1252399307326839, + 1.5176549955167151}, + {0.06122048200295415, 0.8766128070237673, 0.47728611874350335, + 2.6286555605956674}, + {0.10926252787847969, -0.4811951572873209, 0.8697775121287256, + -0.7946544722917663}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.28030414798915965, -0.5991800396948614, -0.7499419075177327, + 2.428247992826745}, + {0.6079419898954396, 0.7154153424148981, -0.34436524905882676, + 3.1543866727148013}, + {0.742856730158679, -0.3593941678278027, 0.5648005936517032, + -0.794654472291766}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.25960661905056537, -0.7580069591045613, -0.5983559586852888, + 2.428247992826744}, + {-0.4560824615830708, 0.4499112594427941, -0.7678337364709403, + 4.205848896953069}, + {0.8512303986474292, 0.47223437885826813, -0.22891373886878083, + -0.7946544722917661}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.958636570067365, -0.258086064605963, 0.12003128669511368, + 1.5176549955167158}, + {-0.003215303703157293, -0.43149765310854393, -0.9021083289627215, + 4.731580009072202}, + {0.2846148069787908, 0.8644080972654206, -0.41447925524735385, + -0.7946544722917662}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.992834940445074, 0.09405868118990741, 0.07370037668995856, + 1.2141239964133723}, + {0.056018011327093935, 0.17843493822832973, -0.982355819052552, + 4.205848896953068}, + {-0.10554981496139189, 0.9794457296411413, 0.17188746100093644, + -0.7946544722917662}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.5819727895662967, 0.05026939415592827, 0.8116530417706931, + 0.6070619982066865}, + {0.09584151698527442, 0.9868916636293634, -0.1298431664772149, + 3.1543866727148013}, + {-0.8075407579970093, 0.1533552485898817, 0.5695261994882689, + -0.7946544722917663}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.5247823074767625, -0.7686380596783918, 0.36578554232391575, + 0.6070619982066867}, + {0.0032153037031566203, 0.4314976531085445, 0.9021083289627214, + 2.102924448476535}, + {-0.8512303986474292, -0.47223437885826813, 0.22891373886878078, + -0.7946544722917661}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.9586365700673652, -0.2580860646059632, 0.12003128669511379, + 1.2141239964133719}, + {0.003215303703156878, 0.43149765310854465, 0.9021083289627218, + 2.1029244484765344}, + {-0.2846148069787909, -0.8644080972654204, 0.4144792552473538, + -0.7946544722917662}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.9928349404450738, 0.0940586811899076, 0.07370037668995869, + 1.5176549955167153}, + {-0.05601801132709388, -0.17843493822832968, 0.9823558190525513, + 1.5771933363574009}, + {0.10554981496139189, -0.9794457296411413, -0.17188746100093644, + -0.7946544722917662}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.6696489291164518, 0.7230710214322986, 0.1695246580826539, + 2.1247169937234016}, + {-0.05601801132709365, -0.17843493822832943, 0.9823558190525516, + 1.5771933363574009}, + {0.7405621473854482, -0.6673299564565524, -0.07898376463267347, + -0.7946544722917662}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.5819727895662965, 0.050269394155928314, 0.811653041770693, + 2.1247169937234016}, + {-0.09584151698527484, -0.9868916636293626, 0.129843166477215, + 0.5257311121191333}, + {0.8075407579970093, -0.1533552485898817, -0.5695261994882689, + -0.7946544722917663}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.3863411332821331, 0.9191578806358752, 0.07674189989336716, + 0.30353099910334314}, + {0.5467215078924839, -0.16119746460886833, -0.8216513678023304, + 4.731580009072203}, + {-0.742856730158679, 0.35939416782780265, -0.5648005936517032, + -0.794654472291766}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.20727614126473407, -0.9246959462706865, 0.31933369413978446, + 0.303530999103343}, + {-0.5467215078924849, 0.1611974646088691, 0.8216513678023303, + 1.5771933363574007}, + {-0.8112534709140967, -0.34489532376393833, -0.47213877364139295, + -0.794654472291766}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.9709901201198639, -0.21873613253416718, -0.09660585361978535, + 1.2141239964133725}, + {-0.09385435001257073, -0.7202114479424704, 0.6873767753105484, + 1.0514622242382674}, + {-0.21993077914046086, -0.6583691780274995, -0.719847537892618, + -0.794654472291766}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.9721374115064794, -0.0647682382197923, 0.2252863255224031, + 1.5176549955167156}, + {-0.09584151698527477, -0.9868916636293626, 0.12984316647721514, + 0.5257311121191336}, + {0.21392348345014198, -0.1478171829550702, -0.9656017935214205, + -0.7946544722917661}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.5490814303330593, 0.7586196048290541, 0.350721938339208, + 0.6070619982066862}, + {0.8285959708235409, -0.43925791486578636, -0.3471040209544599, + 5.257311121191335}, + {-0.10926252787847968, 0.48119515728732093, -0.8697775121287254, + -0.7946544722917663}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.9921258753731453, -0.0010987106726278503, -0.125239930732684, + 1.2141239964133725}, + {-0.061220482002954366, -0.8766128070237673, -0.4772861187435034, 0.0}, + {-0.10926252787847965, 0.48119515728732093, -0.8697775121287254, + -0.7946544722917663}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.6696489291164521, 0.7230710214322988, 0.169524658082654, + 0.607061998206686}, + {0.05601801132709396, 0.17843493822832968, -0.9823558190525518, + 4.205848896953069}, + {-0.7405621473854482, 0.6673299564565525, 0.07898376463267334, + -0.7946544722917662}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.6696489291164525, 0.7230710214322987, 0.1695246580826538, + 0.6070619982066863}, + {0.05601801132709517, 0.1784349382283307, -0.9823558190525518, + 4.205848896953069}, + {-0.7405621473854483, 0.6673299564565526, 0.07898376463267348, + -0.7946544722917663}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.28631144367947836, 0.20700632128770896, 0.9355074238963061, + 0.3035309991033428}, + {0.6079419898954391, 0.7154153424148978, -0.3443652490588263, + 3.6801177848339357}, + {-0.7405621473854481, 0.6673299564565525, 0.07898376463267341, + -0.7946544722917661}, + {0.0, 0.0, 0.0, 1.0}}}; // // Airocean to Icosahedron (inverse) -constexpr double base_air_ico_trans[23][4][4] = {{{0.577112785262594, 0.09385435001257074, 0.8112534709140972, -0.9269302059836626}, {-0.6019490725122669, 0.7202114479424705, 0.3448953237639385, -1.0974189231897016}, {-0.5519041105011576, -0.6873767753105482, 0.47213877364139284, 4.0774547262062395}, {0.0, 0.0, 0.0, 1.0}}, {{0.970990120119864, 0.09385435001257075, 0.21993077914046097, -1.6442540918239978}, {-0.21873613253416777, 0.7202114479424705, 0.6583691780274992, -1.7953209624349933}, {-0.09660585361978517, -0.6873767753105485, 0.7198475378926187, 3.248271917398959}, {0.0, 0.0, 0.0, 1.0}}, {{0.9721374115064793, 0.09584151698527468, -0.21392348345014173, -1.6526118158442071}, {-0.06476823821979319, 0.9868916636293628, 0.14781718295507035, -2.916937653420916}, {0.22528632552240307, -0.12984316647721503, 0.9656017935214205, 0.9033698036730199}, {0.0, 0.0, 0.0, 1.0}}, {{0.9921258753731454, 0.061220482002954296, 0.10926252787847969, -1.5798063949483236}, {-0.0010987106726281115, 0.8766128070237668, -0.48119515728732043, -2.68502954971497}, {-0.12523993073268413, 0.4772861187435032, 0.8697775121287253, -0.3733772136037109}, {0.0, 0.0, 0.0, 1.0}}, {{0.2803041479891603, 0.6079419898954391, 0.7428567301586791, -2.0080176725529477}, {-0.5991800396948611, 0.7154153424148979, -0.35939416782780287, -1.0873330756182955}, {-0.7499419075177335, -0.3443652490588265, 0.5648005936517035, 3.3561274015422433}, {0.0, 0.0, 0.0, 1.0}}, {{0.2596066190505654, -0.4560824615830712, 0.8512303986474292, 1.9642587095706099}, {-0.7580069591045617, 0.4499112594427949, 0.47223437885826836, 0.3236332638697585}, {-0.5983559586852887, -0.7678337364709401, -0.22891373886878078, 4.500442002892026}, {0.0, 0.0, 0.0, 1.0}}, {{0.958636570067365, -0.003215303703156967, 0.28461480697879094, -1.2134956834766393}, {-0.2580860646059631, -0.43149765310854504, 0.8644080972654203, 3.1202570350096352}, {0.12003128669511316, -0.9021083289627222, -0.4144792552473535, 3.756863859611938}, {0.0, 0.0, 0.0, 1.0}}, {{0.992834940445074, 0.05601801132709367, -0.10554981496139178, -1.5249036493302057}, {0.09405868118990754, 0.17843493822832954, 0.9794457296411412, -0.08634836060276646}, {0.07370037668995799, -0.9823558190525513, 0.1718874610009362, 4.17874988170889}, {0.0, 0.0, 0.0, 1.0}}, {{0.581972789566297, 0.09584151698527493, -0.8075407579970092, -1.297330643307362}, {0.05026939415592872, 0.986891663629363, 0.15335524858988142, -3.0216901158893736}, {0.8116530417706934, -0.12984316647721506, 0.5695261994882689, 0.3694283780016493}, {0.0, 0.0, 0.0, 1.0}}, {{0.5247823074767624, 0.0032153037031565812, -0.8512303986474291, -1.0017709802028867}, {-0.7686380596783923, 0.431497653108545, -0.47223437885826824, -0.8160591689057779}, {0.36578554232391597, 0.9021083289627221, 0.22891373886878089, -1.937212836027187}, {0.0, 0.0, 0.0, 1.0}}, {{0.9586365700673654, 0.0032153037031565886, -0.2846148069787907, -1.3968356335709964}, {-0.258086064605963, 0.43149765310854504, -0.8644080972654202, -1.2809642403813966}, {0.12003128669511362, 0.9021083289627224, 0.41447925524735396, -1.7134307317924613}, {0.0, 0.0, 0.0, 1.0}}, {{0.9928349404450739, -0.05601801132709361, 0.10554981496139221, -1.3345540404002831}, {0.09405868118990741, -0.17843493822832956, -0.9794457296411411, -0.639643161258916}, {0.07370037668995856, 0.982355819052552, -0.17188746100093616, -1.7978079362118518}, {0.0, 0.0, 0.0, 1.0}}, {{0.6696489291164524, -0.056018011327093886, 0.7405621473854481, -0.7459722029114777}, {0.723071021432299, -0.1784349382283297, -0.6673299564565522, -1.7851916257515466}, {0.16952465808265363, 0.9823558190525522, -0.07898376463267373, -1.9723217754287594}, {0.0, 0.0, 0.0, 1.0}}, {{0.5819727895662968, -0.09584151698527477, 0.8075407579970091, -0.5444247336640644}, {0.05026939415592821, -0.9868916636293631, -0.15335524858988164, 0.29016698169232114}, {0.8116530417706935, 0.1298431664772151, -0.569526199488269, -2.2453721446813035}, {0.0, 0.0, 0.0, 1.0}}, {{0.3863411332821329, 0.5467215078924852, -0.7428567301586795, -3.2944374903463687}, {0.9191578806358753, -0.16119746460886916, 0.3593941678278029, 0.7693199739932717}, {0.07674189989336772, -0.8216513678023304, -0.564800593651703, 3.4155943230742447}, {0.0, 0.0, 0.0, 1.0}}, {{0.20727614126473443, -0.546721507892485, -0.8112534709140969, 0.15470458601882164}, {-0.9246959462706867, 0.16119746460886913, -0.3448953237639384, -0.24763829408199384}, {0.31933369413978435, 0.8216513678023302, -0.4721387736413931, -1.768017925352872}, {0.0, 0.0, 0.0, 1.0}}, {{0.9709901201198642, -0.09385435001257068, -0.21993077914046077, -1.2549870787377553}, {-0.2187361325341676, -0.7202114479424703, -0.6583691780274997, 0.4996719066292349}, {-0.09660585361978546, 0.6873767753105482, -0.7198475378926181, -1.1774892933385632}, {0.0, 0.0, 0.0, 1.0}}, {{0.9721374115064794, -0.09584151698527459, 0.21392348345014212, -1.2549870787377553}, {-0.06476823821979266, -0.9868916636293628, -0.14781718295507024, 0.49967190662923483}, {0.2252863255224028, 0.12984316647721506, -0.9656017935214204, -1.1774892933385632}, {0.0, 0.0, 0.0, 1.0}}, {{0.5490814303330579, 0.8285959708235412, -0.10926252787847955, -4.776339239093644}, {0.7586196048290552, -0.4392579148657884, 0.4811951572873209, 2.231170271492442}, {0.3507219383392087, -0.3471040209544594, -0.8697775121287253, 0.9207512789590909}, {0.0, 0.0, 0.0, 1.0}}, {{0.9921258753731456, -0.061220482002954546, -0.10926252787847962, -1.2913897891856965}, {-0.00109871067262767, -0.8766128070237672, 0.48119515728732093, 0.38371785477626236}, {-0.12523993073268386, -0.47728611874350324, -0.8697775121287252, -0.5391157847001973}, {0.0, 0.0, 0.0, 1.0}}, {{0.6696489291164526, 0.0560180113270932, -0.7405621473854482, -1.2306127305858023}, {0.723071021432299, 0.17843493822832968, 0.6673299564565522, -0.6591225928490807}, {0.16952465808265377, -0.9823558190525503, 0.07898376463267326, 4.09149296210043}, {0.0, 0.0, 0.0, 1.0}}, {{0.669648929116452, 0.056018011327093706, -0.740562147385448, -1.230612730585803}, {0.7230710214322988, 0.1784349382283296, 0.6673299564565524, -0.6591225928490807}, {0.1695246580826554, -0.9823558190525514, 0.0789837646326731, 4.091492962100434}, {0.0, 0.0, 0.0, 1.0}}, {{0.2863114436794785, 0.6079419898954399, -0.7405621473854486, -2.9126935501461353}, {0.2070063212877089, 0.7154153424148983, 0.6673299564565521, -2.165348826292825}, {0.935507423896306, -0.3443652490588271, 0.07898376463267351, 1.046113976300111}, {0.0, 0.0, 0.0, 1.0}}}; - +constexpr double base_air_ico_trans[23][4][4] = { + {{0.577112785262594, 0.09385435001257074, 0.8112534709140972, + -0.9269302059836626}, + {-0.6019490725122669, 0.7202114479424705, 0.3448953237639385, + -1.0974189231897016}, + {-0.5519041105011576, -0.6873767753105482, 0.47213877364139284, + 4.0774547262062395}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.970990120119864, 0.09385435001257075, 0.21993077914046097, + -1.6442540918239978}, + {-0.21873613253416777, 0.7202114479424705, 0.6583691780274992, + -1.7953209624349933}, + {-0.09660585361978517, -0.6873767753105485, 0.7198475378926187, + 3.248271917398959}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.9721374115064793, 0.09584151698527468, -0.21392348345014173, + -1.6526118158442071}, + {-0.06476823821979319, 0.9868916636293628, 0.14781718295507035, + -2.916937653420916}, + {0.22528632552240307, -0.12984316647721503, 0.9656017935214205, + 0.9033698036730199}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.9921258753731454, 0.061220482002954296, 0.10926252787847969, + -1.5798063949483236}, + {-0.0010987106726281115, 0.8766128070237668, -0.48119515728732043, + -2.68502954971497}, + {-0.12523993073268413, 0.4772861187435032, 0.8697775121287253, + -0.3733772136037109}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.2803041479891603, 0.6079419898954391, 0.7428567301586791, + -2.0080176725529477}, + {-0.5991800396948611, 0.7154153424148979, -0.35939416782780287, + -1.0873330756182955}, + {-0.7499419075177335, -0.3443652490588265, 0.5648005936517035, + 3.3561274015422433}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.2596066190505654, -0.4560824615830712, 0.8512303986474292, + 1.9642587095706099}, + {-0.7580069591045617, 0.4499112594427949, 0.47223437885826836, + 0.3236332638697585}, + {-0.5983559586852887, -0.7678337364709401, -0.22891373886878078, + 4.500442002892026}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.958636570067365, -0.003215303703156967, 0.28461480697879094, + -1.2134956834766393}, + {-0.2580860646059631, -0.43149765310854504, 0.8644080972654203, + 3.1202570350096352}, + {0.12003128669511316, -0.9021083289627222, -0.4144792552473535, + 3.756863859611938}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.992834940445074, 0.05601801132709367, -0.10554981496139178, + -1.5249036493302057}, + {0.09405868118990754, 0.17843493822832954, 0.9794457296411412, + -0.08634836060276646}, + {0.07370037668995799, -0.9823558190525513, 0.1718874610009362, + 4.17874988170889}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.581972789566297, 0.09584151698527493, -0.8075407579970092, + -1.297330643307362}, + {0.05026939415592872, 0.986891663629363, 0.15335524858988142, + -3.0216901158893736}, + {0.8116530417706934, -0.12984316647721506, 0.5695261994882689, + 0.3694283780016493}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.5247823074767624, 0.0032153037031565812, -0.8512303986474291, + -1.0017709802028867}, + {-0.7686380596783923, 0.431497653108545, -0.47223437885826824, + -0.8160591689057779}, + {0.36578554232391597, 0.9021083289627221, 0.22891373886878089, + -1.937212836027187}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.9586365700673654, 0.0032153037031565886, -0.2846148069787907, + -1.3968356335709964}, + {-0.258086064605963, 0.43149765310854504, -0.8644080972654202, + -1.2809642403813966}, + {0.12003128669511362, 0.9021083289627224, 0.41447925524735396, + -1.7134307317924613}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.9928349404450739, -0.05601801132709361, 0.10554981496139221, + -1.3345540404002831}, + {0.09405868118990741, -0.17843493822832956, -0.9794457296411411, + -0.639643161258916}, + {0.07370037668995856, 0.982355819052552, -0.17188746100093616, + -1.7978079362118518}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.6696489291164524, -0.056018011327093886, 0.7405621473854481, + -0.7459722029114777}, + {0.723071021432299, -0.1784349382283297, -0.6673299564565522, + -1.7851916257515466}, + {0.16952465808265363, 0.9823558190525522, -0.07898376463267373, + -1.9723217754287594}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.5819727895662968, -0.09584151698527477, 0.8075407579970091, + -0.5444247336640644}, + {0.05026939415592821, -0.9868916636293631, -0.15335524858988164, + 0.29016698169232114}, + {0.8116530417706935, 0.1298431664772151, -0.569526199488269, + -2.2453721446813035}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.3863411332821329, 0.5467215078924852, -0.7428567301586795, + -3.2944374903463687}, + {0.9191578806358753, -0.16119746460886916, 0.3593941678278029, + 0.7693199739932717}, + {0.07674189989336772, -0.8216513678023304, -0.564800593651703, + 3.4155943230742447}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.20727614126473443, -0.546721507892485, -0.8112534709140969, + 0.15470458601882164}, + {-0.9246959462706867, 0.16119746460886913, -0.3448953237639384, + -0.24763829408199384}, + {0.31933369413978435, 0.8216513678023302, -0.4721387736413931, + -1.768017925352872}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.9709901201198642, -0.09385435001257068, -0.21993077914046077, + -1.2549870787377553}, + {-0.2187361325341676, -0.7202114479424703, -0.6583691780274997, + 0.4996719066292349}, + {-0.09660585361978546, 0.6873767753105482, -0.7198475378926181, + -1.1774892933385632}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.9721374115064794, -0.09584151698527459, 0.21392348345014212, + -1.2549870787377553}, + {-0.06476823821979266, -0.9868916636293628, -0.14781718295507024, + 0.49967190662923483}, + {0.2252863255224028, 0.12984316647721506, -0.9656017935214204, + -1.1774892933385632}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.5490814303330579, 0.8285959708235412, -0.10926252787847955, + -4.776339239093644}, + {0.7586196048290552, -0.4392579148657884, 0.4811951572873209, + 2.231170271492442}, + {0.3507219383392087, -0.3471040209544594, -0.8697775121287253, + 0.9207512789590909}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.9921258753731456, -0.061220482002954546, -0.10926252787847962, + -1.2913897891856965}, + {-0.00109871067262767, -0.8766128070237672, 0.48119515728732093, + 0.38371785477626236}, + {-0.12523993073268386, -0.47728611874350324, -0.8697775121287252, + -0.5391157847001973}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.6696489291164526, 0.0560180113270932, -0.7405621473854482, + -1.2306127305858023}, + {0.723071021432299, 0.17843493822832968, 0.6673299564565522, + -0.6591225928490807}, + {0.16952465808265377, -0.9823558190525503, 0.07898376463267326, + 4.09149296210043}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.669648929116452, 0.056018011327093706, -0.740562147385448, + -1.230612730585803}, + {0.7230710214322988, 0.1784349382283296, 0.6673299564565524, + -0.6591225928490807}, + {0.1695246580826554, -0.9823558190525514, 0.0789837646326731, + 4.091492962100434}, + {0.0, 0.0, 0.0, 1.0}}, + {{0.2863114436794785, 0.6079419898954399, -0.7405621473854486, + -2.9126935501461353}, + {0.2070063212877089, 0.7154153424148983, 0.6673299564565521, + -2.165348826292825}, + {0.935507423896306, -0.3443652490588271, 0.07898376463267351, + 1.046113976300111}, + {0.0, 0.0, 0.0, 1.0}}}; // By default the resulting orientation of the projection is vertical // the following transforms are used to alter the projection data // so that the resulting orientation is horizontal instead -constexpr double orient_horizontal_trans[4][4] = {{0.0, -1.0, 0.0, 5.78304223331047}, {1.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 1.0, 0.0}, {0.0, 0.0, 0.0, 1.0}}; -constexpr double orient_horizontal_inv_trans[4][4] = {{0.0, 1.0, 0.0, 0.0}, {-1.0, -0.0, -0.0, 5.78304223331047}, {0.0, 0.0, 1.0, 0.0}, {0.0, 0.0, 0.0, 1.0}}; - +constexpr double orient_horizontal_trans[4][4] = { + {0.0, -1.0, 0.0, 5.78304223331047}, + {1.0, 0.0, 0.0, 0.0}, + {0.0, 0.0, 1.0, 0.0}, + {0.0, 0.0, 0.0, 1.0}}; +constexpr double orient_horizontal_inv_trans[4][4] = { + {0.0, 1.0, 0.0, 0.0}, + {-1.0, -0.0, -0.0, 5.78304223331047}, + {0.0, 0.0, 1.0, 0.0}, + {0.0, 0.0, 0.0, 1.0}}; namespace { // anonymous namespace - struct pj_airocean_data { - pj_face ico_faces[23] = {}; - PJ_XYZ ico_centers[23] = {}; - PJ_XYZ ico_normals[23] = {}; - pj_face airocean_faces[23] = {}; - double ico_air_trans[23][4][4] = {}; - double air_ico_trans[23][4][4] = {}; - - void initialize() { - memcpy((char *) this->ico_faces, (char *) base_ico_faces, sizeof(pj_face[23])); - memcpy((char *) this->airocean_faces, (char *) base_airocean_faces, sizeof(pj_face[23])); - memcpy(this->ico_centers, base_ico_centers, sizeof(PJ_XYZ[23])); - memcpy(this->ico_normals, base_ico_normals, sizeof(PJ_XYZ[23])); - memcpy(this->ico_air_trans, base_ico_air_trans, sizeof(double[23][4][4])); - memcpy(this->air_ico_trans, base_air_ico_trans, sizeof(double[23][4][4])); - } - - static void mat_mult(const double m1[4][4], const double m2[4][4], double res[4][4]) { - for (unsigned char i = 0; i < 4; ++i) - for (unsigned char j = 0; j < 4; ++j) - res[i][j] = (m1[i][0] * m2[0][j]) - + (m1[i][1] * m2[1][j]) - + (m1[i][2] * m2[2][j]) - + (m1[i][3] * m2[3][j]); - } +struct pj_airocean_data { + pj_face ico_faces[23] = {}; + PJ_XYZ ico_centers[23] = {}; + PJ_XYZ ico_normals[23] = {}; + pj_face airocean_faces[23] = {}; + double ico_air_trans[23][4][4] = {}; + double air_ico_trans[23][4][4] = {}; + + void initialize() { + memcpy((char *)this->ico_faces, (char *)base_ico_faces, + sizeof(pj_face[23])); + memcpy((char *)this->airocean_faces, (char *)base_airocean_faces, + sizeof(pj_face[23])); + memcpy(this->ico_centers, base_ico_centers, sizeof(PJ_XYZ[23])); + memcpy(this->ico_normals, base_ico_normals, sizeof(PJ_XYZ[23])); + memcpy(this->ico_air_trans, base_ico_air_trans, + sizeof(double[23][4][4])); + memcpy(this->air_ico_trans, base_air_ico_trans, + sizeof(double[23][4][4])); + } - static PJ_XYZ vec_mult(const double m[4][4], const PJ_XYZ * v) { - double x = m[0][0] * v->x + m[0][1] * v->y + m[0][2] * v->z + m[0][3]; - double y = m[1][0] * v->x + m[1][1] * v->y + m[1][2] * v->z + m[1][3]; - double z = m[2][0] * v->x + m[2][1] * v->y + m[2][2] * v->z + m[2][3]; - return {x, y, z}; - } + static void mat_mult(const double m1[4][4], const double m2[4][4], + double res[4][4]) { + for (unsigned char i = 0; i < 4; ++i) + for (unsigned char j = 0; j < 4; ++j) + res[i][j] = (m1[i][0] * m2[0][j]) + (m1[i][1] * m2[1][j]) + + (m1[i][2] * m2[2][j]) + (m1[i][3] * m2[3][j]); + } - void transform(const double m[4][4], const double inv_m[4][4]) { - for (unsigned char i=0; i < 23; i++) { - mat_mult(m, base_ico_air_trans[i], this->ico_air_trans[i]); - mat_mult(base_air_ico_trans[i], inv_m, this->air_ico_trans[i]); - this->airocean_faces[i] = { - vec_mult(m, &base_airocean_faces[i].p1), - vec_mult(m, &base_airocean_faces[i].p2), - vec_mult(m, &base_airocean_faces[i].p3), - }; - } + static PJ_XYZ vec_mult(const double m[4][4], const PJ_XYZ *v) { + double x = m[0][0] * v->x + m[0][1] * v->y + m[0][2] * v->z + m[0][3]; + double y = m[1][0] * v->x + m[1][1] * v->y + m[1][2] * v->z + m[1][3]; + double z = m[2][0] * v->x + m[2][1] * v->y + m[2][2] * v->z + m[2][3]; + return {x, y, z}; + } + void transform(const double m[4][4], const double inv_m[4][4]) { + for (unsigned char i = 0; i < 23; i++) { + mat_mult(m, base_ico_air_trans[i], this->ico_air_trans[i]); + mat_mult(base_air_ico_trans[i], inv_m, this->air_ico_trans[i]); + this->airocean_faces[i] = { + vec_mult(m, &base_airocean_faces[i].p1), + vec_mult(m, &base_airocean_faces[i].p2), + vec_mult(m, &base_airocean_faces[i].p3), + }; } - - - }; - - + } +}; } // anonymous namespace - - - inline double det(const PJ_XYZ *u, const PJ_XYZ *v, const PJ_XYZ *w) { - return ( - u->x * (v->y * w->z - v->z * w->y) - - v->x * (u->y * w->z - u->z * w->y) + - w->x * (u->y * v->z - u->z * v->y) - ); + return (u->x * (v->y * w->z - v->z * w->y) - + v->x * (u->y * w->z - u->z * w->y) + + w->x * (u->y * v->z - u->z * v->y)); } -inline bool is_point_in_face(const PJ_XYZ *p, const pj_face * face) { - return ( - det(p, &face->p2, &face->p3) <= 0 && - det(&face->p1, p, &face->p3) <= 0 && - det(&face->p1, &face->p2, p) <= 0 - ); +inline bool is_point_in_face(const PJ_XYZ *p, const pj_face *face) { + return (det(p, &face->p2, &face->p3) <= 0 && + det(&face->p1, p, &face->p3) <= 0 && + det(&face->p1, &face->p2, p) <= 0); } - -inline unsigned char get_ico_face_index(const pj_airocean_data * pj_data, const PJ_XYZ *p) { - for (unsigned char i=0; i < 23; i++) { +inline unsigned char get_ico_face_index(const pj_airocean_data *pj_data, + const PJ_XYZ *p) { + for (unsigned char i = 0; i < 23; i++) { if (is_point_in_face(p, &pj_data->ico_faces[i])) { return i; } @@ -158,9 +659,10 @@ inline unsigned char get_ico_face_index(const pj_airocean_data * pj_data, const return 23; } -inline unsigned char get_dym_face_index(const pj_airocean_data * pj_data, const PJ_XY *p) { +inline unsigned char get_dym_face_index(const pj_airocean_data *pj_data, + const PJ_XY *p) { const PJ_XYZ pp{p->x, p->y, 1.0}; - for (unsigned char i=0; i < 23; i++) { + for (unsigned char i = 0; i < 23; i++) { if (is_point_in_face(&pp, &pj_data->airocean_faces[i])) { return i; } @@ -169,47 +671,45 @@ inline unsigned char get_dym_face_index(const pj_airocean_data * pj_data, const return 23; } -inline PJ_XY ico_to_dym(const pj_airocean_data * pj_data, const PJ_XYZ * p, unsigned char face_id) { +inline PJ_XY ico_to_dym(const pj_airocean_data *pj_data, const PJ_XYZ *p, + unsigned char face_id) { return PJ_XY{ - pj_data->ico_air_trans[face_id][0][0] * p->x + // * -1 - pj_data->ico_air_trans[face_id][0][1] * p->y + // - pj_data->ico_air_trans[face_id][0][2] * p->z + // - pj_data->ico_air_trans[face_id][0][3], // +1000 + pj_data->ico_air_trans[face_id][0][0] * p->x + // * -1 + pj_data->ico_air_trans[face_id][0][1] * p->y + // + pj_data->ico_air_trans[face_id][0][2] * p->z + // + pj_data->ico_air_trans[face_id][0][3], // +1000 pj_data->ico_air_trans[face_id][1][0] * p->x + - pj_data->ico_air_trans[face_id][1][1] * p->y + - pj_data->ico_air_trans[face_id][1][2] * p->z + - pj_data->ico_air_trans[face_id][1][3], + pj_data->ico_air_trans[face_id][1][1] * p->y + + pj_data->ico_air_trans[face_id][1][2] * p->z + + pj_data->ico_air_trans[face_id][1][3], }; } -inline PJ_XYZ dym_to_ico(const pj_airocean_data * pj_data, const PJ_XY * p, unsigned char face_id) { +inline PJ_XYZ dym_to_ico(const pj_airocean_data *pj_data, const PJ_XY *p, + unsigned char face_id) { return PJ_XYZ{ - pj_data->air_ico_trans[face_id][0][0] * p->x + // * -1 - pj_data->air_ico_trans[face_id][0][1] * p->y + // - pj_data->air_ico_trans[face_id][0][3], // + [face_id][0][0] * 1000 + pj_data->air_ico_trans[face_id][0][0] * p->x + // * -1 + pj_data->air_ico_trans[face_id][0][1] * p->y + // + pj_data->air_ico_trans[face_id][0][3], // + [face_id][0][0] * 1000 pj_data->air_ico_trans[face_id][1][0] * p->x + - pj_data->air_ico_trans[face_id][1][1] * p->y + - pj_data->air_ico_trans[face_id][1][3], + pj_data->air_ico_trans[face_id][1][1] * p->y + + pj_data->air_ico_trans[face_id][1][3], pj_data->air_ico_trans[face_id][2][0] * p->x + - pj_data->air_ico_trans[face_id][2][1] * p->y + - pj_data->air_ico_trans[face_id][2][3], + pj_data->air_ico_trans[face_id][2][1] * p->y + + pj_data->air_ico_trans[face_id][2][3], }; } -inline PJ_XYZ cartesian_to_ico(const pj_airocean_data * pj_data, const PJ_XYZ *p, unsigned char face_id) { - const PJ_XYZ * center = &pj_data->ico_centers[face_id]; - const PJ_XYZ * normal = &pj_data->ico_normals[face_id]; +inline PJ_XYZ cartesian_to_ico(const pj_airocean_data *pj_data, const PJ_XYZ *p, + unsigned char face_id) { + const PJ_XYZ *center = &pj_data->ico_centers[face_id]; + const PJ_XYZ *normal = &pj_data->ico_normals[face_id]; // cppcheck-suppress unreadVariable - double a = 1.0 - ( - center->x * normal->x + - center->y * normal->y + - center->z * normal->z - ) / ( - p->x * normal->x + - p->y * normal->y + - p->z * normal->z - ); + double a = + 1.0 - (center->x * normal->x + center->y * normal->y + + center->z * normal->z) / + (p->x * normal->x + p->y * normal->y + p->z * normal->z); return PJ_XYZ{ p->x - a * p->x, @@ -218,7 +718,6 @@ inline PJ_XYZ cartesian_to_ico(const pj_airocean_data * pj_data, const PJ_XYZ *p }; } - // ============================================ // // The Forward and Inverse Functions @@ -262,18 +761,15 @@ static PJ_XY airocean_forward(PJ_LP lp, PJ *P) { PJ_XY airoceanPoint = ico_to_dym(Q, &icoPoint, face_id); - return airoceanPoint; } - static PJ_LP airocean_inverse(PJ_XY xy, PJ *P) { const struct pj_airocean_data *Q = static_cast(P->opaque); PJ_LP lp = {0.0, 0.0}; - unsigned char face_id = get_dym_face_index(Q, &xy); if (face_id == 23) { @@ -286,7 +782,9 @@ static PJ_LP airocean_inverse(PJ_XY xy, PJ *P) { PJ_XYZ sphereCoords = dym_to_ico(Q, &xy, face_id); - double norm = sqrt((sphereCoords.x * sphereCoords.x) + (sphereCoords.y * sphereCoords.y) + (sphereCoords.z * sphereCoords.z)); + double norm = sqrt((sphereCoords.x * sphereCoords.x) + + (sphereCoords.y * sphereCoords.y) + + (sphereCoords.z * sphereCoords.z)); double q = sphereCoords.x / norm; double r = sphereCoords.y / norm; double s = sphereCoords.z / norm; @@ -329,14 +827,13 @@ PJ *PJ_PROJECTION(airocean) { } else if (!strcmp(opt, "vertical")) { // the orientation is vertical by default. } else { - proj_log_error( - P, - _("Invalid value for orient: only vertical or horizontal are supported")); - return pj_default_destructor(P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); + proj_log_error(P, _("Invalid value for orient: only vertical or " + "horizontal are supported")); + return pj_default_destructor(P, + PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } } - P->inv = airocean_inverse; P->fwd = airocean_forward;