diff --git a/demo/viewer/layer_info_dialog.cpp b/demo/viewer/layer_info_dialog.cpp index 321b62248..ec23b1ec4 100644 --- a/demo/viewer/layer_info_dialog.cpp +++ b/demo/viewer/layer_info_dialog.cpp @@ -41,26 +41,26 @@ layer_info_dialog::layer_info_dialog(mapnik::layer& lay, QWidget *parent) mapnik::datasource_ptr ds = lay.datasource(); if (ds) { - mapnik::parameters ps = ds->params(); + mapnik::parameters ps = ds->params(); - ui.tableWidget->setRowCount(ps.size()); - ui.tableWidget->setColumnCount(2); + ui.tableWidget->setRowCount(ps.size()); + ui.tableWidget->setColumnCount(2); - mapnik::parameters::const_iterator pos; + mapnik::parameters::const_iterator pos; int index=0; - for (pos = ps.begin();pos != ps.end();++pos) - { - boost::optional result; - boost::apply_visitor(mapnik::value_extractor_visitor(result),pos->second); - if (result) - { - QTableWidgetItem *keyItem = new QTableWidgetItem(QString(pos->first.c_str())); - QTableWidgetItem *valueItem = new QTableWidgetItem(QString((*result).c_str())); - ui.tableWidget->setItem(index,0,keyItem); - ui.tableWidget->setItem(index,1,valueItem); - ++index; - } - } + for (pos = ps.begin();pos != ps.end();++pos) + { + boost::optional result; + boost::apply_visitor(mapnik::value_extractor_visitor(result),pos->second); + if (result) + { + QTableWidgetItem *keyItem = new QTableWidgetItem(QString(pos->first.c_str())); + QTableWidgetItem *valueItem = new QTableWidgetItem(QString((*result).c_str())); + ui.tableWidget->setItem(index,0,keyItem); + ui.tableWidget->setItem(index,1,valueItem); + ++index; + } + } } } diff --git a/demo/viewer/layerdelegate.hpp b/demo/viewer/layerdelegate.hpp index f6ccc391a..d747ebe7a 100644 --- a/demo/viewer/layerdelegate.hpp +++ b/demo/viewer/layerdelegate.hpp @@ -36,7 +36,7 @@ class LayerDelegate : public QAbstractItemDelegate public: LayerDelegate(QObject *parent = 0); void paint(QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index) const; + const QModelIndex &index) const; QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index ) const; }; diff --git a/demo/viewer/layerlistmodel.cpp b/demo/viewer/layerlistmodel.cpp index 2250ba4a4..b8ae00766 100644 --- a/demo/viewer/layerlistmodel.cpp +++ b/demo/viewer/layerlistmodel.cpp @@ -40,33 +40,33 @@ int LayerListModel::rowCount(QModelIndex const&) const QVariant LayerListModel::data(QModelIndex const& index,int role) const { if (!index.isValid() || !map_) - return QVariant(); + return QVariant(); if (index.row() < 0 || index.row() >= int(map_->layers().size())) - return QVariant(); + return QVariant(); if (role == Qt::DisplayRole) - return QString(map_->layers().at(index.row()).name().c_str()); + return QString(map_->layers().at(index.row()).name().c_str()); else if (role == Qt::DecorationRole) { - double scale = map_->scale(); - if (map_->layers().at(index.row()).isVisible(scale)) - { - return QIcon(":/images/globe.png"); - } - else - { - return QIcon(":/images/globe_bw.png"); - } + double scale = map_->scale(); + if (map_->layers().at(index.row()).isVisible(scale)) + { + return QIcon(":/images/globe.png"); + } + else + { + return QIcon(":/images/globe_bw.png"); + } } else if (role == Qt::CheckStateRole) { - if (map_->layers().at(index.row()).isActive()) + if (map_->layers().at(index.row()).isActive()) return QVariant(Qt::Checked); - else + else return QVariant(Qt::Unchecked); } else { - return QVariant(); + return QVariant(); } } @@ -74,16 +74,16 @@ QVariant LayerListModel::headerData(int section, Qt::Orientation orientation, int role) const { if (role != Qt::DisplayRole) - return QVariant(); + return QVariant(); if (orientation == Qt::Horizontal) - return QString("TODO Column %1").arg(section); + return QString("TODO Column %1").arg(section); else - return QString("TODO Row %1").arg(section); + return QString("TODO Row %1").arg(section); } bool LayerListModel::setData(const QModelIndex &index, - const QVariant &value, int role) + const QVariant &value, int role) { if (!map_) return false; @@ -113,7 +113,7 @@ boost::optional LayerListModel::map_layer(int i) { std::vector & layers = const_cast& >(map_->layers()); if (i < int(layers.size())) - return boost::optional(layers[i]); + return boost::optional(layers[i]); } return boost::optional(); } diff --git a/demo/viewer/styles_model.cpp b/demo/viewer/styles_model.cpp index 999ac2927..aae9aa9ba 100644 --- a/demo/viewer/styles_model.cpp +++ b/demo/viewer/styles_model.cpp @@ -34,80 +34,80 @@ class node : private boost::noncopyable { struct node_base { - virtual QString name() const=0; - virtual QIcon icon() const=0; - virtual ~node_base() {} + virtual QString name() const=0; + virtual QIcon icon() const=0; + virtual ~node_base() {} }; template struct wrap : public node_base { - wrap(T const& obj) - : obj_(obj) {} + wrap(T const& obj) + : obj_(obj) {} - ~wrap() {} + ~wrap() {} - QString name () const - { - return obj_.name(); - } + QString name () const + { + return obj_.name(); + } - QIcon icon() const - { - return obj_.icon(); - } + QIcon icon() const + { + return obj_.icon(); + } - T obj_; + T obj_; }; public: template node ( T const& obj, node * parent=0) - : impl_(new wrap(obj)), - parent_(parent) + : impl_(new wrap(obj)), + parent_(parent) {} QString name() const { - return impl_->name(); + return impl_->name(); } QIcon icon() const { - return impl_->icon(); + return impl_->icon(); } unsigned num_children() const { - return children_.count(); + return children_.count(); } node * child(unsigned row) const { - return children_.value(row); + return children_.value(row); } node * parent() const { - return parent_; + return parent_; } node * add_child(node * child) { - children_.push_back(child); - return child; + children_.push_back(child); + return child; } int row () const { - if (parent_) + if (parent_) return parent_->children_.indexOf(const_cast(this)); - else + else return 0; } ~node() { - qDeleteAll(children_); + qDeleteAll(children_); } private: @@ -121,50 +121,50 @@ struct symbolizer_info : public boost::static_visitor { QString operator() (mapnik::point_symbolizer const& sym) const { - boost::ignore_unused_variable_warning(sym); - return QString("PointSymbolizer"); + boost::ignore_unused_variable_warning(sym); + return QString("PointSymbolizer"); } QString operator() (mapnik::line_symbolizer const& sym) const { - boost::ignore_unused_variable_warning(sym); - return QString("LineSymbolizer"); + boost::ignore_unused_variable_warning(sym); + return QString("LineSymbolizer"); } QString operator() (mapnik::line_pattern_symbolizer const& sym) const { - boost::ignore_unused_variable_warning(sym); - return QString("LinePatternSymbolizer"); + boost::ignore_unused_variable_warning(sym); + return QString("LinePatternSymbolizer"); } QString operator() (mapnik::polygon_symbolizer const& sym) const { - boost::ignore_unused_variable_warning(sym); - return QString("PolygonSymbolizer"); + boost::ignore_unused_variable_warning(sym); + return QString("PolygonSymbolizer"); } QString operator() (mapnik::polygon_pattern_symbolizer const& sym) const { - boost::ignore_unused_variable_warning(sym); - return QString("PolygonSymbolizer"); + boost::ignore_unused_variable_warning(sym); + return QString("PolygonSymbolizer"); } QString operator() (mapnik::text_symbolizer const& sym) const { - boost::ignore_unused_variable_warning(sym); - return QString("TextSymbolizer"); + boost::ignore_unused_variable_warning(sym); + return QString("TextSymbolizer"); } QString operator() (mapnik::shield_symbolizer const& sym) const { - boost::ignore_unused_variable_warning(sym); - return QString("ShieldSymbolizer"); + boost::ignore_unused_variable_warning(sym); + return QString("ShieldSymbolizer"); } template QString operator() (T const& ) const { - return QString ("FIXME"); + return QString ("FIXME"); } }; @@ -172,49 +172,49 @@ struct symbolizer_icon : public boost::static_visitor { QIcon operator() (mapnik::polygon_symbolizer const& sym) const { - QPixmap pix(16,16); - QPainter painter(&pix); - mapnik::color const& fill = sym.get_fill(); - QBrush brush(QColor(fill.red(),fill.green(),fill.blue(),fill.alpha())); - painter.fillRect(0, 0, 16, 16, brush); - return QIcon(pix); + QPixmap pix(16,16); + QPainter painter(&pix); + mapnik::color const& fill = sym.get_fill(); + QBrush brush(QColor(fill.red(),fill.green(),fill.blue(),fill.alpha())); + painter.fillRect(0, 0, 16, 16, brush); + return QIcon(pix); } QIcon operator() (mapnik::point_symbolizer const& sym) const { - // FIXME! - /* - boost::shared_ptr symbol = sym.get_image(); - if (symbol) - { - QImage image(symbol->getBytes(), - symbol->width(),symbol->height(),QImage::Format_ARGB32); - QPixmap pix = QPixmap::fromImage(image.rgbSwapped()); - return QIcon(pix); - } - */ - return QIcon(); + // FIXME! + /* + boost::shared_ptr symbol = sym.get_image(); + if (symbol) + { + QImage image(symbol->getBytes(), + symbol->width(),symbol->height(),QImage::Format_ARGB32); + QPixmap pix = QPixmap::fromImage(image.rgbSwapped()); + return QIcon(pix); + } + */ + return QIcon(); } QIcon operator() (mapnik::line_symbolizer const& sym) const { - QPixmap pix(48,16); - pix.fill(); - QPainter painter(&pix); - mapnik::stroke const& strk = sym.get_stroke(); - mapnik::color const& col = strk.get_color(); - QPen pen(QColor(col.red(),col.green(),col.blue(),col.alpha())); - pen.setWidth(strk.get_width()); - painter.setPen(pen); - painter.drawLine(0,7,47,7); - //painter.drawLine(7,15,12,0); - //painter.drawLine(12,0,8,15); - return QIcon(pix); + QPixmap pix(48,16); + pix.fill(); + QPainter painter(&pix); + mapnik::stroke const& strk = sym.get_stroke(); + mapnik::color const& col = strk.get_color(); + QPen pen(QColor(col.red(),col.green(),col.blue(),col.alpha())); + pen.setWidth(strk.get_width()); + painter.setPen(pen); + painter.drawLine(0,7,47,7); + //painter.drawLine(7,15,12,0); + //painter.drawLine(12,0,8,15); + return QIcon(pix); } template QIcon operator() (T const& ) const { - return QIcon (":/images/filter.png"); + return QIcon (":/images/filter.png"); } }; @@ -222,18 +222,18 @@ class symbolizer_node { public: symbolizer_node(mapnik::symbolizer const & sym) - : sym_(sym) {} + : sym_(sym) {} ~symbolizer_node(){} QString name() const { - //return QString("Symbolizer:fixme"); - return boost::apply_visitor(symbolizer_info(),sym_); + //return QString("Symbolizer:fixme"); + return boost::apply_visitor(symbolizer_info(),sym_); } QIcon icon() const { - return boost::apply_visitor(symbolizer_icon(),sym_);//QIcon(":/images/filter.png"); + return boost::apply_visitor(symbolizer_icon(),sym_);//QIcon(":/images/filter.png"); } mapnik::symbolizer const& sym_; }; @@ -242,19 +242,19 @@ class rule_node { public: rule_node(QString name,mapnik::rule const & r) - : name_(name), - rule_(r) {} + : name_(name), + rule_(r) {} ~rule_node() {} QString name() const { - mapnik::expression_ptr filter = rule_.get_filter(); - - return QString(mapnik::to_expression_string(*filter).c_str()); + mapnik::expression_ptr filter = rule_.get_filter(); + + return QString(mapnik::to_expression_string(*filter).c_str()); } QIcon icon() const { - return QIcon(":/images/filter.png"); + return QIcon(":/images/filter.png"); } private: @@ -266,19 +266,19 @@ class style_node { public: style_node(QString name, mapnik::feature_type_style const& style) - : name_(name), - style_(style) {} + : name_(name), + style_(style) {} ~style_node() {} QString name() const { - return name_; + return name_; } QIcon icon() const { - return QIcon(":/images/style.png"); + return QIcon(":/images/style.png"); } private: @@ -290,17 +290,17 @@ class map_node { public: explicit map_node(boost::shared_ptr map) - : map_(map) {} + : map_(map) {} ~map_node() {} QString name() const { - return QString("Map"); + return QString("Map"); } QIcon icon() const { - return QIcon(":/images/map.png"); + return QIcon(":/images/map.png"); } private: @@ -317,18 +317,18 @@ StyleModel::StyleModel(boost::shared_ptr map, QObject * parent) style_type::const_iterator end = styles.end(); for (; itr != end; ++itr) { - node * style_n = root_->add_child(new node(style_node(QString(itr->first.c_str()),itr->second),root_.get())); - mapnik::rules const& rules = itr->second.get_rules(); - mapnik::rules::const_iterator itr2 = rules.begin(); - for ( ; itr2 != rules.end();++itr2) - { - node* rule_n = style_n->add_child(new node(rule_node(QString("Rule"),*itr2),style_n)); - mapnik::rule::symbolizers::const_iterator itr3 = (*itr2).begin(); - for ( ; itr3 !=itr2->end();++itr3) - { - rule_n->add_child(new node(symbolizer_node(*itr3),rule_n)); - } - } + node * style_n = root_->add_child(new node(style_node(QString(itr->first.c_str()),itr->second),root_.get())); + mapnik::rules const& rules = itr->second.get_rules(); + mapnik::rules::const_iterator itr2 = rules.begin(); + for ( ; itr2 != rules.end();++itr2) + { + node* rule_n = style_n->add_child(new node(rule_node(QString("Rule"),*itr2),style_n)); + mapnik::rule::symbolizers::const_iterator itr3 = (*itr2).begin(); + for ( ; itr3 !=itr2->end();++itr3) + { + rule_n->add_child(new node(symbolizer_node(*itr3),rule_n)); + } + } } } @@ -341,15 +341,15 @@ QModelIndex StyleModel::index (int row, int col, QModelIndex const& parent) cons node * parent_node; if (!parent.isValid()) - parent_node = root_.get(); + parent_node = root_.get(); else - parent_node = static_cast(parent.internalPointer()); + parent_node = static_cast(parent.internalPointer()); node * child_node = parent_node->child(row); if (child_node) - return createIndex(row,col,child_node); + return createIndex(row,col,child_node); else - return QModelIndex(); + return QModelIndex(); } QModelIndex StyleModel::parent (QModelIndex const& index) const @@ -357,7 +357,7 @@ QModelIndex StyleModel::parent (QModelIndex const& index) const node * child_node = static_cast(index.internalPointer()); node * parent_node = child_node->parent(); if (parent_node == root_.get()) - return QModelIndex(); + return QModelIndex(); return createIndex(parent_node->row(),0,parent_node); } @@ -368,9 +368,9 @@ int StyleModel::rowCount(QModelIndex const& parent) const node * parent_node; if (parent.column() > 0) return 0; if (!parent.isValid()) - parent_node = root_.get(); + parent_node = root_.get(); else - parent_node = static_cast(parent.internalPointer()); + parent_node = static_cast(parent.internalPointer()); return parent_node->num_children(); } @@ -383,19 +383,19 @@ QVariant StyleModel::data(const QModelIndex & index, int role) const { //qDebug("data index::internalId() = %lld", index.internalId()); if (!index.isValid()) - return QVariant(); + return QVariant(); node * cur_node = static_cast(index.internalPointer()); if (cur_node) { - if (role == Qt::DisplayRole) - { - - return QVariant(cur_node->name()); - } - else if ( role == Qt::DecorationRole) - { - return cur_node->icon(); - } + if (role == Qt::DisplayRole) + { + + return QVariant(cur_node->name()); + } + else if ( role == Qt::DecorationRole) + { + return cur_node->icon(); + } } return QVariant(); } diff --git a/docs/epydoc_config/build_epydoc.sh b/docs/epydoc_config/build_epydoc.sh index 493f16f6e..3644c8a2a 100755 --- a/docs/epydoc_config/build_epydoc.sh +++ b/docs/epydoc_config/build_epydoc.sh @@ -5,7 +5,7 @@ API_DOCS_DIR="../api_docs/python" if [ ! -d $API_DOCS_DIR ] then echo "creating $API_DOCS_DIR" - mkdir -p $API_DOCS_DIR + mkdir -p $API_DOCS_DIR fi epydoc --no-private \ diff --git a/plugins/input/osm/osm.h b/plugins/input/osm/osm.h index e3a61b465..80198cf89 100644 --- a/plugins/input/osm/osm.h +++ b/plugins/input/osm/osm.h @@ -32,7 +32,7 @@ public: ptypes.push_back(std::pair("natural","heath")); ptypes.push_back(std::pair("natural","marsh")); ptypes.push_back(std::pair("military", - "danger_area")); + "danger_area")); ptypes.push_back(std::pair ("landuse","forest")); ptypes.push_back(std::pair @@ -45,7 +45,7 @@ struct osm_item long id; std::map keyvals; virtual std::string to_string(); - virtual ~osm_item() { } + virtual ~osm_item() { } }; diff --git a/src/svg/process_line_symbolizer.cpp b/src/svg/process_line_symbolizer.cpp index f0ff04e55..0e99eb681 100644 --- a/src/svg/process_line_symbolizer.cpp +++ b/src/svg/process_line_symbolizer.cpp @@ -34,13 +34,13 @@ namespace mapnik Feature const& feature, proj_transform const& prj_trans) { - path_attributes_.set_stroke_color(sym.get_stroke().get_color()); - path_attributes_.set_stroke_opacity(sym.get_stroke().get_opacity()); - path_attributes_.set_stroke_width(sym.get_stroke().get_width()); - path_attributes_.set_stroke_linecap(sym.get_stroke().get_line_cap()); - path_attributes_.set_stroke_linejoin(sym.get_stroke().get_line_join()); - path_attributes_.set_stroke_dasharray(sym.get_stroke().get_dash_array()); - path_attributes_.set_stroke_dashoffset(sym.get_stroke().dash_offset()); + path_attributes_.set_stroke_color(sym.get_stroke().get_color()); + path_attributes_.set_stroke_opacity(sym.get_stroke().get_opacity()); + path_attributes_.set_stroke_width(sym.get_stroke().get_width()); + path_attributes_.set_stroke_linecap(sym.get_stroke().get_line_cap()); + path_attributes_.set_stroke_linejoin(sym.get_stroke().get_line_join()); + path_attributes_.set_stroke_dasharray(sym.get_stroke().get_dash_array()); + path_attributes_.set_stroke_dashoffset(sym.get_stroke().dash_offset()); } template void svg_renderer >::process(line_symbolizer const& sym, diff --git a/src/svg/svg_output_attributes.cpp b/src/svg/svg_output_attributes.cpp index 61b1e4f22..a9b209dde 100644 --- a/src/svg/svg_output_attributes.cpp +++ b/src/svg/svg_output_attributes.cpp @@ -32,195 +32,195 @@ namespace mapnik { namespace svg { void path_output_attributes::set_fill_color(color const& fill_color) { - fill_color_ = fill_color.to_hex_string(); + fill_color_ = fill_color.to_hex_string(); } void path_output_attributes::set_fill_opacity(const double fill_opacity) { - fill_opacity_ = fill_opacity; + fill_opacity_ = fill_opacity; } void path_output_attributes::set_stroke_color(color const& stroke_color) { - stroke_color_ = stroke_color.to_hex_string(); + stroke_color_ = stroke_color.to_hex_string(); } void path_output_attributes::set_stroke_opacity(const double stroke_opacity) { - stroke_opacity_ = stroke_opacity; + stroke_opacity_ = stroke_opacity; } void path_output_attributes::set_stroke_width(const double stroke_width) { - stroke_width_ = stroke_width; + stroke_width_ = stroke_width; } void path_output_attributes::set_stroke_linecap(const line_cap_e stroke_linecap) { - switch(stroke_linecap) - { - case BUTT_CAP: - stroke_linecap_ = "butt"; - break; - case SQUARE_CAP: - stroke_linecap_ = "square"; - break; - case ROUND_CAP: - stroke_linecap_ = "round"; - break; - default: - stroke_linecap_ = "butt"; - } + switch(stroke_linecap) + { + case BUTT_CAP: + stroke_linecap_ = "butt"; + break; + case SQUARE_CAP: + stroke_linecap_ = "square"; + break; + case ROUND_CAP: + stroke_linecap_ = "round"; + break; + default: + stroke_linecap_ = "butt"; + } } void path_output_attributes::set_stroke_linejoin(const line_join_e stroke_linejoin) { - switch(stroke_linejoin) - { - case MITER_JOIN: - stroke_linejoin_ = "miter"; - break; - case MITER_REVERT_JOIN: - stroke_linejoin_ = "miter"; - break; - case ROUND_JOIN: - stroke_linejoin_ = "round"; - break; - case BEVEL_JOIN: - stroke_linejoin_ = "bevel"; - break; - default: - stroke_linejoin_ = "miter"; - } + switch(stroke_linejoin) + { + case MITER_JOIN: + stroke_linejoin_ = "miter"; + break; + case MITER_REVERT_JOIN: + stroke_linejoin_ = "miter"; + break; + case ROUND_JOIN: + stroke_linejoin_ = "round"; + break; + case BEVEL_JOIN: + stroke_linejoin_ = "bevel"; + break; + default: + stroke_linejoin_ = "miter"; + } } void path_output_attributes::set_stroke_dasharray(const dash_array stroke_dasharray) { - stroke_dasharray_ = stroke_dasharray; + stroke_dasharray_ = stroke_dasharray; } void path_output_attributes::set_stroke_dashoffset(const double stroke_dashoffset) { - stroke_dashoffset_ = stroke_dashoffset; + stroke_dashoffset_ = stroke_dashoffset; } const std::string path_output_attributes::fill_color() const { - return fill_color_; + return fill_color_; } - + const double path_output_attributes::fill_opacity() const { - return fill_opacity_; + return fill_opacity_; } const std::string path_output_attributes::stroke_color() const { - return stroke_color_; + return stroke_color_; } - + const double path_output_attributes::stroke_opacity() const { - return stroke_opacity_; + return stroke_opacity_; } const double path_output_attributes::stroke_width() const { - return stroke_width_; + return stroke_width_; } - + const std::string path_output_attributes::stroke_linecap() const { - return stroke_linecap_; + return stroke_linecap_; } const std::string path_output_attributes::stroke_linejoin() const { - return stroke_linejoin_; + return stroke_linejoin_; } const dash_array path_output_attributes::stroke_dasharray() const { - return stroke_dasharray_; + return stroke_dasharray_; } const double path_output_attributes::stroke_dashoffset() const { - return stroke_dashoffset_; + return stroke_dashoffset_; } void path_output_attributes::reset() { - fill_color_ = "none"; - fill_opacity_ = 1.0; - stroke_color_ = "none"; - stroke_opacity_ = 1.0; - stroke_width_ = 0.0; - stroke_linecap_ = "butt"; - stroke_linejoin_ = "miter"; - stroke_dasharray_.clear(); - stroke_dashoffset_ = 0.0; + fill_color_ = "none"; + fill_opacity_ = 1.0; + stroke_color_ = "none"; + stroke_opacity_ = 1.0; + stroke_width_ = 0.0; + stroke_linecap_ = "butt"; + stroke_linejoin_ = "miter"; + stroke_dasharray_.clear(); + stroke_dashoffset_ = 0.0; } // rect_output_attributes void rect_output_attributes::set_x(const int x) { - x_ = x; + x_ = x; } - + void rect_output_attributes::set_y(const int y) { - y_ = y; + y_ = y; } void rect_output_attributes::set_width(const unsigned width) { - width_ = width; + width_ = width; } - + void rect_output_attributes::set_height(const unsigned height) { - height_ = height; + height_ = height; } void rect_output_attributes::set_fill_color(color const& fill_color) { - fill_color_ = fill_color.to_hex_string(); + fill_color_ = fill_color.to_hex_string(); } const int rect_output_attributes::x() const { - return x_; + return x_; } - + const int rect_output_attributes::y() const { - return y_; + return y_; } const int rect_output_attributes::width() const { - return width_; + return width_; } const int rect_output_attributes::height() const { - return height_; + return height_; } const std::string rect_output_attributes::fill_color() const { - return fill_color_; + return fill_color_; } void rect_output_attributes::reset() { - x_ = 0; - y_ = 0; - width_ = 400; - height_ = 400; - fill_color_ = "#000000"; + x_ = 0; + y_ = 0; + width_ = 400; + height_ = 400; + fill_color_ = "#000000"; } // rect_output_attributes @@ -229,64 +229,64 @@ namespace mapnik { namespace svg { const std::string root_output_attributes::SVG_NAMESPACE_URL = "http://www.w3.org/2000/svg"; root_output_attributes::root_output_attributes() - : width_(400), - height_(400), - svg_version_(SVG_VERSION), - svg_namespace_url_(SVG_NAMESPACE_URL) + : width_(400), + height_(400), + svg_version_(SVG_VERSION), + svg_namespace_url_(SVG_NAMESPACE_URL) {} root_output_attributes::root_output_attributes(const unsigned width, const unsigned height) - : width_(width), - height_(height), - svg_version_(SVG_VERSION), - svg_namespace_url_(SVG_NAMESPACE_URL) + : width_(width), + height_(height), + svg_version_(SVG_VERSION), + svg_namespace_url_(SVG_NAMESPACE_URL) {} void root_output_attributes::set_width(const unsigned width) { - width_ = width; + width_ = width; } void root_output_attributes::set_height(const unsigned height) { - height_ = height; + height_ = height; } void root_output_attributes::set_svg_version(const double svg_version) { - svg_version_ = svg_version; + svg_version_ = svg_version; } void root_output_attributes::set_svg_namespace_url(std::string const& svg_namespace_url) { - svg_namespace_url_ = svg_namespace_url; + svg_namespace_url_ = svg_namespace_url; } const unsigned root_output_attributes::width() const { - return width_; + return width_; } const unsigned root_output_attributes::height() const { - return height_; + return height_; } const double root_output_attributes::svg_version() const { - return svg_version_; + return svg_version_; } const std::string root_output_attributes::svg_namespace_url() const { - return svg_namespace_url_; + return svg_namespace_url_; } void root_output_attributes::reset() { - width_ = 400; - height_ = 400; - svg_version_ = SVG_VERSION; - svg_namespace_url_ = SVG_NAMESPACE_URL; + width_ = 400; + height_ = 400; + svg_version_ = SVG_VERSION; + svg_namespace_url_ = SVG_NAMESPACE_URL; } }} diff --git a/src/svg/svg_renderer.cpp b/src/svg/svg_renderer.cpp index 602061086..1cb2c3eca 100644 --- a/src/svg/svg_renderer.cpp +++ b/src/svg/svg_renderer.cpp @@ -34,13 +34,13 @@ namespace mapnik { template svg_renderer::svg_renderer(Map const& m, T & output_iterator, unsigned offset_x, unsigned offset_y) : - feature_style_processor(m), - output_iterator_(output_iterator), - width_(m.width()), - height_(m.height()), - t_(m.width(),m.height(),m.get_current_extent(),offset_x,offset_y), - generator_(output_iterator) - {} + feature_style_processor(m), + output_iterator_(output_iterator), + width_(m.width()), + height_(m.height()), + t_(m.width(),m.height(),m.get_current_extent(),offset_x,offset_y), + generator_(output_iterator) + {} template svg_renderer::~svg_renderer() {} @@ -48,53 +48,53 @@ namespace mapnik template void svg_renderer::start_map_processing(Map const& map) { - #ifdef MAPNIK_DEBUG - std::clog << "start map processing" << std::endl; - #endif - - // generate XML header. - generator_.generate_header(); - - // generate SVG root element opening tag. - // the root element defines the size of the image, - // which is taken from the map's dimensions. - svg::root_output_attributes root_attributes(width_, height_); - generator_.generate_opening_root(root_attributes); - - boost::optional const& bgcolor = map.background(); - if(bgcolor) - { - // generate background color as a rectangle that spans the whole image. - svg::rect_output_attributes bg_attributes(0, 0, width_, height_, *bgcolor); - generator_.generate_rect(bg_attributes); - } + #ifdef MAPNIK_DEBUG + std::clog << "start map processing" << std::endl; + #endif + + // generate XML header. + generator_.generate_header(); + + // generate SVG root element opening tag. + // the root element defines the size of the image, + // which is taken from the map's dimensions. + svg::root_output_attributes root_attributes(width_, height_); + generator_.generate_opening_root(root_attributes); + + boost::optional const& bgcolor = map.background(); + if(bgcolor) + { + // generate background color as a rectangle that spans the whole image. + svg::rect_output_attributes bg_attributes(0, 0, width_, height_, *bgcolor); + generator_.generate_rect(bg_attributes); + } } template void svg_renderer::end_map_processing(Map const& map) { - // generate SVG root element closing tag. - generator_.generate_closing_root(); - - #ifdef MAPNIK_DEBUG - std::clog << "end map processing" << std::endl; - #endif + // generate SVG root element closing tag. + generator_.generate_closing_root(); + + #ifdef MAPNIK_DEBUG + std::clog << "end map processing" << std::endl; + #endif } template void svg_renderer::start_layer_processing(layer const& lay) { - #ifdef MAPNIK_DEBUG - std::clog << "start layer processing: " << lay.name() << std::endl; - #endif + #ifdef MAPNIK_DEBUG + std::clog << "start layer processing: " << lay.name() << std::endl; + #endif } template void svg_renderer::end_layer_processing(layer const& lay) { - #ifdef MAPNIK_DEBUG - std::clog << "end layer processing: " << lay.name() << std::endl; - #endif + #ifdef MAPNIK_DEBUG + std::clog << "end layer processing: " << lay.name() << std::endl; + #endif } template class svg_renderer >; diff --git a/tests/cpp_tests/svg_renderer_tests/background_color_test.cpp b/tests/cpp_tests/svg_renderer_tests/background_color_test.cpp index 8453275b1..03cda25d6 100644 --- a/tests/cpp_tests/svg_renderer_tests/background_color_test.cpp +++ b/tests/cpp_tests/svg_renderer_tests/background_color_test.cpp @@ -28,13 +28,13 @@ using namespace karma; struct F { F() : - x(0), - y(0), - width(100), - height(100), - bgcolor("#ffffff"), - expected_output("") {} - + x(0), + y(0), + width(100), + height(100), + bgcolor("#ffffff"), + expected_output("") {} + ~F() {} const int x; @@ -61,14 +61,14 @@ struct F BOOST_FIXTURE_TEST_CASE(bgcolor_stream_test_case, F) { actual_output - << format( - "", - x, y, width, "px", height, "px", bgcolor); + << format( + "", + x, y, width, "px", height, "px", bgcolor); BOOST_CHECK_EQUAL(actual_output.str(), expected_output); } @@ -92,14 +92,14 @@ BOOST_FIXTURE_TEST_CASE(bgcolor_stream_confix_test_case, F) using fusion::tuple; actual_output - << format( - "", - x, y, tuple(width, "px"), tuple(height, "px"), bgcolor); + << format( + "", + x, y, tuple(width, "px"), tuple(height, "px"), bgcolor); BOOST_CHECK_EQUAL(actual_output.str(), expected_output); } @@ -122,14 +122,14 @@ BOOST_FIXTURE_TEST_CASE(bgcolor_stream_confix_complete_test_case, F) using fusion::tuple; actual_output - << format( - confix('<', "/>")[ - "rect x=" << confix('"', '"')[int_] - << " y=" << confix('"', '"')[int_] - << " width=" << confix('"', '"')[int_ << string] - << " height=" << confix('"', '"')[int_ << string] - << " style=" << confix('"', '"')["fill: " << string]], - x, y, tuple(width, "px"), tuple(height, "px"), bgcolor); + << format( + confix('<', "/>")[ + "rect x=" << confix('"', '"')[int_] + << " y=" << confix('"', '"')[int_] + << " width=" << confix('"', '"')[int_ << string] + << " height=" << confix('"', '"')[int_ << string] + << " style=" << confix('"', '"')["fill: " << string]], + x, y, tuple(width, "px"), tuple(height, "px"), bgcolor); BOOST_CHECK_EQUAL(actual_output.str(), expected_output); } @@ -152,14 +152,14 @@ BOOST_FIXTURE_TEST_CASE(bgcolor_stream_iterator_test_case, F) std::ostream_iterator actual_output_iterator(actual_output); generate( - actual_output_iterator, - confix("<", "/>")[ - "rect x=" << confix('"', '"')[int_] - << " y=" << confix('"', '"')[int_] - << " width=" << confix('"', '"')[int_ << string] - << " height=" << confix('"', '"')[int_ << string] - << " style=" << confix('"', '"')["fill: " << string]], - x, y, tuple(width, "px"), tuple(height, "px"), bgcolor); + actual_output_iterator, + confix("<", "/>")[ + "rect x=" << confix('"', '"')[int_] + << " y=" << confix('"', '"')[int_] + << " width=" << confix('"', '"')[int_ << string] + << " height=" << confix('"', '"')[int_ << string] + << " style=" << confix('"', '"')["fill: " << string]], + x, y, tuple(width, "px"), tuple(height, "px"), bgcolor); BOOST_CHECK_EQUAL(actual_output.str(), expected_output); } diff --git a/tests/cpp_tests/svg_renderer_tests/combined_test.cpp b/tests/cpp_tests/svg_renderer_tests/combined_test.cpp index 3296ea156..ffd1730b5 100644 --- a/tests/cpp_tests/svg_renderer_tests/combined_test.cpp +++ b/tests/cpp_tests/svg_renderer_tests/combined_test.cpp @@ -38,17 +38,17 @@ BOOST_AUTO_TEST_CASE(combined_test_case) renderer.apply(); std::string expected_output = - svg_ren::XML_DECLARATION - + "\n" - + svg_ren::SVG_DTD - + "\n" - + "" - +"\n" - +"" - +"\n" - +""; + svg_ren::XML_DECLARATION + + "\n" + + svg_ren::SVG_DTD + + "\n" + + "" + +"\n" + +"" + +"\n" + +""; std::string actual_output = output_stream.str(); BOOST_CHECK_EQUAL(actual_output, expected_output); diff --git a/tests/cpp_tests/svg_renderer_tests/compilation_test.cpp b/tests/cpp_tests/svg_renderer_tests/compilation_test.cpp index 6ca837f18..34723d3f3 100644 --- a/tests/cpp_tests/svg_renderer_tests/compilation_test.cpp +++ b/tests/cpp_tests/svg_renderer_tests/compilation_test.cpp @@ -24,13 +24,13 @@ BOOST_AUTO_TEST_CASE(compile_test_case) try { - std::ostringstream output_stream; - std::ostream_iterator output_stream_iterator(output_stream); - svg_renderer > renderer(map, output_stream_iterator); - renderer.apply(); + std::ostringstream output_stream; + std::ostream_iterator output_stream_iterator(output_stream); + svg_renderer > renderer(map, output_stream_iterator); + renderer.apply(); } catch(...) { - BOOST_FAIL("Empty implementation throws exception."); + BOOST_FAIL("Empty implementation throws exception."); } } diff --git a/tests/cpp_tests/svg_renderer_tests/file_output_test.cpp b/tests/cpp_tests/svg_renderer_tests/file_output_test.cpp index e5c55ca83..0b0e0aee4 100644 --- a/tests/cpp_tests/svg_renderer_tests/file_output_test.cpp +++ b/tests/cpp_tests/svg_renderer_tests/file_output_test.cpp @@ -50,20 +50,20 @@ BOOST_AUTO_TEST_CASE(file_output_test_case) if(output_stream) { - std::ostream_iterator output_stream_iterator(output_stream); - - svg_ren renderer(map, output_stream_iterator); - renderer.apply(); - - output_stream.close(); - - filesystem::path output_filename_path = - filesystem::system_complete(filesystem::path(".")) / filesystem::path(output_filename); - - BOOST_CHECK_MESSAGE(filesystem::exists(output_filename_path), "File '"+output_filename_path.string()+"' was created."); + std::ostream_iterator output_stream_iterator(output_stream); + + svg_ren renderer(map, output_stream_iterator); + renderer.apply(); + + output_stream.close(); + + filesystem::path output_filename_path = + filesystem::system_complete(filesystem::path(".")) / filesystem::path(output_filename); + + BOOST_CHECK_MESSAGE(filesystem::exists(output_filename_path), "File '"+output_filename_path.string()+"' was created."); } else { - BOOST_FAIL("Could not create create/open file '"+output_filename+"'."); + BOOST_FAIL("Could not create create/open file '"+output_filename+"'."); } } diff --git a/tests/cpp_tests/svg_renderer_tests/path_element_test.cpp b/tests/cpp_tests/svg_renderer_tests/path_element_test.cpp index 5fe1268bd..3a1d79f68 100644 --- a/tests/cpp_tests/svg_renderer_tests/path_element_test.cpp +++ b/tests/cpp_tests/svg_renderer_tests/path_element_test.cpp @@ -130,63 +130,63 @@ void prepare_map(Map& m) // layers // Provincial polygons { - parameters p; - p["type"]="shape"; - p["file"]=mapnik_dir+"/demo/data/boundaries"; - - layer lyr("Provinces"); - lyr.set_datasource(datasource_cache::instance()->create(p)); - lyr.add_style("provinces"); - m.addLayer(lyr); + parameters p; + p["type"]="shape"; + p["file"]=mapnik_dir+"/demo/data/boundaries"; + + layer lyr("Provinces"); + lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.add_style("provinces"); + m.addLayer(lyr); } // Drainage { - parameters p; - p["type"]="shape"; - p["file"]=mapnik_dir+"/demo/data/qcdrainage"; - layer lyr("Quebec Hydrography"); - lyr.set_datasource(datasource_cache::instance()->create(p)); - lyr.add_style("drainage"); - m.addLayer(lyr); + parameters p; + p["type"]="shape"; + p["file"]=mapnik_dir+"/demo/data/qcdrainage"; + layer lyr("Quebec Hydrography"); + lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.add_style("drainage"); + m.addLayer(lyr); } { - parameters p; - p["type"]="shape"; - p["file"]=mapnik_dir+"/demo/data/ontdrainage"; - - layer lyr("Ontario Hydrography"); - lyr.set_datasource(datasource_cache::instance()->create(p)); - lyr.add_style("drainage"); - m.addLayer(lyr); + parameters p; + p["type"]="shape"; + p["file"]=mapnik_dir+"/demo/data/ontdrainage"; + + layer lyr("Ontario Hydrography"); + lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.add_style("drainage"); + m.addLayer(lyr); } // Provincial boundaries { - parameters p; - p["type"]="shape"; - p["file"]=mapnik_dir+"/demo/data/boundaries_l"; - layer lyr("Provincial borders"); - lyr.set_datasource(datasource_cache::instance()->create(p)); - lyr.add_style("provlines"); - m.addLayer(lyr); + parameters p; + p["type"]="shape"; + p["file"]=mapnik_dir+"/demo/data/boundaries_l"; + layer lyr("Provincial borders"); + lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.add_style("provlines"); + m.addLayer(lyr); } // Roads { - parameters p; - p["type"]="shape"; - p["file"]=mapnik_dir+"/demo/data/roads"; - layer lyr("Roads"); - lyr.set_datasource(datasource_cache::instance()->create(p)); - lyr.add_style("smallroads"); - lyr.add_style("road-border"); - lyr.add_style("road-fill"); - lyr.add_style("highway-border"); - lyr.add_style("highway-fill"); - - m.addLayer(lyr); + parameters p; + p["type"]="shape"; + p["file"]=mapnik_dir+"/demo/data/roads"; + layer lyr("Roads"); + lyr.set_datasource(datasource_cache::instance()->create(p)); + lyr.add_style("smallroads"); + lyr.add_style("road-border"); + lyr.add_style("road-fill"); + lyr.add_style("highway-border"); + lyr.add_style("highway-fill"); + + m.addLayer(lyr); } } @@ -196,35 +196,36 @@ void render_to_file(Map const& m, const std::string output_filename) if(output_stream) { - typedef svg_renderer > svg_ren; - - std::ostream_iterator output_stream_iterator(output_stream); - - svg_ren renderer(m, output_stream_iterator); - renderer.apply(); - - output_stream.close(); - - filesystem::path output_filename_path = - filesystem::system_complete(filesystem::path(".")) / filesystem::path(output_filename); - - BOOST_CHECK_MESSAGE(filesystem::exists(output_filename_path), "File '"+output_filename_path.string()+"' was created."); + typedef svg_renderer > svg_ren; + + std::ostream_iterator output_stream_iterator(output_stream); + + svg_ren renderer(m, output_stream_iterator); + renderer.apply(); + + output_stream.close(); + + filesystem::path output_filename_path = + filesystem::system_complete(filesystem::path(".")) / filesystem::path(output_filename); + + BOOST_CHECK_MESSAGE(filesystem::exists(output_filename_path), + "File '"+output_filename_path.string()+"' was created."); } else { - BOOST_FAIL("Could not create create/open file '"+output_filename+"'."); + BOOST_FAIL("Could not create create/open file '"+output_filename+"'."); } } BOOST_AUTO_TEST_CASE(path_element_test_case_1) { Map m(800,600); - m.set_background(color_factory::from_string("white")); + m.set_background(color_factory::from_string("steelblue")); prepare_map(m); - m.zoom_to_box(box2d(1405120.04127408, -247003.813399447, - 1706357.31328276, -25098.593149577)); - + //m.zoom_to_box(box2d(1405120.04127408, -247003.813399447, + //1706357.31328276, -25098.593149577)); + m.zoom_all(); render_to_file(m, "path_element_test_case_1.svg"); } diff --git a/tests/cpp_tests/svg_renderer_tests/root_element_test.cpp b/tests/cpp_tests/svg_renderer_tests/root_element_test.cpp index 716795bd8..c98755bf8 100644 --- a/tests/cpp_tests/svg_renderer_tests/root_element_test.cpp +++ b/tests/cpp_tests/svg_renderer_tests/root_element_test.cpp @@ -27,11 +27,11 @@ using namespace karma; struct F { F() : - width(100), - height(100), - version(1.1), - xmlns("http://www.w3.org/2000/svg"), - expected_output("") {} + width(100), + height(100), + version(1.1), + xmlns("http://www.w3.org/2000/svg"), + expected_output("") {} ~F() {} @@ -58,13 +58,13 @@ struct F BOOST_FIXTURE_TEST_CASE(bgcolor_stream_test_case, F) { actual_output - << format( - "", - width, "px", height, "px", version, xmlns); + << format( + "", + width, "px", height, "px", version, xmlns); BOOST_CHECK_EQUAL(actual_output.str(), expected_output); } @@ -88,13 +88,13 @@ BOOST_FIXTURE_TEST_CASE(bgcolor_stream_confix_test_case, F) using fusion::tuple; actual_output - << format( - "", - tuple(width, "px"), tuple(height, "px"), version, xmlns); + << format( + "", + tuple(width, "px"), tuple(height, "px"), version, xmlns); BOOST_CHECK_EQUAL(actual_output.str(), expected_output); } @@ -117,13 +117,13 @@ BOOST_FIXTURE_TEST_CASE(bgcolor_stream_confix_complete_test_case, F) using fusion::tuple; actual_output - << format( - confix('<', ">")[ - "svg width=" << confix('"', '"')[int_ << string] - << " height=" << confix('"', '"')[int_ << string] - << " version=" << confix('"', '"')[float_] - << " xmlns=" << confix('"', '"')[string]], - tuple(width, "px"), tuple(height, "px"), version, xmlns); + << format( + confix('<', ">")[ + "svg width=" << confix('"', '"')[int_ << string] + << " height=" << confix('"', '"')[int_ << string] + << " version=" << confix('"', '"')[float_] + << " xmlns=" << confix('"', '"')[string]], + tuple(width, "px"), tuple(height, "px"), version, xmlns); BOOST_CHECK_EQUAL(actual_output.str(), expected_output); } @@ -146,13 +146,13 @@ BOOST_FIXTURE_TEST_CASE(bgcolor_stream_iterator_test_case, F) std::ostream_iterator actual_output_iterator(actual_output); generate( - actual_output_iterator, - confix("<", ">")[ - "svg width=" << confix('"', '"')[int_ << string] - << " height=" << confix('"', '"')[int_ << string] - << " version=" << confix('"', '"')[float_] - << " xmlns=" << confix('"', '"')[string]], - tuple(width, "px"), tuple(height, "px"), version, xmlns); + actual_output_iterator, + confix("<", ">")[ + "svg width=" << confix('"', '"')[int_ << string] + << " height=" << confix('"', '"')[int_ << string] + << " version=" << confix('"', '"')[float_] + << " xmlns=" << confix('"', '"')[string]], + tuple(width, "px"), tuple(height, "px"), version, xmlns); BOOST_CHECK_EQUAL(actual_output.str(), expected_output); } diff --git a/utils/xml/mapnik2.dtd b/utils/xml/mapnik2.dtd index a66e06f58..8cc7997b7 100644 --- a/utils/xml/mapnik2.dtd +++ b/utils/xml/mapnik2.dtd @@ -1,221 +1,221 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +