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

Method assignDim

pdal/PointLayout.cpp:102–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100
101
102Dimension::Id PointLayout::assignDim(const std::string& name,
103 Dimension::Type type)
104{
105 if (!Dimension::nameValid(name))
106 throw pdal_error("Can't create dimension with invalid name '" + name + "'.");
107 if (m_nextFree == Dimension::COUNT)
108 throw pdal_error("No dimension IDs remaining for assignment.");
109 Dimension::Id id = (Dimension::Id)m_nextFree;
110
111 auto di = m_propIds.find(name);
112 if (di != m_propIds.end())
113 id = di->second;
114 Dimension::Detail dd = m_detail[Utils::toNative(id)];
115 dd.setType(resolveType(type, dd.type()));
116 if (update(dd, name))
117 {
118 if (di == m_propIds.end())
119 {
120 m_nextFree++;
121 m_propIds[name] = id;
122 }
123 return id;
124 }
125 return Dimension::Id::Unknown;
126}
127
128
129Dimension::Id PointLayout::registerOrAssignDim(const std::string name,

Callers 6

TESTFunction · 0.80
TESTFunction · 0.80
addDimensionsMethod · 0.80
addDimensionsMethod · 0.80
addDimensionsMethod · 0.80
TESTFunction · 0.80

Calls 6

nameValidFunction · 0.85
toNativeFunction · 0.50
findMethod · 0.45
endMethod · 0.45
setTypeMethod · 0.45
typeMethod · 0.45

Tested by 3

TESTFunction · 0.64
TESTFunction · 0.64
TESTFunction · 0.64