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

Function GetScaleIndex

libs/indexer/feature.cpp:48–68  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

46// -2 : index for the worst geometry
47// default : index for the request scale
48int 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.
71int GetScaleIndex(SharedLoadInfo const & loadInfo, int scale, FeatureType::GeometryOffsets const & offsets)

Callers 2

ParseGeometryMethod · 0.85
ParseTrianglesMethod · 0.85

Calls 6

ASSERTFunction · 0.85
IsRealGeomOffsetFunction · 0.85
GetScalesCountMethod · 0.45
GetLastScaleMethod · 0.45
GetScaleMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected