#include <map.hpp>
Public Types | |
enum | aspect_fix_mode { GROW_BBOX, GROW_CANVAS, SHRINK_BBOX, SHRINK_CANVAS, ADJUST_BBOX_WIDTH, ADJUST_BBOX_HEIGHT, ADJUST_CANVAS_WIDTH, ADJUST_CANVAS_HEIGHT } |
typedef std::map< std::string, feature_type_style > ::const_iterator | const_style_iterator |
typedef std::map< std::string, feature_type_style >::iterator | style_iterator |
Public Member Functions | |
Map () | |
Default constructor. | |
Map (int width, int height, std::string const &srs="+proj=latlong +datum=WGS84") | |
Constructor. | |
Map (const Map &rhs) | |
Copy Constructur. | |
Map & | operator= (const Map &rhs) |
Assignment operator. | |
std::map< std::string, feature_type_style > const & | styles () const |
Get all styles. | |
std::map< std::string, feature_type_style > & | styles () |
Get all styles. | |
const_style_iterator | begin_styles () const |
Get first iterator in styles. | |
const_style_iterator | end_styles () const |
Get last iterator in styles. | |
style_iterator | begin_styles () |
Get first iterator in styles. | |
style_iterator | end_styles () |
Get last iterator in styles. | |
bool | insert_style (std::string const &name, feature_type_style const &style) |
Insert a style in the map. | |
void | remove_style (const std::string &name) |
Remove a style from the map. | |
feature_type_style const & | find_style (std::string const &name) const |
Find a style. | |
bool | insert_fontset (std::string const &name, FontSet const &fontset) |
Insert a fontset into the map. | |
FontSet const & | find_fontset (std::string const &name) const |
Find a fontset. | |
size_t | layerCount () const |
Get number of all layers. | |
void | addLayer (const Layer &l) |
Add a layer to the map. | |
const Layer & | getLayer (size_t index) const |
Get a layer. | |
Layer & | getLayer (size_t index) |
Get a layer. | |
void | removeLayer (size_t index) |
Remove a layer. | |
std::vector< Layer > const & | layers () const |
Get all layers. | |
std::vector< Layer > & | layers () |
Get all layers. | |
void | remove_all () |
Remove all layers and styles from the map. | |
unsigned | getWidth () const |
Get map width. | |
unsigned | getHeight () const |
Get map height. | |
void | setWidth (unsigned width) |
Set map width. | |
void | setHeight (unsigned height) |
Set map height. | |
void | resize (unsigned width, unsigned height) |
Resize the map. | |
std::string const & | srs () const |
Get the map projection. | |
void | set_srs (std::string const &srs) |
Set the map projection. | |
void | set_background (const Color &c) |
Set the map background color. | |
boost::optional< Color > const & | background () const |
Get the map background color. | |
void | zoom (double factor) |
Zoom the map at the current position. | |
void | zoomToBox (const Envelope< double > &box) |
Zoom the map to a bounding box. | |
void | zoom_all () |
Zoom the map to show all data. | |
void | pan (int x, int y) |
void | pan_and_zoom (int x, int y, double zoom) |
const Envelope< double > & | getCurrentExtent () const |
Get current bounding box. | |
double | scale () const |
CoordTransform | view_transform () const |
featureset_ptr | query_point (unsigned index, double x, double y) const |
featureset_ptr | query_map_point (unsigned index, double x, double y) const |
~Map () | |
void | setAspectFixMode (aspect_fix_mode afm) |
bool | getAspectFixMode () |
typedef std::map<std::string,feature_type_style>::const_iterator mapnik::Map::const_style_iterator |
typedef std::map<std::string,feature_type_style>::iterator mapnik::Map::style_iterator |
mapnik::Map::Map | ( | ) |
Default constructor.
Creates a map with these parameters:
mapnik::Map::Map | ( | int | width, | |
int | height, | |||
std::string const & | srs = "+proj=latlong +datum=WGS84" | |||
) |
Constructor.
width | Initial map width. | |
height | Initial map height. | |
srs | Initial map projection. |
mapnik::Map::~Map | ( | ) |
Assignment operator.
TODO: to be documented
References aspectFixMode_, background_, height_, layers_, srs_, styles_, and width_.
std::map< std::string, feature_type_style > const & mapnik::Map::styles | ( | ) | const |
std::map< std::string, feature_type_style > & mapnik::Map::styles | ( | ) |
Get all styles.
Map::const_style_iterator mapnik::Map::begin_styles | ( | ) | const |
Get first iterator in styles.
Map::const_style_iterator mapnik::Map::end_styles | ( | ) | const |
Get last iterator in styles.
Map::style_iterator mapnik::Map::begin_styles | ( | ) |
Get first iterator in styles.
Map::style_iterator mapnik::Map::end_styles | ( | ) |
Get last iterator in styles.
bool mapnik::Map::insert_style | ( | std::string const & | name, | |
feature_type_style const & | style | |||
) |
Insert a style in the map.
name | The name of the style. | |
style | The style to insert. |
false If no success.
void mapnik::Map::remove_style | ( | const std::string & | name | ) |
Remove a style from the map.
name | The name of the style. |
feature_type_style const & mapnik::Map::find_style | ( | std::string const & | name | ) | const |
Find a style.
name | The name of the style. |
bool mapnik::Map::insert_fontset | ( | std::string const & | name, | |
FontSet const & | fontset | |||
) |
Insert a fontset into the map.
name | The name of the fontset. | |
style | The fontset to insert. |
false If failure.
FontSet const & mapnik::Map::find_fontset | ( | std::string const & | name | ) | const |
Find a fontset.
name | The name of the fontset. |
size_t mapnik::Map::layerCount | ( | ) | const |
Get number of all layers.
void mapnik::Map::addLayer | ( | const Layer & | l | ) |
const Layer & mapnik::Map::getLayer | ( | size_t | index | ) | const |
Layer & mapnik::Map::getLayer | ( | size_t | index | ) |
void mapnik::Map::removeLayer | ( | size_t | index | ) |
std::vector< Layer > const & mapnik::Map::layers | ( | ) | const |
Get all layers.
Referenced by mapnik::feature_style_processor< mapnik::agg_renderer< T > >::apply(), and mapnik::save_map().
std::vector< Layer > & mapnik::Map::layers | ( | ) |
Get all layers.
void mapnik::Map::remove_all | ( | ) |
Remove all layers and styles from the map.
unsigned mapnik::Map::getWidth | ( | ) | const |
Get map width.
unsigned mapnik::Map::getHeight | ( | ) | const |
Get map height.
void mapnik::Map::setWidth | ( | unsigned | width | ) |
Set map width.
void mapnik::Map::setHeight | ( | unsigned | height | ) |
Set map height.
void mapnik::Map::resize | ( | unsigned | width, | |
unsigned | height | |||
) |
Resize the map.
std::string const & mapnik::Map::srs | ( | ) | const |
Get the map projection.
Referenced by mapnik::feature_style_processor< mapnik::agg_renderer< T > >::apply(), mapnik::map_parser::parse_map(), and mapnik::save_map().
void mapnik::Map::set_srs | ( | std::string const & | srs | ) |
Set the map projection.
srs | Map projection. |
Referenced by mapnik::map_parser::parse_map().
void mapnik::Map::set_background | ( | const Color & | c | ) |
Set the map background color.
c | Background color. |
Referenced by mapnik::map_parser::parse_map().
boost::optional< Color > const & mapnik::Map::background | ( | ) | const |
Get the map background color.
Referenced by mapnik::agg_renderer< T >::agg_renderer(), mapnik::save_map(), and mapnik::cairo_renderer< T >::start_map_processing().
void mapnik::Map::zoom | ( | double | factor | ) |
Zoom the map at the current position.
factor | The factor how much the map is zoomed in or out. |
References mapnik::Envelope< T >::center(), mapnik::Envelope< T >::height(), and mapnik::Envelope< T >::width().
Referenced by pan_and_zoom().
void mapnik::Map::zoomToBox | ( | const Envelope< double > & | box | ) |
Zoom the map to a bounding box.
Aspect is handled automatic if not fitting to width/height.
box | The bounding box where to zoom. |
Referenced by zoom_all().
void mapnik::Map::zoom_all | ( | ) |
Zoom the map to show all data.
References mapnik::proj_transform::backward(), mapnik::Envelope< T >::expand_to_include(), mapnik::Envelope< T >::maxx(), mapnik::Envelope< T >::maxy(), mapnik::Envelope< T >::minx(), mapnik::Envelope< T >::miny(), and zoomToBox().
void mapnik::Map::pan | ( | int | x, | |
int | y | |||
) |
const Envelope< double > & mapnik::Map::getCurrentExtent | ( | ) | const |
Get current bounding box.
Referenced by mapnik::cairo_renderer< T >::start_map_processing(), and mapnik::agg_renderer< T >::start_map_processing().
double mapnik::Map::scale | ( | ) | const |
References mapnik::Envelope< T >::width().
Referenced by mapnik::agg_renderer< T >::agg_renderer(), mapnik::cairo_renderer< T >::cairo_renderer(), and mapnik::scale_denominator().
CoordTransform mapnik::Map::view_transform | ( | ) | const |
Referenced by query_map_point().
featureset_ptr mapnik::Map::query_point | ( | unsigned | index, | |
double | x, | |||
double | y | |||
) | const |
featureset_ptr mapnik::Map::query_map_point | ( | unsigned | index, | |
double | x, | |||
double | y | |||
) | const |
void mapnik::Map::setAspectFixMode | ( | aspect_fix_mode | afm | ) | [inline] |
bool mapnik::Map::getAspectFixMode | ( | ) | [inline] |