alaCarte Maps
Renderer for OpenStreetMap tiles
tile_identifier.hpp
Go to the documentation of this file.
1 
21 #pragma once
22 #ifndef TILE_IDENTIFIER_HPP
23 #define TILE_IDENTIFIER_HPP
24 
25 #include "settings.hpp"
26 
27 class StylesheetManager;
28 class Configuration;
29 
34 {
35 public:
39  enum Format
40  {
41  PNG,
42 // JPEG,
43 // GIF,
44  SVG,
45 // SVGZ,
47  };
48 private:
49  static const string FormatString[enumSize];
50 public:
51  static shared_ptr<TileIdentifier> Create(const string& url, shared_ptr<StylesheetManager> StylesheetManager, const shared_ptr<Configuration>& config);
52  static shared_ptr<TileIdentifier> CreateEmptyTID(const string& stylesheetPath,
53  TileIdentifier::Format format);
54  static int stringToInt(const char* c);
55 
56  TileIdentifier(int x, int y, int zoom, string styleSheetpath, Format imageFormat);
57 
58 
59  TESTABLE int getX() const;
60  TESTABLE int getY() const;
61  TESTABLE int getZoom() const;
63  TESTABLE const string& getImageFormatString() const;
64  TESTABLE const string& getStylesheetPath() const;
65  TESTABLE bool isDefaultIdentifier() const;
66  TESTABLE bool isNoneDataIdentifier() const;
67 
68 protected:
70  int x;
72  int y;
74  int zoom;
79 };
80 
81 std::ostream& operator<<(std::ostream& out, const TileIdentifier& ti);
82 std::size_t hash_value(const TileIdentifier &ti);
83 bool operator==(const TileIdentifier &a, const TileIdentifier &b);
84 
85 #endif
string styleSheetpath
path to the Stylesheet which should be used for rendering.
TileIdentifier(int x, int y, int zoom, string styleSheetpath, Format imageFormat)
Constructs a new TileIdentifier with the given parameters.
bool operator==(const TileIdentifier &a, const TileIdentifier &b)
Equals operator for two TileIdentifiers.
TESTABLE bool isDefaultIdentifier() const
Determine whether this is the Identifier for the default tile.
static const string FormatString[enumSize]
This file is part of alaCarte.
The StylesheetManager provides an interface to get arbitrary Stylesheets from the stylesheet director...
Format
Enumeration which contains all supported image formats.
std::ostream & operator<<(std::ostream &out, const TileIdentifier &ti)
toString method for TileIdentifier (overloading << operator).
TESTABLE const string & getImageFormatString() const
Returns the image Format of the Tile.
A TileIdentifier identifies a Tile.
TESTABLE int getY() const
Returns the y coordinate of the Tile.
int x
x coordinate of the Tile.
TESTABLE int getZoom() const
Returns the zoom level of the Tile.
std::size_t hash_value(const TileIdentifier &ti)
Returns a hash for the TileIdentifier.
TESTABLE bool isNoneDataIdentifier() const
TESTABLE const string & getStylesheetPath() const
Returns the path to the Stylesheet which should be used for rendering.
TESTABLE Format getImageFormat() const
Returns the image Format of the Tile.
int y
y coordinate of the Tile.
TESTABLE int getX() const
Returns the x coordinate of the Tile.
static int stringToInt(const char *c)
Converts the given char* to integer.
static const char * config
Option to get the configuration filename (type: string)
Format imageFormat
Format of the image.
Represents a set of options accessible via strings.
static shared_ptr< TileIdentifier > CreateEmptyTID(const string &stylesheetPath, TileIdentifier::Format format)
Return the TileIdentifier used for Tiles without data.
static shared_ptr< TileIdentifier > Create(const string &url, shared_ptr< StylesheetManager > StylesheetManager, const shared_ptr< Configuration > &config)
Constructs a new TileIdentifier with the given url.
int zoom
zoom level of the Tile.
#define TESTABLE
Definition: settings.hpp:85