tabs -> spaces

This commit is contained in:
Dane Springmeyer 2011-05-04 15:53:36 +00:00
parent 4572a4fdd5
commit 1070b293ad
16 changed files with 685 additions and 684 deletions

View file

@ -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<std::string> result;
boost::apply_visitor(mapnik::value_extractor_visitor<std::string>(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<std::string> result;
boost::apply_visitor(mapnik::value_extractor_visitor<std::string>(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;
}
}
}
}

View file

@ -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;
};

View file

@ -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<mapnik::layer&> LayerListModel::map_layer(int i)
{
std::vector<mapnik::layer> & layers = const_cast<std::vector<mapnik::layer>& >(map_->layers());
if (i < int(layers.size()))
return boost::optional<mapnik::layer&>(layers[i]);
return boost::optional<mapnik::layer&>(layers[i]);
}
return boost::optional<mapnik::layer&>();
}

View file

@ -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 <typename T>
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 <typename T>
node ( T const& obj, node * parent=0)
: impl_(new wrap<T>(obj)),
parent_(parent)
: impl_(new wrap<T>(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<node*>(this));
else
else
return 0;
}
~node()
{
qDeleteAll(children_);
qDeleteAll(children_);
}
private:
@ -121,50 +121,50 @@ struct symbolizer_info : public boost::static_visitor<QString>
{
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 <typename T>
QString operator() (T const& ) const
{
return QString ("FIXME");
return QString ("FIXME");
}
};
@ -172,49 +172,49 @@ struct symbolizer_icon : public boost::static_visitor<QIcon>
{
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<mapnik::image_data_32> 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<mapnik::image_data_32> 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 <typename T>
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<mapnik::Map> 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<mapnik::Map> 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<node*>(parent.internalPointer());
parent_node = static_cast<node*>(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<node*>(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<node*>(parent.internalPointer());
parent_node = static_cast<node*>(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<node*>(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();
}

View file

@ -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 \

View file

@ -32,7 +32,7 @@ public:
ptypes.push_back(std::pair<std::string,std::string>("natural","heath"));
ptypes.push_back(std::pair<std::string,std::string>("natural","marsh"));
ptypes.push_back(std::pair<std::string,std::string>("military",
"danger_area"));
"danger_area"));
ptypes.push_back(std::pair<std::string,std::string>
("landuse","forest"));
ptypes.push_back(std::pair<std::string,std::string>
@ -45,7 +45,7 @@ struct osm_item
long id;
std::map<std::string,std::string> keyvals;
virtual std::string to_string();
virtual ~osm_item() { }
virtual ~osm_item() { }
};

View file

@ -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<std::ostream_iterator<char> >::process(line_symbolizer const& sym,

View file

@ -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;
}
}}

View file

@ -34,13 +34,13 @@ namespace mapnik
{
template <typename T>
svg_renderer<T>::svg_renderer(Map const& m, T & output_iterator, unsigned offset_x, unsigned offset_y) :
feature_style_processor<svg_renderer>(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<svg_renderer>(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 <typename T>
svg_renderer<T>::~svg_renderer() {}
@ -48,53 +48,53 @@ namespace mapnik
template <typename T>
void svg_renderer<T>::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<color> 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<color> 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 <typename T>
void svg_renderer<T>::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 <typename T>
void svg_renderer<T>::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 <typename T>
void svg_renderer<T>::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<std::ostream_iterator<char> >;

View file

@ -28,13 +28,13 @@ using namespace karma;
struct F
{
F() :
x(0),
y(0),
width(100),
height(100),
bgcolor("#ffffff"),
expected_output("<rect x=\"0\" y=\"0\" width=\"100px\" height=\"100px\" style=\"fill: #ffffff\"/>") {}
x(0),
y(0),
width(100),
height(100),
bgcolor("#ffffff"),
expected_output("<rect x=\"0\" y=\"0\" width=\"100px\" height=\"100px\" style=\"fill: #ffffff\"/>") {}
~F() {}
const int x;
@ -61,14 +61,14 @@ struct F
BOOST_FIXTURE_TEST_CASE(bgcolor_stream_test_case, F)
{
actual_output
<< format(
"<rect x=\"" << int_ << "\" "
<< "y=\"" << int_ << "\" "
<< "width=\"" << int_ << string << "\" "
<< "height=\"" << int_ << string << "\" "
<< "style=\"fill: " << string << "\""
<< "/>",
x, y, width, "px", height, "px", bgcolor);
<< format(
"<rect x=\"" << int_ << "\" "
<< "y=\"" << int_ << "\" "
<< "width=\"" << int_ << string << "\" "
<< "height=\"" << int_ << string << "\" "
<< "style=\"fill: " << string << "\""
<< "/>",
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(
"<rect x=" << confix('"', '"')[int_]
<< " y=" << confix('"', '"')[int_]
<< " width=" << confix('"', '"')[int_ << string]
<< " height=" << confix('"', '"')[int_ << string]
<< " style=" << confix('"', '"')["fill: " << string]
<< "/>",
x, y, tuple<int, std::string>(width, "px"), tuple<int, std::string>(height, "px"), bgcolor);
<< format(
"<rect x=" << confix('"', '"')[int_]
<< " y=" << confix('"', '"')[int_]
<< " width=" << confix('"', '"')[int_ << string]
<< " height=" << confix('"', '"')[int_ << string]
<< " style=" << confix('"', '"')["fill: " << string]
<< "/>",
x, y, tuple<int, std::string>(width, "px"), tuple<int, std::string>(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<int, std::string>(width, "px"), tuple<int, std::string>(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<int, std::string>(width, "px"), tuple<int, std::string>(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<char> 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<int, std::string>(width, "px"), tuple<int, std::string>(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<int, std::string>(width, "px"), tuple<int, std::string>(height, "px"), bgcolor);
BOOST_CHECK_EQUAL(actual_output.str(), expected_output);
}

View file

@ -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"
+ "<svg width=\"800px\" height=\"600px\" version=\"1.1\" xmlns=\""
+ svg_ren::SVG_NAMESPACE_URL
+ "\">"
+"\n"
+"<rect x=\"0\" y=\"0\" width=\"800px\" height=\"600px\" style=\"fill: #ffffff\"/>"
+"\n"
+"</svg>";
svg_ren::XML_DECLARATION
+ "\n"
+ svg_ren::SVG_DTD
+ "\n"
+ "<svg width=\"800px\" height=\"600px\" version=\"1.1\" xmlns=\""
+ svg_ren::SVG_NAMESPACE_URL
+ "\">"
+"\n"
+"<rect x=\"0\" y=\"0\" width=\"800px\" height=\"600px\" style=\"fill: #ffffff\"/>"
+"\n"
+"</svg>";
std::string actual_output = output_stream.str();
BOOST_CHECK_EQUAL(actual_output, expected_output);

View file

@ -24,13 +24,13 @@ BOOST_AUTO_TEST_CASE(compile_test_case)
try
{
std::ostringstream output_stream;
std::ostream_iterator<char> output_stream_iterator(output_stream);
svg_renderer<std::ostream_iterator<char> > renderer(map, output_stream_iterator);
renderer.apply();
std::ostringstream output_stream;
std::ostream_iterator<char> output_stream_iterator(output_stream);
svg_renderer<std::ostream_iterator<char> > renderer(map, output_stream_iterator);
renderer.apply();
}
catch(...)
{
BOOST_FAIL("Empty implementation throws exception.");
BOOST_FAIL("Empty implementation throws exception.");
}
}

View file

@ -50,20 +50,20 @@ BOOST_AUTO_TEST_CASE(file_output_test_case)
if(output_stream)
{
std::ostream_iterator<char> 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<char> 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+"'.");
}
}

View file

@ -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<std::ostream_iterator<char> > svg_ren;
std::ostream_iterator<char> 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<std::ostream_iterator<char> > svg_ren;
std::ostream_iterator<char> 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<double>(1405120.04127408, -247003.813399447,
1706357.31328276, -25098.593149577));
//m.zoom_to_box(box2d<double>(1405120.04127408, -247003.813399447,
//1706357.31328276, -25098.593149577));
m.zoom_all();
render_to_file(m, "path_element_test_case_1.svg");
}

View file

@ -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("<svg width=\"100px\" height=\"100px\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">") {}
width(100),
height(100),
version(1.1),
xmlns("http://www.w3.org/2000/svg"),
expected_output("<svg width=\"100px\" height=\"100px\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">") {}
~F() {}
@ -58,13 +58,13 @@ struct F
BOOST_FIXTURE_TEST_CASE(bgcolor_stream_test_case, F)
{
actual_output
<< format(
"<svg width=\"" << int_ << string << "\" "
<< "height=\"" << int_ << string << "\" "
<< "version=\"" << float_ << "\" "
<< "xmlns=\"" << string << "\""
<< ">",
width, "px", height, "px", version, xmlns);
<< format(
"<svg width=\"" << int_ << string << "\" "
<< "height=\"" << int_ << string << "\" "
<< "version=\"" << float_ << "\" "
<< "xmlns=\"" << string << "\""
<< ">",
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(
"<svg width=" << confix('"', '"')[int_ << string]
<< " height=" << confix('"', '"')[int_ << string]
<< " version=" << confix('"', '"')[float_]
<< " xmlns=" << confix('"', '"')[string]
<< ">",
tuple<int, std::string>(width, "px"), tuple<int, std::string>(height, "px"), version, xmlns);
<< format(
"<svg width=" << confix('"', '"')[int_ << string]
<< " height=" << confix('"', '"')[int_ << string]
<< " version=" << confix('"', '"')[float_]
<< " xmlns=" << confix('"', '"')[string]
<< ">",
tuple<int, std::string>(width, "px"), tuple<int, std::string>(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<int, std::string>(width, "px"), tuple<int, std::string>(height, "px"), version, xmlns);
<< format(
confix('<', ">")[
"svg width=" << confix('"', '"')[int_ << string]
<< " height=" << confix('"', '"')[int_ << string]
<< " version=" << confix('"', '"')[float_]
<< " xmlns=" << confix('"', '"')[string]],
tuple<int, std::string>(width, "px"), tuple<int, std::string>(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<char> 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<int, std::string>(width, "px"), tuple<int, std::string>(height, "px"), version, xmlns);
actual_output_iterator,
confix("<", ">")[
"svg width=" << confix('"', '"')[int_ << string]
<< " height=" << confix('"', '"')[int_ << string]
<< " version=" << confix('"', '"')[float_]
<< " xmlns=" << confix('"', '"')[string]],
tuple<int, std::string>(width, "px"), tuple<int, std::string>(height, "px"), version, xmlns);
BOOST_CHECK_EQUAL(actual_output.str(), expected_output);
}

View file

@ -1,221 +1,221 @@
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT Map (Datasource | FileSource | FontSet | Layer | Style)* >
<!ATTLIST Map
bgcolor CDATA "transparent"
srs CDATA "+proj=latlong +datum=WGS84"
buffer_size CDATA "0"
minimum_version CDATA #IMPLIED
paths_from_xml (true|false) "true"
>
<!ELEMENT Datasource (Parameter)*>
<!-- Template Variant -->
<!-- name defaults to "Unnamed" -->
<!ATTLIST Datasource
name ID #IMPLIED
>
<!-- General Form -->
<!ATTLIST Datasource
base IDREF #IMPLIED
>
<!ELEMENT Parameter (#PCDATA)>
<!-- gdal type: type, encoding?, band?, file, shared?
kismet type: type, encoding, estimate_extent?, extent?, host, port
occi type: type, encoding?, estimate_extent?, extent?, geometry_field?, host, initial_size?, max_size?,
multiple_geometries, password?, row_limit?, row_prefetch?, table, use_spatial_index?, user
ogr type: type, encoding?, file, layer, multiple_geometries
osm type: type, bbox, encoding?, file, parser?, url
postgis type: type, cursor_size?, dbname, estimate_extent?, extent?, extent_from_subquery?,
geometry_field?, geometry_table?, host, initial_size?, max_size?, multiple_geometries?,
password, persist_connection?, port, row_limit?, srid?, table, user
raster type: type, base?, file, format, lox, loy, hix, hiy
shape type: type, base?, encoding?, file
sqlite type: type, base, encoding?, extent?, file, geometry_field?, key_field?, metadata?,
multiple_geometries?, row_offset?, row_limit?, table?, wkb_format?, use_spatial_index?
-->
<!ATTLIST Parameter
name (type|encoding|band|file|shared|estimate_extent|extent|host|port|
geometry_field|initial_size|max_size|multiple_geometries|password|row_limit|
row_prefetch|table|use_spatial_index|user|
layer|
bbox|parser|url|
cursor_size|dbname|extent_from_subquery|geometry_table|persist_connection|srid|
base|format|lox|loy|hix|hiy|
key_field|metadata|row_offset|wkb_format) #REQUIRED
>
<!ELEMENT FileSource (#PCDATA)>
<!ATTLIST FileSource
name CDATA #IMPLIED
>
<!ELEMENT FontSet (Font)*>
<!ATTLIST FontSet
name CDATA #IMPLIED
>
<!ELEMENT Font EMPTY>
<!ATTLIST Font
face_name CDATA #REQUIRED
>
<!ELEMENT Style (Rule)+>
<!ATTLIST Style
name ID #REQUIRED
>
<!ELEMENT Layer (StyleName|Datasource)*>
<!-- FIXME: queryable true/false ? -->
<!ATTLIST Layer
abstract CDATA #IMPLIED
clear_label_cache (yes|1|no|0) #IMPLIED
minzoom CDATA "0"
maxzoom CDATA #IMPLIED
name CDATA #IMPLIED
queryable (true|on|1|false|off|0) "0"
srs CDATA #IMPLIED
status (on|1|off|0) "1"
title CDATA ""
tolerance CDATA #IMPLIED
toleranceunits CDATA #IMPLIED
>
<!ELEMENT StyleName (#PCDATA)>
<!ELEMENT Rule ((Filter|ElseFilter)|MaxScaleDenominator|MinScaleDenominator|
BuildingSymbolizer|PointSymbolizer|LineSymbolizer|PolygonSymbolizer|PolygonPatternSymbolizer|
LinePatternSymbolizer|MarkersSymbolizer|RasterSymbolizer|ShieldSymbolizer|TextSymbolizer)*>
<!-- FIXME: MapnikXMLDescription.pdf specified name is required? -->
<!ATTLIST Rule
name CDATA #IMPLIED
title CDATA #IMPLIED
>
<!ELEMENT Filter (#PCDATA)>
<!ELEMENT ElseFilter (#PCDATA)>
<!ELEMENT MaxScaleDenominator (#PCDATA)>
<!ELEMENT MinScaleDenominator (#PCDATA)>
<!ELEMENT BuildingSymbolizer (CssParameter)*>
<!ELEMENT CssParameter (#PCDATA)>
<!ATTLIST CssParameter
name (fill|fill-opacity|height
|stroke|stroke-width|stroke-opacity|stroke-linejoin|stroke-linecap|stroke-dasharray
|gamma
|mode|opacity|scaling) #IMPLIED
>
<!ELEMENT PointSymbolizer EMPTY>
<!ATTLIST PointSymbolizer
allow_overlap (yes|true|1|no|false|0) "0"
base IDREF #IMPLIED
file CDATA #IMPLIED
height CDATA #IMPLIED
opacity CDATA #IMPLIED
type (tiff|png) #IMPLIED
width CDATA #IMPLIED
>
<!ELEMENT LineSymbolizer (CssParameter)*>
<!ELEMENT LinePatternSymbolizer EMPTY>
<!ATTLIST LinePatternSymbolizer
base IDREF #IMPLIED
file CDATA #REQUIRED
height CDATA #REQUIRED
type (tiff|png) #REQUIRED
width CDATA #REQUIRED
>
<!ELEMENT TextSymbolizer EMPTY>
<!-- FIXME: MapnikXMLDescription: horizontal_alignment "bottom" -> "middle"? -->
<!-- FIXME: label_position_tolerance not available in XML -->
<!-- FIXME: text_ratio not available in XML -->
<!ATTLIST TextSymbolizer
avoid_edges (true|false) "false"
allow_overlap (true|false) "false"
character_spacing CDATA "0"
dx CDATA "0"
dy CDATA "0"
face_name CDATA #IMPLIED
fontset_name IDREF #IMPLIED
fill CDATA "black"
force_odd_labels (true|false) "false"
halo_fill CDATA "white"
halo_radius CDATA "0"
horizontal_alignment (left|middle|right) "left"
justify_alignment (left|middle|right) "middle"
label_position_tolerance CDATA "0"
line_spacing CDATA "0"
max_char_angle_delta CDATA #IMPLIED
min_distance CDATA "0"
name CDATA #IMPLIED
opacity CDATA "1.0"
placement (point|line) "point"
size CDATA "10"
spacing CDATA "0"
text_convert (none|toupper|tolower) "none"
text_ratio CDATA #IMPLIED
vertical_alignment (top|middle|bottom) "middle"
wrap_before (true|false) "false"
wrap_character CDATA " "
wrap_width CDATA "0"
>
<!ELEMENT MarkersSymbolizer EMPTY>
<!ATTLIST MarkersSymbolizer
allow_overlap (yes|true|1|no|false|0) "0"
>
<!ELEMENT PolygonSymbolizer (CssParameter)*>
<!ELEMENT RasterSymbolizer (CssParameter)*>
<!-- FIXME: MapnikXMLDescription: horizontal_alignment "bottom" -> "middle"? -->
<!ELEMENT ShieldSymbolizer EMPTY>
<!ATTLIST ShieldSymbolizer
allow_overlap (true|false) "false"
avoid_edges (true|false) "false"
unlock_image (true|false) "false"
opacity CDATA "1.0"
base IDREF #IMPLIED
file CDATA #REQUIRED
height CDATA #REQUIRED
type (tiff|png) #REQUIRED
width CDATA #REQUIRED
character_spacing CDATA "0"
dx CDATA #IMPLIED
dy CDATA #IMPLIED
face_name CDATA #IMPLIED
fontset_name IDREF #IMPLIED
fill CDATA "black"
halo_fill CDATA "white"
halo_radius CDATA "0"
horizontal_alignment (left|middle|right) "middle"
justify_alignment (left|middle|right) "middle"
line_spacing CDATA "0"
min_distance CDATA "0"
name CDATA #IMPLIED
no_text (true|false) "false"
placement (point|line|vertex) "point"
size CDATA "10"
spacing CDATA "0"
text_convert (none|toupper|tolower) "none"
vertical_alignment (top|middle|bottom) "middle"
wrap_before (true|false) "false"
wrap_character CDATA " "
wrap_width CDATA "0"
>
<!ELEMENT PolygonPatternSymbolizer EMPTY>
<!ATTLIST PolygonPatternSymbolizer
base IDREF #IMPLIED
file CDATA #IMPLIED
height CDATA #IMPLIED
type (tiff|png) #IMPLIED
width CDATA #IMPLIED
>
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT Map (Datasource | FileSource | FontSet | Layer | Style)* >
<!ATTLIST Map
bgcolor CDATA "transparent"
srs CDATA "+proj=latlong +datum=WGS84"
buffer_size CDATA "0"
minimum_version CDATA #IMPLIED
paths_from_xml (true|false) "true"
>
<!ELEMENT Datasource (Parameter)*>
<!-- Template Variant -->
<!-- name defaults to "Unnamed" -->
<!ATTLIST Datasource
name ID #IMPLIED
>
<!-- General Form -->
<!ATTLIST Datasource
base IDREF #IMPLIED
>
<!ELEMENT Parameter (#PCDATA)>
<!-- gdal type: type, encoding?, band?, file, shared?
kismet type: type, encoding, estimate_extent?, extent?, host, port
occi type: type, encoding?, estimate_extent?, extent?, geometry_field?, host, initial_size?, max_size?,
multiple_geometries, password?, row_limit?, row_prefetch?, table, use_spatial_index?, user
ogr type: type, encoding?, file, layer, multiple_geometries
osm type: type, bbox, encoding?, file, parser?, url
postgis type: type, cursor_size?, dbname, estimate_extent?, extent?, extent_from_subquery?,
geometry_field?, geometry_table?, host, initial_size?, max_size?, multiple_geometries?,
password, persist_connection?, port, row_limit?, srid?, table, user
raster type: type, base?, file, format, lox, loy, hix, hiy
shape type: type, base?, encoding?, file
sqlite type: type, base, encoding?, extent?, file, geometry_field?, key_field?, metadata?,
multiple_geometries?, row_offset?, row_limit?, table?, wkb_format?, use_spatial_index?
-->
<!ATTLIST Parameter
name (type|encoding|band|file|shared|estimate_extent|extent|host|port|
geometry_field|initial_size|max_size|multiple_geometries|password|row_limit|
row_prefetch|table|use_spatial_index|user|
layer|
bbox|parser|url|
cursor_size|dbname|extent_from_subquery|geometry_table|persist_connection|srid|
base|format|lox|loy|hix|hiy|
key_field|metadata|row_offset|wkb_format) #REQUIRED
>
<!ELEMENT FileSource (#PCDATA)>
<!ATTLIST FileSource
name CDATA #IMPLIED
>
<!ELEMENT FontSet (Font)*>
<!ATTLIST FontSet
name CDATA #IMPLIED
>
<!ELEMENT Font EMPTY>
<!ATTLIST Font
face_name CDATA #REQUIRED
>
<!ELEMENT Style (Rule)+>
<!ATTLIST Style
name ID #REQUIRED
>
<!ELEMENT Layer (StyleName|Datasource)*>
<!-- FIXME: queryable true/false ? -->
<!ATTLIST Layer
abstract CDATA #IMPLIED
clear_label_cache (yes|1|no|0) #IMPLIED
minzoom CDATA "0"
maxzoom CDATA #IMPLIED
name CDATA #IMPLIED
queryable (true|on|1|false|off|0) "0"
srs CDATA #IMPLIED
status (on|1|off|0) "1"
title CDATA ""
tolerance CDATA #IMPLIED
toleranceunits CDATA #IMPLIED
>
<!ELEMENT StyleName (#PCDATA)>
<!ELEMENT Rule ((Filter|ElseFilter)|MaxScaleDenominator|MinScaleDenominator|
BuildingSymbolizer|PointSymbolizer|LineSymbolizer|PolygonSymbolizer|PolygonPatternSymbolizer|
LinePatternSymbolizer|MarkersSymbolizer|RasterSymbolizer|ShieldSymbolizer|TextSymbolizer)*>
<!-- FIXME: MapnikXMLDescription.pdf specified name is required? -->
<!ATTLIST Rule
name CDATA #IMPLIED
title CDATA #IMPLIED
>
<!ELEMENT Filter (#PCDATA)>
<!ELEMENT ElseFilter (#PCDATA)>
<!ELEMENT MaxScaleDenominator (#PCDATA)>
<!ELEMENT MinScaleDenominator (#PCDATA)>
<!ELEMENT BuildingSymbolizer (CssParameter)*>
<!ELEMENT CssParameter (#PCDATA)>
<!ATTLIST CssParameter
name (fill|fill-opacity|height
|stroke|stroke-width|stroke-opacity|stroke-linejoin|stroke-linecap|stroke-dasharray
|gamma
|mode|opacity|scaling) #IMPLIED
>
<!ELEMENT PointSymbolizer EMPTY>
<!ATTLIST PointSymbolizer
allow_overlap (yes|true|1|no|false|0) "0"
base IDREF #IMPLIED
file CDATA #IMPLIED
height CDATA #IMPLIED
opacity CDATA #IMPLIED
type (tiff|png) #IMPLIED
width CDATA #IMPLIED
>
<!ELEMENT LineSymbolizer (CssParameter)*>
<!ELEMENT LinePatternSymbolizer EMPTY>
<!ATTLIST LinePatternSymbolizer
base IDREF #IMPLIED
file CDATA #REQUIRED
height CDATA #REQUIRED
type (tiff|png) #REQUIRED
width CDATA #REQUIRED
>
<!ELEMENT TextSymbolizer EMPTY>
<!-- FIXME: MapnikXMLDescription: horizontal_alignment "bottom" -> "middle"? -->
<!-- FIXME: label_position_tolerance not available in XML -->
<!-- FIXME: text_ratio not available in XML -->
<!ATTLIST TextSymbolizer
avoid_edges (true|false) "false"
allow_overlap (true|false) "false"
character_spacing CDATA "0"
dx CDATA "0"
dy CDATA "0"
face_name CDATA #IMPLIED
fontset_name IDREF #IMPLIED
fill CDATA "black"
force_odd_labels (true|false) "false"
halo_fill CDATA "white"
halo_radius CDATA "0"
horizontal_alignment (left|middle|right) "left"
justify_alignment (left|middle|right) "middle"
label_position_tolerance CDATA "0"
line_spacing CDATA "0"
max_char_angle_delta CDATA #IMPLIED
min_distance CDATA "0"
name CDATA #IMPLIED
opacity CDATA "1.0"
placement (point|line) "point"
size CDATA "10"
spacing CDATA "0"
text_convert (none|toupper|tolower) "none"
text_ratio CDATA #IMPLIED
vertical_alignment (top|middle|bottom) "middle"
wrap_before (true|false) "false"
wrap_character CDATA " "
wrap_width CDATA "0"
>
<!ELEMENT MarkersSymbolizer EMPTY>
<!ATTLIST MarkersSymbolizer
allow_overlap (yes|true|1|no|false|0) "0"
>
<!ELEMENT PolygonSymbolizer (CssParameter)*>
<!ELEMENT RasterSymbolizer (CssParameter)*>
<!-- FIXME: MapnikXMLDescription: horizontal_alignment "bottom" -> "middle"? -->
<!ELEMENT ShieldSymbolizer EMPTY>
<!ATTLIST ShieldSymbolizer
allow_overlap (true|false) "false"
avoid_edges (true|false) "false"
unlock_image (true|false) "false"
opacity CDATA "1.0"
base IDREF #IMPLIED
file CDATA #REQUIRED
height CDATA #REQUIRED
type (tiff|png) #REQUIRED
width CDATA #REQUIRED
character_spacing CDATA "0"
dx CDATA #IMPLIED
dy CDATA #IMPLIED
face_name CDATA #IMPLIED
fontset_name IDREF #IMPLIED
fill CDATA "black"
halo_fill CDATA "white"
halo_radius CDATA "0"
horizontal_alignment (left|middle|right) "middle"
justify_alignment (left|middle|right) "middle"
line_spacing CDATA "0"
min_distance CDATA "0"
name CDATA #IMPLIED
no_text (true|false) "false"
placement (point|line|vertex) "point"
size CDATA "10"
spacing CDATA "0"
text_convert (none|toupper|tolower) "none"
vertical_alignment (top|middle|bottom) "middle"
wrap_before (true|false) "false"
wrap_character CDATA " "
wrap_width CDATA "0"
>
<!ELEMENT PolygonPatternSymbolizer EMPTY>
<!ATTLIST PolygonPatternSymbolizer
base IDREF #IMPLIED
file CDATA #IMPLIED
height CDATA #IMPLIED
type (tiff|png) #IMPLIED
width CDATA #IMPLIED
>