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

Method extractDim

io/PcdWriter.cpp:75–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73
74
75PcdWriter::DimSpec PcdWriter::extractDim(std::string dim, PointTableRef table)
76{
77 Utils::trim(dim);
78
79 uint32_t precision(m_precision);
80 PcdField field;
81 field.m_count = 1;
82 StringList s = Utils::split(dim, '=');
83 if (s.size() == 1)
84 {
85 precision = m_precision;
86 Id id = table.layout()->findDim(s[0]);
87 if (id == Id::X || id == Id::Y || id == Id::Z)
88 field.m_size = 4;
89 else
90 field.m_size = 8;
91 field.m_type = PcdFieldType::F;
92 }
93 else if (s.size() == 2)
94 {
95 try
96 {
97 StringList t = Utils::split(s[1], ':');
98
99 if (t[0] == "Unsigned8")
100 {
101 field.m_type = PcdFieldType::U;
102 field.m_size = 1;
103 }
104 else if (t[0] == "Unsigned16")
105 {
106 field.m_type = PcdFieldType::U;
107 field.m_size = 2;
108 }
109 else if (t[0] == "Unsigned32")
110 {
111 field.m_type = PcdFieldType::U;
112 field.m_size = 4;
113 }
114 else if (t[0] == "Unsigned64")
115 {
116 field.m_type = PcdFieldType::U;
117 field.m_size = 8;
118 }
119 else if (t[0] == "Signed8")
120 {
121 field.m_type = PcdFieldType::I;
122 field.m_size = 1;
123 }
124 else if (t[0] == "Signed16")
125 {
126 field.m_type = PcdFieldType::I;
127 field.m_size = 2;
128 }
129 else if (t[0] == "Signed32")
130 {
131 field.m_type = PcdFieldType::I;
132 field.m_size = 4;

Callers

nothing calls this directly

Calls 5

trimFunction · 0.85
splitFunction · 0.85
dimNameMethod · 0.80
sizeMethod · 0.45
findDimMethod · 0.45

Tested by

no test coverage detected