MCPcopy Create free account
hub / github.com/OSGeo/PROJ / _exportToJSONInternal

Method _exportToJSONInternal

src/iso19111/crs.cpp:2570–2614  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2568//! @cond Doxygen_Suppress
2569
2570void GeodeticCRS::_exportToJSONInternal(
2571 io::JSONFormatter *formatter,
2572 const char *objectName) const // throw(io::FormattingException)
2573{
2574 auto writer = formatter->writer();
2575 auto objectContext(
2576 formatter->MakeObjectContext(objectName, !identifiers().empty()));
2577
2578 writer->AddObjKey("name");
2579 const auto &l_name = nameStr();
2580 if (l_name.empty()) {
2581 writer->Add("unnamed");
2582 } else {
2583 writer->Add(l_name);
2584 }
2585
2586 const auto &l_datum(datum());
2587 if (l_datum) {
2588 writer->AddObjKey("datum");
2589 l_datum->_exportToJSON(formatter);
2590 } else {
2591 writer->AddObjKey("datum_ensemble");
2592 formatter->setOmitTypeInImmediateChild();
2593 datumEnsemble()->_exportToJSON(formatter);
2594 }
2595
2596 writer->AddObjKey("coordinate_system");
2597 formatter->setOmitTypeInImmediateChild();
2598 coordinateSystem()->_exportToJSON(formatter);
2599
2600 if (const auto dynamicGRF =
2601 dynamic_cast<datum::DynamicGeodeticReferenceFrame *>(
2602 l_datum.get())) {
2603 const auto &deformationModel = dynamicGRF->deformationModelName();
2604 if (deformationModel.has_value()) {
2605 writer->AddObjKey("deformation_models");
2606 auto arrayContext(writer->MakeArrayContext(false));
2607 auto objectContext2(formatter->MakeObjectContext(nullptr, false));
2608 writer->AddObjKey("name");
2609 writer->Add(*deformationModel);
2610 }
2611 }
2612
2613 ObjectUsage::baseExportToJSON(formatter);
2614}
2615
2616void GeodeticCRS::_exportToJSON(
2617 io::JSONFormatter *formatter) const // throw(io::FormattingException)

Callers

nothing calls this directly

Calls 8

writerMethod · 0.80
AddObjKeyMethod · 0.80
AddMethod · 0.80
has_valueMethod · 0.80
emptyMethod · 0.45
_exportToJSONMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected