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

Method Stylist

libs/drape_frontend/stylist.cpp:164–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162}
163
164Stylist::Stylist(FeatureType & f, uint8_t zoomLevel, int8_t deviceLang)
165{
166 feature::TypesHolder const types(f);
167 Classificator const & cl = classif();
168
169 uint32_t mainOverlayType = 0;
170 if (types.Size() == 1)
171 mainOverlayType = types.front();
172 else
173 {
174 // Determine main overlays type by priority. Priorities might be different across zoom levels
175 // so a max value across all zooms is used to make sure main type doesn't change.
176 int overlaysMaxPriority = std::numeric_limits<int>::min();
177 for (uint32_t t : types)
178 {
179 int const priority = cl.GetObject(t)->GetMaxOverlaysPriority();
180 if (priority > overlaysMaxPriority)
181 {
182 overlaysMaxPriority = priority;
183 mainOverlayType = t;
184 }
185 }
186 }
187
188 auto const & hatchingChecker = IsHatchingTerritoryChecker::Instance();
189 auto const geomType = types.GetGeomType();
190
191 drule::KeysT keys;
192 for (uint32_t t : types)
193 {
194 drule::KeysT typeKeys;
195 cl.GetObject(t)->GetSuitable(zoomLevel, geomType, typeKeys);
196 bool const hasHatching = hatchingChecker(t);
197
198 for (auto & k : typeKeys)
199 {
200 // Take overlay drules from the main type only.
201 if (t == mainOverlayType || (k.m_type != drule::caption && k.m_type != drule::symbol &&
202 k.m_type != drule::shield && k.m_type != drule::pathtext))
203 {
204 if (hasHatching && k.m_type == drule::area)
205 k.m_hatching = true;
206 keys.push_back(k);
207 }
208 }
209 }
210
211 feature::FilterRulesByRuntimeSelector(f, zoomLevel, keys);
212
213 if (keys.empty())
214 return;
215
216 // Leave only one area drule and an optional hatching drule.
217 drule::MakeUnique(keys);
218
219 for (auto const & key : keys)
220 ProcessKey(f, key);
221

Callers

nothing calls this directly

Calls 15

MakeUniqueFunction · 0.85
ASSERTFunction · 0.85
GetRoadShieldsFunction · 0.85
frontMethod · 0.80
GetObjectMethod · 0.80
GetSuitableMethod · 0.80
IsHouseNumberExistsMethod · 0.80
SizeXMethod · 0.80

Tested by

no test coverage detected