42 const std::string& path,
43 int tileSize,
int layer) :
48 m_scale(
std::pow(2.0, m_layer)),
52 float width = std::ceil(
m_geo.
Width() / std::pow(2.0
f, layer));
53 float height = std::ceil(
m_geo.
Height() / std::pow(2.0
f, layer));
57 m_rows = std::ceil(height / tileSize);
62 m_tiles.push_back(std::vector<Tile*>());
78 bool needsTiles =
false;
82 for (int32_t r = 0; r <
m_rows; r++)
84 std::string rowString = QString::number(r).toStdString();
85 while (rowString.length() < 5) rowString =
'0' + rowString;
87 std::string columnString = QString::number(c).toStdString();
88 while (columnString.length() < 5) columnString =
'0' + columnString;
119 m_path +
"/tile" + rowString +
"x" + columnString +
"." + extension,
120 c, r,
m_layer, top_left, top_right, bottom_left, bottom_right));
122 needsTiles |= !
m_tiles[c][r]->Exists();
130 printf(
"Error: Missing expected tiles\n");
156 int& startRow,
int& startColumn,
157 int& endRow,
int& endColumn)
const 159 GetTileIndex(top_left.x(), top_left.y(), startRow, startColumn);
164 if ((uint32_t)startColumn >=
m_tiles.size())
166 startColumn =
m_tiles.size() - 1;
172 if ((uint32_t)startRow >=
m_tiles[0].size())
174 startRow =
m_tiles[0].size() - 1;
177 GetTileIndex(bottom_right.x(), bottom_right.y(), endRow, endColumn);
182 if ((uint32_t)endColumn >=
m_tiles.size())
184 endColumn =
m_tiles.size() - 1;
190 if ((uint32_t)endRow >=
m_tiles[0].size())
192 endRow =
m_tiles[0].size() - 1;
void GetTileIndex(const tf::Point &position, int &row, int &column) const
const swri_transform_util::GeoReference & m_geo
void GetTileRange(const tf::Point &top_left, const tf::Point &bottom_right, int &startRow, int &startColumn, int &endRow, int &endColumn) const
TileSetLayer(const swri_transform_util::GeoReference &geo, const std::string &path, int tileSize, int layer)
std::vector< std::vector< Tile * > > m_tiles