| 260 | } |
| 261 | |
| 262 | void RuleDrawer::ProcessAreaAndPointStyle(FeatureType & f, Stylist const & s, TInsertShapeFn const & insertShape) |
| 263 | { |
| 264 | bool isBuilding = false; |
| 265 | bool is3dBuilding = false; |
| 266 | bool isBuildingOutline = false; |
| 267 | if (f.GetLayer() >= 0) |
| 268 | { |
| 269 | feature::TypesHolder const types(f); |
| 270 | using namespace ftypes; |
| 271 | |
| 272 | bool const hasParts = |
| 273 | IsBuildingHasPartsChecker::Instance()(types); // possible to do this checks beforehand in stylist? |
| 274 | bool const isPart = IsBuildingPartChecker::Instance()(types); |
| 275 | |
| 276 | // Looks like nonsense, but there are some osm objects with types |
| 277 | // highway-path-bridge and building (sic!) at the same time (pedestrian crossing). |
| 278 | isBuilding = (isPart || IsBuildingChecker::Instance()(types)) && !IsBridgeOrTunnelChecker::Instance()(types); |
| 279 | |
| 280 | isBuildingOutline = isBuilding && hasParts && !isPart; |
| 281 | is3dBuilding = isBuilding && !isBuildingOutline && m_context->Is3dBuildingsEnabled(); |
| 282 | } |
| 283 | |
| 284 | m2::PointD featureCenter; |
| 285 | |
| 286 | float areaHeight = 0.0f; |
| 287 | float areaMinHeight = 0.0f; |
| 288 | if (is3dBuilding) |
| 289 | { |
| 290 | double const heightInMeters = GetBuildingHeightInMeters(f); |
| 291 | double const minHeightInMeters = GetBuildingMinHeightInMeters(f); |
| 292 | // Loads geometry of the feature. |
| 293 | featureCenter = feature::GetCenter(f, m_zoomLevel); |
| 294 | double const lon = mercator::XToLon(featureCenter.x); |
| 295 | double const lat = mercator::YToLat(featureCenter.y); |
| 296 | |
| 297 | m2::RectD rectMercator = mercator::MetersToXY(lon, lat, heightInMeters); |
| 298 | areaHeight = static_cast<float>((rectMercator.SizeX() + rectMercator.SizeY()) * 0.5); |
| 299 | |
| 300 | rectMercator = mercator::MetersToXY(lon, lat, minHeightInMeters); |
| 301 | areaMinHeight = static_cast<float>((rectMercator.SizeX() + rectMercator.SizeY()) * 0.5); |
| 302 | } |
| 303 | |
| 304 | bool applyPointStyle = s.m_symbolRule || s.m_captionRule || s.m_houseNumberRule; |
| 305 | if (applyPointStyle) |
| 306 | { |
| 307 | if (!is3dBuilding) |
| 308 | { |
| 309 | // Loads geometry of the feature. |
| 310 | featureCenter = feature::GetCenter(f, m_zoomLevel); |
| 311 | } |
| 312 | applyPointStyle = m_globalRect.IsPointInside(featureCenter); |
| 313 | } |
| 314 | |
| 315 | bool const skipTriangles = isBuildingOutline && m_context->Is3dBuildingsEnabled(); |
| 316 | if (!skipTriangles && isBuilding && f.GetTrgVerticesCount(m_zoomLevel) >= 10000) |
| 317 | isBuilding = false; |
| 318 | |
| 319 | ApplyAreaFeature apply(m_context->GetTileKey(), insertShape, f, m_currentScaleGtoP, isBuilding, |
nothing calls this directly
no test coverage detected