MCPcopy Create free account
hub / github.com/OSGeo/gdal / GetAxesCount

Method GetAxesCount

ogr/ogrspatialreference.cpp:10919–10967  ·  view source on GitHub ↗

* \brief Return the number of axis of the coordinate system of the CRS. * * @since GDAL 3.0 */

Source from the content-addressed store, hash-verified

10917 * @since GDAL 3.0
10918 */
10919int OGRSpatialReference::GetAxesCount() const
10920{
10921 TAKE_OPTIONAL_LOCK();
10922
10923 int axisCount = 0;
10924 d->refreshProjObj();
10925 if (d->m_pj_crs == nullptr)
10926 {
10927 return 0;
10928 }
10929 d->demoteFromBoundCRS();
10930 auto ctxt = d->getPROJContext();
10931 if (d->m_pjType == PJ_TYPE_COMPOUND_CRS)
10932 {
10933 for (int i = 0;; i++)
10934 {
10935 auto subCRS = proj_crs_get_sub_crs(ctxt, d->m_pj_crs, i);
10936 if (!subCRS)
10937 break;
10938 if (proj_get_type(subCRS) == PJ_TYPE_BOUND_CRS)
10939 {
10940 auto baseCRS = proj_get_source_crs(ctxt, subCRS);
10941 if (baseCRS)
10942 {
10943 proj_destroy(subCRS);
10944 subCRS = baseCRS;
10945 }
10946 }
10947 auto cs = proj_crs_get_coordinate_system(ctxt, subCRS);
10948 if (cs)
10949 {
10950 axisCount += proj_cs_get_axis_count(ctxt, cs);
10951 proj_destroy(cs);
10952 }
10953 proj_destroy(subCRS);
10954 }
10955 }
10956 else
10957 {
10958 auto cs = proj_crs_get_coordinate_system(ctxt, d->m_pj_crs);
10959 if (cs)
10960 {
10961 axisCount = proj_cs_get_axis_count(ctxt, cs);
10962 proj_destroy(cs);
10963 }
10964 }
10965 d->undoDemoteFromBoundCRS();
10966 return axisCount;
10967}
10968
10969/************************************************************************/
10970/* OSRGetAxesCount() */

Callers 15

GetConversionFactorsFunction · 0.80
OSRGetAxesCountFunction · 0.80
FindMatchesMethod · 0.80
GetSrsIdMethod · 0.80
ICreateLayerMethod · 0.80
OGRGML_SRSCache_GetInfoFunction · 0.80
ICreateLayerMethod · 0.80
test_osr_basic_20Function · 0.80
EmitTextDisplayOfCRSFunction · 0.80

Calls 4

refreshProjObjMethod · 0.80
demoteFromBoundCRSMethod · 0.80
getPROJContextMethod · 0.80