| 67 | namespace { |
| 68 | |
| 69 | class CApi : public ::testing::Test { |
| 70 | |
| 71 | static void DummyLogFunction(void *, int, const char *) {} |
| 72 | |
| 73 | protected: |
| 74 | void SetUp() override { |
| 75 | m_ctxt = proj_context_create(); |
| 76 | proj_log_func(m_ctxt, nullptr, DummyLogFunction); |
| 77 | } |
| 78 | |
| 79 | void TearDown() override { |
| 80 | if (m_ctxt) |
| 81 | proj_context_destroy(m_ctxt); |
| 82 | } |
| 83 | |
| 84 | static BoundCRSNNPtr createBoundCRS() { |
| 85 | return BoundCRS::create( |
| 86 | GeographicCRS::EPSG_4807, GeographicCRS::EPSG_4326, |
| 87 | Transformation::create( |
| 88 | PropertyMap(), GeographicCRS::EPSG_4807, |
| 89 | GeographicCRS::EPSG_4326, nullptr, PropertyMap(), |
| 90 | {OperationParameter::create( |
| 91 | PropertyMap().set(IdentifiedObject::NAME_KEY, "foo"))}, |
| 92 | {ParameterValue::create( |
| 93 | Measure(1.0, UnitOfMeasure::SCALE_UNITY))}, |
| 94 | {})); |
| 95 | } |
| 96 | |
| 97 | static ProjectedCRSNNPtr createProjectedCRS() { |
| 98 | PropertyMap propertiesCRS; |
| 99 | propertiesCRS.set(Identifier::CODESPACE_KEY, "EPSG") |
| 100 | .set(Identifier::CODE_KEY, 32631) |
| 101 | .set(IdentifiedObject::NAME_KEY, "WGS 84 / UTM zone 31N"); |
| 102 | return ProjectedCRS::create( |
| 103 | propertiesCRS, GeographicCRS::EPSG_4326, |
| 104 | Conversion::createUTM(PropertyMap(), 31, true), |
| 105 | CartesianCS::createEastingNorthing(UnitOfMeasure::METRE)); |
| 106 | } |
| 107 | |
| 108 | static DerivedProjectedCRSNNPtr createDerivedProjectedCRS() { |
| 109 | auto derivingConversion = Conversion::create( |
| 110 | PropertyMap().set(IdentifiedObject::NAME_KEY, "unnamed"), |
| 111 | PropertyMap().set(IdentifiedObject::NAME_KEY, "PROJ unimplemented"), |
| 112 | std::vector<OperationParameterNNPtr>{}, |
| 113 | std::vector<ParameterValueNNPtr>{}); |
| 114 | |
| 115 | return DerivedProjectedCRS::create( |
| 116 | PropertyMap().set(IdentifiedObject::NAME_KEY, |
| 117 | "derived projectedCRS"), |
| 118 | createProjectedCRS(), derivingConversion, |
| 119 | CartesianCS::createEastingNorthing(UnitOfMeasure::METRE)); |
| 120 | } |
| 121 | |
| 122 | static VerticalCRSNNPtr createVerticalCRS() { |
| 123 | PropertyMap propertiesVDatum; |
| 124 | propertiesVDatum.set(Identifier::CODESPACE_KEY, "EPSG") |
| 125 | .set(Identifier::CODE_KEY, 5101) |
| 126 | .set(IdentifiedObject::NAME_KEY, "Ordnance Datum Newlyn"); |
nothing calls this directly
no outgoing calls
no test coverage detected