MCPcopy Create free account
hub / github.com/comaps/comaps / CalculateHeader

Function CalculateHeader

libs/indexer/feature_data.cpp:155–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153} // namespace
154
155uint8_t CalculateHeader(size_t const typesCount, HeaderGeomType const headerGeomType, FeatureParamsBase const & params)
156{
157 ASSERT(typesCount != 0, ("Feature should have at least one type."));
158 ASSERT_LESS_OR_EQUAL(typesCount, kMaxTypesCount, ());
159 uint8_t header = static_cast<uint8_t>(typesCount - 1);
160
161 if (!params.name.IsEmpty())
162 header |= HEADER_MASK_HAS_NAME;
163
164 if (params.layer != LAYER_EMPTY)
165 header |= HEADER_MASK_HAS_LAYER;
166
167 header |= static_cast<uint8_t>(headerGeomType);
168
169 // Geometry type for additional info is only one.
170 switch (headerGeomType)
171 {
172 case HeaderGeomType::Point:
173 if (params.rank != 0)
174 header |= HEADER_MASK_HAS_ADDINFO;
175 break;
176 case HeaderGeomType::Line:
177 if (!params.ref.empty())
178 header |= HEADER_MASK_HAS_ADDINFO;
179 break;
180 case HeaderGeomType::Area:
181 case HeaderGeomType::PointEx:
182 if (!params.house.IsEmpty())
183 header |= HEADER_MASK_HAS_ADDINFO;
184 break;
185 }
186
187 return header;
188}
189
190void TypesHolder::SortByUseless()
191{

Callers 2

GetHeaderMethod · 0.85
CreateFromMapObjectMethod · 0.85

Calls 3

ASSERTFunction · 0.85
IsEmptyMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected