| 985 | // --------------------------------------------------------------------------- |
| 986 | |
| 987 | static int outputOperations( |
| 988 | const DatabaseContextPtr &dbContext, const std::string &sourceCRSStr, |
| 989 | const std::string &sourceEpoch, const std::string &targetCRSStr, |
| 990 | const std::string &targetEpoch, const ExtentPtr &bboxFilter, |
| 991 | CoordinateOperationContext::SpatialCriterion spatialCriterion, |
| 992 | bool spatialCriterionExplicitlySpecified, |
| 993 | CoordinateOperationContext::SourceTargetCRSExtentUse crsExtentUse, |
| 994 | CoordinateOperationContext::GridAvailabilityUse gridAvailabilityUse, |
| 995 | CoordinateOperationContext::IntermediateCRSUse allowUseIntermediateCRS, |
| 996 | const std::vector<std::pair<std::string, std::string>> &pivots, |
| 997 | const std::string &authority, bool usePROJGridAlternatives, |
| 998 | bool showSuperseded, bool promoteTo3D, bool normalizeAxisOrder, |
| 999 | double minimumAccuracy, const OutputOptions &outputOpt, bool summary, |
| 1000 | Streamer &strm) { |
| 1001 | auto sourceObj = buildObject( |
| 1002 | dbContext, sourceCRSStr, sourceEpoch, "crs_preferred", "source CRS", |
| 1003 | false, CoordinateOperationContext::IntermediateCRSUse::NEVER, |
| 1004 | promoteTo3D, normalizeAxisOrder, outputOpt.quiet, strm); |
| 1005 | if (!sourceObj.has_value()) |
| 1006 | return 1; |
| 1007 | auto sourceCRS = nn_dynamic_pointer_cast<CRS>(sourceObj.value()); |
| 1008 | CoordinateMetadataPtr sourceCoordinateMetadata; |
| 1009 | if (!sourceCRS) { |
| 1010 | sourceCoordinateMetadata = |
| 1011 | nn_dynamic_pointer_cast<CoordinateMetadata>(sourceObj.value()); |
| 1012 | if (!sourceCoordinateMetadata) { |
| 1013 | strm.cerr |
| 1014 | << "source CRS string is not a CRS or a CoordinateMetadata" |
| 1015 | << std::endl; |
| 1016 | return 1; |
| 1017 | } |
| 1018 | if (!sourceCoordinateMetadata->coordinateEpoch().has_value()) { |
| 1019 | sourceCRS = sourceCoordinateMetadata->crs().as_nullable(); |
| 1020 | sourceCoordinateMetadata.reset(); |
| 1021 | } |
| 1022 | } |
| 1023 | |
| 1024 | auto targetObj = buildObject( |
| 1025 | dbContext, targetCRSStr, targetEpoch, "crs_preferred", "target CRS", |
| 1026 | false, CoordinateOperationContext::IntermediateCRSUse::NEVER, |
| 1027 | promoteTo3D, normalizeAxisOrder, outputOpt.quiet, strm); |
| 1028 | if (!targetObj.has_value()) |
| 1029 | return 1; |
| 1030 | auto targetCRS = nn_dynamic_pointer_cast<CRS>(targetObj.value()); |
| 1031 | CoordinateMetadataPtr targetCoordinateMetadata; |
| 1032 | if (!targetCRS) { |
| 1033 | targetCoordinateMetadata = |
| 1034 | nn_dynamic_pointer_cast<CoordinateMetadata>(targetObj.value()); |
| 1035 | if (!targetCoordinateMetadata) { |
| 1036 | strm.cerr |
| 1037 | << "target CRS string is not a CRS or a CoordinateMetadata" |
| 1038 | << std::endl; |
| 1039 | return 1; |
| 1040 | } |
| 1041 | if (!targetCoordinateMetadata->coordinateEpoch().has_value()) { |
| 1042 | targetCRS = targetCoordinateMetadata->crs().as_nullable(); |
| 1043 | targetCoordinateMetadata.reset(); |
| 1044 | } |
no test coverage detected