mapnik::Map Class Reference

#include <map.hpp>

List of all members.

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.
Mapoperator= (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 LayergetLayer (size_t index) const
 Get a layer.
LayergetLayer (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 ()


Member Typedef Documentation

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


Member Enumeration Documentation

Enumerator:
GROW_BBOX 
GROW_CANVAS 
SHRINK_BBOX 
SHRINK_CANVAS 
ADJUST_BBOX_WIDTH 
ADJUST_BBOX_HEIGHT 
ADJUST_CANVAS_WIDTH 
ADJUST_CANVAS_HEIGHT 


Constructor & Destructor Documentation

mapnik::Map::Map (  ) 

Default constructor.

Creates a map with these parameters:

  • width = 400
  • height = 400
  • projection = "+proj=latlong +datum=WGS84"

mapnik::Map::Map ( int  width,
int  height,
std::string const &  srs = "+proj=latlong +datum=WGS84" 
)

Constructor.

Parameters:
width Initial map width.
height Initial map height.
srs Initial map projection.

mapnik::Map::Map ( const Map rhs  ) 

Copy Constructur.

Parameters:
rhs Map to copy from.

mapnik::Map::~Map (  ) 


Member Function Documentation

void mapnik::Map::addLayer ( const Layer l  ) 

Add a layer to the map.

Parameters:
l The layer to add.

boost::optional< Color > const & mapnik::Map::background (  )  const

Get the map background color.

Returns:
Background color as boost::optional object

Referenced by mapnik::agg_renderer< T >::agg_renderer(), mapnik::save_map(), and mapnik::cairo_renderer< T >::start_map_processing().

Map::style_iterator mapnik::Map::begin_styles (  ) 

Get first iterator in styles.

Returns:
Non-constant style iterator.

Map::const_style_iterator mapnik::Map::begin_styles (  )  const

Get first iterator in styles.

Returns:
Constant style iterator.

Map::style_iterator mapnik::Map::end_styles (  ) 

Get last iterator in styles.

Returns:
Non-constant style iterator.

Map::const_style_iterator mapnik::Map::end_styles (  )  const

Get last iterator in styles.

Returns:
Constant style iterator.

FontSet const & mapnik::Map::find_fontset ( std::string const &  name  )  const

Find a fontset.

Parameters:
name The name of the fontset.
Returns:
The fontset if found. If not found return the default map fontset.

feature_type_style const & mapnik::Map::find_style ( std::string const &  name  )  const

Find a style.

Parameters:
name The name of the style.
Returns:
The style if found. If not found return the default map style.

bool mapnik::Map::getAspectFixMode (  )  [inline]

const Envelope< double > & mapnik::Map::getCurrentExtent (  )  const

Get current bounding box.

Returns:
The current bounding box.

Referenced by mapnik::cairo_renderer< T >::start_map_processing(), and mapnik::agg_renderer< T >::start_map_processing().

unsigned mapnik::Map::getHeight (  )  const

Get map height.

Layer & mapnik::Map::getLayer ( size_t  index  ) 

Get a layer.

Parameters:
index Layer number.
Returns:
Non-constant layer.

const Layer & mapnik::Map::getLayer ( size_t  index  )  const

Get a layer.

Parameters:
index Layer number.
Returns:
Constant layer.

unsigned mapnik::Map::getWidth (  )  const

Get map width.

bool mapnik::Map::insert_fontset ( std::string const &  name,
FontSet const &  fontset 
)

Insert a fontset into the map.

Parameters:
name The name of the fontset.
style The fontset to insert.
Returns:
true If success.

false If failure.

bool mapnik::Map::insert_style ( std::string const &  name,
feature_type_style const &  style 
)

Insert a style in the map.

Parameters:
name The name of the style.
style The style to insert.
Returns:
true If success.

false If no success.

size_t mapnik::Map::layerCount (  )  const

Get number of all layers.

std::vector< Layer > & mapnik::Map::layers (  ) 

Get all layers.

Returns:
Non-constant layers.

std::vector< Layer > const & mapnik::Map::layers (  )  const

Get all layers.

Returns:
Constant layers.

Referenced by mapnik::feature_style_processor< cairo_renderer< T > >::apply(), and mapnik::save_map().

Map & mapnik::Map::operator= ( const Map rhs  ) 

Assignment operator.

TODO: to be documented

References aspectFixMode_, background_, height_, layers_, srs_, styles_, and width_.

void mapnik::Map::pan ( int  x,
int  y 
)

void mapnik::Map::pan_and_zoom ( int  x,
int  y,
double  zoom 
)

References pan(), and zoom().

featureset_ptr mapnik::Map::query_map_point ( unsigned  index,
double  x,
double  y 
) const

featureset_ptr mapnik::Map::query_point ( unsigned  index,
double  x,
double  y 
) const

void mapnik::Map::remove_all (  ) 

Remove all layers and styles from the map.

void mapnik::Map::remove_style ( const std::string &  name  ) 

Remove a style from the map.

Parameters:
name The name of the style.

void mapnik::Map::removeLayer ( size_t  index  ) 

Remove a layer.

Parameters:
index Layer number.

void mapnik::Map::resize ( unsigned  width,
unsigned  height 
)

Resize the map.

double mapnik::Map::scale (  )  const

void mapnik::Map::set_background ( const Color c  ) 

Set the map background color.

Parameters:
c Background color.

Referenced by mapnik::map_parser::parse_map().

void mapnik::Map::set_srs ( std::string const &  srs  ) 

Set the map projection.

Parameters:
srs Map projection.

Referenced by mapnik::map_parser::parse_map().

void mapnik::Map::setAspectFixMode ( aspect_fix_mode  afm  )  [inline]

void mapnik::Map::setHeight ( unsigned  height  ) 

Set map height.

void mapnik::Map::setWidth ( unsigned  width  ) 

Set map width.

std::string const & mapnik::Map::srs (  )  const

std::map< std::string, feature_type_style > & mapnik::Map::styles (  ) 

Get all styles.

Returns:
Non-constant reference to styles

std::map< std::string, feature_type_style > const & mapnik::Map::styles (  )  const

Get all styles.

Returns:
Const reference to styles

Referenced by mapnik::save_map().

CoordTransform mapnik::Map::view_transform (  )  const

Referenced by query_map_point().

void mapnik::Map::zoom ( double  factor  ) 

Zoom the map at the current position.

Parameters:
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::zoom_all (  ) 

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.

Parameters:
box The bounding box where to zoom.

Referenced by zoom_all().


The documentation for this class was generated from the following files:

Generated for Mapnik by doxygen 1.5.8