alaCarte Maps
Renderer for OpenStreetMap tiles
|
The StylesheetManager provides an interface to get arbitrary Stylesheets from the stylesheet directory. More...
#include <stylesheet_manager.hpp>
Public Member Functions | |
StylesheetManager (const shared_ptr< Configuration > &config) | |
Creates a new StylesheetManager with the given Configuration. More... | |
TESTABLE void | startStylesheetObserving (const shared_ptr< RequestManager > &manager) |
starts observing the Stylesheet directory. More... | |
TESTABLE void | stopStylesheetObserving () |
Stops the folder observation. More... | |
TESTABLE shared_ptr< Stylesheet > | getStylesheet (const string &path) |
Returns the Stylesheet Object for the Stylesheet specified. More... | |
TESTABLE bool | hasStylesheet (const string &path) |
Private Member Functions | |
TESTABLE void | onNewStylesheet (const fs::path &stylesheet_path) |
tries to read and parse the given file. More... | |
TESTABLE void | onRemovedStylesheet (const fs::path &stylesheet_path) |
removes the Stylesheet from the Stylesheet Cache and the prerendered tiles from the Cache. More... | |
TESTABLE void | onFileSystemEvent (const boost::system::error_code &ec, const boost::asio::dir_monitor_event &ev) |
handler method for dirwatch, forwards only .mapcss files to onNewStylesheet and onRemovedStylesheet More... | |
Static Private Member Functions | |
static shared_ptr< Stylesheet > | makeFallbackStylesheet (const shared_ptr< Geodata > &geodata) |
Private Attributes | |
shared_ptr< Configuration > | config |
weak_ptr< RequestManager > | manager |
boost::shared_mutex | stylesheetsLock |
boost::unordered_map< fs::path, shared_ptr< Stylesheet > > | parsedStylesheets |
fs::path | stylesheetFolder |
boost::asio::io_service | ioService |
boost::thread | monitorThread |
boost::scoped_ptr< boost::asio::dir_monitor > | monitorService |
The StylesheetManager provides an interface to get arbitrary Stylesheets from the stylesheet directory.
Additionally, it observes the stylesheet directory for changes to prerender new stylesheets, and drop deleted ones off the Cache.
Definition at line 45 of file stylesheet_manager.hpp.
StylesheetManager::StylesheetManager | ( | const shared_ptr< Configuration > & | config | ) |
Creates a new StylesheetManager with the given Configuration.
This file is part of alaCarte.
config | the Configuration object to read the stylesheet directory path and prerender level from |
alaCarte is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
alaCarte 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with alaCarte. If not, see http://www.gnu.org/licenses/.
Copyright alaCarte 2012-2013 Simon Dreher, Florian Jacob, Tobias Kahlert, Patrick Niklaus, Bernhard Scheirle, Lisa Winter Maintainer: Florian Jacob
Definition at line 38 of file stylesheet_manager.cpp.
shared_ptr< Stylesheet > StylesheetManager::getStylesheet | ( | const string & | path | ) |
Returns the Stylesheet Object for the Stylesheet specified.
path | path of the stylesheet |
Definition at line 83 of file stylesheet_manager.cpp.
bool StylesheetManager::hasStylesheet | ( | const string & | path | ) |
Definition at line 73 of file stylesheet_manager.cpp.
|
staticprivate |
Definition at line 215 of file stylesheet_manager.cpp.
|
private |
handler method for dirwatch, forwards only .mapcss files to onNewStylesheet and onRemovedStylesheet
Definition at line 161 of file stylesheet_manager.cpp.
|
private |
tries to read and parse the given file.
If that succeeds, saves it in the Stylesheet Cache and enqueues it for prerendering.
Definition at line 100 of file stylesheet_manager.cpp.
|
private |
removes the Stylesheet from the Stylesheet Cache and the prerendered tiles from the Cache.
Definition at line 150 of file stylesheet_manager.cpp.
void StylesheetManager::startStylesheetObserving | ( | const shared_ptr< RequestManager > & | manager | ) |
starts observing the Stylesheet directory.
On new or changed stylesheet files, the Tiles to prerender get enqueued in the RequestManager. On changed or deleted stylesheet files, the Cache gets notified to drop the cached Tiles.
manager | the RequestManager to use to enqueue new Tiles to prerender |
Definition at line 46 of file stylesheet_manager.cpp.
void StylesheetManager::stopStylesheetObserving | ( | ) |
Stops the folder observation.
Stops the internal mechanism, which is used to watch the stylesheet folder.
Definition at line 67 of file stylesheet_manager.cpp.
|
private |
Definition at line 100 of file stylesheet_manager.hpp.
|
private |
Definition at line 110 of file stylesheet_manager.hpp.
|
private |
Definition at line 101 of file stylesheet_manager.hpp.
|
private |
Definition at line 112 of file stylesheet_manager.hpp.
|
private |
Definition at line 111 of file stylesheet_manager.hpp.
|
private |
Definition at line 104 of file stylesheet_manager.hpp.
|
private |
Definition at line 106 of file stylesheet_manager.hpp.
|
private |
Definition at line 103 of file stylesheet_manager.hpp.