MCPcopy Create free account
hub / github.com/PDAL/PDAL / writeXml

Method writeXml

pdal/XMLSchema.cpp:577–659  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

575
576
577void XMLSchema::writeXml(xmlTextWriterPtr w) const
578{
579 int pos = 0;
580 for (auto di = m_dims.begin(); di != m_dims.end(); ++di, ++pos)
581 {
582 xmlTextWriterStartElementNS(w, (const xmlChar*)"pc",
583 (const xmlChar*)"dimension", NULL);
584
585 Utils::OStringStreamClassicLocale position;
586 position << (pos + 1);
587 xmlTextWriterWriteElementNS(w, (const xmlChar*)"pc",
588 (const xmlChar*)"position", NULL,
589 (const xmlChar*)position.str().c_str());
590
591 Utils::OStringStreamClassicLocale size;
592 size << Dimension::size(di->m_dimType.m_type);
593 xmlTextWriterWriteElementNS(w, (const xmlChar*)"pc",
594 (const xmlChar*)"size", NULL, (const xmlChar*)size.str().c_str());
595
596 std::string description = Dimension::description(di->m_dimType.m_id);
597 if (description.size())
598 xmlTextWriterWriteElementNS(w, (const xmlChar*)"pc",
599 (const xmlChar*)"description", NULL,
600 (const xmlChar*)description.c_str());
601
602 XForm xform = di->m_dimType.m_xform;
603 if (xform.nonstandard())
604 {
605 Utils::OStringStreamClassicLocale out;
606 out.precision(15);
607
608 out << xform.m_scale.m_val;
609 std::string scale = out.str();
610
611 out.str(std::string());
612 out << xform.m_offset.m_val;
613 std::string offset = out.str();
614
615 out << xform.m_scale.m_val;
616 xmlTextWriterWriteElementNS(w, (const xmlChar*)"pc",
617 (const xmlChar *)"scale", NULL,
618 (const xmlChar *)scale.data());
619 xmlTextWriterWriteElementNS(w, (const xmlChar*)"pc",
620 (const xmlChar *)"offset", NULL,
621 (const xmlChar *)offset.data());
622 }
623
624 std::string name = di->m_name;
625 if (name.size())
626 xmlTextWriterWriteElementNS(w, (const xmlChar*)"pc",
627 (const xmlChar*)"name", NULL, (const xmlChar*)name.c_str());
628
629 xmlTextWriterWriteElementNS(w, (const xmlChar*)"pc",
630 (const xmlChar*)"interpretation", NULL,
631 (const xmlChar*)
632 Dimension::interpretationName(di->m_dimType.m_type).c_str());
633
634 xmlTextWriterWriteElementNS(w, (const xmlChar*)"pc",

Callers

nothing calls this directly

Calls 12

descriptionFunction · 0.85
interpretationNameFunction · 0.85
addMetadataEntryFunction · 0.85
strMethod · 0.80
nonstandardMethod · 0.80
sizeFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
precisionMethod · 0.45
dataMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected