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

Function fromString

io/CopcReader.cpp:156–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154
155template<>
156StatusWithReason fromString(const std::string& from,
157 SrsOrderSpec& srsOrder)
158{
159 using namespace las;
160
161 static const std::map<std::string, SrsType> typemap =
162 { { "wkt2", SrsType::Wkt2 },
163 { "wkt1", SrsType::Wkt1 },
164 { "projjson", SrsType::Proj } };
165
166 StringList srsTypes = Utils::split2(from, ',');
167 std::transform(srsTypes.cbegin(), srsTypes.cend(), srsTypes.begin(),
168 [](std::string s){ Utils::trim(s); return Utils::tolower(s); });
169
170 for (std::string& stype : srsTypes)
171 {
172 auto it = typemap.find(stype);
173 if (it == typemap.end())
174 return { -1, "Invalid SRS type '" + stype + "'. Must be one of 'wkt1', "
175 "'wkt' or 'projjson'." };
176 SrsType type = it->second;
177 if (Utils::contains(srsOrder.types, type))
178 return { -1,
179 "Duplicate SRS type '" + stype + "' in 'vlr_srs_order'" };
180 srsOrder.types.push_back(type);
181 }
182 return true;
183}
184
185template<>
186std::string toString(const SrsOrderSpec& srsOrder)

Callers

nothing calls this directly

Calls 7

transformFunction · 0.85
trimFunction · 0.85
tolowerFunction · 0.85
containsFunction · 0.50
beginMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected