/* Copyright 2015, Michele Santullo * This file is part of DoorKeeper. * * DoorKeeper is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * DoorKeeper is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with DoorKeeper. If not, see . */ namespace dk { template LayeredViewport::LayeredViewport (Tyler& parTyler) : m_tyler(parTyler) { } template LayeredViewport::~LayeredViewport() { } template LayeredViewport& LayeredViewport::operator+= (const coords_f& parValue) { for (auto& view : m_views) { view.second += parValue; } return *this; } template LayeredViewport& LayeredViewport::operator-= (const coords_f& parValue) { for (auto& view : m_views) { view.second -= parValue; } return *this; } template void LayeredViewport::on_layer_added (const LayerBase* parLayer) { } template void LayeredViewport::on_layer_removed (const LayerBase* parLayer) { } template auto LayeredViewport::begin() -> iterator { return iterator(m_view.begin(), std::bind(&LayeredViewport::viewport, this, std::placeholders::_1)); template auto LayeredViewport::begin() const -> const_iterator { return const_iterator(m_view.begin(), std::bind(&LayeredViewport::viewport, this, std::placeholders::_1)); } template auto LayeredViewport::end() -> iterator { return iterator(m_view.end(), std::bind(&LayeredViewport::viewport, this, std::placeholders::_1)); template auto LayeredViewport::end() const -> const_iterator { return const_iterator(m_view.end(), std::bind(&LayeredViewport::viewport, this, std::placeholders::_1)); } template Viewport& LayeredViewport::viewport (const LayerBase& parLayer) { return const_cast&>(const_cast*>(this)->viewport(parLayer)); template const Viewport& LayeredViewport::viewport (const LayerBase& parLayer) const { const TileInfo tinfo { parLayer.tile_size(), parLayer.map_size() }; return m_views[tinfo]; } } //namespace dk