Get an index of inner geometry scale range. @param[in] scale: -1 : index for the best geometry -2 : index for the worst geometry default : index for the request scale
| 46 | // -2 : index for the worst geometry |
| 47 | // default : index for the request scale |
| 48 | int GetScaleIndex(SharedLoadInfo const & loadInfo, int scale) |
| 49 | { |
| 50 | int const count = loadInfo.GetScalesCount(); |
| 51 | |
| 52 | switch (scale) |
| 53 | { |
| 54 | case FeatureType::WORST_GEOMETRY: return 0; |
| 55 | case FeatureType::BEST_GEOMETRY: return count - 1; |
| 56 | default: |
| 57 | // In case of WorldCoasts we should get correct last geometry. |
| 58 | int const lastScale = loadInfo.GetLastScale(); |
| 59 | if (scale > lastScale) |
| 60 | scale = lastScale; |
| 61 | |
| 62 | for (int i = 0; i < count; ++i) |
| 63 | if (scale <= loadInfo.GetScale(i)) |
| 64 | return i; |
| 65 | ASSERT(false, ("No suitable geometry scale range in the map file.")); |
| 66 | return -1; |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | // Get an index of outer geometry scale range. |
| 71 | int GetScaleIndex(SharedLoadInfo const & loadInfo, int scale, FeatureType::GeometryOffsets const & offsets) |
no test coverage detected