27 static vector<int> levels;
29 int maxLevel = getMaxZoomLevel().
level;
33 while (level <= maxLevel) {
35 levels.push_back(level);
36 int step = level / 10;
50 if (dir == RoundUp) effective = RoundDown;
51 else if (dir == RoundDown) effective = RoundUp;
55 auto i = lower_bound(levels.begin(), levels.end(), requested.
level);
59 if (i == levels.end()) {
60 newLevel.level = maxLevel;
62 }
else if (*i == requested.
level) {
63 newLevel.level = requested.
level;
65 }
else if (effective == RoundUp) {
68 }
else if (effective == RoundDown) {
69 if (i != levels.begin()) {
75 if (i != levels.begin()) {
78 if (requested.
level - *j < *i - requested.
level) {
87 if (newLevel.level == 1) {
91 using namespace std::rel_ops;
92 if (newLevel > getMaxZoomLevel()) {
93 newLevel = getMaxZoomLevel();
94 }
else if (newLevel < getMinZoomLevel()) {
95 newLevel = getMinZoomLevel();
virtual ZoomLevel getNearestZoomLevel(ZoomLevel requested, RoundingDirection dir=RoundNearest) const override
Given an "ideal" zoom level (frames per pixel or pixels per frame) for a given zoom level...