diff --git a/CHANGELOG b/CHANGELOG index 920a5bde6..c60bcb714 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,7 +3,7 @@ ---------------- Mapnik Changelog ---------------- - + A simple log of core changes affecting Mapnik usage. Developers: Please commit along with changes. @@ -18,6 +18,7 @@ Mapnik 2.1.0 - Fixed bug in shield line placement when dx/dy are used to shift the label relative to the placement point (Matt Amos) (#908) +- Added parameter in OGR plugin to select a layer by SQL query (besides name or index): see http://www.gdal.org/ogr/ogr_sql.html for specifications (kunitoki) (#472) Mapnik 2.0.0 @@ -45,7 +46,7 @@ Mapnik 2.0.0 - Added map.base parameter that can be set to control where files with relative paths should be interpreted from when a map is loaded from a string or saved to a string. It defaults to an empty string which means that the base path will be the current working directory of the mapnik process. When a stylesheet is read - from a file that files directory is used. And a custom value can still be passed as an argument to + from a file that files directory is used. And a custom value can still be passed as an argument to load_map_from_string(). - Added python function 'render_grid' to allow conversion of grid buffer to python object containing list of grid @@ -112,7 +113,7 @@ Mapnik 2.0.0 Mapnik 0.7.2 Release -------------------- - + - Added forward compatibility for Mapnik 2.0 XML syntax (https://trac.mapnik.org/wiki/Mapnik2/Changes) - Build fixes to ensure boost_threads are not used unless THREADING=multi build option is used @@ -167,9 +168,9 @@ Mapnik 0.7.0 Release * Use the gdaladdo utility to add overviews to existing GDAL datasets -- PostGIS: Added an optional 'geometry_table' parameter. The 'geometry_table' used by Mapnik to look up +- PostGIS: Added an optional 'geometry_table' parameter. The 'geometry_table' used by Mapnik to look up metadata in the geometry_columns and calculate extents (when the 'geometry_field' and 'srid' parameters - are not supplied). If 'geometry_table' is not specified Mapnik will attempt to determine the name of the + are not supplied). If 'geometry_table' is not specified Mapnik will attempt to determine the name of the table to query based on parsing the 'table' parameter, which may fail for complex queries with more than one 'from' keyword. Using this parameter should allow for existing metadata and table indexes to be used while opening the door to much more complicated subqueries being passed to the 'table' parameter without @@ -191,7 +192,7 @@ Mapnik 0.7.0 Release query to be used by indexes. (#415) * Pass the bbox token inside a subquery like: !bbox! - + * Valid Usages include: @@ -210,7 +211,7 @@ Mapnik 0.7.0 Release - PostGIS Plugin: Added support for quoted table names (r1454) (#393) -- PostGIS: Add a 'persist_connection' option (default true), that when false will release +- PostGIS: Add a 'persist_connection' option (default true), that when false will release the idle psql connection after datasource goes out of scope (r1337) (#433,#434) - PostGIS: Added support for BigInt (int8) postgres type (384) @@ -234,14 +235,14 @@ Mapnik 0.7.0 Release - PolygonSymbolizer: Added 'gamma' attribute to allow for dilation of polygon edges - a solution to gap artifacts or "ghost lines" between adjacent polygons and allows for slight sharpening of the edges of non overlapping polygons. Accepts any values but 0-1 is the recommended range. - -- TextSymbolizer: Large set of new attributes: 'text_transform', 'line_spacing', 'character_spacing', + +- TextSymbolizer: Large set of new attributes: 'text_transform', 'line_spacing', 'character_spacing', 'wrap_character', 'wrap_before', 'horizontal_alignment', 'justify_alignment', and 'opacity'. * More details at changesets: r1254 and r1341 - SheildSymbolizer: Added special new attributes: 'unlock_image', 'VERTEX' placement, 'no_text' and many - attributes previously only supported in the TextSymbolizer: 'allow_overlap', 'vertical_alignment', + attributes previously only supported in the TextSymbolizer: 'allow_overlap', 'vertical_alignment', 'horizontal_alignment', 'justify_alignment', 'wrap_width', 'wrap_character', 'wrap_before', 'text_transform', 'line_spacing', 'character_spacing', and 'opacity'. @@ -281,7 +282,7 @@ Mapnik 0.7.0 Release - Python: Ensured mapnik::config_errors now throw RuntimeError exception instead of UserWarning exception (#442) -- Filters: Added support for '!=' as an alias to '<>' for not-equals filters (avoids <>) (r1326) (#427) +- Filters: Added support for '!=' as an alias to '<>' for not-equals filters (avoids <>) (r1326) (#427) - SCons: Improved boost auto-detection (r1255,r1279) @@ -303,7 +304,7 @@ Mapnik 0.6.1 Release (Packaged from r1247) -- Plugins: expose list of registered plugins as a 'plugin_names()' method of DatasourceCache (r1180) +- Plugins: expose list of registered plugins as a 'plugin_names()' method of DatasourceCache (r1180) - XML: Fixed serialization and parsing bugs related to handling of integers and Enums (#328,#353) diff --git a/SConstruct b/SConstruct index df07632ec..e02adfc99 100644 --- a/SConstruct +++ b/SConstruct @@ -425,7 +425,6 @@ pickle_store = [# Scons internal variables 'PYTHON_INSTALL_LOCATION', 'PYTHON_SYS_PREFIX', 'COLOR_PRINT', - 'HAS_BOOST_SYSTEM', 'SVN_REVISION', 'HAS_CAIRO', 'HAS_PYCAIRO', @@ -1070,15 +1069,17 @@ if not preconfigured: env.AppendUnique(CPPPATH = os.path.realpath(inc_path)) env.AppendUnique(LIBPATH = os.path.realpath(lib_path)) - conf.parse_config('FREETYPE_CONFIG') - - # check if freetype links to bz2 - if env['RUNTIME_LINK'] == 'static': - temp_env = env.Clone() - temp_env['LIBS'] = [] - temp_env.ParseConfig('%s --libs' % env['FREETYPE_CONFIG']) - if 'bz2' in temp_env['LIBS']: - env['EXTRA_FREETYPE_LIBS'].append('bz2') + if conf.parse_config('FREETYPE_CONFIG'): + # check if freetype links to bz2 + if env['RUNTIME_LINK'] == 'static': + temp_env = env.Clone() + temp_env['LIBS'] = [] + try: + temp_env.ParseConfig('%s --libs' % env['FREETYPE_CONFIG']) + if 'bz2' in temp_env['LIBS']: + env['EXTRA_FREETYPE_LIBS'].append('bz2') + except OSError,e: + pass # libxml2 should be optional but is currently not # https://github.com/mapnik/mapnik/issues/913 @@ -1126,18 +1127,14 @@ if not preconfigured: conf.FindBoost(BOOST_SEARCH_PREFIXES,thread_flag) - # boost system is used in boost 1.35 and greater - env['HAS_BOOST_SYSTEM'] = False boost_lib_version_from_header = conf.GetBoostLibVersion() if boost_lib_version_from_header: boost_version_from_header = int(boost_lib_version_from_header.split('_')[1]) - if boost_version_from_header >= 35: - env['HAS_BOOST_SYSTEM'] = True # The other required boost headers. BOOST_LIBSHEADERS = [ - ['system', 'boost/system/system_error.hpp', env['HAS_BOOST_SYSTEM']], + ['system', 'boost/system/system_error.hpp', True], ['filesystem', 'boost/filesystem/operations.hpp', True], ['regex', 'boost/regex.hpp', True], ['program_options', 'boost/program_options.hpp', False] diff --git a/bindings/python/mapnik/__init__.py b/bindings/python/mapnik/__init__.py index 2ed760e73..d5c2b4a0c 100644 --- a/bindings/python/mapnik/__init__.py +++ b/bindings/python/mapnik/__init__.py @@ -485,10 +485,11 @@ def Ogr(**keywords): Required keyword arguments: file -- path to OGR supported dataset - layer -- name of layer to use within datasource (optional if layer_by_index is used) + layer -- name of layer to use within datasource (optional if layer_by_index or layer_by_sql is used) Optional keyword arguments: - layer_by_index -- choose layer by index number instead of by layer name. + layer_by_index -- choose layer by index number instead of by layer name or sql. + layer_by_sql -- choose layer by sql query number instead of by layer name or index. base -- path prefix (default None) encoding -- file encoding (default 'utf-8') multiple_geometries -- boolean, direct the Mapnik wkb reader to interpret as multigeometries (default False) diff --git a/demo/c++/rundemo.cpp b/demo/c++/rundemo.cpp index 4216dd677..8f4ba0a3a 100644 --- a/demo/c++/rundemo.cpp +++ b/demo/c++/rundemo.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/demo/viewer/about_dialog.cpp b/demo/viewer/about_dialog.cpp index 3594c63e1..5f6fa88f5 100644 --- a/demo/viewer/about_dialog.cpp +++ b/demo/viewer/about_dialog.cpp @@ -1,5 +1,6 @@ /* This file is part of Mapnik (c++ mapping toolkit) - * Copyright (C) 2007 Artem Pavlenko + * + * Copyright (C) 2011 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/demo/viewer/about_dialog.hpp b/demo/viewer/about_dialog.hpp index 13d71dda2..b70e27330 100644 --- a/demo/viewer/about_dialog.hpp +++ b/demo/viewer/about_dialog.hpp @@ -1,5 +1,6 @@ /* This file is part of Mapnik (c++ mapping toolkit) - * Copyright (C) 2007 Artem Pavlenko + * + * Copyright (C) 2011 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/demo/viewer/info_dialog.cpp b/demo/viewer/info_dialog.cpp index 89652c33e..92b3599d3 100644 --- a/demo/viewer/info_dialog.cpp +++ b/demo/viewer/info_dialog.cpp @@ -1,5 +1,6 @@ - /* This file is part of Mapnik (c++ mapping toolkit) - * Copyright (C) 2007 Artem Pavlenko +/* This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -35,6 +36,6 @@ info_dialog::info_dialog(QVector > const& info, QWidget * QTableWidgetItem *keyItem = new QTableWidgetItem(info[i].first); QTableWidgetItem *valueItem = new QTableWidgetItem(info[i].second); ui.tableWidget->setItem(i,0,keyItem); - ui.tableWidget->setItem(i,1,valueItem); + ui.tableWidget->setItem(i,1,valueItem); } } diff --git a/demo/viewer/info_dialog.hpp b/demo/viewer/info_dialog.hpp index f9fda8b03..81d550c8b 100644 --- a/demo/viewer/info_dialog.hpp +++ b/demo/viewer/info_dialog.hpp @@ -1,5 +1,6 @@ /* This file is part of Mapnik (c++ mapping toolkit) - * Copyright (C) 2007 Artem Pavlenko + * + * Copyright (C) 2011 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/demo/viewer/layer_info_dialog.cpp b/demo/viewer/layer_info_dialog.cpp index ec23b1ec4..c223146b4 100644 --- a/demo/viewer/layer_info_dialog.cpp +++ b/demo/viewer/layer_info_dialog.cpp @@ -1,5 +1,6 @@ /* This file is part of Mapnik (c++ mapping toolkit) - * Copyright (C) 2007 Artem Pavlenko + * + * Copyright (C) 2011 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -28,15 +29,15 @@ layer_info_dialog::layer_info_dialog(mapnik::layer& lay, QWidget *parent) : QDialog(parent) { ui.setupUi(this); - + ui.tableWidget->setHorizontalHeaderItem(0,new QTableWidgetItem("Name")); ui.tableWidget->setHorizontalHeaderItem(1,new QTableWidgetItem("Value")); - + // Layer name ui.layerNameEdit->setText(QString(lay.name().c_str())); // Named Styles : TODO!!! - + // Datasource mapnik::datasource_ptr ds = lay.datasource(); if (ds) @@ -57,10 +58,10 @@ layer_info_dialog::layer_info_dialog(mapnik::layer& lay, QWidget *parent) 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); + ui.tableWidget->setItem(index,1,valueItem); ++index; } - } + } } } diff --git a/demo/viewer/layer_info_dialog.hpp b/demo/viewer/layer_info_dialog.hpp index d9ecb8a90..4fb8730fa 100644 --- a/demo/viewer/layer_info_dialog.hpp +++ b/demo/viewer/layer_info_dialog.hpp @@ -1,5 +1,6 @@ /* This file is part of Mapnik (c++ mapping toolkit) - * Copyright (C) 2007 Artem Pavlenko + * + * Copyright (C) 2011 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/demo/viewer/layerdelegate.cpp b/demo/viewer/layerdelegate.cpp index b06a129ef..fbaf101ed 100644 --- a/demo/viewer/layerdelegate.cpp +++ b/demo/viewer/layerdelegate.cpp @@ -1,5 +1,6 @@ /* This file is part of Mapnik (c++ mapping toolkit) - * Copyright (C) 2007 Artem Pavlenko + * + * Copyright (C) 2011 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -37,7 +38,7 @@ void LayerDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, else painter->setBrush(QBrush(QColor(255, 0, 0, 64))); - + painter->drawRoundRect(option.rect,4,4); if (option.state & QStyle::State_Selected) diff --git a/demo/viewer/layerdelegate.hpp b/demo/viewer/layerdelegate.hpp index d747ebe7a..a5442a6fc 100644 --- a/demo/viewer/layerdelegate.hpp +++ b/demo/viewer/layerdelegate.hpp @@ -1,5 +1,6 @@ /* This file is part of Mapnik (c++ mapping toolkit) - * Copyright (C) 2007 Artem Pavlenko + * + * Copyright (C) 2011 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -32,11 +33,11 @@ class QPainter; class LayerDelegate : public QAbstractItemDelegate { Q_OBJECT - + 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 b8ae00766..b6dae0d20 100644 --- a/demo/viewer/layerlistmodel.cpp +++ b/demo/viewer/layerlistmodel.cpp @@ -1,5 +1,6 @@ /* This file is part of Mapnik (c++ mapping toolkit) - * Copyright (C) 2007 Artem Pavlenko + * + * Copyright (C) 2011 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -61,7 +62,7 @@ QVariant LayerListModel::data(QModelIndex const& index,int role) const { if (map_->layers().at(index.row()).isActive()) return QVariant(Qt::Checked); - else + else return QVariant(Qt::Unchecked); } else @@ -75,7 +76,7 @@ QVariant LayerListModel::headerData(int section, Qt::Orientation orientation, { if (role != Qt::DisplayRole) return QVariant(); - + if (orientation == Qt::Horizontal) return QString("TODO Column %1").arg(section); else @@ -86,22 +87,22 @@ bool LayerListModel::setData(const QModelIndex &index, const QVariant &value, int role) { if (!map_) return false; - + if (index.isValid() && role == Qt::CheckStateRole) { - int status = value.toInt(); + int status = value.toInt(); std::vector & layers = const_cast& >(map_->layers()); layers.at(index.row()).setActive(status); emit dataChanged(index, index); return true; - } + } return false; } Qt::ItemFlags LayerListModel::flags(QModelIndex const& index) const { Qt::ItemFlags flags = QAbstractItemModel::flags(index); - + if (index.isValid()) flags |= Qt::ItemIsUserCheckable; return flags; @@ -121,4 +122,4 @@ boost::optional LayerListModel::map_layer(int i) - + diff --git a/demo/viewer/layerlistmodel.hpp b/demo/viewer/layerlistmodel.hpp index 30f126ba5..52720a9ca 100644 --- a/demo/viewer/layerlistmodel.hpp +++ b/demo/viewer/layerlistmodel.hpp @@ -1,5 +1,6 @@ /* This file is part of Mapnik (c++ mapping toolkit) - * Copyright (C) 2007 Artem Pavlenko + * + * Copyright (C) 2011 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -36,10 +37,10 @@ class LayerListModel : public QAbstractListModel int rowCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role) const; QVariant headerData(int section, Qt::Orientation orientation, - int role = Qt::DisplayRole) const; + int role = Qt::DisplayRole) const; bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); - Qt::ItemFlags flags(QModelIndex const& index) const; + Qt::ItemFlags flags(QModelIndex const& index) const; boost::optional map_layer(int i); private: diff --git a/demo/viewer/layerwidget.cpp b/demo/viewer/layerwidget.cpp index c5402b53d..4affb0a2c 100644 --- a/demo/viewer/layerwidget.cpp +++ b/demo/viewer/layerwidget.cpp @@ -1,5 +1,6 @@ /* This file is part of Mapnik (c++ mapping toolkit) - * Copyright (C) 2007 Artem Pavlenko + * + * Copyright (C) 2011 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -41,7 +42,7 @@ LayerTab::LayerTab(QWidget* parent) void LayerTab::paintEvent(QPaintEvent *e) { - QListView::paintEvent(e); + QListView::paintEvent(e); } void LayerTab::dataChanged(const QModelIndex &topLeft, @@ -55,7 +56,7 @@ void LayerTab::dataChanged(const QModelIndex &topLeft, void LayerTab::selectionChanged(const QItemSelection & selected, const QItemSelection &) { QModelIndexList list = selected.indexes(); - if (list.size() != 0) + if (list.size() != 0) { std::cout << "SELECTED LAYER ->" << list[0].row() << "\n"; emit layerSelected(list[0].row()); @@ -69,7 +70,7 @@ void LayerTab::layerInfo() if (indexes.size() > 0) { qDebug("id = %d",indexes[0].row()); - + } } @@ -81,7 +82,7 @@ void LayerTab::layerInfo2(QModelIndex const& index) unsigned i = index.row(); LayerListModel * model = static_cast(this->model()); boost::optional layer = model->map_layer(i); - + if (layer) { layer_info_dialog dlg(*layer,this); @@ -91,7 +92,7 @@ void LayerTab::layerInfo2(QModelIndex const& index) StyleTab::StyleTab(QWidget*) { - + } void StyleTab::contextMenuEvent(QContextMenuEvent * event ) diff --git a/demo/viewer/layerwidget.hpp b/demo/viewer/layerwidget.hpp index 38ab77e7b..a62a91e10 100644 --- a/demo/viewer/layerwidget.hpp +++ b/demo/viewer/layerwidget.hpp @@ -1,5 +1,6 @@ /* This file is part of Mapnik (c++ mapping toolkit) - * Copyright (C) 2006 Artem Pavlenko + * + * Copyright (C) 2011 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -33,10 +34,10 @@ class LayerTab : public QListView void paintEvent(QPaintEvent *e); signals: void update_mapwidget(); - void layerSelected(int) const; + void layerSelected(int) const; public slots: - void layerInfo(); - void layerInfo2(QModelIndex const&); + void layerInfo(); + void layerInfo2(QModelIndex const&); protected slots: void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); void selectionChanged(const QItemSelection & selected, const QItemSelection &); @@ -51,4 +52,4 @@ protected: void contextMenuEvent(QContextMenuEvent * event ); }; -#endif +#endif diff --git a/demo/viewer/main.cpp b/demo/viewer/main.cpp index d4b785f7b..21f639815 100644 --- a/demo/viewer/main.cpp +++ b/demo/viewer/main.cpp @@ -1,5 +1,6 @@ /* This file is part of Mapnik (c++ mapping toolkit) - * Copyright (C) 2006 Artem Pavlenko + * + * Copyright (C) 2011 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -34,13 +35,13 @@ int main( int argc, char **argv ) { using mapnik::datasource_cache; using mapnik::freetype_engine; - + QCoreApplication::setOrganizationName("Mapnik"); QCoreApplication::setOrganizationDomain("mapnik.org"); QCoreApplication::setApplicationName("Viewer"); - + QSettings settings("viewer.ini",QSettings::IniFormat); - + // register input plug-ins QString plugins_dir = settings.value("mapnik/plugins_dir", QVariant("/usr/local/lib/mapnik2/input/")).toString(); @@ -54,8 +55,8 @@ int main( int argc, char **argv ) freetype_engine::register_fonts(font_dir.toStdString()); } settings.endArray(); - - QApplication app( argc, argv ); + + QApplication app( argc, argv ); MainWindow window; window.show(); if (argc > 1) window.open(argv[1]); @@ -82,5 +83,5 @@ int main( int argc, char **argv ) double scaling_factor = QString(argv[3]).toDouble(&ok); if (ok) window.set_scaling_factor(scaling_factor); } - return app.exec(); + return app.exec(); } diff --git a/demo/viewer/mainwindow.cpp b/demo/viewer/mainwindow.cpp index a4da2a683..d8cda56e1 100644 --- a/demo/viewer/mainwindow.cpp +++ b/demo/viewer/mainwindow.cpp @@ -1,5 +1,6 @@ /* This file is part of Mapnik (c++ mapping toolkit) - * Copyright (C) 2006 Artem Pavlenko + * + * Copyright (C) 2011 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -47,42 +48,42 @@ MainWindow::MainWindow() : filename_(), default_extent_(-20037508.3428,-20037508.3428,20037508.3428,20037508.3428) -{ +{ mapWidget_ = new MapWidget(this); - QSplitter *splitter = new QSplitter(this); + QSplitter *splitter = new QSplitter(this); QTabWidget *tabWidget=new QTabWidget; layerTab_ = new LayerTab; layerTab_->setFocusPolicy(Qt::NoFocus); layerTab_->setIconSize(QSize(16,16)); - - //LayerDelegate *delegate = new LayerDelegate(this); + + //LayerDelegate *delegate = new LayerDelegate(this); //layerTab_->setItemDelegate(delegate); //layerTab_->setItemDelegate(new QItemDelegate(this)); //layerTab_->setViewMode(QListView::IconMode); - + layerTab_->setFlow(QListView::TopToBottom); tabWidget->addTab(layerTab_,tr("Layers")); // Styles tab styleTab_ = new StyleTab; - tabWidget->addTab(styleTab_,tr("Styles")); + tabWidget->addTab(styleTab_,tr("Styles")); splitter->addWidget(tabWidget); splitter->addWidget(mapWidget_); QList list; list.push_back(200); list.push_back(600); splitter->setSizes(list); - + mapWidget_->setFocusPolicy(Qt::StrongFocus); mapWidget_->setFocus(); - + //setCentralWidget(mapWidget_); setCentralWidget(splitter); createActions(); createMenus(); createToolBars(); createContextMenu(); - + setWindowTitle(tr("Mapnik Viewer")); status=new QStatusBar(this); status->showMessage(tr("")); @@ -91,11 +92,11 @@ MainWindow::MainWindow() //connect mapview to layerlist connect(mapWidget_, SIGNAL(mapViewChanged()),layerTab_, SLOT(update())); - // slider + // slider connect(slider_,SIGNAL(valueChanged(int)),mapWidget_,SLOT(zoomToLevel(int))); - // + // connect(layerTab_,SIGNAL(update_mapwidget()),mapWidget_,SLOT(updateMap())); - connect(layerTab_,SIGNAL(layerSelected(int)), + connect(layerTab_,SIGNAL(layerSelected(int)), mapWidget_,SLOT(layerSelected(int))); } @@ -128,21 +129,21 @@ void MainWindow::open(QString const& path) { filename_ = path; } - + if (!filename_.isEmpty()) { - + load_map_file(filename_); setWindowTitle(tr("%1 - Mapnik Viewer").arg(filename_)); } - + } void MainWindow::reload() { if (!filename_.isEmpty()) { - + mapnik::box2d bbox = mapWidget_->getMap()->get_current_extent(); load_map_file(filename_); mapWidget_->zoomToBox(bbox); @@ -157,7 +158,7 @@ void MainWindow::save() initialPath, tr("%1 Files (*.xml)") .arg(QString("Mapnik definition"))); - if (!filename.isEmpty()) + if (!filename.isEmpty()) { std::cout<<"saving "<< filename.toStdString() << std::endl; mapnik::save_map(*mapWidget_->getMap(),filename.toStdString()); @@ -166,16 +167,16 @@ void MainWindow::save() void MainWindow::load_map_file(QString const& filename) { - std::cout<<"loading "<< filename.toStdString() << std::endl; + std::cout<<"loading "<< filename.toStdString() << std::endl; unsigned width = mapWidget_->width(); unsigned height = mapWidget_->height(); - boost::shared_ptr map(new mapnik::Map(width,height)); + boost::shared_ptr map(new mapnik::Map(width,height)); mapWidget_->setMap(map); - try - { + try + { mapnik::load_map(*map,filename.toStdString()); } - catch (mapnik::config_error & ex) + catch (mapnik::config_error & ex) { std::cout << ex.what() << "\n"; } @@ -195,7 +196,7 @@ void MainWindow::zoom_to_box() void MainWindow::pan() { - mapWidget_->setTool(MapWidget::Pan); + mapWidget_->setTool(MapWidget::Pan); } void MainWindow::info() @@ -240,7 +241,7 @@ void MainWindow::export_as() tr("%1 Files (*.%2);;All Files (*)") .arg(QString(fileFormat.toUpper())) .arg(QString(fileFormat))); - if (!fileName.isEmpty()) + if (!fileName.isEmpty()) { QPixmap const& pix = mapWidget_->pixmap(); pix.save(fileName); @@ -248,8 +249,8 @@ void MainWindow::export_as() } void MainWindow::print() -{ - +{ + //Q_ASSERT(mapWidget_->pixmap()); //QPrintDialog dialog(&printer, this); //if (dialog.exec()) { @@ -264,31 +265,31 @@ void MainWindow::print() } void MainWindow::createActions() -{ +{ //exportAct = new QAction(tr("&Export as ..."),this); //exportAct->setShortcut(tr("Ctrl+E")); //connect(exportAct, SIGNAL(triggered()), this, SLOT(export_as())); zoomAllAct = new QAction(QIcon(":/images/home.png"),tr("Zoom All"),this); connect(zoomAllAct, SIGNAL(triggered()), this, SLOT(zoom_all())); - + zoomBoxAct = new QAction(QIcon(":/images/zoombox.png"),tr("Zoom To Box"),this); zoomBoxAct->setCheckable(true); connect(zoomBoxAct, SIGNAL(triggered()), this, SLOT(zoom_to_box())); - + panAct = new QAction(QIcon(":/images/pan.png"),tr("Pan"),this); panAct->setCheckable(true); connect(panAct, SIGNAL(triggered()), this, SLOT(pan())); - + infoAct = new QAction(QIcon(":/images/info.png"),tr("Info"),this); infoAct->setCheckable(true); connect(infoAct, SIGNAL(triggered()), this, SLOT(info())); - + toolsGroup=new QActionGroup(this); toolsGroup->addAction(zoomBoxAct); toolsGroup->addAction(panAct); toolsGroup->addAction(infoAct); zoomBoxAct->setChecked(true); - + openAct=new QAction(tr("Open Map definition"),this); connect(openAct,SIGNAL(triggered()),this,SLOT(open())); saveAct=new QAction(tr("Save Map definition"),this); @@ -302,27 +303,27 @@ void MainWindow::createActions() connect(panUpAct, SIGNAL(triggered()), this, SLOT(pan_up())); panDownAct = new QAction(QIcon(":/images/down.png"),tr("&Pan Down"),this); connect(panDownAct, SIGNAL(triggered()), this, SLOT(pan_down())); - + reloadAct = new QAction(QIcon(":/images/reload.png"),tr("Reload"),this); connect(reloadAct, SIGNAL(triggered()), this, SLOT(reload())); - + layerInfo = new QAction(QIcon(":/images/info.png"),tr("&Layer info"),layerTab_); connect(layerInfo, SIGNAL(triggered()), layerTab_,SLOT(layerInfo())); connect(layerTab_, SIGNAL(doubleClicked(QModelIndex const&)), layerTab_,SLOT(layerInfo2(QModelIndex const&))); - foreach (QByteArray format, QImageWriter::supportedImageFormats()) + foreach (QByteArray format, QImageWriter::supportedImageFormats()) { QString text = tr("%1...").arg(QString(format).toUpper()); - + QAction *action = new QAction(text, this); action->setData(format); connect(action, SIGNAL(triggered()), this, SLOT(export_as())); exportAsActs.append(action); } - + printAct = new QAction(QIcon(":/images/print.png"),tr("&Print ..."),this); printAct->setShortcut(tr("Ctrl+E")); connect(printAct, SIGNAL(triggered()), this, SLOT(print())); - + exitAct = new QAction(tr("E&xit"), this); exitAct->setShortcut(tr("Ctrl+Q")); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); @@ -335,8 +336,8 @@ void MainWindow::createMenus() { exportMenu = new QMenu(tr("&Export As"), this); foreach (QAction *action, exportAsActs) - exportMenu->addAction(action); - + exportMenu->addAction(action); + fileMenu = new QMenu(tr("&File"),this); fileMenu->addAction(openAct); fileMenu->addAction(saveAct); @@ -345,7 +346,7 @@ void MainWindow::createMenus() fileMenu->addSeparator(); fileMenu->addAction(exitAct); menuBar()->addMenu(fileMenu); - + helpMenu = new QMenu(tr("&Help"), this); helpMenu->addAction(aboutAct); menuBar()->addMenu(helpMenu); @@ -377,10 +378,10 @@ void MainWindow::createToolBars() void MainWindow::set_default_extent(double x0,double y0, double x1, double y1) { - try + try { boost::shared_ptr map_ptr = mapWidget_->getMap(); - if (map_ptr) + if (map_ptr) { mapnik::projection prj(map_ptr->srs()); prj.forward(x0,y0); @@ -401,7 +402,7 @@ void MainWindow::set_scaling_factor(double scaling_factor) void MainWindow::zoom_all() { boost::shared_ptr map_ptr = mapWidget_->getMap(); - if (map_ptr) + if (map_ptr) { map_ptr->zoom_all(); mapnik::box2d const& ext = map_ptr->get_current_extent(); diff --git a/demo/viewer/mainwindow.hpp b/demo/viewer/mainwindow.hpp index 2d70210d5..64080cdd1 100644 --- a/demo/viewer/mainwindow.hpp +++ b/demo/viewer/mainwindow.hpp @@ -1,5 +1,6 @@ /* This file is part of Mapnik (c++ mapping toolkit) - * Copyright (C) 2006 Artem Pavlenko + * + * Copyright (C) 2011 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -67,7 +68,7 @@ private: void createToolBars(); void createContextMenu(); void load_map_file(QString const& filename); - + QString currentPath; QString filename_; diff --git a/demo/viewer/mapwidget.cpp b/demo/viewer/mapwidget.cpp index d9c72c043..eafdb7adc 100644 --- a/demo/viewer/mapwidget.cpp +++ b/demo/viewer/mapwidget.cpp @@ -1,5 +1,6 @@ /* This file is part of Mapnik (c++ mapping toolkit) - * Copyright (C) 2006 Artem Pavlenko + * + * Copyright (C) 2011 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -63,7 +64,7 @@ double scales [] = {279541132.014, 1066.36479192, 533.182395962}; -MapWidget::MapWidget(QWidget *parent) +MapWidget::MapWidget(QWidget *parent) : QWidget(parent), map_(), selected_(1), @@ -90,9 +91,9 @@ void MapWidget::setTool(eTool tool) } void MapWidget::paintEvent(QPaintEvent*) -{ +{ QPainter painter(this); - + if (drag_) { if (cur_tool_ == ZoomToBox) @@ -119,7 +120,7 @@ void MapWidget::paintEvent(QPaintEvent*) } painter.end(); } - + void MapWidget::resizeEvent(QResizeEvent * ev) { if (map_) @@ -128,10 +129,10 @@ void MapWidget::resizeEvent(QResizeEvent * ev) updateMap(); } } - + void MapWidget::mousePressEvent(QMouseEvent* e) { - if (e->button()==Qt::LeftButton) + if (e->button()==Qt::LeftButton) { if (cur_tool_ == ZoomToBox || cur_tool_==Pan) { @@ -142,17 +143,17 @@ void MapWidget::mousePressEvent(QMouseEvent* e) else if (cur_tool_==Info) { if (map_) - { + { QVector > info; - + projection map_proj(map_->srs()); // map projection double scale_denom = scale_denominator(*map_,map_proj.is_geographic()); CoordTransform t(map_->width(),map_->height(),map_->get_current_extent()); - + for (unsigned index = 0; index < map_->layer_count();++index) { if (int(index) != selectedLayer_) continue; - + layer & layer = map_->layers()[index]; if (!layer.isVisible(scale_denom)) continue; std::string name = layer.name(); @@ -163,11 +164,11 @@ void MapWidget::mousePressEvent(QMouseEvent* e) mapnik::proj_transform prj_trans(map_proj,layer_proj); //std::auto_ptr data(new mapnik::memory_datasource); mapnik::featureset_ptr fs = map_->query_map_point(index,x,y); - + if (fs) { feature_ptr feat = fs->next(); - if (feat) + if (feat) { std::map const& props = feat->props(); std::map::const_iterator itr=props.begin(); @@ -180,10 +181,10 @@ void MapWidget::mousePressEvent(QMouseEvent* e) } } typedef mapnik::coord_transform2 path_type; - + for (unsigned i=0; inum_geometries();++i) { - mapnik::geometry_type & geom = feat->get_geometry(i); + mapnik::geometry_type & geom = feat->get_geometry(i); path_type path(t,geom,prj_trans); if (geom.num_points() > 0) { @@ -208,7 +209,7 @@ void MapWidget::mousePressEvent(QMouseEvent* e) } } } - + if (info.size() > 0) { info_dialog info_dlg(info,this); @@ -216,34 +217,34 @@ void MapWidget::mousePressEvent(QMouseEvent* e) break; } } - + // remove annotation layer map_->layers().erase(remove_if(map_->layers().begin(), map_->layers().end(), bind(&layer::name,_1) == "*annotations*") , map_->layers().end()); } - } + } } - else if (e->button()==Qt::RightButton) - { + else if (e->button()==Qt::RightButton) + { //updateMap(); } } - + void MapWidget::mouseMoveEvent(QMouseEvent* e) -{ +{ if (cur_tool_ == ZoomToBox || cur_tool_==Pan) { end_x_ = e->x(); end_y_ = e->y(); update(); - } + } } void MapWidget::mouseReleaseEvent(QMouseEvent* e) { - if (e->button()==Qt::LeftButton) + if (e->button()==Qt::LeftButton) { end_x_ = e->x(); end_y_ = e->y(); @@ -252,7 +253,7 @@ void MapWidget::mouseReleaseEvent(QMouseEvent* e) drag_=false; if (map_) { - CoordTransform t(map_->width(),map_->height(),map_->get_current_extent()); + CoordTransform t(map_->width(),map_->height(),map_->get_current_extent()); box2d box = t.backward(box2d(start_x_,start_y_,end_x_,end_y_)); map_->zoom_to_box(box); updateMap(); @@ -267,7 +268,7 @@ void MapWidget::mouseReleaseEvent(QMouseEvent* e) int cy = int(0.5 * map_->height()); int dx = end_x_ - start_x_; int dy = end_y_ - start_y_; - map_->pan(cx - dx ,cy - dy); + map_->pan(cx - dx ,cy - dy); updateMap(); } } @@ -275,10 +276,10 @@ void MapWidget::mouseReleaseEvent(QMouseEvent* e) } -void MapWidget::keyPressEvent(QKeyEvent *e) +void MapWidget::keyPressEvent(QKeyEvent *e) { std::cout << "key pressed:"<< e->key()<<"\n"; - switch (e->key()) { + switch (e->key()) { case Qt::Key_Minus: zoomOut(); break; @@ -294,10 +295,10 @@ void MapWidget::keyPressEvent(QKeyEvent *e) break; case Qt::Key_Down: panDown(); - break; + break; case Qt::Key_Left: panLeft(); - break; + break; case Qt::Key_Right: panRight(); break; @@ -309,7 +310,7 @@ void MapWidget::keyPressEvent(QKeyEvent *e) break; case 51: zoomToLevel(12); - break; + break; case 52: zoomToLevel(13); break; @@ -318,7 +319,7 @@ void MapWidget::keyPressEvent(QKeyEvent *e) break; case 54: zoomToLevel(15); - break; + break; case 55: zoomToLevel(16); break; @@ -327,12 +328,12 @@ void MapWidget::keyPressEvent(QKeyEvent *e) break; case 57: zoomToLevel(18); - break; + break; default: QWidget::keyPressEvent(e); } - - + + } void MapWidget::zoomToBox(mapnik::box2d const& bbox) @@ -344,7 +345,7 @@ void MapWidget::zoomToBox(mapnik::box2d const& bbox) } } -void MapWidget::defaultView() +void MapWidget::defaultView() { if (map_) { @@ -354,7 +355,7 @@ void MapWidget::defaultView() } } -void MapWidget::zoomIn() +void MapWidget::zoomIn() { if (map_) { @@ -363,7 +364,7 @@ void MapWidget::zoomIn() } } -void MapWidget::zoomOut() +void MapWidget::zoomOut() { if (map_) { @@ -406,12 +407,12 @@ void MapWidget::panLeft() } void MapWidget::panRight() -{ +{ if (map_) { double cx = 0.5*map_->width(); double cy = 0.5*map_->height(); - map_->pan(int(cx + cx * 0.25),int(cy)); + map_->pan(int(cx + cx * 0.25),int(cy)); updateMap(); } } @@ -425,11 +426,11 @@ void MapWidget::zoomToLevel(int level) std::cerr << "scale denominator = " << scale_denom << "\n"; mapnik::box2d ext = map_->get_current_extent(); double width = static_cast(map_->width()); - double height= static_cast(map_->height()); + double height= static_cast(map_->height()); mapnik::coord2d pt = ext.center(); double res = scale_denom * 0.00028; - + mapnik::box2d box(pt.x - 0.5 * width * res, pt.y - 0.5 * height*res, pt.x + 0.5 * width * res, @@ -439,37 +440,37 @@ void MapWidget::zoomToLevel(int level) } } -void MapWidget::export_to_file(unsigned ,unsigned ,std::string const&,std::string const&) +void MapWidget::export_to_file(unsigned ,unsigned ,std::string const&,std::string const&) { //image_32 image(width,height); //agg_renderer renderer(map,image); //renderer.apply(); //image.saveToFile(filename,type); } - + void MapWidget::set_scaling_factor(double scaling_factor) { scaling_factor_ = scaling_factor; } -void MapWidget::updateMap() -{ +void MapWidget::updateMap() +{ if (map_) { unsigned width=map_->width(); unsigned height=map_->height(); - + image_32 buf(width,height); - try + try { mapnik::agg_renderer ren(*map_,buf,scaling_factor_); ren.apply(); - + QImage image((uchar*)buf.raw_data(),width,height,QImage::Format_ARGB32); pix_=QPixmap::fromImage(image.rgbSwapped()); projection prj(map_->srs()); // map projection - + box2d ext = map_->get_current_extent(); double x0 = ext.minx(); double y0 = ext.miny(); diff --git a/demo/viewer/mapwidget.hpp b/demo/viewer/mapwidget.hpp index e2d3c13d3..92cbe7322 100644 --- a/demo/viewer/mapwidget.hpp +++ b/demo/viewer/mapwidget.hpp @@ -1,5 +1,6 @@ /* This file is part of Mapnik (c++ mapping toolkit) - * Copyright (C) 2007 Artem Pavlenko + * + * Copyright (C) 2011 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -32,19 +33,19 @@ #include #include -class MapWidget : public QWidget +class MapWidget : public QWidget { Q_OBJECT - - public: - enum eTool + + public: + enum eTool { ZoomToBox = 1, Pan, Info, }; - -private: + +private: boost::shared_ptr map_; int selected_; QPixmap pix_; @@ -64,7 +65,7 @@ public: void setTool(eTool tool); boost::shared_ptr getMap(); inline QPixmap const& pixmap() const { return pix_;} - void setMap(boost::shared_ptr map); + void setMap(boost::shared_ptr map); void defaultView(); void zoomToBox(mapnik::box2d const& box); void zoomIn(); @@ -80,7 +81,7 @@ public slots: void layerSelected(int); signals: void mapViewChanged(); -protected: +protected: void paintEvent(QPaintEvent* ev); void resizeEvent(QResizeEvent* ev); void mousePressEvent(QMouseEvent* e); @@ -89,8 +90,8 @@ protected: void keyPressEvent(QKeyEvent *e); void export_to_file(unsigned width, unsigned height, - std::string const& filename, - std::string const& type); + std::string const& filename, + std::string const& type); }; #endif // MAP_WIDGET_HPP diff --git a/demo/viewer/styles_model.cpp b/demo/viewer/styles_model.cpp index aae9aa9ba..4a0fd0116 100644 --- a/demo/viewer/styles_model.cpp +++ b/demo/viewer/styles_model.cpp @@ -1,5 +1,6 @@ /* This file is part of Mapnik (c++ mapping toolkit) - * Copyright (C) 2007 Artem Pavlenko + * + * Copyright (C) 2011 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -38,60 +39,60 @@ class node : private boost::noncopyable virtual QIcon icon() const=0; virtual ~node_base() {} }; - + template struct wrap : public node_base { wrap(T const& obj) : obj_(obj) {} - + ~wrap() {} - + QString name () const { return obj_.name(); } - + QIcon icon() const { return obj_.icon(); } - + T obj_; }; - + public: - template + template node ( T const& obj, node * parent=0) : impl_(new wrap(obj)), parent_(parent) {} - + QString name() const { return impl_->name(); } - + QIcon icon() const { return impl_->icon(); } - + unsigned num_children() const { return children_.count(); } - + node * child(unsigned row) const { return children_.value(row); } - + node * parent() const { return parent_; } - + node * add_child(node * child) { children_.push_back(child); @@ -104,12 +105,12 @@ public: else return 0; } - - ~node() + + ~node() { qDeleteAll(children_); } - + private: boost::scoped_ptr impl_; QList children_; @@ -124,7 +125,7 @@ struct symbolizer_info : public boost::static_visitor boost::ignore_unused_variable_warning(sym); return QString("PointSymbolizer"); } - + QString operator() (mapnik::line_symbolizer const& sym) const { boost::ignore_unused_variable_warning(sym); @@ -148,19 +149,19 @@ struct symbolizer_info : public boost::static_visitor 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"); } - + QString operator() (mapnik::shield_symbolizer const& sym) const { boost::ignore_unused_variable_warning(sym); return QString("ShieldSymbolizer"); } - + template QString operator() (T const& ) const { @@ -200,14 +201,14 @@ struct symbolizer_icon : public boost::static_visitor QPixmap pix(48,16); pix.fill(); QPainter painter(&pix); - mapnik::stroke const& strk = sym.get_stroke(); + 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); + //painter.drawLine(12,0,8,15); return QIcon(pix); } @@ -224,13 +225,13 @@ public: symbolizer_node(mapnik::symbolizer const & sym) : sym_(sym) {} ~symbolizer_node(){} - - QString name() const + + QString name() const { //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"); @@ -248,15 +249,15 @@ public: QString name() const { mapnik::expression_ptr filter = rule_.get_filter(); - + return QString(mapnik::to_expression_string(*filter).c_str()); - } - + } + QIcon icon() const { return QIcon(":/images/filter.png"); } - + private: QString name_; mapnik::rule const& rule_; @@ -268,19 +269,19 @@ public: style_node(QString name, mapnik::feature_type_style const& style) : name_(name), style_(style) {} - + ~style_node() {} - + QString name() const { return name_; } - + QIcon icon() const { return QIcon(":/images/style.png"); } - + private: QString name_; mapnik::feature_type_style const& style_; @@ -292,26 +293,26 @@ public: explicit map_node(boost::shared_ptr map) : map_(map) {} ~map_node() {} - + QString name() const { return QString("Map"); } - + QIcon icon() const { return QIcon(":/images/map.png"); } - + private: boost::shared_ptr map_; }; StyleModel::StyleModel(boost::shared_ptr map, QObject * parent) : QAbstractItemModel(parent), - root_(new node(map_node(map))) + root_(new node(map_node(map))) { - typedef std::map style_type; + typedef std::map style_type; style_type const & styles = map->styles(); style_type::const_iterator itr = styles.begin(); style_type::const_iterator end = styles.end(); @@ -329,22 +330,22 @@ StyleModel::StyleModel(boost::shared_ptr map, QObject * parent) rule_n->add_child(new node(symbolizer_node(*itr3),rule_n)); } } - } + } } StyleModel::~StyleModel() {} -// interface +// interface QModelIndex StyleModel::index (int row, int col, QModelIndex const& parent) const { // qDebug("index() row=%d col=%d parent::internalId() = %lld", row,col,parent.internalId()); node * parent_node; - + if (!parent.isValid()) parent_node = root_.get(); else parent_node = static_cast(parent.internalPointer()); - + node * child_node = parent_node->child(row); if (child_node) return createIndex(row,col,child_node); @@ -358,7 +359,7 @@ QModelIndex StyleModel::parent (QModelIndex const& index) const node * parent_node = child_node->parent(); if (parent_node == root_.get()) return QModelIndex(); - + return createIndex(parent_node->row(),0,parent_node); } @@ -389,7 +390,7 @@ QVariant StyleModel::data(const QModelIndex & index, int role) const { if (role == Qt::DisplayRole) { - + return QVariant(cur_node->name()); } else if ( role == Qt::DecorationRole) diff --git a/demo/viewer/styles_model.hpp b/demo/viewer/styles_model.hpp index 621a3fd33..fc7626484 100644 --- a/demo/viewer/styles_model.hpp +++ b/demo/viewer/styles_model.hpp @@ -1,5 +1,6 @@ /* This file is part of Mapnik (c++ mapping toolkit) - * Copyright (C) 2007 Artem Pavlenko + * + * Copyright (C) 2011 Artem Pavlenko * * Mapnik is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -32,11 +33,11 @@ class StyleModel : public QAbstractItemModel public: StyleModel(boost::shared_ptr map, QObject * parent=0); ~StyleModel(); - // interface + // interface QModelIndex index (int row, int col, QModelIndex const& parent = QModelIndex()) const; QModelIndex parent (QModelIndex const& child) const; int rowCount( QModelIndex const& parent = QModelIndex()) const; - int columnCount( QModelIndex const& parent = QModelIndex()) const; + int columnCount( QModelIndex const& parent = QModelIndex()) const; QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const; private: //boost::shared_ptr map_; diff --git a/deps/agg/include/agg_path_storage.h b/deps/agg/include/agg_path_storage.h index 6a238aee7..9a2fd8232 100644 --- a/deps/agg/include/agg_path_storage.h +++ b/deps/agg/include/agg_path_storage.h @@ -736,7 +736,7 @@ namespace agg template void join_path(VertexSource& vs, unsigned path_id = 0) { - double x, y; + double x=0.0, y=0.0; unsigned cmd; vs.rewind(path_id); cmd = vs.vertex(&x, &y); diff --git a/deps/agg/include/agg_rasterizer_outline_aa.h b/deps/agg/include/agg_rasterizer_outline_aa.h index a06bd1e84..538321c9d 100644 --- a/deps/agg/include/agg_rasterizer_outline_aa.h +++ b/deps/agg/include/agg_rasterizer_outline_aa.h @@ -323,68 +323,65 @@ namespace agg int y2; int lprev; - if(close_polygon) + if(close_polygon && (m_src_vertices.size() >= 3)) { - if(m_src_vertices.size() >= 3) + dv.idx = 2; + + v = &m_src_vertices[m_src_vertices.size() - 1]; + x1 = v->x; + y1 = v->y; + lprev = v->len; + + v = &m_src_vertices[0]; + x2 = v->x; + y2 = v->y; + dv.lcurr = v->len; + line_parameters prev(x1, y1, x2, y2, lprev); + + v = &m_src_vertices[1]; + dv.x1 = v->x; + dv.y1 = v->y; + dv.lnext = v->len; + dv.curr = line_parameters(x2, y2, dv.x1, dv.y1, dv.lcurr); + + v = &m_src_vertices[dv.idx]; + dv.x2 = v->x; + dv.y2 = v->y; + dv.next = line_parameters(dv.x1, dv.y1, dv.x2, dv.y2, dv.lnext); + + dv.xb1 = 0; + dv.yb1 = 0; + dv.xb2 = 0; + dv.yb2 = 0; + + switch(m_line_join) { - dv.idx = 2; + case outline_no_join: + dv.flags = 3; + break; - v = &m_src_vertices[m_src_vertices.size() - 1]; - x1 = v->x; - y1 = v->y; - lprev = v->len; + case outline_miter_join: + case outline_round_join: + dv.flags = + (prev.diagonal_quadrant() == dv.curr.diagonal_quadrant()) | + ((dv.curr.diagonal_quadrant() == dv.next.diagonal_quadrant()) << 1); + break; - v = &m_src_vertices[0]; - x2 = v->x; - y2 = v->y; - dv.lcurr = v->len; - line_parameters prev(x1, y1, x2, y2, lprev); - - v = &m_src_vertices[1]; - dv.x1 = v->x; - dv.y1 = v->y; - dv.lnext = v->len; - dv.curr = line_parameters(x2, y2, dv.x1, dv.y1, dv.lcurr); - - v = &m_src_vertices[dv.idx]; - dv.x2 = v->x; - dv.y2 = v->y; - dv.next = line_parameters(dv.x1, dv.y1, dv.x2, dv.y2, dv.lnext); - - dv.xb1 = 0; - dv.yb1 = 0; - dv.xb2 = 0; - dv.yb2 = 0; - - switch(m_line_join) - { - case outline_no_join: - dv.flags = 3; - break; - - case outline_miter_join: - case outline_round_join: - dv.flags = - (prev.diagonal_quadrant() == dv.curr.diagonal_quadrant()) | - ((dv.curr.diagonal_quadrant() == dv.next.diagonal_quadrant()) << 1); - break; - - case outline_miter_accurate_join: - dv.flags = 0; - break; - } - - if((dv.flags & 1) == 0 && m_line_join != outline_round_join) - { - bisectrix(prev, dv.curr, &dv.xb1, &dv.yb1); - } - - if((dv.flags & 2) == 0 && m_line_join != outline_round_join) - { - bisectrix(dv.curr, dv.next, &dv.xb2, &dv.yb2); - } - draw(dv, 0, m_src_vertices.size()); + case outline_miter_accurate_join: + dv.flags = 0; + break; } + + if((dv.flags & 1) == 0 && m_line_join != outline_round_join) + { + bisectrix(prev, dv.curr, &dv.xb1, &dv.yb1); + } + + if((dv.flags & 2) == 0 && m_line_join != outline_round_join) + { + bisectrix(dv.curr, dv.next, &dv.xb2, &dv.yb2); + } + draw(dv, 0, m_src_vertices.size()); } else { diff --git a/deps/agg/src/agg_rounded_rect.cpp b/deps/agg/src/agg_rounded_rect.cpp index bebc06362..7f68651b7 100644 --- a/deps/agg/src/agg_rounded_rect.cpp +++ b/deps/agg/src/agg_rounded_rect.cpp @@ -78,8 +78,8 @@ namespace agg //-------------------------------------------------------------------- void rounded_rect::normalize_radius() { - double dx = fabs(m_y2 - m_y1); - double dy = fabs(m_x2 - m_x1); + double dx = fabs(m_x2 - m_x1); + double dy = fabs(m_y2 - m_y1); double k = 1.0; double t; diff --git a/docs/contributing.markdown b/docs/contributing.markdown index 722841a34..b3fba320a 100644 --- a/docs/contributing.markdown +++ b/docs/contributing.markdown @@ -15,11 +15,33 @@ Look through the code to get an idea, and do not hesitate to ask questions. Also read the design philosophy page for the motivations that lead to code decisions. +Templates are good, within reason. We seek to use templates were possible for flexible code, but not in cases where functional +patterns would be just as concise and clear. + In general we use Boost, it makes more possible in C++. It is a big build time dependency (as in time to compile against and # of headers) but ultimately compiles to small object code and is very fast (particularly spirit). It also has no dependencies itself (it's really an extension to the C++ language) so requiring it is much easier than requiring a hard dependency that itself has other dependencies. This is a big reason that we prefer AGG to Cairo as our primary renderer. Also AGG, besides producing the best visual output, strikes an excellent balance between speed and thread safety by using very lightweight objects. Cairo not so much. You will also notice that we don't use many of the standard geo libraries when we could. For instance we don't use GDAL, OGR, or GEOS anywhere in core, and only leverage them in optional plugins. We feel we can often write code that is faster and more thread safe than these libraries but that still does the job. If this ever changes we can adapt and start using these libraries or others as dependencies - nothing is nicer than standing on the shoulders of giants when it makes sense. +## Code commits best practices. + +#### Big changes - awesome as pull requests + +We love big, aggressive refactoring - but ideally in branches. Even if the changes should go directly into the mainline code and are stable, very big changes are useful to see as a group and branches are cheap. So, branch and commit then create a pull request against master so that other developers can take a quick look. This is a great way for informal code review when a full issue is not warrented. + +#### Commits that fix issues should note the issue # + + git commit plugins/input/ogr/ -m "implemented sql query in OGR plugin (closes #472)" + +#### Commits that relate to issues should reference them: + + git commit tests/python_tests/sqlite_test.py -m "more robust sqlite tests - refs #928" + +#### Commits that add a new feature or fix should be added to the CHANGELOG + +Ideally the CHANGELOG can be a very concise place to look for the most important recent development and should not read like a full commit log. So, some developers may prefer to weekly or monthly look back over their commits and summarize all at once with additions to the CHANGELOG. Other developers may prefer to add as they go. + + ## License Mapnik is licensed LGPL, which means that you are a free to use the code in any of your applications whether they be open source or not. It also means that if you contribute code to Mapnik that others are free to continue using Mapnik in the same way, even with your new additions. If you choose to redistribute an application using Mapnik just make sure to provide any source code modifications you make back to the community. For the actual details see the full LGPL license in the COPYING doc. @@ -67,13 +89,19 @@ If you see bits of code around that do not follow these please don't hesitate to #### Indentation is four spaces +#### Use C++ style casts + + static_cast(value); // yes + + (int)value; // no + #### Shared pointers should be created with [boost::make_shared](http://www.boost.org/doc/libs/1_47_0/libs/smart_ptr/make_shared.html) where possible #### Function definitions should not be separated from their arguments: - void foo(int a) { ... } // please + void foo(int a) // please - void foo (int a) { ... } // no + void foo (int a) // no #### Separate arguments by a single space: @@ -87,7 +115,18 @@ If you see bits of code around that do not follow these please don't hesitate to if(a==b) // no -#### Braces should ideally be on a separate line: +#### Braces should always be used: + + if (!file) + { + throw mapnik::datasource_exception("not found"); // please + } + + if (!file) + throw mapnik::datasource_exception("not found"); // no + + +#### Braces should be on a separate line: if (a == b) { diff --git a/include/mapnik/agg_pattern_source.hpp b/include/mapnik/agg_pattern_source.hpp index 1a9046d7d..0f24ddaf4 100644 --- a/include/mapnik/agg_pattern_source.hpp +++ b/include/mapnik/agg_pattern_source.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,15 +19,16 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef MAPNIK_AGG_PATTERN_SOURCE_HPP #define MAPNIK_AGG_PATTERN_SOURCE_HPP // mapnik #include + // boost #include + // agg #include "agg_color_rgba.h" @@ -61,4 +62,4 @@ private: }; } -#endif //MAPNIK_AGG_PATTERN_SOURCE_HPP +#endif // MAPNIK_AGG_PATTERN_SOURCE_HPP diff --git a/include/mapnik/agg_rasterizer.hpp b/include/mapnik/agg_rasterizer.hpp index 44ee4eee5..49ac23b81 100644 --- a/include/mapnik/agg_rasterizer.hpp +++ b/include/mapnik/agg_rasterizer.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,12 +19,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef MAPNIK_AGG_RASTERIZER_HPP #define MAPNIK_AGG_RASTERIZER_HPP +// boost #include + +// agg #include "agg_rasterizer_scanline_aa.h" namespace mapnik { @@ -33,4 +35,4 @@ struct rasterizer : agg::rasterizer_scanline_aa<>, boost::noncopyable {}; } -#endif //MAPNIK_AGG_RASTERIZER_HPP +#endif // MAPNIK_AGG_RASTERIZER_HPP diff --git a/include/mapnik/agg_renderer.hpp b/include/mapnik/agg_renderer.hpp index 3e5e218a5..1a74dd461 100644 --- a/include/mapnik/agg_renderer.hpp +++ b/include/mapnik/agg_renderer.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,8 @@ * *****************************************************************************/ -//$Id$ - -#ifndef AGG_RENDERER_HPP -#define AGG_RENDERER_HPP +#ifndef MAPNIK_AGG_RENDERER_HPP +#define MAPNIK_AGG_RENDERER_HPP // mapnik #include @@ -134,4 +132,4 @@ private: }; } -#endif //AGG_RENDERER_HPP +#endif // MAPNIK_AGG_RENDERER_HPP diff --git a/include/mapnik/arrow.hpp b/include/mapnik/arrow.hpp index d070427f6..93a56db67 100644 --- a/include/mapnik/arrow.hpp +++ b/include/mapnik/arrow.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,8 @@ * *****************************************************************************/ -//$Id$ - -#ifndef ARROW_HPP -#define ARROW_HPP +#ifndef MAPNIK_ARROW_HPP +#define MAPNIK_ARROW_HPP #include @@ -44,4 +42,4 @@ private: }; } -#endif // ARROW_HPP +#endif // MAPNIK_ARROW_HPP diff --git a/include/mapnik/attribute.hpp b/include/mapnik/attribute.hpp index 7a34c30ab..d4172ab9c 100644 --- a/include/mapnik/attribute.hpp +++ b/include/mapnik/attribute.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,15 +20,18 @@ * *****************************************************************************/ -//$Id$ - #ifndef MAPNIK_ATTRIBUTE_HPP #define MAPNIK_ATTRIBUTE_HPP +// mapnik +#include +// stl #include namespace mapnik { +static mapnik::value _null_value; + struct attribute { std::string name_; @@ -38,7 +41,13 @@ struct attribute template V value(F const& f) const { - return f[name_]; + typedef typename F::const_iterator const_iterator; + const_iterator itr = f.find(name_); + if (itr != f.end()) + { + return itr->second; + } + return _null_value; } std::string const& name() const { return name_;} }; diff --git a/include/mapnik/attribute_collector.hpp b/include/mapnik/attribute_collector.hpp index 9f386a582..b9b62a89c 100644 --- a/include/mapnik/attribute_collector.hpp +++ b/include/mapnik/attribute_collector.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,20 +20,20 @@ * *****************************************************************************/ -//$Id$ - -#ifndef ATTRIBUTE_COLLECTOR_HPP -#define ATTRIBUTE_COLLECTOR_HPP +#ifndef MAPNIK_ATTRIBUTE_COLLECTOR_HPP +#define MAPNIK_ATTRIBUTE_COLLECTOR_HPP // mapnik #include #include #include #include + // boost #include #include #include + // stl #include #include @@ -271,4 +271,4 @@ private: } // namespace mapnik -#endif //ATTRIBUTE_COLLECTOR_HPP +#endif // MAPNIK_ATTRIBUTE_COLLECTOR_HPP diff --git a/include/mapnik/attribute_descriptor.hpp b/include/mapnik/attribute_descriptor.hpp index 72e15839c..7ba2e665d 100644 --- a/include/mapnik/attribute_descriptor.hpp +++ b/include/mapnik/attribute_descriptor.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,8 @@ * *****************************************************************************/ -//$Id$ - -#ifndef ATTRIBUTE_DESCRIPTOR -#define ATTRIBUTE_DESCRIPTOR +#ifndef MAPNIK_ATTRIBUTE_DESCRIPTOR_HPP +#define MAPNIK_ATTRIBUTE_DESCRIPTOR_HPP #include @@ -118,4 +116,4 @@ operator << (std::basic_ostream& out, } -#endif // ATTRIBUTE_DESCRIPTOR_HPP +#endif // MAPNIK_ATTRIBUTE_DESCRIPTOR_HPP diff --git a/include/mapnik/box2d.hpp b/include/mapnik/box2d.hpp index b9e21ad35..16d7f85c4 100644 --- a/include/mapnik/box2d.hpp +++ b/include/mapnik/box2d.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,16 +20,16 @@ * *****************************************************************************/ -//$Id: box2d.hpp 39 2005-04-10 20:39:53Z pavlenko $ - #ifndef MAPNIK_BOX2D_HPP #define MAPNIK_BOX2D_HPP // mapnik #include #include + // boost #include + // stl #include diff --git a/include/mapnik/cairo_renderer.hpp b/include/mapnik/cairo_renderer.hpp index 60a79b144..821ed1334 100644 --- a/include/mapnik/cairo_renderer.hpp +++ b/include/mapnik/cairo_renderer.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2008 Tom Hughes + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,14 +20,10 @@ * *****************************************************************************/ -//$Id$ - #if defined(HAVE_CAIRO) -#ifndef CAIRO_RENDERER_HPP -#define CAIRO_RENDERER_HPP - - +#ifndef MAPNIK_CAIRO_RENDERER_HPP +#define MAPNIK_CAIRO_RENDERER_HPP // mapnik #include @@ -152,6 +148,6 @@ public: }; } -#endif +#endif // MAPNIK_CAIRO_RENDERER_HPP -#endif //CAIRO_RENDERER_HPP +#endif diff --git a/include/mapnik/color.hpp b/include/mapnik/color.hpp index a923d3223..37c10cc93 100644 --- a/include/mapnik/color.hpp +++ b/include/mapnik/color.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,8 @@ * *****************************************************************************/ -//$Id: color.hpp 39 2005-04-10 20:39:53Z pavlenko $ - -#ifndef COLOR_HPP -#define COLOR_HPP +#ifndef MAPNIK_COLOR_HPP +#define MAPNIK_COLOR_HPP // mapnik #include @@ -32,6 +30,7 @@ //boost #include #include + // stl #include @@ -141,4 +140,4 @@ public: } -#endif //COLOR_HPP +#endif // MAPNIK_COLOR_HPP diff --git a/include/mapnik/color_factory.hpp b/include/mapnik/color_factory.hpp index 15a3e07a8..c27af5fa4 100644 --- a/include/mapnik/color_factory.hpp +++ b/include/mapnik/color_factory.hpp @@ -20,8 +20,6 @@ * *****************************************************************************/ -//$Id$ - #ifndef MAPNIK_COLOR_FACTORY_HPP #define MAPNIK_COLOR_FACTORY_HPP @@ -120,4 +118,4 @@ public: #endif -#endif //MAPNIK_COLOR_FACTORY_HPP +#endif // MAPNIK_COLOR_FACTORY_HPP diff --git a/include/mapnik/config.hpp b/include/mapnik/config.hpp index 75a96fa2e..a79ade04d 100644 --- a/include/mapnik/config.hpp +++ b/include/mapnik/config.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef CONFIG_HPP -#define CONFIG_HPP +#ifndef MAPNIK_CONFIG_HPP +#define MAPNIK_CONFIG_HPP // Windows DLL support @@ -47,4 +47,5 @@ #endif #define PROJ_ENVELOPE_POINTS 20 -#endif // CONFIG_HPP + +#endif // MAPNIK_CONFIG_HPP diff --git a/include/mapnik/config_error.hpp b/include/mapnik/config_error.hpp index 933b101ed..c43169e50 100644 --- a/include/mapnik/config_error.hpp +++ b/include/mapnik/config_error.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef MAPNIK_CONFIG_ERROR_INCLUDED -#define MAPNIK_CONFIG_ERROR_INCLUDED +#ifndef MAPNIK_CONFIG_ERROR_HPP +#define MAPNIK_CONFIG_ERROR_HPP #include #include @@ -54,4 +54,4 @@ protected: }; } -#endif // MAPNIK_CONFIG_ERROR_INCLUDED +#endif // MAPNIK_CONFIG_ERROR_HPP diff --git a/include/mapnik/coord.hpp b/include/mapnik/coord.hpp index 6a5fe529d..340929801 100644 --- a/include/mapnik/coord.hpp +++ b/include/mapnik/coord.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,12 +20,13 @@ * *****************************************************************************/ -//$Id: coord.hpp 39 2005-04-10 20:39:53Z pavlenko $ - -#ifndef COORD_HPP -#define COORD_HPP +#ifndef MAPNIK_COORD_HPP +#define MAPNIK_COORD_HPP +// boost #include + +// stl #include #include @@ -187,4 +188,4 @@ operator << (std::basic_ostream& out, } } -#endif // COORD_HPP +#endif // MAPNIK_COORD_HPP diff --git a/include/mapnik/coord_array.hpp b/include/mapnik/coord_array.hpp index 45c76cab7..410e8e5d0 100644 --- a/include/mapnik/coord_array.hpp +++ b/include/mapnik/coord_array.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,13 +20,12 @@ * *****************************************************************************/ -//$Id: coord_array.hpp 39 2005-04-10 20:39:53Z pavlenko $ - -#ifndef COORD_ARRAY_HPP -#define COORD_ARRAY_HPP +#ifndef MAPNIK_COORD_ARRAY_HPP +#define MAPNIK_COORD_ARRAY_HPP //mapnik #include + // stl #include @@ -89,4 +88,4 @@ private: } -#endif //COORD_ARRAY_HPP +#endif // MAPNIK_COORD_ARRAY_HPP diff --git a/include/mapnik/css_color_grammar.hpp b/include/mapnik/css_color_grammar.hpp index 8e04011de..28166b5fb 100644 --- a/include/mapnik/css_color_grammar.hpp +++ b/include/mapnik/css_color_grammar.hpp @@ -20,22 +20,23 @@ * *****************************************************************************/ -//$Id$ - #ifndef MAPNIK_CSS_COLOR_GRAMMAR_HPP #define MAPNIK_CSS_COLOR_GRAMMAR_HPP // mapnik #include + // spirit2 #include #include #include + // phoenix #include #include #include #include + // fusion #include #include @@ -387,4 +388,4 @@ struct css_color_grammar : qi::grammar } -#endif //MAPNIK_CSS_COLOR_GRAMMAR_HPP +#endif // MAPNIK_CSS_COLOR_GRAMMAR_HPP diff --git a/include/mapnik/css_color_grammar_deprecated.hpp b/include/mapnik/css_color_grammar_deprecated.hpp index 1fdd44fb9..336dd2f56 100644 --- a/include/mapnik/css_color_grammar_deprecated.hpp +++ b/include/mapnik/css_color_grammar_deprecated.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2009 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,22 +20,23 @@ * *****************************************************************************/ -//$Id$ - -#ifndef MAPNIK_CSS_COLOR_GRAMMAR_HPP -#define MAPNIK_CSS_COLOR_GRAMMAR_HPP +#ifndef MAPNIK_CSS_COLOR_GRAMMAR_DEPRECATED_HPP +#define MAPNIK_CSS_COLOR_GRAMMAR_DEPRECATED_HPP // mapnik #include + // spirit2 #include #include #include + // phoenix #include #include #include #include + // fusion #include @@ -45,7 +46,6 @@ // stl #include - //BOOST_FUSION_ADAPT_CLASS( // mapnik::color, // (unsigned, unsigned, obj.red(), obj.set_red(val)) @@ -417,4 +417,4 @@ struct css_color_grammar : qi::grammar } -#endif //MAPNIK_CSS_COLOR_GRAMMAR_HPP +#endif // MAPNIK_CSS_COLOR_GRAMMAR_DEPRECATED_HPP diff --git a/include/mapnik/ctrans.hpp b/include/mapnik/ctrans.hpp index c0996f2b8..6fc2297f4 100644 --- a/include/mapnik/ctrans.hpp +++ b/include/mapnik/ctrans.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,10 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ -#ifndef CTRANS_HPP -#define CTRANS_HPP +#ifndef MAPNIK_CTRANS_HPP +#define MAPNIK_CTRANS_HPP // mapnik #include @@ -518,4 +517,4 @@ public: }; } -#endif //CTRANS_HPP +#endif // MAPNIK_CTRANS_HPP diff --git a/include/mapnik/datasource.hpp b/include/mapnik/datasource.hpp index f2d34e724..0495ab450 100644 --- a/include/mapnik/datasource.hpp +++ b/include/mapnik/datasource.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,9 @@ * *****************************************************************************/ -//$Id: datasource.hpp 43 2005-04-22 18:52:47Z pavlenko $ +#ifndef MAPNIK_DATASOURCE_HPP +#define MAPNIK_DATASOURCE_HPP -#ifndef DATASOURCE_HPP -#define DATASOURCE_HPP // mapnik #include #include @@ -31,9 +30,11 @@ #include #include #include + // boost #include #include + // stl #include #include @@ -142,6 +143,7 @@ typedef boost::shared_ptr datasource_ptr; delete ds; \ } \ // + } -#endif //DATASOURCE_HPP +#endif // MAPNIK_DATASOURCE_HPP diff --git a/include/mapnik/datasource_cache.hpp b/include/mapnik/datasource_cache.hpp index 4a063c826..08cb18a47 100644 --- a/include/mapnik/datasource_cache.hpp +++ b/include/mapnik/datasource_cache.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,18 +20,18 @@ * *****************************************************************************/ -//$Id: datasource_cache.hpp 39 2005-04-10 20:39:53Z pavlenko $ - -#ifndef DATASOURCE_CACHE_HPP -#define DATASOURCE_CACHE_HPP +#ifndef MAPNIK_DATASOURCE_CACHE_HPP +#define MAPNIK_DATASOURCE_CACHE_HPP // mapnik #include #include #include #include + // boost #include + // stl #include @@ -57,4 +57,4 @@ public: }; } -#endif //DATASOURCE_CACHE_HPP +#endif // MAPNIK_DATASOURCE_CACHE_HPP diff --git a/include/mapnik/distance.hpp b/include/mapnik/distance.hpp index ca1b276b7..5c1b8f7eb 100644 --- a/include/mapnik/distance.hpp +++ b/include/mapnik/distance.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,8 @@ * *****************************************************************************/ -//$Id$ - -#ifndef DISTANCE_HPP -#define DISTANCE_HPP +#ifndef MAPNIK_DISTANCE_HPP +#define MAPNIK_DISTANCE_HPP #include @@ -52,4 +50,4 @@ public: */ } -#endif // GEO_UTILS_HPP +#endif // MAPNIK_DISTANCE_HPP diff --git a/include/mapnik/ellipsoid.hpp b/include/mapnik/ellipsoid.hpp index 14ea28f50..82c3e7231 100644 --- a/include/mapnik/ellipsoid.hpp +++ b/include/mapnik/ellipsoid.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,6 @@ * *****************************************************************************/ -//$Id$ - #ifndef MAPNIK_ELLIPSOID_HPP #define MAPNIK_ELLIPSOID_HPP diff --git a/include/mapnik/enumeration.hpp b/include/mapnik/enumeration.hpp index f93cffc2c..19ffc2828 100644 --- a/include/mapnik/enumeration.hpp +++ b/include/mapnik/enumeration.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,11 +20,13 @@ * *****************************************************************************/ -#ifndef MAPNIK_ENUMERATION_INCLUDED -#define MAPNIK_ENUMERATION_INCLUDED +#ifndef MAPNIK_ENUMERATION_HPP +#define MAPNIK_ENUMERATION_HPP +// mapnik #include +// stl #include #include #include @@ -325,4 +327,4 @@ operator>>(std::istream & is, mapnik::enumeration & e) template <> std::string name ::our_name_ = #name; \ template <> bool name ::our_verified_flag_( name ::verify(__FILE__, __LINE__)); -#endif // MAPNIK_ENUMERATION_INCLUDED +#endif // MAPNIK_ENUMERATION_HPP diff --git a/include/mapnik/expression_evaluator.hpp b/include/mapnik/expression_evaluator.hpp index ad8cfad30..83dcf119a 100644 --- a/include/mapnik/expression_evaluator.hpp +++ b/include/mapnik/expression_evaluator.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2009 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,6 @@ * *****************************************************************************/ -//$Id$ - #ifndef MAPNIK_EXPRESSION_EVALUATOR_HPP #define MAPNIK_EXPRESSION_EVALUATOR_HPP @@ -43,7 +41,11 @@ struct evaluate : boost::static_visitor explicit evaluate(feature_type const& f) : feature_(f) {} - value_type operator() (value_type x) const { return x; } + value_type operator() (value_type x) const + { + return x; + } + value_type operator() (attribute const& attr) const { return attr.value(feature_); @@ -104,4 +106,4 @@ struct evaluate : boost::static_visitor } -#endif //MAPNIK_EXPRESSION_EVALUATOR_HPP +#endif // MAPNIK_EXPRESSION_EVALUATOR_HPP diff --git a/include/mapnik/expression_grammar.hpp b/include/mapnik/expression_grammar.hpp index 8f6a4f1e2..469a24a09 100644 --- a/include/mapnik/expression_grammar.hpp +++ b/include/mapnik/expression_grammar.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2009 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,6 @@ * *****************************************************************************/ -//$Id$ - #ifndef MAPNIK_EXPRESSIONS_GRAMMAR_HPP #define MAPNIK_EXPRESSIONS_GRAMMAR_HPP @@ -34,12 +32,15 @@ #include #include #include -//spirit2 + +// spirit2 #include #include -//fusion + +// fusion #include -//phoenix + +// phoenix #include #include #include @@ -222,11 +223,13 @@ struct expression_grammar : qi::grammar | '(' >> expr [_val = _1 ] >> ')' ; - attr %= '[' >> +(char_ - ']') >> ']'; + #if BOOST_VERSION > 104200 ustring %= '\'' >> no_skip[*~char_('\'')] >> '\''; + attr %= '[' >> no_skip[+~char_(']')] >> ']'; #else ustring %= '\'' >> lexeme[*(char_-'\'')] >> '\''; + attr %= '[' >> lexeme[+(char_ - ']')] >> ']'; #endif } diff --git a/include/mapnik/expression_node.hpp b/include/mapnik/expression_node.hpp index e8bbda615..c83ed795d 100644 --- a/include/mapnik/expression_node.hpp +++ b/include/mapnik/expression_node.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2009 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,12 +20,13 @@ * *****************************************************************************/ -#ifndef MAPNIK_EXPRESSION_NODE_HPP -#define MAPNIK_EXPRESSION_NODE_HPP +#ifndef MAPNIK_EXPRESSION_NODE_HPP +#define MAPNIK_EXPRESSION_NODE_HPP // mapnik #include #include + // boost #include #include diff --git a/include/mapnik/expression_string.hpp b/include/mapnik/expression_string.hpp index e55ebbf53..1f8279a87 100644 --- a/include/mapnik/expression_string.hpp +++ b/include/mapnik/expression_string.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2009 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,14 +20,13 @@ * *****************************************************************************/ -//$Id$ - #ifndef MAPNIK_EXPRESSION_STRING_HPP #define MAPNIK_EXPRESSION_STRING_HPP // mapnik #include #include + // stl #include diff --git a/include/mapnik/factory.hpp b/include/mapnik/factory.hpp index 28baa9327..71d09d703 100644 --- a/include/mapnik/factory.hpp +++ b/include/mapnik/factory.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,13 +20,12 @@ * *****************************************************************************/ -//$Id: factory.hpp 39 2005-04-10 20:39:53Z pavlenko $ - -#ifndef FACTORY_HPP -#define FACTORY_HPP +#ifndef MAPNIK_FACTORY_HPP +#define MAPNIK_FACTORY_HPP // mapnik #include + // stl #include #include @@ -89,4 +88,4 @@ public: }; } -#endif //FACTORY_HPP +#endif // MAPNIK_FACTORY_HPP diff --git a/include/mapnik/fastmath.hpp b/include/mapnik/fastmath.hpp index 78259e5a9..c5b086727 100644 --- a/include/mapnik/fastmath.hpp +++ b/include/mapnik/fastmath.hpp @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef FASTMATH_HPP -#define FASTMATH_HPP +#ifndef MAPNIK_FASTMATH_HPP +#define MAPNIK_FASTMATH_HPP /* Timings: * fast_sin(not inlined) 8.95s @@ -109,4 +109,4 @@ static inline double fast_atan2(double y, double x) return result; } -#endif // FASTMATH_HPP +#endif // MAPNIK_FASTMATH_HPP diff --git a/include/mapnik/feature.hpp b/include/mapnik/feature.hpp index 462733e3d..fd8347a3e 100644 --- a/include/mapnik/feature.hpp +++ b/include/mapnik/feature.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,9 @@ * *****************************************************************************/ -//$Id: feature.hpp 40 2005-04-13 20:20:46Z pavlenko $ +#ifndef MAPNIK_FEATURE_HPP +#define MAPNIK_FEATURE_HPP -#ifndef FEATURE_HPP -#define FEATURE_HPP // mapnik #include #include @@ -36,9 +35,9 @@ #else #include #endif - #include #include + // stl #include @@ -66,6 +65,7 @@ private: std::map props_; public: typedef std::map::iterator iterator; + typedef std::map::const_iterator const_iterator; explicit feature(int id) : properties(props_), id_(id), @@ -146,7 +146,7 @@ public: { return props_; } - + iterator begin() { return props_.begin(); @@ -156,12 +156,27 @@ public: { return props_.end(); } + + const_iterator begin() const + { + return props_.begin(); + } + const_iterator end() const + { + return props_.end(); + } + + const_iterator find(std::string const& key) const + { + return props_.find(key); + } + std::string to_string() const { std::stringstream ss; - ss << "feature (" << std::endl; - ss << " id:" << id_ << std::endl; + ss << "feature " + << id_ << " (" << std::endl; for (std::map::const_iterator itr=props_.begin(); itr != props_.end();++itr) { @@ -181,4 +196,4 @@ inline std::ostream& operator<< (std::ostream & out,Feature const& f) } } -#endif //FEATURE_HPP +#endif // MAPNIK_FEATURE_HPP diff --git a/include/mapnik/feature_factory.hpp b/include/mapnik/feature_factory.hpp index 2383e3b50..dd550a16d 100644 --- a/include/mapnik/feature_factory.hpp +++ b/include/mapnik/feature_factory.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,12 +20,13 @@ * *****************************************************************************/ -//$Id$ - -#ifndef FEATURE_FACTORY_HPP -#define FEATURE_FACTORY_HPP +#ifndef MAPNIK_FEATURE_FACTORY_HPP +#define MAPNIK_FEATURE_FACTORY_HPP +// mapnik #include + +// boost #include //#include @@ -39,8 +40,7 @@ struct feature_factory //return boost::allocate_shared(boost::fast_pool_allocator(),fid); return boost::make_shared(fid); } - }; } -#endif //FEATURE_FACTORY_HPP +#endif // MAPNIK_FEATURE_FACTORY_HPP diff --git a/include/mapnik/feature_layer_desc.hpp b/include/mapnik/feature_layer_desc.hpp index 8ae1363f5..14adb6d4e 100644 --- a/include/mapnik/feature_layer_desc.hpp +++ b/include/mapnik/feature_layer_desc.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,14 +20,13 @@ * *****************************************************************************/ -//$Id$ - -#ifndef FEATURE_LAYER_DESC_HPP -#define FEATURE_LAYER_DESC_HPP +#ifndef MAPNIK_FEATURE_LAYER_DESC_HPP +#define MAPNIK_FEATURE_LAYER_DESC_HPP // mapnik #include +// stl #include #include #include @@ -106,4 +105,4 @@ operator << (std::basic_ostream& out, } } -#endif //FEATURE_LAYER_DESC_HPP +#endif // MAPNIK_FEATURE_LAYER_DESC_HPP diff --git a/include/mapnik/feature_style_processor.hpp b/include/mapnik/feature_style_processor.hpp index 6c944d979..d0e1b3b99 100644 --- a/include/mapnik/feature_style_processor.hpp +++ b/include/mapnik/feature_style_processor.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,8 @@ * *****************************************************************************/ -//$Id$ - -#ifndef FEATURE_STYLE_PROCESSOR_HPP -#define FEATURE_STYLE_PROCESSOR_HPP +#ifndef MAPNIK_FEATURE_STYLE_PROCESSOR_HPP +#define MAPNIK_FEATURE_STYLE_PROCESSOR_HPP #include #include @@ -74,4 +72,4 @@ private: }; } -#endif //FEATURE_STYLE_PROCESSOR_HPP +#endif // MAPNIK_FEATURE_STYLE_PROCESSOR_HPP diff --git a/include/mapnik/feature_type_style.hpp b/include/mapnik/feature_type_style.hpp index 829d36c82..d1a0fc6e1 100644 --- a/include/mapnik/feature_type_style.hpp +++ b/include/mapnik/feature_type_style.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,14 +20,14 @@ * *****************************************************************************/ -//$Id$ +#ifndef MAPNIK_FEATURE_TYPE_STYLE_HPP +#define MAPNIK_FEATURE_TYPE_STYLE_HPP -#ifndef FEATURE_TYPE_STYLE_HPP -#define FEATURE_TYPE_STYLE_HPP // mapnik #include #include #include + // stl #include @@ -69,4 +69,4 @@ public: }; } -#endif //FEATURE_TYPE_STYLE_HPP +#endif // MAPNIK_FEATURE_TYPE_STYLE_HPP diff --git a/include/mapnik/fill.hpp b/include/mapnik/fill.hpp index 2762e8806..a802c4925 100644 --- a/include/mapnik/fill.hpp +++ b/include/mapnik/fill.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,17 +20,16 @@ * *****************************************************************************/ -//$Id$ - -#ifndef FILL_HPP -#define FILL_HPP +#ifndef MAPNIK_FILL_HPP +#define MAPNIK_FILL_HPP namespace mapnik { + class fill { - }; + } -#endif //FILL_HPP +#endif // MAPNIK_FILL_HPP diff --git a/include/mapnik/filter_factory.hpp b/include/mapnik/filter_factory.hpp index 79709c4f6..3e25c4014 100644 --- a/include/mapnik/filter_factory.hpp +++ b/include/mapnik/filter_factory.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006-2009 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,14 +20,13 @@ * *****************************************************************************/ -//$Id$ - #ifndef MAPNIK_FILTER_FACTORY_HPP #define MAPNIK_FILTER_FACTORY_HPP // mapnik #include #include + // stl #include @@ -41,4 +40,4 @@ MAPNIK_DECL expression_ptr parse_expression (std::string const& wkt); } -#endif //MAPNIK_FILTER_FACTORY_HPP +#endif // MAPNIK_FILTER_FACTORY_HPP diff --git a/include/mapnik/filter_featureset.hpp b/include/mapnik/filter_featureset.hpp index 866f33583..37b57803f 100644 --- a/include/mapnik/filter_featureset.hpp +++ b/include/mapnik/filter_featureset.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,11 +20,10 @@ * *****************************************************************************/ -//$Id$ - #ifndef MAPNIK_FILTER_FEATURESET_HPP #define MAPNIK_FILTER_FEATURESET_HPP +// mapnik #include namespace mapnik { @@ -54,4 +53,4 @@ private: }; } -#endif //MAPNIK_FILTER_FEATURESET_HPP +#endif // MAPNIK_FILTER_FEATURESET_HPP diff --git a/include/mapnik/font_engine_freetype.hpp b/include/mapnik/font_engine_freetype.hpp index eaa464ace..fcdbb9740 100644 --- a/include/mapnik/font_engine_freetype.hpp +++ b/include/mapnik/font_engine_freetype.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,9 @@ * *****************************************************************************/ -//$Id$ +#ifndef MAPNIK_FONT_ENGINE_FREETYPE_HPP +#define MAPNIK_FONT_ENGINE_FREETYPE_HPP -#ifndef FONT_ENGINE_FREETYPE_HPP -#define FONT_ENGINE_FREETYPE_HPP // mapnik #include #include @@ -50,7 +49,6 @@ extern "C" #include #endif - // stl #include #include @@ -121,7 +119,13 @@ public: { if (! FT_Set_Pixel_Sizes( face_, 0, size )) return true; + return false; + } + bool set_character_sizes(float size) + { + if ( !FT_Set_Char_Size(face_,0,(FT_F26Dot6)(size * (1<<6)),0,0)) + return true; return false; } @@ -186,6 +190,14 @@ public: (*face)->set_pixel_sizes(size); } } + + void set_character_sizes(float size) + { + for (std::vector::iterator face = faces_.begin(); face != faces_.end(); ++face) + { + (*face)->set_character_sizes(size); + } + } private: std::vector faces_; std::map dimension_cache_; @@ -200,7 +212,7 @@ public: void init(double radius) { - FT_Stroker_Set(s_, (FT_Fixed) radius * (1<<6), + FT_Stroker_Set(s_, (FT_Fixed) (radius * (1<<6)), FT_STROKER_LINECAP_ROUND, FT_STROKER_LINEJOIN_ROUND, 0); @@ -334,11 +346,17 @@ struct text_renderer : private boost::noncopyable halo_radius_(0.0), opacity_(1.0) {} + void set_pixel_size(unsigned size) { faces_->set_pixel_sizes(size); } - + + void set_character_size(float size) + { + faces_->set_character_sizes(size); + } + void set_fill(mapnik::color const& fill) { fill_=fill; @@ -602,4 +620,4 @@ private: }; } -#endif // FONT_ENGINE_FREETYPE_HPP +#endif // MAPNIK_FONT_ENGINE_FREETYPE_HPP diff --git a/include/mapnik/font_set.hpp b/include/mapnik/font_set.hpp index 7ce08db5e..11c73a316 100644 --- a/include/mapnik/font_set.hpp +++ b/include/mapnik/font_set.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,8 @@ * *****************************************************************************/ -//$Id$ - -#ifndef FONT_SET_HPP -#define FONT_SET_HPP +#ifndef MAPNIK_FONT_SET_HPP +#define MAPNIK_FONT_SET_HPP // mapnik #include @@ -52,4 +50,4 @@ private: }; } -#endif //FONT_SET_HPP +#endif // MAPNIK_FONT_SET_HPP diff --git a/include/mapnik/gamma.hpp b/include/mapnik/gamma.hpp index c24dfa44a..5267c3e89 100644 --- a/include/mapnik/gamma.hpp +++ b/include/mapnik/gamma.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,8 @@ * *****************************************************************************/ -//$Id: gamma.hpp 39 2005-04-10 20:39:53Z pavlenko $ - -#ifndef GAMMA_HPP -#define GAMMA_HPP +#ifndef MAPNIK_GAMMA_HPP +#define MAPNIK_GAMMA_HPP #include @@ -50,4 +48,4 @@ struct MAPNIK_DECL gamma }; } -#endif //GAMMA_HPP +#endif // MAPNIK_GAMMA_HPP diff --git a/include/mapnik/geom_util.hpp b/include/mapnik/geom_util.hpp index f01b678e8..87c91e02a 100644 --- a/include/mapnik/geom_util.hpp +++ b/include/mapnik/geom_util.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,15 +20,16 @@ * *****************************************************************************/ -//$Id: geom_util.hpp 39 2005-04-10 20:39:53Z pavlenko $ +#ifndef MAPNIK_GEOM_UTIL_HPP +#define MAPNIK_GEOM_UTIL_HPP -#ifndef GEOM_UTIL_HPP -#define GEOM_UTIL_HPP // mapnik #include #include + // boost #include + // stl #include @@ -217,4 +218,4 @@ struct filter_at_point }; } -#endif //GEOM_UTIL_HPP +#endif // MAPNIK_GEOM_UTIL_HPP diff --git a/include/mapnik/geometry.hpp b/include/mapnik/geometry.hpp index 33153b9e9..f083d5102 100644 --- a/include/mapnik/geometry.hpp +++ b/include/mapnik/geometry.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,15 +20,14 @@ * *****************************************************************************/ -//$Id: geometry.hpp 39 2005-04-10 20:39:53Z pavlenko $ - -#ifndef GEOMETRY_HPP -#define GEOMETRY_HPP +#ifndef MAPNIK_GEOMETRY_HPP +#define MAPNIK_GEOMETRY_HPP // mapnik #include #include #include + // boost #include #include @@ -392,4 +391,4 @@ typedef boost::ptr_vector geometry_containter; } -#endif //GEOMETRY_HPP +#endif // MAPNIK_GEOMETRY_HPP diff --git a/include/mapnik/global.hpp b/include/mapnik/global.hpp index 55eb6f1b1..f834552c7 100644 --- a/include/mapnik/global.hpp +++ b/include/mapnik/global.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,14 +20,13 @@ * *****************************************************************************/ -//$Id$ - -#ifndef GLOBAL_HPP -#define GLOBAL_HPP +#ifndef MAPNIK_GLOBAL_HPP +#define MAPNIK_GLOBAL_HPP // boost #include #include + // stl #include @@ -183,4 +182,4 @@ inline double round (double val) -#endif //GLOBAL_HPP +#endif // MAPNIK_GLOBAL_HPP diff --git a/include/mapnik/glyph_symbolizer.hpp b/include/mapnik/glyph_symbolizer.hpp index a45830a08..25daf62b8 100644 --- a/include/mapnik/glyph_symbolizer.hpp +++ b/include/mapnik/glyph_symbolizer.hpp @@ -1,5 +1,27 @@ -#ifndef GLYPH_SYMBOLIZER_HPP -#define GLYPH_SYMBOLIZER_HPP +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef MAPNIK_GLYPH_SYMBOLIZER_HPP +#define MAPNIK_GLYPH_SYMBOLIZER_HPP // mapnik #include @@ -190,4 +212,4 @@ private: } // end mapnik namespace -#endif +#endif // MAPNIK_GLYPH_SYMBOLIZER_HPP diff --git a/include/mapnik/gradient.hpp b/include/mapnik/gradient.hpp index a1d029e38..896765133 100644 --- a/include/mapnik/gradient.hpp +++ b/include/mapnik/gradient.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,11 +19,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ -#ifndef GRADIENT_HPP -#define GRADIENT_HPP +#ifndef MAPNIK_GRADIENT_HPP +#define MAPNIK_GRADIENT_HPP +// agg #include // mapnik @@ -104,4 +104,4 @@ private: }; } -#endif //GRADIENT_HPP +#endif // MAPNIK_GRADIENT_HPP diff --git a/include/mapnik/graphics.hpp b/include/mapnik/graphics.hpp index 421e29287..6774da392 100644 --- a/include/mapnik/graphics.hpp +++ b/include/mapnik/graphics.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,8 @@ * *****************************************************************************/ -//$Id: graphics.hpp 39 2005-04-10 20:39:53Z pavlenko $ - -#ifndef GRAPHICS_HPP -#define GRAPHICS_HPP +#ifndef MAPNIK_GRAPHICS_HPP +#define MAPNIK_GRAPHICS_HPP // mapnik #include @@ -520,4 +518,5 @@ public: } }; } -#endif //GRAPHICS_HPP + +#endif // MAPNIK_GRAPHICS_HPP diff --git a/include/mapnik/hextree.hpp b/include/mapnik/hextree.hpp index c9f1265e5..9c42d5798 100644 --- a/include/mapnik/hextree.hpp +++ b/include/mapnik/hextree.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,10 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ -#ifndef _HEXTREE_HPP_ -#define _HEXTREE_HPP_ +#ifndef MAPNIK_HEXTREE_HPP +#define MAPNIK_HEXTREE_HPP // mapnik #include @@ -455,4 +454,4 @@ private: }; } // namespace mapnik -#endif // _HEXTREE_HPP_ +#endif // MAPNIK_HEXTREE_HPP diff --git a/include/mapnik/hit_test_filter.hpp b/include/mapnik/hit_test_filter.hpp index 702d7d250..67c3837ca 100644 --- a/include/mapnik/hit_test_filter.hpp +++ b/include/mapnik/hit_test_filter.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,11 +20,10 @@ * *****************************************************************************/ -//$Id$ - -#ifndef HIT_TEST_FILTER_HPP -#define HIT_TEST_FILTER_HPP +#ifndef MAPNIK_HIT_TEST_FILTER_HPP +#define MAPNIK_HIT_TEST_FILTER_HPP +// mapnik #include namespace mapnik { @@ -54,4 +53,4 @@ private: }; } -#endif // HIT_TEST_FILTER_HPP +#endif // MAPNIK_HIT_TEST_FILTER_HPP diff --git a/include/mapnik/image_compositing.hpp b/include/mapnik/image_compositing.hpp index adf5df9ab..dcd35676e 100644 --- a/include/mapnik/image_compositing.hpp +++ b/include/mapnik/image_compositing.hpp @@ -20,10 +20,8 @@ * *****************************************************************************/ -//$Id$ - -#ifndef IMAGE_COMPOSITING_HPP -#define IMAGE_COMPOSITING_HPP +#ifndef MAPNIK_IMAGE_COMPOSITING_HPP +#define MAPNIK_IMAGE_COMPOSITING_HPP // agg #include "agg_rendering_buffer.h" @@ -186,4 +184,4 @@ void composite(T1 & im, T2 & im2, composite_mode_e mode) } -#endif // IMAGE_COMPOSITING_HPP +#endif // MAPNIK_IMAGE_COMPOSITING_HPP diff --git a/include/mapnik/image_data.hpp b/include/mapnik/image_data.hpp index 3b8de2bea..d381f1393 100644 --- a/include/mapnik/image_data.hpp +++ b/include/mapnik/image_data.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,12 +20,13 @@ * *****************************************************************************/ -//$Id: image_data.hpp 39 2005-04-10 20:39:53Z pavlenko $ - -#ifndef IMAGE_DATA_HPP -#define IMAGE_DATA_HPP +#ifndef MAPNIK_IMAGE_DATA_HPP +#define MAPNIK_IMAGE_DATA_HPP +// mapnik #include + +// stl #include #include @@ -139,4 +140,4 @@ typedef ImageData image_data_32; typedef ImageData image_data_8; } -#endif //IMAGE_DATA_HPP +#endif // MAPNIK_IMAGE_DATA_HPP diff --git a/include/mapnik/image_reader.hpp b/include/mapnik/image_reader.hpp index 36074ea9f..144863c1e 100644 --- a/include/mapnik/image_reader.hpp +++ b/include/mapnik/image_reader.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,13 +20,13 @@ * *****************************************************************************/ -//$Id: image_reader.hpp 39 2005-04-10 20:39:53Z pavlenko $ +#ifndef MAPNIK_IMAGE_READER_HPP +#define MAPNIK_IMAGE_READER_HPP -#ifndef IMAGE_READER_HPP -#define IMAGE_READER_HPP // mapnik #include #include + // stl #include #include @@ -63,4 +63,4 @@ MAPNIK_DECL image_reader* get_image_reader(const std::string& file); } -#endif //IMAGE_READER_HPP +#endif // MAPNIK_IMAGE_READER_HPP diff --git a/include/mapnik/image_util.hpp b/include/mapnik/image_util.hpp index 2f8aff77d..604b34b78 100644 --- a/include/mapnik/image_util.hpp +++ b/include/mapnik/image_util.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,8 @@ * *****************************************************************************/ -//$Id: image_util.hpp 39 2005-04-10 20:39:53Z pavlenko $ - -#ifndef IMAGE_UTIL_HPP -#define IMAGE_UTIL_HPP +#ifndef MAPNIK_IMAGE_UTIL_HPP +#define MAPNIK_IMAGE_UTIL_HPP // mapnik #include @@ -292,10 +290,13 @@ template MAPNIK_DECL std::string save_to_string(image_data_32 con rgba_palette const&); template MAPNIK_DECL std::string save_to_string > (image_view const&, - std::string const&, + std::string const&); + +template MAPNIK_DECL std::string save_to_string > (image_view const&, + std::string const&, rgba_palette const&); #endif } -#endif //IMAGE_UTIL_HPP +#endif // MAPNIK_IMAGE_UTIL_HPP diff --git a/include/mapnik/image_view.hpp b/include/mapnik/image_view.hpp index 45498b204..c942d17d2 100644 --- a/include/mapnik/image_view.hpp +++ b/include/mapnik/image_view.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,11 +20,8 @@ * *****************************************************************************/ -//$Id$ - -#ifndef IMAGE_VIEW_HPP -#define IMAGE_VIEW_HPP - +#ifndef MAPNIK_IMAGE_VIEW_HPP +#define MAPNIK_IMAGE_VIEW_HPP namespace mapnik { @@ -107,5 +104,5 @@ private: }; } -#endif // IMAGE_VIEW_HPP +#endif // MAPNIK_IMAGE_VIEW_HPP diff --git a/include/mapnik/jpeg_io.hpp b/include/mapnik/jpeg_io.hpp index 33a7fba74..f5d96bc71 100644 --- a/include/mapnik/jpeg_io.hpp +++ b/include/mapnik/jpeg_io.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,6 @@ * *****************************************************************************/ -//$Id$ - #ifndef MAPNIK_JPEG_IO_HPP #define MAPNIK_JPEG_IO_HPP diff --git a/include/mapnik/label_collision_detector.hpp b/include/mapnik/label_collision_detector.hpp index b9da67595..48de5f647 100644 --- a/include/mapnik/label_collision_detector.hpp +++ b/include/mapnik/label_collision_detector.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,13 +20,12 @@ * *****************************************************************************/ -//$Id$ - -#ifndef LABEL_COLLISION_DETECTOR_HPP -#define LABEL_COLLISION_DETECTOR_HPP +#ifndef MAPNIK_LABEL_COLLISION_DETECTOR_HPP +#define MAPNIK_LABEL_COLLISION_DETECTOR_HPP // mapnik #include + // stl #include #include @@ -233,4 +232,4 @@ public: }; } -#endif // LABEL_COLLISION_DETECTOR_HPP +#endif // MAPNIK_LABEL_COLLISION_DETECTOR_HPP diff --git a/include/mapnik/label_placement.hpp b/include/mapnik/label_placement.hpp index c1bdbad96..a667516a9 100644 --- a/include/mapnik/label_placement.hpp +++ b/include/mapnik/label_placement.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,10 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ -#ifndef LABEL_PLACEMENT_HPP -#define LABEL_PLACEMENT_HPP +#ifndef MAPNIK_LABEL_PLACEMENT_HPP +#define MAPNIK_LABEL_PLACEMENT_HPP namespace mapnik { @@ -51,4 +50,4 @@ public: }; } -#endif //LABEL_PLACEMENT_HPP +#endif // MAPNIK_LABEL_PLACEMENT_HPP diff --git a/include/mapnik/layer.hpp b/include/mapnik/layer.hpp index d4d4c7ea4..337bc1872 100644 --- a/include/mapnik/layer.hpp +++ b/include/mapnik/layer.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,10 +19,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id: layer.hpp 39 2005-04-10 20:39:53Z pavlenko $ -#ifndef LAYER_HPP -#define LAYER_HPP +#ifndef MAPNIK_LAYER_HPP +#define MAPNIK_LAYER_HPP + // mapnik #include #include @@ -217,4 +217,4 @@ private: }; } -#endif //LAYER_HPP +#endif // MAPNIK_LAYER_HPP diff --git a/include/mapnik/libxml2_loader.hpp b/include/mapnik/libxml2_loader.hpp index d81e14187..c4e5ca893 100644 --- a/include/mapnik/libxml2_loader.hpp +++ b/include/mapnik/libxml2_loader.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,11 +20,13 @@ * *****************************************************************************/ -#ifndef LIBXML2_LOADER_INCLUDED -#define LIBXML2_LOADER_INCLUDED +#ifndef MAPNIK_LIBXML2_LOADER_HPP +#define MAPNIK_LIBXML2_LOADER_HPP +// boost #include +// stl #include namespace mapnik @@ -33,4 +35,4 @@ void read_xml2( std::string const & filename, boost::property_tree::ptree & pt); void read_xml2_string( std::string const & str, boost::property_tree::ptree & pt, std::string const & base_path=""); } -#endif // LIBXML2_LOADER_INCLUDED +#endif // MAPNIK_LIBXML2_LOADER_HPP diff --git a/include/mapnik/line_pattern_symbolizer.hpp b/include/mapnik/line_pattern_symbolizer.hpp index 88cea4082..8a65bf043 100644 --- a/include/mapnik/line_pattern_symbolizer.hpp +++ b/include/mapnik/line_pattern_symbolizer.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,10 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id: polygon_symbolizer.hpp 39 2005-04-10 20:39:53Z pavlenko $ -#ifndef LINE_PATTERN_SYMBOLIZER_HPP -#define LINE_PATTERN_SYMBOLIZER_HPP +#ifndef MAPNIK_LINE_PATTERN_SYMBOLIZER_HPP +#define MAPNIK_LINE_PATTERN_SYMBOLIZER_HPP // mapnik #include @@ -38,4 +37,4 @@ struct MAPNIK_DECL line_pattern_symbolizer : }; } -#endif // LINE_PATTERN_SYMBOLIZER_HPP +#endif // MAPNIK_LINE_PATTERN_SYMBOLIZER_HPP diff --git a/include/mapnik/line_symbolizer.hpp b/include/mapnik/line_symbolizer.hpp index e76eccbb2..39df6685d 100644 --- a/include/mapnik/line_symbolizer.hpp +++ b/include/mapnik/line_symbolizer.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,11 +19,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id: line_symbolizer.hpp 39 2005-04-10 20:39:53Z pavlenko $ -#ifndef LINE_SYMBOLIZER_HPP -#define LINE_SYMBOLIZER_HPP +#ifndef MAPNIK_LINE_SYMBOLIZER_HPP +#define MAPNIK_LINE_SYMBOLIZER_HPP +// mapnik #include #include #include @@ -82,4 +82,4 @@ private: }; } -#endif //LINE_SYMBOLIZER_HPP +#endif // MAPNIK_LINE_SYMBOLIZER_HPP diff --git a/include/mapnik/load_map.hpp b/include/mapnik/load_map.hpp index 84d35a19f..3a22c6f93 100644 --- a/include/mapnik/load_map.hpp +++ b/include/mapnik/load_map.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,16 +19,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -// $Id$ -#ifndef MAP_LOADER_HPP -#define MAP_LOADER_HPP +#ifndef MAPNIK_LOAD_MAP_HPP +#define MAPNIK_LOAD_MAP_HPP #ifdef HAVE_CONFIG_H #include #endif +// mapnik #include + +// stl #include namespace mapnik @@ -37,4 +39,4 @@ MAPNIK_DECL void load_map(Map & map, std::string const& filename, bool strict = MAPNIK_DECL void load_map_string(Map & map, std::string const& str, bool strict = false, std::string const& base_path=""); } -#endif // LOAD_MAP_HPP +#endif // MAPNIK_LOAD_MAP_HPP diff --git a/include/mapnik/map.hpp b/include/mapnik/map.hpp index 9cc58116f..2be677e24 100644 --- a/include/mapnik/map.hpp +++ b/include/mapnik/map.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,10 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id: map.hpp 39 2005-04-10 20:39:53Z pavlenko $ -#ifndef MAP_HPP -#define MAP_HPP +#ifndef MAPNIK_MAP_HPP +#define MAPNIK_MAP_HPP #ifdef HAVE_CONFIG_H #include @@ -461,4 +460,4 @@ private: DEFINE_ENUM(aspect_fix_mode_e,Map::aspect_fix_mode); } -#endif //MAP_HPP +#endif // MAPNIK_MAP_HPP diff --git a/include/mapnik/mapped_memory_cache.hpp b/include/mapnik/mapped_memory_cache.hpp index b143a6f30..d6bb27f5c 100644 --- a/include/mapnik/mapped_memory_cache.hpp +++ b/include/mapnik/mapped_memory_cache.hpp @@ -20,21 +20,19 @@ * *****************************************************************************/ -//$Id$ - -#ifndef MEMORY_REGION_CACHE_HPP -#define MEMORY_REGION_CACHE_HPP +#ifndef MAPNIK_MAPPED_MEMORY_CACHE_HPP +#define MAPNIK_MAPPED_MEMORY_CACHE_HPP // mapnik #include #include + // boost #include #include #include #include #include - #ifdef MAPNIK_THREADSAFE #include #endif @@ -61,5 +59,5 @@ struct MAPNIK_DECL mapped_memory_cache : } -#endif // MAPNIK_MARKER_CACHE_HPP +#endif // MAPNIK_MAPPED_MEMORY_CACHE_HPP diff --git a/include/mapnik/marker.hpp b/include/mapnik/marker.hpp index 1fd9918ca..571180ecd 100644 --- a/include/mapnik/marker.hpp +++ b/include/mapnik/marker.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,18 +20,19 @@ * *****************************************************************************/ -//$Id: image_data.hpp 39 2005-04-10 20:39:53Z pavlenko $ - -#ifndef MARKER_HPP -#define MARKER_HPP +#ifndef MAPNIK_MARKER_HPP +#define MAPNIK_MARKER_HPP +// mapnik #include #include #include #include #include +// agg #include "agg_path_storage.h" + // boost #include #include @@ -39,6 +40,7 @@ #include #include +// stl #include #include @@ -125,4 +127,4 @@ private: } -#endif //MARKER_HPP +#endif // MAPNIK_MARKER_HPP diff --git a/include/mapnik/marker_cache.hpp b/include/mapnik/marker_cache.hpp index 9c8c620fb..7595334ea 100644 --- a/include/mapnik/marker_cache.hpp +++ b/include/mapnik/marker_cache.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2009 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,6 @@ * *****************************************************************************/ -//$Id$ - #ifndef MAPNIK_MARKER_CACHE_HPP #define MAPNIK_MARKER_CACHE_HPP @@ -32,8 +30,10 @@ #include #include #include + // agg #include "agg_path_storage.h" + // boost #include #include diff --git a/include/mapnik/markers_placement.hpp b/include/mapnik/markers_placement.hpp index d2519af61..259fd4ae4 100644 --- a/include/mapnik/markers_placement.hpp +++ b/include/mapnik/markers_placement.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Hermann Kraus + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,13 +20,19 @@ * *****************************************************************************/ -#ifndef MARKERS_PLACEMENT_HPP -#define MARKERS_PLACEMENT_HPP +#ifndef MAPNIK_MARKERS_PLACEMENT_HPP +#define MAPNIK_MARKERS_PLACEMENT_HPP +// agg #include "agg_basics.h" + +// mapnik #include +// boost #include + +// stl #include namespace mapnik { @@ -242,5 +248,7 @@ template box2d markers_placement(x1_, y1_, x2_, y2_); } -} /* end namespace */ -#endif // MARKERS_PLACEMENT_HPP + +} + +#endif // MAPNIK_MARKERS_PLACEMENT_HPP diff --git a/include/mapnik/markers_symbolizer.hpp b/include/mapnik/markers_symbolizer.hpp index 507519157..09d568cca 100644 --- a/include/mapnik/markers_symbolizer.hpp +++ b/include/mapnik/markers_symbolizer.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,8 @@ * *****************************************************************************/ -//$Id$ - -#ifndef MARKERS_SYMBOLIZER_HPP -#define MARKERS_SYMBOLIZER_HPP +#ifndef MAPNIK_MARKERS_SYMBOLIZER_HPP +#define MAPNIK_MARKERS_SYMBOLIZER_HPP //mapnik #include @@ -92,4 +90,4 @@ private: } -#endif // MARKERS_SYMBOLIZER_HPP +#endif // MAPNIK_MARKERS_SYMBOLIZER_HPP diff --git a/include/mapnik/memory.hpp b/include/mapnik/memory.hpp index 71ac50d9f..ecdb05dcc 100644 --- a/include/mapnik/memory.hpp +++ b/include/mapnik/memory.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,11 +19,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id: memory.hpp 39 2005-04-10 20:39:53Z pavlenko $ -#ifndef MEMORY_HPP -#define MEMORY_HPP +#ifndef MAPNIK_MEMORY_HPP +#define MAPNIK_MEMORY_HPP +// stl #include #include @@ -85,4 +85,4 @@ public: }; } -#endif //MEMORY_HPP +#endif // MAPNIK_MEMORY_HPP diff --git a/include/mapnik/memory_datasource.hpp b/include/mapnik/memory_datasource.hpp index f344ff1d7..4a51b46a2 100644 --- a/include/mapnik/memory_datasource.hpp +++ b/include/mapnik/memory_datasource.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,13 +20,14 @@ * *****************************************************************************/ -//$Id$ - -#ifndef MEMORY_DATASOURCE_HPP -#define MEMORY_DATASOURCE_HPP +#ifndef MAPNIK_MEMORY_DATASOURCE_HPP +#define MAPNIK_MEMORY_DATASOURCE_HPP +// mapnik #include #include + +// stl #include namespace mapnik { @@ -65,4 +66,4 @@ private: }; } -#endif // MEMORY_DATASOURCE_HPP +#endif // MAPNIK_MEMORY_DATASOURCE_HPP diff --git a/include/mapnik/memory_featureset.hpp b/include/mapnik/memory_featureset.hpp index 116e1f350..2b6557521 100644 --- a/include/mapnik/memory_featureset.hpp +++ b/include/mapnik/memory_featureset.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,11 +20,13 @@ * *****************************************************************************/ -//$Id$ -#ifndef MEMORY_FEATURESET_HPP -#define MEMORY_FEATURESET_HPP +#ifndef MAPNIK_MEMORY_FEATURESET_HPP +#define MAPNIK_MEMORY_FEATURESET_HPP +// mapnik #include + +// boost #include namespace mapnik { @@ -73,4 +75,4 @@ private: }; } -#endif // MEMORY_FEATURESET_HPP +#endif // MAPNIK_MEMORY_FEATURESET_HPP diff --git a/include/mapnik/metawriter.hpp b/include/mapnik/metawriter.hpp index 3549e4f8e..fa324cecf 100644 --- a/include/mapnik/metawriter.hpp +++ b/include/mapnik/metawriter.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Hermann Kraus + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,21 +20,21 @@ * *****************************************************************************/ +#ifndef MAPNIK_METAWRITER_HPP +#define MAPNIK_METAWRITER_HPP -#ifndef METAWRITER_HPP -#define METAWRITER_HPP - -// Mapnik +// mapnik #include #include #include -// Boost +// boost #include #include #include #include -// STL + +// stl #include #include @@ -47,11 +47,22 @@ struct placement; class metawriter_property_map { public: + typedef std::map property_map; + typedef property_map::const_iterator const_iterator; + metawriter_property_map() {} UnicodeString const& operator[](std::string const& key) const; UnicodeString& operator[](std::string const& key) {return m_[key];} + std::map::const_iterator find(std::string const& key) const + { + return m_.find(key); + } + std::map::const_iterator end() const + { + return m_.end(); + } private: - std::map m_; + property_map m_; UnicodeString not_found_; }; @@ -139,4 +150,4 @@ typedef std::pair metawriter_with_propert } -#endif +#endif // MAPNIK_METAWRITER_HPP diff --git a/include/mapnik/metawriter_factory.hpp b/include/mapnik/metawriter_factory.hpp index d9c4fffe0..cb0150fd4 100644 --- a/include/mapnik/metawriter_factory.hpp +++ b/include/mapnik/metawriter_factory.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2011 MapQuest + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,8 @@ * *****************************************************************************/ - -#ifndef METAWRITER_FACTORY_HPP -#define METAWRITER_FACTORY_HPP +#ifndef MAPNIK_METAWRITER_FACTORY_HPP +#define MAPNIK_METAWRITER_FACTORY_HPP // mapnik #include @@ -51,5 +50,5 @@ void metawriter_save( } -#endif /* METAWRITER_FACTORY_HPP */ +#endif // MAPNIK_METAWRITER_FACTORY_HPP diff --git a/include/mapnik/metawriter_inmem.hpp b/include/mapnik/metawriter_inmem.hpp index 278ffea44..5fb00d624 100644 --- a/include/mapnik/metawriter_inmem.hpp +++ b/include/mapnik/metawriter_inmem.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2011 MapQuest + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,8 @@ * *****************************************************************************/ - -#ifndef METAWRITER_INMEM_HPP -#define METAWRITER_INMEM_HPP +#ifndef MAPNIK_METAWRITER_INMEM_HPP +#define MAPNIK_METAWRITER_INMEM_HPP // mapnik #include @@ -117,4 +116,4 @@ typedef boost::shared_ptr metawriter_inmem_ptr; } -#endif /* METAWRITER_INMEM_HPP */ +#endif // MAPNIK_METAWRITER_INMEM_HPP diff --git a/include/mapnik/metawriter_json.hpp b/include/mapnik/metawriter_json.hpp index f46a7393c..eb7ae8ca9 100644 --- a/include/mapnik/metawriter_json.hpp +++ b/include/mapnik/metawriter_json.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Hermann Kraus + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,9 +20,8 @@ * *****************************************************************************/ - -#ifndef METAWRITER_JSON_HPP -#define METAWRITER_JSON_HPP +#ifndef MAPNIK_METAWRITER_JSON_HPP +#define MAPNIK_METAWRITER_JSON_HPP // mapnik #include @@ -150,4 +149,4 @@ typedef boost::shared_ptr metawriter_json_ptr; } -#endif +#endif // MAPNIK_METAWRITER_JSON_HPP diff --git a/include/mapnik/octree.hpp b/include/mapnik/octree.hpp index fc08302aa..755fbb3cc 100644 --- a/include/mapnik/octree.hpp +++ b/include/mapnik/octree.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,10 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ -#ifndef _OCTREE_HPP_ -#define _OCTREE_HPP_ +#ifndef MAPNIK_OCTREE_HPP +#define MAPNIK_OCTREE_HPP // mapnik #include @@ -303,6 +302,7 @@ public: private: node * root_; }; + } // namespace mapnik -#endif /* _OCTREE_HPP_ */ +#endif // MAPNIK_OCTREE_HPP diff --git a/include/mapnik/palette.hpp b/include/mapnik/palette.hpp index 18b433b30..ea1f66a33 100644 --- a/include/mapnik/palette.hpp +++ b/include/mapnik/palette.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,11 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ - -#ifndef _PALETTE_HPP_ -#define _PALETTE_HPP_ +#ifndef MAPNIK_PALETTE_HPP +#define MAPNIK_PALETTE_HPP // mapnik #include @@ -164,5 +162,5 @@ private: } // namespace mapnik -#endif // _PALETTE_HPP_ +#endif // MAPNIK_PALETTE_HPP diff --git a/include/mapnik/params.hpp b/include/mapnik/params.hpp index 4590d3b38..97f4fd4f6 100644 --- a/include/mapnik/params.hpp +++ b/include/mapnik/params.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,15 +19,17 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id: params.hpp 39 2005-04-10 20:39:53Z pavlenko $ -#ifndef PARAMS_HPP -#define PARAMS_HPP +#ifndef MAPNIK_PARAMS_HPP +#define MAPNIK_PARAMS_HPP +// mapnik #include #include #include #include + +// stl #include #include @@ -100,4 +102,4 @@ public: }; } -#endif //PARAMS_HPP +#endif // MAPNIK_PARAMS_HPP diff --git a/include/mapnik/parse_path.hpp b/include/mapnik/parse_path.hpp index 4434ec2bf..250a175ef 100644 --- a/include/mapnik/parse_path.hpp +++ b/include/mapnik/parse_path.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -28,10 +28,12 @@ #include #include #include + // boost #include #include #include + // stl #include #include @@ -140,4 +142,4 @@ typedef mapnik::path_processor path_processor_type; } -#endif //MAPNIK_PARSE_PATH_HPP +#endif // MAPNIK_PARSE_PATH_HPP diff --git a/include/mapnik/path_expression_grammar.hpp b/include/mapnik/path_expression_grammar.hpp index eae2ed7aa..632745dad 100644 --- a/include/mapnik/path_expression_grammar.hpp +++ b/include/mapnik/path_expression_grammar.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2009 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,6 @@ * *****************************************************************************/ -//$Id$ - #ifndef MAPNIK_PATH_EXPRESSIONS_GRAMMAR_HPP #define MAPNIK_PATH_EXPRESSIONS_GRAMMAR_HPP @@ -29,22 +27,26 @@ #include #include #include + // boost #include #include -//spirit2 +// spirit2 #include #include -//fusion + +// fusion #include -//phoenix + +// phoenix #include #include #include #include #include #include + // stl #include #include @@ -56,11 +58,9 @@ namespace qi = boost::spirit::qi; namespace phoenix = boost::phoenix; namespace standard_wide = boost::spirit::standard_wide; -// using standard_wide::space_type; using standard_wide::space; - template struct path_expression_grammar : qi::grammar(), space_type> { @@ -92,8 +92,6 @@ struct path_expression_grammar : qi::grammar str; }; - } #endif // MAPNIK_PATH_EXPRESSIONS_GRAMMAR_HPP - diff --git a/include/mapnik/placement_finder.hpp b/include/mapnik/placement_finder.hpp index 2a605d15b..bf8869ec4 100644 --- a/include/mapnik/placement_finder.hpp +++ b/include/mapnik/placement_finder.hpp @@ -2,8 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko - * Copyright (C) 2006 10East Corp. + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -21,11 +20,10 @@ * *****************************************************************************/ -//$Id$ - -#ifndef __PLACEMENT_FINDER__ -#define __PLACEMENT_FINDER__ +#ifndef MAPNIK_PLACEMENT_FINDER_HPP +#define MAPNIK_PLACEMENT_FINDER_HPP +// mapnik #include #include #include @@ -34,6 +32,7 @@ #include #include +// stl #include namespace mapnik @@ -145,7 +144,7 @@ private: DetectorT & detector_; box2d const& dimensions_; }; + } -#endif - +#endif // MAPNIK_PLACEMENT_FINDER_HPP diff --git a/include/mapnik/plugin.hpp b/include/mapnik/plugin.hpp index 8d800f4a8..5ccd3ca78 100644 --- a/include/mapnik/plugin.hpp +++ b/include/mapnik/plugin.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,14 +20,15 @@ * *****************************************************************************/ -//$Id: plugin.hpp 39 2005-04-10 20:39:53Z pavlenko $ +#ifndef MAPNIK_PLUGIN_HPP +#define MAPNIK_PLUGIN_HPP -#ifndef PLUGIN_HPP -#define PLUGIN_HPP // boost #include + // stl #include + // ltdl #include @@ -46,4 +47,4 @@ public: }; } -#endif //PLUGIN_HPP +#endif // MAPNIK_PLUGIN_HPP diff --git a/include/mapnik/png_io.hpp b/include/mapnik/png_io.hpp index 5c85c1404..fd47535b3 100644 --- a/include/mapnik/png_io.hpp +++ b/include/mapnik/png_io.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,16 +20,16 @@ * *****************************************************************************/ -//$Id$ - #ifndef MAPNIK_PNG_IO_HPP #define MAPNIK_PNG_IO_HPP +// mapnik #include #include #include #include +// zlib #include extern "C" diff --git a/include/mapnik/point_symbolizer.hpp b/include/mapnik/point_symbolizer.hpp index e47ea4fc1..c1f7c1382 100644 --- a/include/mapnik/point_symbolizer.hpp +++ b/include/mapnik/point_symbolizer.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id: image_symbolizer.hpp 39 2005-04-10 20:39:53Z pavlenko $ #ifndef MAPNIK_POINT_SYMBOLIZER_HPP #define MAPNIK_POINT_SYMBOLIZER_HPP diff --git a/include/mapnik/polygon_pattern_symbolizer.hpp b/include/mapnik/polygon_pattern_symbolizer.hpp index 0c389e36d..e1ffc39b9 100644 --- a/include/mapnik/polygon_pattern_symbolizer.hpp +++ b/include/mapnik/polygon_pattern_symbolizer.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,10 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ -#ifndef POLYGON_PATTERN_SYMBOLIZER_HPP -#define POLYGON_PATTERN_SYMBOLIZER_HPP +#ifndef MAPNIK_POLYGON_PATTERN_SYMBOLIZER_HPP +#define MAPNIK_POLYGON_PATTERN_SYMBOLIZER_HPP // mapnik #include @@ -57,4 +56,4 @@ private: }; } -#endif //POLYGON_PATTERN_SYMBOLIZER_HPP +#endif // MAPNIK_POLYGON_PATTERN_SYMBOLIZER_HPP diff --git a/include/mapnik/polygon_symbolizer.hpp b/include/mapnik/polygon_symbolizer.hpp index d6695ba3b..809ceced3 100644 --- a/include/mapnik/polygon_symbolizer.hpp +++ b/include/mapnik/polygon_symbolizer.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,8 @@ * *****************************************************************************/ -//$Id: polygon_symbolizer.hpp 39 2005-04-10 20:39:53Z pavlenko $ - -#ifndef POLYGON_SYMBOLIZER_HPP -#define POLYGON_SYMBOLIZER_HPP +#ifndef MAPNIK_POLYGON_SYMBOLIZER_HPP +#define MAPNIK_POLYGON_SYMBOLIZER_HPP // mapnik #include @@ -122,4 +120,4 @@ private: }; } -#endif // POLYGON_SYMBOLIZER_HPP +#endif // MAPNIK_POLYGON_SYMBOLIZER_HPP diff --git a/include/mapnik/pool.hpp b/include/mapnik/pool.hpp index 7459fd719..518744a9c 100644 --- a/include/mapnik/pool.hpp +++ b/include/mapnik/pool.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,17 +20,15 @@ * *****************************************************************************/ -//$Id: pool.hpp 39 2005-04-10 20:39:53Z pavlenko $ - -#ifndef POOL_HPP -#define POOL_HPP +#ifndef MAPNIK_POOL_HPP +#define MAPNIK_POOL_HPP // mapnik #include + // boost #include #include - #ifdef MAPNIK_THREADSAFE #include #endif @@ -164,5 +162,7 @@ public: return size; } }; + } -#endif //POOL_HPP + +#endif // MAPNIK_POOL_HPP diff --git a/include/mapnik/proj_transform.hpp b/include/mapnik/proj_transform.hpp index 83430bf57..8c156a0a8 100644 --- a/include/mapnik/proj_transform.hpp +++ b/include/mapnik/proj_transform.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,8 @@ * *****************************************************************************/ -//$Id$ - -#ifndef PROJ_TRANSFORM_HPP -#define PROJ_TRANSFORM_HPP +#ifndef MAPNIK_PROJ_TRANSFORM_HPP +#define MAPNIK_PROJ_TRANSFORM_HPP // mapnik #include @@ -62,4 +60,4 @@ private: }; } -#endif // PROJ_TRANSFORM_HPP +#endif // MAPNIK_PROJ_TRANSFORM_HPP diff --git a/include/mapnik/projection.hpp b/include/mapnik/projection.hpp index 33a534dcd..26d64466a 100644 --- a/include/mapnik/projection.hpp +++ b/include/mapnik/projection.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,8 @@ * *****************************************************************************/ -//$Id$ - -#ifndef PROJECTION_HPP -#define PROJECTION_HPP +#ifndef MAPNIK_PROJECTION_HPP +#define MAPNIK_PROJECTION_HPP // mapnik #include @@ -35,8 +33,8 @@ #if defined(MAPNIK_THREADSAFE) && PJ_VERSION < 480 #include #endif - #include + // stl #include #include @@ -85,6 +83,7 @@ private: static boost::mutex mutex_; #endif }; + } -#endif //PROJECTION_HPP +#endif // MAPNIK_PROJECTION_HPP diff --git a/include/mapnik/ptree_helpers.hpp b/include/mapnik/ptree_helpers.hpp index 88a75f458..c97ce4d55 100644 --- a/include/mapnik/ptree_helpers.hpp +++ b/include/mapnik/ptree_helpers.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,17 +20,20 @@ * *****************************************************************************/ -#ifndef MAPNIK_CONFIG_HELPERS_INCLUDED -#define MAPNIK_CONFIG_HELPERS_INCLUDED +#ifndef MAPNIK_PTREE_HELPERS_HPP +#define MAPNIK_PTREE_HELPERS_HPP +// mapnik #include #include #include +// boost #include #include #include +// stl #include #include @@ -422,6 +425,7 @@ inline boost::optional get_optional(const boost::property_tree::ptree & n return result; } + } // end of namespace mapnik -#endif // MAPNIK_CONFIG_HELPERS_INCLUDED +#endif // MAPNIK_PTREE_HELPERS_HPP diff --git a/include/mapnik/quad_tree.hpp b/include/mapnik/quad_tree.hpp index 0c9af81d0..63b305c73 100644 --- a/include/mapnik/quad_tree.hpp +++ b/include/mapnik/quad_tree.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,15 +19,17 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ -#ifndef QUAD_TREE_HPP -#define QUAD_TREE_HPP +#ifndef MAPNIK_QUAD_TREE_HPP +#define MAPNIK_QUAD_TREE_HPP + // mapnik #include + // boost #include #include + // stl #include #include @@ -220,4 +222,4 @@ private: }; } -#endif +#endif // MAPNIK_QUAD_TREE_HPP diff --git a/include/mapnik/query.hpp b/include/mapnik/query.hpp index d43c8b722..db607c587 100644 --- a/include/mapnik/query.hpp +++ b/include/mapnik/query.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,8 @@ * *****************************************************************************/ -//$Id$ - -#ifndef QUERY_HPP -#define QUERY_HPP +#ifndef MAPNIK_QUERY_HPP +#define MAPNIK_QUERY_HPP //mapnik #include @@ -123,7 +121,7 @@ public: return names_; } }; + } - -#endif //QUERY_HPP +#endif // MAPNIK_QUERY_HPP diff --git a/include/mapnik/raster.hpp b/include/mapnik/raster.hpp index 5449294cd..cd26af27a 100644 --- a/include/mapnik/raster.hpp +++ b/include/mapnik/raster.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,11 +19,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id: raster.hpp 39 2005-04-10 20:39:53Z pavlenko $ -#ifndef RASTER_HPP -#define RASTER_HPP +#ifndef MAPNIK_RASTER_HPP +#define MAPNIK_RASTER_HPP +// mapnik #include namespace mapnik { @@ -37,5 +37,5 @@ struct raster }; } -#endif //RASTER_HPP +#endif // MAPNIK_RASTER_HPP diff --git a/include/mapnik/raster_colorizer.hpp b/include/mapnik/raster_colorizer.hpp index e0e0796ca..fcf0bb333 100644 --- a/include/mapnik/raster_colorizer.hpp +++ b/include/mapnik/raster_colorizer.hpp @@ -3,7 +3,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ /** \brief Raster Colouriser * @@ -35,9 +34,8 @@ * */ - -#ifndef RASTER_COLORIZER_HPP -#define RASTER_COLORIZER_HPP +#ifndef MAPNIK_RASTER_COLORIZER_HPP +#define MAPNIK_RASTER_COLORIZER_HPP // mapnik #include @@ -214,14 +212,9 @@ private: }; - - - - - typedef boost::shared_ptr raster_colorizer_ptr; } // mapnik namespace -#endif //RASTER_COLORIZER_HPP +#endif // MAPNIK_RASTER_COLORIZER_HPP diff --git a/include/mapnik/raster_symbolizer.hpp b/include/mapnik/raster_symbolizer.hpp index 2bc4cad32..76366b4a8 100644 --- a/include/mapnik/raster_symbolizer.hpp +++ b/include/mapnik/raster_symbolizer.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,10 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ -#ifndef RASTER_SYMBOLIZER_HPP -#define RASTER_SYMBOLIZER_HPP +#ifndef MAPNIK_RASTER_SYMBOLIZER_HPP +#define MAPNIK_RASTER_SYMBOLIZER_HPP // mapnik #include @@ -159,4 +158,4 @@ private: }; } -#endif //RASTER_SYMBOLIZER_HPP +#endif // MAPNIK_RASTER_SYMBOLIZER_HPP diff --git a/include/mapnik/rule.hpp b/include/mapnik/rule.hpp index a5f111a4d..53780dfc4 100644 --- a/include/mapnik/rule.hpp +++ b/include/mapnik/rule.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef RULE_HPP -#define RULE_HPP +#ifndef MAPNIK_RULE_HPP +#define MAPNIK_RULE_HPP // mapnik #include @@ -327,4 +327,4 @@ private: } -#endif //RULE_HPP +#endif // MAPNIK_RULE_HPP diff --git a/include/mapnik/save_map.hpp b/include/mapnik/save_map.hpp index f28746dc2..65ca13dac 100644 --- a/include/mapnik/save_map.hpp +++ b/include/mapnik/save_map.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,22 +19,22 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -// $Id$ -#ifndef SAVE_MAP_HPP -#define SAVE_MAP_HPP +#ifndef MAPNIK_SAVE_MAP_HPP +#define MAPNIK_SAVE_MAP_HPP + // mapnik #include + // stl #include namespace mapnik { class Map; + MAPNIK_DECL void save_map(Map const& map, std::string const& filename, bool explicit_defaults = false); - MAPNIK_DECL std::string save_map_to_string(Map const& map, bool explicit_defaults = false); - } -#endif // SAVE_MAP_HPP +#endif // MAPNIK_SAVE_MAP_HPP diff --git a/include/mapnik/scale_denominator.hpp b/include/mapnik/scale_denominator.hpp index 31562bc9e..c42b15788 100644 --- a/include/mapnik/scale_denominator.hpp +++ b/include/mapnik/scale_denominator.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,10 @@ * *****************************************************************************/ -//$Id$ #ifndef MAPNIK_SCALE_DENOMINATOR_HPP #define MAPNIK_SCALE_DENOMINATOR_HPP +// mapnik #include namespace mapnik { diff --git a/include/mapnik/segment.hpp b/include/mapnik/segment.hpp index 1836eb69c..12fa2a74b 100644 --- a/include/mapnik/segment.hpp +++ b/include/mapnik/segment.hpp @@ -20,8 +20,6 @@ * *****************************************************************************/ -//$Id$ - #ifndef MAPNIK_SEGMENT_HPP #define MAPNIK_SEGMENT_HPP @@ -41,4 +39,4 @@ static bool y_order(segment_t const& first,segment_t const& second) } -#endif //MAPNIK_SEGMENT_HPP +#endif // MAPNIK_SEGMENT_HPP diff --git a/include/mapnik/shield_symbolizer.hpp b/include/mapnik/shield_symbolizer.hpp index b373608cb..847bff663 100644 --- a/include/mapnik/shield_symbolizer.hpp +++ b/include/mapnik/shield_symbolizer.hpp @@ -2,8 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko - * Copyright (C) 2006 10East Corp. + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef MAPNIK_SHIELD_SYMBOLIZER_HPP #define MAPNIK_SHIELD_SYMBOLIZER_HPP @@ -40,11 +38,11 @@ struct MAPNIK_DECL shield_symbolizer : public text_symbolizer, { shield_symbolizer(expression_ptr name, std::string const& face_name, - unsigned size, + float size, color const& fill, path_expression_ptr file); shield_symbolizer(expression_ptr name, - unsigned size, + float size, color const& fill, path_expression_ptr file); @@ -62,4 +60,4 @@ private: }; } -#endif // SHIELD_SYMBOLIZER_HPP +#endif // MAPNIK_SHIELD_SYMBOLIZER_HPP diff --git a/include/mapnik/sql_utils.hpp b/include/mapnik/sql_utils.hpp index c208d3b11..666cf1dbd 100644 --- a/include/mapnik/sql_utils.hpp +++ b/include/mapnik/sql_utils.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,8 @@ * *****************************************************************************/ -//$Id: sql_utils.hpp 39 2005-04-10 20:39:53Z pavlenko $ - -#ifndef SQL_UTILS_HPP -#define SQL_UTILS_HPP +#ifndef MAPNIK_SQL_UTILS_HPP +#define MAPNIK_SQL_UTILS_HPP // boost #include @@ -196,4 +194,4 @@ inline std::string numeric2string(const char* buf) } -#endif //SQL_UTILS_HPP +#endif // MAPNIK_SQL_UTILS_HPP diff --git a/include/mapnik/stroke.hpp b/include/mapnik/stroke.hpp index 194878886..36b6a882c 100644 --- a/include/mapnik/stroke.hpp +++ b/include/mapnik/stroke.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,13 +19,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ -#ifndef STROKE_HPP -#define STROKE_HPP +#ifndef MAPNIK_STROKE_HPP +#define MAPNIK_STROKE_HPP + // mapnik #include #include + // stl #include @@ -107,4 +108,4 @@ private: }; } -#endif //STROKE_HPP +#endif // MAPNIK_STROKE_HPP diff --git a/include/mapnik/style_factory.hpp b/include/mapnik/style_factory.hpp index aa372d76a..fb0982f40 100644 --- a/include/mapnik/style_factory.hpp +++ b/include/mapnik/style_factory.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,10 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id: style_factory.hpp 39 2005-04-10 20:39:53Z pavlenko $ -#ifndef STYLE_FACTORY_HPP -#define STYLE_FACTORY_HPP +#ifndef MAPNIK_STYLE_FACTORY_HPP +#define MAPNIK_STYLE_FACTORY_HPP //#include @@ -34,4 +33,4 @@ class style_factory } -#endif //STYLE_FACTORY_HPP +#endif // MAPNIK_STYLE_FACTORY_HPP diff --git a/include/mapnik/svg/svg_converter.hpp b/include/mapnik/svg/svg_converter.hpp index a875feefc..74689971c 100644 --- a/include/mapnik/svg/svg_converter.hpp +++ b/include/mapnik/svg/svg_converter.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,15 +20,16 @@ * *****************************************************************************/ -// $Id$ - #ifndef MAPNIK_SVG_CONVERTER_HPP #define MAPNIK_SVG_CONVERTER_HPP + // mapnik #include #include + // boost #include + // agg #include "agg_path_storage.h" #include "agg_conv_transform.h" @@ -37,6 +38,7 @@ #include "agg_conv_curve.h" #include "agg_color_rgba.h" #include "agg_bounding_rect.h" + // stl #include @@ -327,5 +329,4 @@ typedef svg_converter #include +// stl #include namespace mapnik { namespace svg { diff --git a/include/mapnik/svg/svg_path_adapter.hpp b/include/mapnik/svg/svg_path_adapter.hpp index e8d9b6240..86e6f728f 100644 --- a/include/mapnik/svg/svg_path_adapter.hpp +++ b/include/mapnik/svg/svg_path_adapter.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,17 +19,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ -#ifndef MAPNIK_SVG_PATH_ADAPTER -#define MAPNIK_SVG_PATH_ADAPTER +#ifndef MAPNIK_SVG_PATH_ADAPTER_HPP +#define MAPNIK_SVG_PATH_ADAPTER_HPP // mapnik #include + // agg #include "agg_math.h" #include "agg_array.h" #include "agg_bezier_arc.h" + // stl #include #include diff --git a/include/mapnik/svg/svg_path_attributes.hpp b/include/mapnik/svg/svg_path_attributes.hpp index a1a7250b7..66df711fb 100644 --- a/include/mapnik/svg/svg_path_attributes.hpp +++ b/include/mapnik/svg/svg_path_attributes.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,16 +20,16 @@ * *****************************************************************************/ -// $Id$ - #ifndef MAPNIK_SVG_PATH_ATTRIBUTES_HPP #define MAPNIK_SVG_PATH_ATTRIBUTES_HPP +// agg #include "agg_math_stroke.h" #include "agg_color_rgba.h" #include "agg_pixfmt_rgba.h" #include "agg_trans_affine.h" +// mapnik #include namespace mapnik { diff --git a/include/mapnik/svg/svg_path_commands.hpp b/include/mapnik/svg/svg_path_commands.hpp index b5e01b5da..ab6bcee46 100644 --- a/include/mapnik/svg/svg_path_commands.hpp +++ b/include/mapnik/svg/svg_path_commands.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,12 +20,13 @@ * *****************************************************************************/ -#ifndef SVG_COMMANDS_HPP -#define SVG_COMMANDS_HPP +#ifndef MAPNIK_SVG_PATH_COMMANDS_HPP +#define MAPNIK_SVG_PATH_COMMANDS_HPP // mapnik #include -// + +// boost #include #include #include @@ -262,4 +263,4 @@ namespace mapnik { namespace svg { }} -#endif // SVG_COMMANDS_HPP +#endif // MAPNIK_SVG_COMMANDS_HPP diff --git a/include/mapnik/svg/svg_path_grammar.hpp b/include/mapnik/svg/svg_path_grammar.hpp index 3cc078d2f..5411db679 100644 --- a/include/mapnik/svg/svg_path_grammar.hpp +++ b/include/mapnik/svg/svg_path_grammar.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,11 +20,12 @@ * *****************************************************************************/ -#ifndef SVG_PATH_GRAMMAR_HPP -#define SVG_PATH_GRAMMAR_HPP +#ifndef MAPNIK_SVG_PATH_GRAMMAR_HPP +#define MAPNIK_SVG_PATH_GRAMMAR_HPP // mapnik #include + // spirit #include #include @@ -152,4 +153,4 @@ namespace mapnik { namespace svg { }} -#endif // SVG_PATH_GRAMMAR_HPP +#endif // MAPNIK_SVG_PATH_GRAMMAR_HPP diff --git a/include/mapnik/svg/svg_path_iterator.hpp b/include/mapnik/svg/svg_path_iterator.hpp index 30bb847f8..5f5ad6395 100644 --- a/include/mapnik/svg/svg_path_iterator.hpp +++ b/include/mapnik/svg/svg_path_iterator.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/include/mapnik/svg/svg_path_parser.hpp b/include/mapnik/svg/svg_path_parser.hpp index d836deffc..4d249cb9d 100644 --- a/include/mapnik/svg/svg_path_parser.hpp +++ b/include/mapnik/svg/svg_path_parser.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef SVG_PATH_PARSER_HPP -#define SVG_PATH_PARSER_HPP +#ifndef MAPNIK_SVG_PATH_PARSER_HPP +#define MAPNIK_SVG_PATH_PARSER_HPP #include #include @@ -42,5 +42,4 @@ bool MAPNIK_DECL parse_transform(const char * wkt, TransformType & tr); }} - -#endif // SVG_PATH_PARSER_HPP +#endif // MAPNIK_SVG_PATH_PARSER_HPP diff --git a/include/mapnik/svg/svg_points_grammar.hpp b/include/mapnik/svg/svg_points_grammar.hpp index 77e1a2480..e6deb843d 100644 --- a/include/mapnik/svg/svg_points_grammar.hpp +++ b/include/mapnik/svg/svg_points_grammar.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/include/mapnik/svg/svg_renderer.hpp b/include/mapnik/svg/svg_renderer.hpp index e13e36a7c..4ffe11cd3 100644 --- a/include/mapnik/svg/svg_renderer.hpp +++ b/include/mapnik/svg/svg_renderer.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/include/mapnik/svg/svg_storage.hpp b/include/mapnik/svg/svg_storage.hpp index bd6df64d3..f3600646a 100644 --- a/include/mapnik/svg/svg_storage.hpp +++ b/include/mapnik/svg/svg_storage.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,12 +20,13 @@ * *****************************************************************************/ -// $Id$ - #ifndef MAPNIK_SVG_STORAGE_HPP #define MAPNIK_SVG_STORAGE_HPP +// mapnik #include + +// boost #include namespace mapnik { diff --git a/include/mapnik/svg/svg_transform_grammar.hpp b/include/mapnik/svg/svg_transform_grammar.hpp index 8f8c7f03f..9d9bab750 100644 --- a/include/mapnik/svg/svg_transform_grammar.hpp +++ b/include/mapnik/svg/svg_transform_grammar.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,15 +20,15 @@ * *****************************************************************************/ -//$Id$ - -#ifndef SVG_TRANSFORM_GRAMMAR_HPP -#define SVG_TRANSFORM_GRAMMAR_HPP +#ifndef MAPNIK_SVG_TRANSFORM_GRAMMAR_HPP +#define MAPNIK_SVG_TRANSFORM_GRAMMAR_HPP // mapnik #include + // agg #include + // spirit #include #include @@ -260,4 +260,4 @@ namespace mapnik { namespace svg { }} -#endif // SVG_TRANSFORM_GRAMMAR_HPP +#endif // MAPNIK_SVG_TRANSFORM_GRAMMAR_HPP diff --git a/include/mapnik/svg_renderer.hpp b/include/mapnik/svg_renderer.hpp index 15c7ebdc9..3459d0eb3 100644 --- a/include/mapnik/svg_renderer.hpp +++ b/include/mapnik/svg_renderer.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,15 +20,12 @@ * *****************************************************************************/ -//$Id$ - -#ifndef SVG_RENDERER_HPP -#define SVG_RENDERER_HPP +#ifndef MAPNIK_SVG_RENDERER_HPP +#define MAPNIK_SVG_RENDERER_HPP // mapnik #include #include - #include #include @@ -150,4 +147,4 @@ namespace mapnik }; } -#endif //SVG_RENDERER_HPP +#endif // MAPNIK_SVG_RENDERER_HPP diff --git a/include/mapnik/symbolizer.hpp b/include/mapnik/symbolizer.hpp index c4b46cde3..546c4c1fe 100644 --- a/include/mapnik/symbolizer.hpp +++ b/include/mapnik/symbolizer.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id: symbolizer.hpp 39 2005-04-10 20:39:53Z pavlenko $ #ifndef MAPNIK_SYMBOLIZER_HPP #define MAPNIK_SYMBOLIZER_HPP @@ -105,4 +104,4 @@ protected: }; } -#endif //MAPNIK_SYMBOLIZER_HPP +#endif // MAPNIK_SYMBOLIZER_HPP diff --git a/include/mapnik/text_path.hpp b/include/mapnik/text_path.hpp index cd9a4c275..eeebd97c4 100644 --- a/include/mapnik/text_path.hpp +++ b/include/mapnik/text_path.hpp @@ -2,8 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko - * Copyright (C) 2006 10East Corp. + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -21,13 +20,14 @@ * *****************************************************************************/ -//$Id$ - -#ifndef __TEXT_PATH_H__ -#define __TEXT_PATH_H__ +#ifndef MAPNIK_TEXT_PATH_HPP +#define MAPNIK_TEXT_PATH_HPP +// boost #include #include + +// uci #include namespace mapnik @@ -180,6 +180,4 @@ struct text_path : boost::noncopyable typedef boost::shared_ptr text_path_ptr; } -#endif - - +#endif // MAPNIK_TEXT_PATH_HPP diff --git a/include/mapnik/text_placements.hpp b/include/mapnik/text_placements.hpp index 56b0c04de..383bbcb33 100644 --- a/include/mapnik/text_placements.hpp +++ b/include/mapnik/text_placements.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2011 Hermann Kraus + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,18 +19,19 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -#ifndef TEXT_PLACEMENTS_HPP -#define TEXT_PLACEMENTS_HPP -//mapnik +#ifndef MAPNIK_TEXT_PLACEMENTS_HPP +#define MAPNIK_TEXT_PLACEMENTS_HPP + +// mapnik #include #include -//stl +// stl #include #include -//boost +// boost #include #include #include @@ -111,7 +112,7 @@ public: /* NOTE: Values are public and non-virtual to avoid any performance problems. */ position displacement; - unsigned text_size; + float text_size; horizontal_alignment_e halign; justify_alignment_e jalign; vertical_alignment_e valign; @@ -126,9 +127,9 @@ public: text_size_(10), halign_(H_MIDDLE), jalign_(J_MIDDLE), valign_(V_MIDDLE) {} virtual text_placement_info_ptr get_placement_info() const =0; - virtual void set_default_text_size(unsigned size) { text_size_ = size; } - unsigned get_default_text_size() const { return text_size_; } - + virtual void set_default_text_size(float size) { text_size_ = size; } + float get_default_text_size() const { return text_size_; } + virtual void set_default_displacement(position const& displacement) { displacement_ = displacement;} position const& get_default_displacement() { return displacement_; } @@ -143,7 +144,7 @@ public: virtual ~text_placements() {} protected: - unsigned text_size_; + float text_size_; position displacement_; horizontal_alignment_e halign_; justify_alignment_e jalign_; @@ -176,7 +177,6 @@ private: }; - } //namespace -#endif // TEXT_PLACEMENTS_HPP +#endif // MAPNIK_TEXT_PLACEMENTS_HPP diff --git a/include/mapnik/text_placements_simple.hpp b/include/mapnik/text_placements_simple.hpp index 9b11c6abe..fe0e541ca 100644 --- a/include/mapnik/text_placements_simple.hpp +++ b/include/mapnik/text_placements_simple.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2011 Hermann Kraus + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,8 +19,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -#ifndef TEXT_PLACEMENTS_SIMPLE_HPP -#define TEXT_PLACEMENTS_SIMPLE_HPP + +#ifndef MAPNIK_TEXT_PLACEMENTS_SIMPLE_HPP +#define MAPNIK_TEXT_PLACEMENTS_SIMPLE_HPP + +// mapnik #include namespace mapnik { @@ -70,6 +73,6 @@ private: text_placements_simple const* parent_; }; - } //namespace -#endif + +#endif // MAPNIK_TEXT_PLACEMENTS_SIMPLE_HPP diff --git a/include/mapnik/text_symbolizer.hpp b/include/mapnik/text_symbolizer.hpp index 98c0e5181..5ad9f7f44 100644 --- a/include/mapnik/text_symbolizer.hpp +++ b/include/mapnik/text_symbolizer.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,6 @@ * *****************************************************************************/ -//$Id$ - #ifndef MAPNIK_TEXT_SYMBOLIZER_HPP #define MAPNIK_TEXT_SYMBOLIZER_HPP @@ -46,10 +44,10 @@ namespace mapnik struct MAPNIK_DECL text_symbolizer : public symbolizer_base { text_symbolizer(expression_ptr name, std::string const& face_name, - unsigned size, color const& fill, + float size, color const& fill, text_placements_ptr placements = boost::make_shared() ); - text_symbolizer(expression_ptr name, unsigned size, color const& fill, + text_symbolizer(expression_ptr name, float size, color const& fill, text_placements_ptr placements = boost::make_shared() ); text_symbolizer(text_symbolizer const& rhs); @@ -82,8 +80,8 @@ struct MAPNIK_DECL text_symbolizer : public symbolizer_base void set_force_odd_labels(bool force); double get_max_char_angle_delta() const; // maximum change in angle between adjacent characters void set_max_char_angle_delta(double angle); - unsigned get_text_size() const; - void set_text_size(unsigned size); + float get_text_size() const; + void set_text_size(float size); std::string const& get_face_name() const; void set_face_name(std::string face_name); font_set const& get_fontset() const; @@ -154,4 +152,4 @@ private: }; } -#endif //MAPNIK_TEXT_SYMBOLIZER_HPP +#endif // MAPNIK_TEXT_SYMBOLIZER_HPP diff --git a/include/mapnik/timer.hpp b/include/mapnik/timer.hpp index 4791b8772..e747e9e7b 100644 --- a/include/mapnik/timer.hpp +++ b/include/mapnik/timer.hpp @@ -20,9 +20,10 @@ * *****************************************************************************/ -#ifndef MAPNIK_TIMER_INCLUDED -#define MAPNIK_TIMER_INCLUDED +#ifndef MAPNIK_TIMER_HPP +#define MAPNIK_TIMER_HPP +// stl #include #include #include @@ -121,4 +122,4 @@ private: }; }; -#endif // MAPNIK_TIMER_INCLUDED +#endif // MAPNIK_TIMER_HPP diff --git a/include/mapnik/unicode.hpp b/include/mapnik/unicode.hpp index 6f79e8f38..1d9cb077d 100644 --- a/include/mapnik/unicode.hpp +++ b/include/mapnik/unicode.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,18 +20,20 @@ * *****************************************************************************/ -//$Id$ -#ifndef UNICODE_HPP -#define UNICODE_HPP +#ifndef MAPNIK_UNICODE_HPP +#define MAPNIK_UNICODE_HPP //mapnik #include + // icu #include #include + // boost #include #include + // stl #include @@ -49,4 +51,4 @@ private: }; } -#endif // UNICODE_HPP +#endif // MAPNIK_UNICODE_HPP diff --git a/include/mapnik/utils.hpp b/include/mapnik/utils.hpp index a6ec6fdb5..b6acd5e58 100644 --- a/include/mapnik/utils.hpp +++ b/include/mapnik/utils.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,8 @@ * *****************************************************************************/ -//$Id: utils.hpp 39 2005-04-10 20:39:53Z pavlenko $ - -#ifndef UTILS_HPP -#define UTILS_HPP +#ifndef MAPNIK_UTILS_HPP +#define MAPNIK_UTILS_HPP #ifdef MAPNIK_THREADSAFE #include @@ -165,9 +163,8 @@ template class CreatePolicy> T* singleton::pInstance_=0; template class CreatePolicy> bool singleton::destroyed_=false; - + template class CreatePolicy> bool singleton::destroyed_=false; + } - -#endif //UTILS_HPP +#endif // MAPNIK_UTILS_HPP diff --git a/include/mapnik/value.hpp b/include/mapnik/value.hpp index 46fb7b05f..f6ac076d0 100644 --- a/include/mapnik/value.hpp +++ b/include/mapnik/value.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,10 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ -#ifndef VALUE_HPP -#define VALUE_HPP +#ifndef MAPNIK_VALUE_HPP +#define MAPNIK_VALUE_HPP // mapnik #include @@ -30,17 +29,18 @@ #include // boost - #include #include #include #include + // stl #include #include #include #include #include + // uci #include #include @@ -823,4 +823,4 @@ operator << (std::basic_ostream& out, } } -#endif //VALUE_HPP +#endif // MAPNIK_VALUE_HPP diff --git a/include/mapnik/value_error.hpp b/include/mapnik/value_error.hpp index a83631f5d..22a692946 100644 --- a/include/mapnik/value_error.hpp +++ b/include/mapnik/value_error.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef MAPNIK_VALUE_ERROR_INCLUDED -#define MAPNIK_VALUE_ERROR_INCLUDED +#ifndef MAPNIK_VALUE_ERROR_HPP +#define MAPNIK_VALUE_ERROR_HPP #include #include @@ -54,4 +54,4 @@ protected: }; } -#endif // MAPNIK_VALUE_ERROR_INCLUDED +#endif // MAPNIK_VALUE_ERROR_HPP diff --git a/include/mapnik/version.hpp b/include/mapnik/version.hpp index defeb9da1..dd69d20bd 100644 --- a/include/mapnik/version.hpp +++ b/include/mapnik/version.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2009 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,14 +19,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef MAPNIK_VERSION_HPP #define MAPNIK_VERSION_HPP #define MAPNIK_VERSION 200000 -#endif //MAPNIK_VERSION_HPP - - - +#endif // MAPNIK_VERSION_HPP diff --git a/include/mapnik/vertex.hpp b/include/mapnik/vertex.hpp index 4227cd10d..ca76b48dc 100644 --- a/include/mapnik/vertex.hpp +++ b/include/mapnik/vertex.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,10 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id: vertex.hpp 39 2005-04-10 20:39:53Z pavlenko $ -#ifndef VERTEX_HPP -#define VERTEX_HPP +#ifndef MAPNIK_VERTEX_HPP +#define MAPNIK_VERTEX_HPP #include #include @@ -109,4 +108,4 @@ operator << (std::basic_ostream& out, } -#endif // VERTEX_HPP +#endif // MAPNIK_VERTEX_HPP diff --git a/include/mapnik/vertex_transform.hpp b/include/mapnik/vertex_transform.hpp index 3a333bdfc..1f6ac72c3 100644 --- a/include/mapnik/vertex_transform.hpp +++ b/include/mapnik/vertex_transform.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,10 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id: vertex_transform.hpp 39 2005-04-10 20:39:53Z pavlenko $ -#ifndef VERTEX_TRANSFORM_HPP -#define VERTEX_TRANSFORM_HPP +#ifndef MAPNIK_VERTEX_TRANSFORM_HPP +#define MAPNIK_VERTEX_TRANSFORM_HPP // mapnik #include @@ -90,4 +89,4 @@ struct view_transform,box2d,Trans> }; } -#endif //VERTEX_TRANSFORM_HPP +#endif // MAPNIK_VERTEX_TRANSFORM_HPP diff --git a/include/mapnik/vertex_vector.hpp b/include/mapnik/vertex_vector.hpp index 72f7e1d0a..43adc1cde 100644 --- a/include/mapnik/vertex_vector.hpp +++ b/include/mapnik/vertex_vector.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,17 +24,17 @@ // author of Anti-Grain Geometry (http://www.antigrain.com). I have used // the datastructure from AGG as a template for my own. +#ifndef MAPNIK_VERTEX_VECTOR_HPP +#define MAPNIK_VERTEX_VECTOR_HPP -//$Id: vertex_vector.hpp 39 2005-04-10 20:39:53Z pavlenko $ - -#ifndef VERTEX_VECTOR_HPP -#define VERTEX_VECTOR_HPP // mapnik #include #include + // boost #include #include + // stl #include #include @@ -143,4 +143,4 @@ private: } -#endif //VERTEX_VECTOR_HPP +#endif // MAPNIK_VERTEX_VECTOR_HPP diff --git a/include/mapnik/warp.hpp b/include/mapnik/warp.hpp index 32ea74445..4fc30877d 100644 --- a/include/mapnik/warp.hpp +++ b/include/mapnik/warp.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006-2011 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,11 +19,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ -#ifndef WARP_HPP -#define WARP_HPP +#ifndef MAPNIK_WARP_HPP +#define MAPNIK_WARP_HPP +// mapnik #include #include @@ -38,4 +38,5 @@ void reproject_raster(raster &target, raster const& source, std::string scaling_method_name); } -#endif //WARP_HPP + +#endif // MAPNIK_WARP_HPP diff --git a/include/mapnik/wkb.hpp b/include/mapnik/wkb.hpp index 6b733b528..77c7c04c6 100644 --- a/include/mapnik/wkb.hpp +++ b/include/mapnik/wkb.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,11 +20,10 @@ * *****************************************************************************/ -//$Id: wkb.hpp 39 2005-04-10 20:39:53Z pavlenko $ - -#ifndef WKB_HPP -#define WKB_HPP +#ifndef MAPNIK_WKB_HPP +#define MAPNIK_WKB_HPP +// mapnik #include #include #include @@ -66,4 +65,4 @@ private: }; } -#endif //WKB_HPP +#endif // MAPNIK_WKB_HPP diff --git a/plugins/input/csv/csv_datasource.cpp b/plugins/input/csv/csv_datasource.cpp index 88a3cad62..8b71bf52e 100644 --- a/plugins/input/csv/csv_datasource.cpp +++ b/plugins/input/csv/csv_datasource.cpp @@ -53,7 +53,8 @@ csv_datasource::csv_datasource(parameters const& params, bool bind) /* TODO: general: - refactor parser into generic class - - tests + - tests of grid_renderer output + - ensure that the attribute desc_ matches the first feature added alternate large file pipeline: - stat file, detect > 15 MB - build up csv line-by-line iterator @@ -353,7 +354,7 @@ void csv_datasource::parse_csv(T& stream, throw mapnik::datasource_exception(s.str()); } - int feature_count(0); + int feature_count(1); bool extent_initialized = false; int num_headers = headers_.size(); mapnik::transcoder tr(desc_.get_encoding()); @@ -586,7 +587,7 @@ void csv_datasource::parse_csv(T& stream, { UnicodeString ustr = tr.transcode(value.c_str()); boost::put(*feature,fld_name,ustr); - if (!feature_count) + if (feature_count == 1) desc_.add_descriptor(mapnik::attribute_descriptor(fld_name,mapnik::String)); } @@ -601,14 +602,14 @@ void csv_datasource::parse_csv(T& stream, if (value.find(".") != std::string::npos) { boost::put(*feature,fld_name,float_val); - if (!feature_count) + if (feature_count == 1) desc_.add_descriptor(mapnik::attribute_descriptor(fld_name,mapnik::Double)); } else { int val = static_cast(float_val); boost::put(*feature,fld_name,val); - if (!feature_count) + if (feature_count == 1) desc_.add_descriptor(mapnik::attribute_descriptor(fld_name,mapnik::Integer)); } } @@ -617,7 +618,7 @@ void csv_datasource::parse_csv(T& stream, // fallback to normal string UnicodeString ustr = tr.transcode(value.c_str()); boost::put(*feature,fld_name,ustr); - if (!feature_count) + if (feature_count == 1) desc_.add_descriptor(mapnik::attribute_descriptor(fld_name,mapnik::String)); } } @@ -627,13 +628,13 @@ void csv_datasource::parse_csv(T& stream, if (value_lower == "true") { boost::put(*feature,fld_name,true); - if (!feature_count) + if (feature_count == 1) desc_.add_descriptor(mapnik::attribute_descriptor(fld_name,mapnik::Boolean)); } else if(value_lower == "false") { boost::put(*feature,fld_name,false); - if (!feature_count) + if (feature_count == 1) desc_.add_descriptor(mapnik::attribute_descriptor(fld_name,mapnik::Boolean)); } else @@ -641,7 +642,7 @@ void csv_datasource::parse_csv(T& stream, // fallback to normal string UnicodeString ustr = tr.transcode(value.c_str()); boost::put(*feature,fld_name,ustr); - if (!feature_count) + if (feature_count == 1) desc_.add_descriptor(mapnik::attribute_descriptor(fld_name,mapnik::String)); } } @@ -696,6 +697,7 @@ void csv_datasource::parse_csv(T& stream, extent_.expand_to_include(feature->envelope()); } features_.push_back(feature); + ++feature_count; } else { @@ -783,6 +785,10 @@ void csv_datasource::parse_csv(T& stream, } } } + if (!feature_count > 0) + { + if (!quiet_) std::clog << "CSV Plugin: could not parse any lines of data\n"; + } } std::string csv_datasource::name() diff --git a/plugins/input/gdal/build.py b/plugins/input/gdal/build.py index 2f81d98b1..491c26d55 100644 --- a/plugins/input/gdal/build.py +++ b/plugins/input/gdal/build.py @@ -42,6 +42,7 @@ plugin_env['LIBS'].append(env['ICU_LIB_NAME']) if env['RUNTIME_LINK'] == 'static': cmd = 'gdal-config --dep-libs' plugin_env.ParseConfig(cmd) + plugin_env['LIBS'].append('proj') input_plugin = plugin_env.SharedLibrary('../gdal', source=gdal_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LINKFLAGS=env['CUSTOM_LDFLAGS']) diff --git a/plugins/input/gdal/gdal_datasource.hpp b/plugins/input/gdal/gdal_datasource.hpp index d3e8c12c8..a352c2cd5 100644 --- a/plugins/input/gdal/gdal_datasource.hpp +++ b/plugins/input/gdal/gdal_datasource.hpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef GDAL_DATASOURCE_HPP #define GDAL_DATASOURCE_HPP diff --git a/plugins/input/gdal/gdal_featureset.cpp b/plugins/input/gdal/gdal_featureset.cpp index 1c489f240..fd8969b4f 100644 --- a/plugins/input/gdal/gdal_featureset.cpp +++ b/plugins/input/gdal/gdal_featureset.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ // mapnik #include diff --git a/plugins/input/gdal/gdal_featureset.hpp b/plugins/input/gdal/gdal_featureset.hpp index 3ae0d6716..55cb03ec6 100644 --- a/plugins/input/gdal/gdal_featureset.hpp +++ b/plugins/input/gdal/gdal_featureset.hpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef GDAL_FEATURESET_HPP #define GDAL_FEATURESET_HPP diff --git a/plugins/input/geos/geos_datasource.cpp b/plugins/input/geos/geos_datasource.cpp index 5270ab185..e67298392 100644 --- a/plugins/input/geos/geos_datasource.cpp +++ b/plugins/input/geos/geos_datasource.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,16 +19,16 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -// $Id$ +#include "geos_datasource.hpp" +#include "geos_featureset.hpp" + +// stl #include #include #include #include -#include "geos_datasource.hpp" -#include "geos_featureset.hpp" - // mapnik #include #include @@ -44,17 +44,9 @@ // geos #include -using std::clog; -using std::endl; - using boost::lexical_cast; using boost::bad_lexical_cast; -using mapnik::datasource; -using mapnik::parameters; - -DATASOURCE_PLUGIN(geos_datasource) - using mapnik::box2d; using mapnik::coord2d; using mapnik::query; @@ -62,9 +54,12 @@ using mapnik::featureset_ptr; using mapnik::layer_descriptor; using mapnik::attribute_descriptor; using mapnik::datasource_exception; +using mapnik::datasource; +using mapnik::parameters; using mapnik::filter_in_box; using mapnik::filter_at_point; +DATASOURCE_PLUGIN(geos_datasource) void geos_notice(const char* fmt, ...) { @@ -90,17 +85,17 @@ void geos_error(const char* fmt, ...) geos_datasource::geos_datasource(parameters const& params, bool bind) - : datasource(params), - extent_(), - extent_initialized_(false), - type_(datasource::Vector), - desc_(*params.get("type"), *params.get("encoding","utf-8")), - geometry_data_(""), - geometry_data_name_("name"), - geometry_id_(1) + : datasource(params), + extent_(), + extent_initialized_(false), + type_(datasource::Vector), + desc_(*params.get("type"), *params.get("encoding", "utf-8")), + geometry_data_(""), + geometry_data_name_("name"), + geometry_id_(1) { boost::optional geometry = params.get("wkt"); - if (!geometry) throw datasource_exception("missing parameter"); + if (! geometry) throw datasource_exception("missing parameter"); geometry_string_ = *geometry; multiple_geometries_ = *params_.get("multiple_geometries",false); @@ -153,7 +148,7 @@ void geos_datasource::bind() const if (! extent_initialized_) { #ifdef MAPNIK_DEBUG - clog << "GEOS Plugin: initializing extent from geometry" << endl; + std::clog << "GEOS Plugin: initializing extent from geometry" << std::endl; #endif if (GEOSGeomTypeId(*geometry_) == GEOS_POINT) @@ -167,7 +162,7 @@ void geos_datasource::bind() const GEOSCoordSeq_getX(cs, 0, &x); GEOSCoordSeq_getY(cs, 0, &y); - extent_.init(x,y,x,y); + extent_.init(x, y, x, y); extent_initialized_ = true; } else @@ -177,7 +172,7 @@ void geos_datasource::bind() const { #ifdef MAPNIK_DEBUG char* wkt = GEOSGeomToWKT(*envelope); - clog << "GEOS Plugin: getting coord sequence from: " << wkt << endl; + std::clog << "GEOS Plugin: getting coord sequence from: " << wkt << std::endl; GEOSFree(wkt); #endif @@ -188,7 +183,7 @@ void geos_datasource::bind() const if (cs != NULL) { #ifdef MAPNIK_DEBUG - clog << "GEOS Plugin: iterating boundary points" << endl; + std::clog << "GEOS Plugin: iterating boundary points" << std::endl; #endif double x, y; @@ -196,8 +191,8 @@ void geos_datasource::bind() const miny = std::numeric_limits::max(), maxx = -std::numeric_limits::max(), maxy = -std::numeric_limits::max(); - unsigned int num_points; + unsigned int num_points; GEOSCoordSeq_getSize(cs, &num_points); for (unsigned int i = 0; i < num_points; ++i) @@ -211,7 +206,7 @@ void geos_datasource::bind() const if (y > maxy) maxy = y; } - extent_.init(minx,miny,maxx,maxy); + extent_.init(minx, miny, maxx, maxy); extent_initialized_ = true; } } @@ -220,7 +215,9 @@ void geos_datasource::bind() const } if (! extent_initialized_) + { throw datasource_exception("GEOS Plugin: cannot determine extent for geometry"); + } is_bound_ = true; } @@ -237,21 +234,21 @@ int geos_datasource::type() const box2d geos_datasource::envelope() const { - if (!is_bound_) bind(); + if (! is_bound_) bind(); return extent_; } layer_descriptor geos_datasource::get_descriptor() const { - if (!is_bound_) bind(); + if (! is_bound_) bind(); return desc_; } featureset_ptr geos_datasource::features(query const& q) const { - if (!is_bound_) bind(); + if (! is_bound_) bind(); const mapnik::box2d extent = q.get_bbox(); @@ -265,7 +262,7 @@ featureset_ptr geos_datasource::features(query const& q) const << "))"; #ifdef MAPNIK_DEBUG - clog << "GEOS Plugin: using extent: " << s.str() << endl; + std::clog << "GEOS Plugin: using extent: " << s.str() << std::endl; #endif return boost::make_shared(*geometry_, @@ -279,13 +276,13 @@ featureset_ptr geos_datasource::features(query const& q) const featureset_ptr geos_datasource::features_at_point(coord2d const& pt) const { - if (!is_bound_) bind(); + if (! is_bound_) bind(); std::ostringstream s; s << "POINT(" << pt.x << " " << pt.y << ")"; #ifdef MAPNIK_DEBUG - clog << "GEOS Plugin: using point: " << s.str() << endl; + std::clog << "GEOS Plugin: using point: " << s.str() << std::endl; #endif return boost::make_shared(*geometry_, @@ -296,4 +293,3 @@ featureset_ptr geos_datasource::features_at_point(coord2d const& pt) const desc_.get_encoding(), multiple_geometries_); } - diff --git a/plugins/input/geos/geos_datasource.hpp b/plugins/input/geos/geos_datasource.hpp index b675b8972..2ba154df0 100644 --- a/plugins/input/geos/geos_datasource.hpp +++ b/plugins/input/geos/geos_datasource.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef GEOS_DATASOURCE_HPP #define GEOS_DATASOURCE_HPP @@ -36,28 +35,28 @@ class geos_datasource : public mapnik::datasource { - public: - geos_datasource(mapnik::parameters const& params, bool bind=true); - virtual ~geos_datasource (); - int type() const; - static std::string name(); - mapnik::featureset_ptr features(mapnik::query const& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const; - mapnik::box2d envelope() const; - mapnik::layer_descriptor get_descriptor() const; - void bind() const; - private: - mutable mapnik::box2d extent_; - mutable bool extent_initialized_; - int type_; - mutable mapnik::layer_descriptor desc_; - mutable geos_feature_ptr geometry_; - mutable std::string geometry_data_; - mutable std::string geometry_data_name_; - mutable int geometry_id_; - std::string geometry_string_; - bool multiple_geometries_; +public: + geos_datasource(mapnik::parameters const& params, bool bind = true); + virtual ~geos_datasource (); + int type() const; + static std::string name(); + mapnik::featureset_ptr features(mapnik::query const& q) const; + mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const; + mapnik::box2d envelope() const; + mapnik::layer_descriptor get_descriptor() const; + void bind() const; + +private: + mutable mapnik::box2d extent_; + mutable bool extent_initialized_; + int type_; + mutable mapnik::layer_descriptor desc_; + mutable geos_feature_ptr geometry_; + mutable std::string geometry_data_; + mutable std::string geometry_data_name_; + mutable int geometry_id_; + std::string geometry_string_; + bool multiple_geometries_; }; - #endif // GEOS_DATASOURCE_HPP diff --git a/plugins/input/geos/geos_feature_ptr.hpp b/plugins/input/geos/geos_feature_ptr.hpp index 377436f3c..1425822d6 100644 --- a/plugins/input/geos/geos_feature_ptr.hpp +++ b/plugins/input/geos/geos_feature_ptr.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/plugins/input/geos/geos_featureset.cpp b/plugins/input/geos/geos_featureset.cpp index 4d961bc08..51335b3d5 100644 --- a/plugins/input/geos/geos_featureset.cpp +++ b/plugins/input/geos/geos_featureset.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,8 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ +// stl #include #include @@ -35,12 +35,8 @@ #include #include -// ogr #include "geos_featureset.hpp" -using std::clog; -using std::endl; - using mapnik::query; using mapnik::box2d; using mapnik::coord2d; @@ -59,14 +55,14 @@ geos_featureset::geos_featureset(GEOSGeometry* geometry, const std::string& field_name, const std::string& encoding, bool multiple_geometries) - : geometry_(geometry), - tr_(new transcoder(encoding)), - extent_(extent), - identifier_(identifier), - field_(field), - field_name_(field_name), - multiple_geometries_(multiple_geometries), - already_rendered_(false) + : geometry_(geometry), + tr_(new transcoder(encoding)), + extent_(extent), + identifier_(identifier), + field_(field), + field_name_(field_name), + multiple_geometries_(multiple_geometries), + already_rendered_(false) { } @@ -84,12 +80,12 @@ feature_ptr geos_featureset::next() { bool render_geometry = true; - if (*extent_ != NULL && GEOSisValid(*extent_) && !GEOSisEmpty(*extent_)) + if (*extent_ != NULL && GEOSisValid(*extent_) && ! GEOSisEmpty(*extent_)) { const int type = GEOSGeomTypeId(*extent_); render_geometry = false; - switch ( type ) + switch (type) { case GEOS_POINT: if (GEOSIntersects(*extent_, geometry_)) @@ -97,6 +93,7 @@ feature_ptr geos_featureset::next() render_geometry = true; } break; + case GEOS_POLYGON: if (GEOSContains(*extent_, geometry_) || GEOSWithin(geometry_, *extent_) @@ -105,9 +102,10 @@ feature_ptr geos_featureset::next() render_geometry = true; } break; - default: + + default: #ifdef MAPNIK_DEBUG - clog << "GEOS Plugin: unknown extent geometry_type=" << type << endl; + std::clog << "GEOS Plugin: unknown extent geometry_type=" << type << std::endl; #endif break; } @@ -138,4 +136,3 @@ feature_ptr geos_featureset::next() return feature_ptr(); } - diff --git a/plugins/input/geos/geos_featureset.hpp b/plugins/input/geos/geos_featureset.hpp index 3b284a92d..8a4cd1e16 100644 --- a/plugins/input/geos/geos_featureset.hpp +++ b/plugins/input/geos/geos_featureset.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef GEOS_FEATURESET_HPP #define GEOS_FEATURESET_HPP @@ -40,28 +39,28 @@ class geos_featureset : public mapnik::Featureset { public: - geos_featureset(GEOSGeometry* geometry, - GEOSGeometry* extent, - int identifier, - const std::string& field, - const std::string& field_name, - const std::string& encoding, - bool multiple_geometries); - virtual ~geos_featureset(); - mapnik::feature_ptr next(); + geos_featureset(GEOSGeometry* geometry, + GEOSGeometry* extent, + int identifier, + const std::string& field, + const std::string& field_name, + const std::string& encoding, + bool multiple_geometries); + virtual ~geos_featureset(); + mapnik::feature_ptr next(); private: - GEOSGeometry* geometry_; - boost::scoped_ptr tr_; - geos_feature_ptr extent_; - int identifier_; - std::string field_; - std::string field_name_; - bool multiple_geometries_; - bool already_rendered_; + GEOSGeometry* geometry_; + boost::scoped_ptr tr_; + geos_feature_ptr extent_; + int identifier_; + std::string field_; + std::string field_name_; + bool multiple_geometries_; + bool already_rendered_; - geos_featureset(const geos_featureset&); - const geos_featureset& operator=(const geos_featureset&); + geos_featureset(const geos_featureset&); + const geos_featureset& operator=(const geos_featureset&); }; #endif // GEOS_FEATURESET_HPP diff --git a/plugins/input/kismet/kismet_datasource.hpp b/plugins/input/kismet/kismet_datasource.hpp index c269b387e..1f54a377b 100644 --- a/plugins/input/kismet/kismet_datasource.hpp +++ b/plugins/input/kismet/kismet_datasource.hpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef KISMET_DATASOURCE_HPP #define KISMET_DATASOURCE_HPP diff --git a/plugins/input/kismet/kismet_featureset.cpp b/plugins/input/kismet/kismet_featureset.cpp index 360d3eaa4..08bc6b185 100644 --- a/plugins/input/kismet/kismet_featureset.cpp +++ b/plugins/input/kismet/kismet_featureset.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ // mapnik #include diff --git a/plugins/input/kismet/kismet_featureset.hpp b/plugins/input/kismet/kismet_featureset.hpp index 098241379..811713020 100644 --- a/plugins/input/kismet/kismet_featureset.hpp +++ b/plugins/input/kismet/kismet_featureset.hpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef KISMET_FEATURESET_HPP #define KISMET_FEATURESET_HPP diff --git a/plugins/input/kismet/kismet_types.hpp b/plugins/input/kismet/kismet_types.hpp index 4465f5e2f..7cdb9fe92 100644 --- a/plugins/input/kismet/kismet_types.hpp +++ b/plugins/input/kismet/kismet_types.hpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef KISMET_TYPES_HPP #define KISMET_TYPES_HPP diff --git a/plugins/input/occi/occi_datasource.hpp b/plugins/input/occi/occi_datasource.hpp index cc7bad223..e0d5826e4 100644 --- a/plugins/input/occi/occi_datasource.hpp +++ b/plugins/input/occi/occi_datasource.hpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef OCCI_DATASOURCE_HPP #define OCCI_DATASOURCE_HPP diff --git a/plugins/input/occi/occi_featureset.cpp b/plugins/input/occi/occi_featureset.cpp index c9fe9dae9..e94e990d9 100644 --- a/plugins/input/occi/occi_featureset.cpp +++ b/plugins/input/occi/occi_featureset.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ // mapnik #include diff --git a/plugins/input/occi/occi_featureset.hpp b/plugins/input/occi/occi_featureset.hpp index 1d5987dfa..ab60c884f 100644 --- a/plugins/input/occi/occi_featureset.hpp +++ b/plugins/input/occi/occi_featureset.hpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef OCCI_FEATURESET_HPP #define OCCI_FEATURESET_HPP diff --git a/plugins/input/occi/occi_types.cpp b/plugins/input/occi/occi_types.cpp index 18d33c467..86208e7a4 100644 --- a/plugins/input/occi/occi_types.cpp +++ b/plugins/input/occi/occi_types.cpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #include "occi_types.hpp" diff --git a/plugins/input/occi/occi_types.hpp b/plugins/input/occi/occi_types.hpp index 64b382ebb..8c369c037 100644 --- a/plugins/input/occi/occi_types.hpp +++ b/plugins/input/occi/occi_types.hpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef OCCI_TYPES_HPP #define OCCI_TYPES_HPP diff --git a/plugins/input/ogr/build.py b/plugins/input/ogr/build.py index f07b8701e..4b3225737 100644 --- a/plugins/input/ogr/build.py +++ b/plugins/input/ogr/build.py @@ -46,6 +46,7 @@ plugin_env['LIBS'].append('boost_filesystem%s' % env['BOOST_APPEND']) if env['RUNTIME_LINK'] == 'static': cmd = 'gdal-config --dep-libs' plugin_env.ParseConfig(cmd) + plugin_env['LIBS'].append('proj') input_plugin = plugin_env.SharedLibrary('../ogr', source=ogr_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LINKFLAGS=env['CUSTOM_LDFLAGS']) diff --git a/plugins/input/ogr/ogr_converter.cpp b/plugins/input/ogr/ogr_converter.cpp index 0198a2cbc..5d27cb08e 100644 --- a/plugins/input/ogr/ogr_converter.cpp +++ b/plugins/input/ogr/ogr_converter.cpp @@ -19,8 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ +// mapnik #include #include #include diff --git a/plugins/input/ogr/ogr_converter.hpp b/plugins/input/ogr/ogr_converter.hpp index 70dff71b2..f810dff39 100644 --- a/plugins/input/ogr/ogr_converter.hpp +++ b/plugins/input/ogr/ogr_converter.hpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef OGR_CONVERTER_HPP #define OGR_CONVERTER_HPP diff --git a/plugins/input/ogr/ogr_datasource.cpp b/plugins/input/ogr/ogr_datasource.cpp index 23d522a7c..7186f138c 100644 --- a/plugins/input/ogr/ogr_datasource.cpp +++ b/plugins/input/ogr/ogr_datasource.cpp @@ -56,7 +56,7 @@ ogr_datasource::ogr_datasource(parameters const& params, bool bind) : datasource(params), extent_(), type_(datasource::Vector), - desc_(*params.get("type"), *params.get("encoding","utf-8")), + desc_(*params_.get("type"), *params_.get("encoding", "utf-8")), indexed_(false) { boost::optional file = params.get("file"); @@ -66,7 +66,7 @@ ogr_datasource::ogr_datasource(parameters const& params, bool bind) throw datasource_exception("missing or parameter"); } - multiple_geometries_ = *params.get("multiple_geometries",false); + multiple_geometries_ = *params.get("multiple_geometries", false); if (string) { @@ -95,6 +95,9 @@ ogr_datasource::~ogr_datasource() { if (is_bound_) { + // free layer before destroying the datasource + layer_.free_layer(); + OGRDataSource::DestroyDataSource (dataset_); } } @@ -105,9 +108,24 @@ void ogr_datasource::bind() const // initialize ogr formats OGRRegisterAll(); + + std::string driver = *params_.get("driver",""); + + if (! driver.empty()) + { + OGRSFDriver * ogr_driver = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(driver.c_str()); + if (ogr_driver && ogr_driver != NULL) + { + dataset_ = ogr_driver->Open((dataset_name_).c_str(), FALSE); + } + + } + else + { + // open ogr driver + dataset_ = OGRSFDriverRegistrar::Open((dataset_name_).c_str(), FALSE); + } - // open ogr driver - dataset_ = OGRSFDriverRegistrar::Open((dataset_name_).c_str(), FALSE); if (! dataset_) { const std::string err = CPLGetLastErrorMsg(); @@ -122,19 +140,27 @@ void ogr_datasource::bind() const } // initialize layer - boost::optional layer_by_name = params_.get("layer"); boost::optional layer_by_index = params_.get("layer_by_index"); + boost::optional layer_by_sql = params_.get("layer_by_sql"); - if (layer_by_name && layer_by_index) + int passed_parameters = 0; + passed_parameters += layer_by_name ? 1 : 0; + passed_parameters += layer_by_index ? 1 : 0; + passed_parameters += layer_by_sql ? 1 : 0; + + if (passed_parameters > 1) { - throw datasource_exception("OGR Plugin: you can only select an ogr layer by name ('layer' parameter) or by number ('layer_by_index' parameter), do not supply both parameters" ); + throw datasource_exception("OGR Plugin: you can only select an ogr layer by name " + "('layer' parameter), by number ('layer_by_index' parameter), " + "or by sql ('layer_by_sql' parameter), " + "do not supply 2 or more of them at the same time" ); } if (layer_by_name) { - layerName_ = *layer_by_name; - layer_ = dataset_->GetLayerByName(layerName_.c_str()); + layer_name_ = *layer_by_name; + layer_.layer_by_name(dataset_, layer_name_); } else if (layer_by_index) { @@ -149,21 +175,19 @@ void ogr_datasource::bind() const throw datasource_exception(s.str()); } - OGRLayer* ogr_layer = dataset_->GetLayer(*layer_by_index); - if (ogr_layer) - { - OGRFeatureDefn* def = ogr_layer->GetLayerDefn(); - if (def != 0) - { - layerName_ = def->GetName(); - layer_ = ogr_layer; - } - } + layer_.layer_by_index(dataset_, *layer_by_index); + layer_name_ = layer_.layer_name(); + } + else if (layer_by_sql) + { + layer_.layer_by_sql(dataset_, *layer_by_sql); + layer_name_ = layer_.layer_name(); } else { std::ostringstream s; - s << "OGR Plugin: missing or parameter, available layers are: "; + s << "OGR Plugin: missing or or " + << "parameter, available layers are: "; unsigned num_layers = dataset_->GetLayerCount(); bool layer_found = false; @@ -186,7 +210,7 @@ void ogr_datasource::bind() const throw datasource_exception(s.str()); } - if (! layer_) + if (! layer_.is_valid()) { std::string s("OGR Plugin: "); @@ -198,15 +222,22 @@ void ogr_datasource::bind() const { s += "cannot find layer by index number '" + *layer_by_index; } + else if (layer_by_sql) + { + s += "cannot find layer by sql query '" + *layer_by_sql; + } s += "' in dataset '" + dataset_name_ + "'"; throw datasource_exception(s); } + // work with real OGR layer + OGRLayer* layer = layer_.layer(); + // initialize envelope OGREnvelope envelope; - layer_->GetExtent(&envelope); + layer->GetExtent(&envelope); extent_.init(envelope.MinX, envelope.MinY, envelope.MaxX, envelope.MaxY); // scan for index file @@ -220,7 +251,7 @@ void ogr_datasource::bind() const } index_name_ = dataset_name_.substr(0, breakpoint) + ".ogrindex"; - std::ifstream index_file (index_name_.c_str(), std::ios::in | std::ios::binary); + std::ifstream index_file(index_name_.c_str(), std::ios::in | std::ios::binary); if (index_file) { indexed_ = true; @@ -237,7 +268,7 @@ void ogr_datasource::bind() const #endif // deal with attributes descriptions - OGRFeatureDefn* def = layer_->GetLayerDefn(); + OGRFeatureDefn* def = layer->GetLayerDefn(); if (def != 0) { const int fld_count = def->GetFieldCount(); @@ -323,39 +354,16 @@ featureset_ptr ogr_datasource::features(query const& q) const { if (! is_bound_) bind(); - if (dataset_ && layer_) + if (dataset_ && layer_.is_valid()) { -#if 0 - // TODO - actually filter fields! - // http://trac.osgeo.org/gdal/wiki/rfc29_desired_fields - // http://trac.osgeo.org/gdal/wiki/rfc28_sqlfunc - - std::ostringstream s; - - s << "select "; - std::set const& props = q.property_names(); - std::set::const_iterator pos = props.begin(); - std::set::const_iterator end = props.end(); - while (pos != end) - { - s << ",\"" << *pos << "\""; - ++pos; - } - s << " from " << layerName_ ; - - // execute existing SQL - OGRLayer* layer = dataset_->ExecuteSQL(s.str(), poly); - - // layer must be freed - dataset_->ReleaseResultSet(layer); -#endif + OGRLayer* layer = layer_.layer(); if (indexed_) { filter_in_box filter(q.get_bbox()); return featureset_ptr(new ogr_index_featureset(*dataset_, - *layer_, + *layer, filter, index_name_, desc_.get_encoding(), @@ -364,12 +372,13 @@ featureset_ptr ogr_datasource::features(query const& q) const else { return featureset_ptr(new ogr_featureset (*dataset_, - *layer_, + *layer, q.get_bbox(), desc_.get_encoding(), multiple_geometries_)); } } + return featureset_ptr(); } @@ -377,14 +386,16 @@ featureset_ptr ogr_datasource::features_at_point(coord2d const& pt) const { if (!is_bound_) bind(); - if (dataset_ && layer_) + if (dataset_ && layer_.is_valid()) { + OGRLayer* layer = layer_.layer(); + if (indexed_) { filter_at_point filter(pt); return featureset_ptr(new ogr_index_featureset (*dataset_, - *layer_, + *layer, filter, index_name_, desc_.get_encoding(), @@ -397,11 +408,12 @@ featureset_ptr ogr_datasource::features_at_point(coord2d const& pt) const point.setY (pt.y); return featureset_ptr(new ogr_featureset (*dataset_, - *layer_, + *layer, point, desc_.get_encoding(), multiple_geometries_)); } } + return featureset_ptr(); } diff --git a/plugins/input/ogr/ogr_datasource.hpp b/plugins/input/ogr/ogr_datasource.hpp index a52f5c112..23228432f 100644 --- a/plugins/input/ogr/ogr_datasource.hpp +++ b/plugins/input/ogr/ogr_datasource.hpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef OGR_DATASOURCE_HPP #define OGR_DATASOURCE_HPP @@ -35,12 +34,13 @@ // ogr #include +#include "ogr_layer_ptr.hpp" + class ogr_datasource : public mapnik::datasource { public: ogr_datasource(mapnik::parameters const& params, bool bind=true); virtual ~ogr_datasource (); - int type() const; static std::string name(); mapnik::featureset_ptr features(mapnik::query const& q) const; @@ -55,8 +55,8 @@ private: std::string dataset_name_; mutable std::string index_name_; mutable OGRDataSource* dataset_; - mutable OGRLayer* layer_; - mutable std::string layerName_; + mutable ogr_layer_ptr layer_; + mutable std::string layer_name_; mutable mapnik::layer_descriptor desc_; bool multiple_geometries_; mutable bool indexed_; diff --git a/plugins/input/ogr/ogr_feature_ptr.hpp b/plugins/input/ogr/ogr_feature_ptr.hpp index 7125986cc..ed87bb9cf 100644 --- a/plugins/input/ogr/ogr_feature_ptr.hpp +++ b/plugins/input/ogr/ogr_feature_ptr.hpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef OGR_FEATURE_PTR_HPP #define OGR_FEATURE_PTR_HPP @@ -30,15 +29,17 @@ class ogr_feature_ptr { public: - ogr_feature_ptr (OGRFeature* const feat) - : feat_ (feat) + ogr_feature_ptr(OGRFeature* const feat) + : feat_(feat) { } - ~ogr_feature_ptr () + ~ogr_feature_ptr() { if (feat_ != NULL) - OGRFeature::DestroyFeature (feat_); + { + OGRFeature::DestroyFeature(feat_); + } } OGRFeature* operator*() diff --git a/plugins/input/ogr/ogr_featureset.cpp b/plugins/input/ogr/ogr_featureset.cpp index 13baf9bdb..d34964cbf 100644 --- a/plugins/input/ogr/ogr_featureset.cpp +++ b/plugins/input/ogr/ogr_featureset.cpp @@ -19,8 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ +// mapnik #include #include #include diff --git a/plugins/input/ogr/ogr_featureset.hpp b/plugins/input/ogr/ogr_featureset.hpp index 65c8e5fcb..9cf7bb067 100644 --- a/plugins/input/ogr/ogr_featureset.hpp +++ b/plugins/input/ogr/ogr_featureset.hpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef OGR_FEATURESET_HPP #define OGR_FEATURESET_HPP diff --git a/plugins/input/ogr/ogr_index_featureset.cpp b/plugins/input/ogr/ogr_index_featureset.cpp index 407578ad4..a67881b9c 100644 --- a/plugins/input/ogr/ogr_index_featureset.cpp +++ b/plugins/input/ogr/ogr_index_featureset.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2007 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/plugins/input/ogr/ogr_index_featureset.hpp b/plugins/input/ogr/ogr_index_featureset.hpp index 38bfff21f..39b90598a 100644 --- a/plugins/input/ogr/ogr_index_featureset.hpp +++ b/plugins/input/ogr/ogr_index_featureset.hpp @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef OGR_INDEX_FEATURESET_HPP #define OGR_INDEX_FEATURESET_HPP diff --git a/plugins/input/ogr/ogr_layer_ptr.hpp b/plugins/input/ogr/ogr_layer_ptr.hpp new file mode 100644 index 000000000..8fdc85971 --- /dev/null +++ b/plugins/input/ogr/ogr_layer_ptr.hpp @@ -0,0 +1,194 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef OGR_LAYER_PTR_HPP +#define OGR_LAYER_PTR_HPP + +// stl +#include +#include +#include + +// ogr +#include + +class ogr_layer_ptr +{ +public: + ogr_layer_ptr() + : datasource_(NULL), + layer_(NULL), + owns_layer_(false), + is_valid_(false) + { + } + + ~ogr_layer_ptr() + { + free_layer(); + } + + void free_layer() + { + if (owns_layer_ && layer_ != NULL && datasource_ != NULL) + { + datasource_->ReleaseResultSet(layer_); + } + + datasource_ = NULL; + layer_ = NULL; + layer_name_ = ""; + owns_layer_ = false; + is_valid_ = false; + } + + void layer_by_name(OGRDataSource* const datasource, + const std::string& layer_name) + { + free_layer(); + + datasource_ = datasource; + + OGRLayer* ogr_layer = datasource_->GetLayerByName(layer_name.c_str()); + if (ogr_layer) + { + layer_name_ = layer_name; + layer_ = ogr_layer; + is_valid_ = true; + +#ifdef MAPNIK_DEBUG + std::clog << "OGR Plugin: layer_from_name layer is " << layer_name_ << std::endl; +#endif + } + +#ifdef MAPNIK_DEBUG + debug_print_last_error(); +#endif + } + + void layer_by_index(OGRDataSource* const datasource, + int layer_index) + { + free_layer(); + + datasource_ = datasource; + + OGRLayer* ogr_layer = datasource_->GetLayer(layer_index); + if (ogr_layer) + { + OGRFeatureDefn* def = ogr_layer->GetLayerDefn(); + if (def != 0) + { + layer_ = ogr_layer; + layer_name_ = def->GetName(); + is_valid_ = true; + +#ifdef MAPNIK_DEBUG + std::clog << "OGR Plugin: layer_from_index layer is " << layer_name_ << std::endl; +#endif + } + } + +#ifdef MAPNIK_DEBUG + debug_print_last_error(); +#endif + } + + void layer_by_sql(OGRDataSource* const datasource, + const std::string& layer_sql) + { + free_layer(); + + datasource_ = datasource; + owns_layer_ = true; + + // TODO - actually filter fields! + // http://trac.osgeo.org/gdal/wiki/rfc29_desired_fields + // http://trac.osgeo.org/gdal/wiki/rfc28_sqlfunc + + OGRGeometry* spatial_filter = NULL; + const char* sql_dialect = NULL; + OGRLayer* ogr_layer = datasource_->ExecuteSQL(layer_sql.c_str(), spatial_filter, sql_dialect); + + if (ogr_layer) + { + OGRFeatureDefn* def = ogr_layer->GetLayerDefn(); + if (def != 0) + { + layer_ = ogr_layer; + layer_name_ = def->GetName(); + is_valid_ = true; + +#ifdef MAPNIK_DEBUG + std::clog << "OGR Plugin: layer_from_sql layer is " << layer_name_ << std::endl; +#endif + } + } + +#ifdef MAPNIK_DEBUG + debug_print_last_error(); +#endif + } + + const std::string& layer_name() const + { + return layer_name_; + } + + OGRLayer* layer() const + { + return layer_; + } + + bool is_valid() const + { + return is_valid_; + } + +private: + +#ifdef MAPNIK_DEBUG + void debug_print_last_error() + { + if (! is_valid_) + { + const std::string err = CPLGetLastErrorMsg(); + if (err.size() == 0) + { + std::clog << "OGR Plugin: error getting layer" << std::endl; + } + else + { + std::clog << "OGR Plugin: " << err << std::endl; + } + } + } +#endif + + OGRDataSource* datasource_; + OGRLayer* layer_; + std::string layer_name_; + bool owns_layer_; + bool is_valid_; +}; + +#endif // OGR_LAYER_PTR_HPP diff --git a/plugins/input/osm/basiccurl.cpp b/plugins/input/osm/basiccurl.cpp index 74d6c9880..d0d1fd725 100755 --- a/plugins/input/osm/basiccurl.cpp +++ b/plugins/input/osm/basiccurl.cpp @@ -1,45 +1,70 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + #include "basiccurl.h" -CURL_LOAD_DATA *grab_http_response(const char *url) +CURL_LOAD_DATA* grab_http_response(const char* url) { - CURL_LOAD_DATA *data; + CURL_LOAD_DATA* data; - CURL *curl = curl_easy_init(); + CURL* curl = curl_easy_init(); - if(curl) - { - data = do_grab(curl,url); - curl_easy_cleanup(curl); - return data; - } - return NULL; + if(curl) + { + data = do_grab(curl, url); + curl_easy_cleanup(curl); + return data; + } + return NULL; } -CURL_LOAD_DATA *do_grab(CURL *curl,const char *url) +CURL_LOAD_DATA* do_grab(CURL* curl,const char* url) { - CURLcode res; - CURL_LOAD_DATA *data = (CURL_LOAD_DATA *)malloc(sizeof(CURL_LOAD_DATA)); - data->data = NULL; - data->nbytes = 0; + CURLcode res; + CURL_LOAD_DATA* data = (CURL_LOAD_DATA*)malloc(sizeof(CURL_LOAD_DATA)); + data->data = NULL; + data->nbytes = 0; - curl_easy_setopt(curl,CURLOPT_URL,url); - curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,response_callback); - curl_easy_setopt(curl,CURLOPT_WRITEDATA,data); + curl_easy_setopt(curl, CURLOPT_URL, url); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, response_callback); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, data); - res=curl_easy_perform(curl); + res = curl_easy_perform(curl); - return data; + return data; } -size_t response_callback(void *ptr,size_t size,size_t nmemb, void *d) +size_t response_callback(void* ptr, size_t size, size_t nmemb, void* d) { - size_t rsize=size*nmemb; - CURL_LOAD_DATA *data=(CURL_LOAD_DATA *)d; -// fprintf(stderr,"rsize is %d\n", rsize); - data->data=(char *)realloc(data->data,(data->nbytes+rsize) - *sizeof(char)); - memcpy(&(data->data[data->nbytes]),ptr,rsize); - data->nbytes += rsize; -// fprintf(stderr,"data->nbytes is %d\n", data->nbytes); - return rsize; + size_t rsize = size * nmemb; + CURL_LOAD_DATA* data = (CURL_LOAD_DATA*)d; + + // fprintf(stderr,"rsize is %d\n", rsize); + + data->data = (char*)realloc(data->data, (data->nbytes + rsize) * sizeof(char)); + memcpy(&(data->data[data->nbytes]), ptr, rsize); + data->nbytes += rsize; + + // fprintf(stderr,"data->nbytes is %d\n", data->nbytes); + + return rsize; } diff --git a/plugins/input/osm/basiccurl.h b/plugins/input/osm/basiccurl.h index 8981c773a..0736720c7 100755 --- a/plugins/input/osm/basiccurl.h +++ b/plugins/input/osm/basiccurl.h @@ -1,3 +1,25 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + #ifndef BASICCURL_H #define BASICCURL_H @@ -12,7 +34,7 @@ typedef struct } CURL_LOAD_DATA; CURL_LOAD_DATA *grab_http_response(const char *url); -CURL_LOAD_DATA *do_grab(CURL *curl,const char *url); -size_t response_callback(void *ptr,size_t size,size_t nmemb, void *data); +CURL_LOAD_DATA *do_grab(CURL *curl, const char *url); +size_t response_callback(void *ptr ,size_t size, size_t nmemb, void *data); -#endif +#endif // BASICCURL_H diff --git a/plugins/input/osm/dataset_deliverer.cpp b/plugins/input/osm/dataset_deliverer.cpp index 1e2b11d8c..e56a52a38 100644 --- a/plugins/input/osm/dataset_deliverer.cpp +++ b/plugins/input/osm/dataset_deliverer.cpp @@ -1,56 +1,86 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + #include "dataset_deliverer.h" #include "basiccurl.h" #include -osm_dataset * dataset_deliverer::dataset=NULL; +osm_dataset * dataset_deliverer::dataset = NULL; std::string dataset_deliverer::last_bbox = ""; std::string dataset_deliverer::last_filename = ""; -osm_dataset* dataset_deliverer::load_from_file(const string& file, - const string& parser) +osm_dataset* dataset_deliverer::load_from_file(const string& file, const string& parser) { - // Only actually load from file if we haven't done so already - if(dataset == NULL) - { - dataset = new osm_dataset; - if(dataset->load(file.c_str(),parser)==false) - return NULL; - atexit(dataset_deliverer::release); - last_filename = file; - } - else if(file != last_filename) - { - dataset = new osm_dataset; - if(dataset->load(file.c_str(),parser)==false) - return NULL; - last_filename = file; - } - return dataset; + // Only actually load from file if we haven't done so already + if (dataset == NULL) + { + dataset = new osm_dataset; + if (dataset->load(file.c_str(), parser) == false) + { + return NULL; + } + + atexit(dataset_deliverer::release); + last_filename = file; + } + else if(file != last_filename) + { + dataset = new osm_dataset; + if (dataset->load(file.c_str(), parser) == false) + { + return NULL; + } + last_filename = file; + } + return dataset; } -osm_dataset* dataset_deliverer::load_from_url - (const string& url,const string& bbox,const string& parser) +osm_dataset* dataset_deliverer::load_from_url(const string& url, const string& bbox, const string& parser) { - - if(dataset==NULL) - { - dataset = new osm_dataset; - if(dataset->load_from_url(url.c_str(),bbox,parser)==false) - return NULL; - atexit(dataset_deliverer::release); - last_bbox = bbox; - } - else if (bbox != last_bbox) - { + if (dataset == NULL) + { + dataset = new osm_dataset; + if (dataset->load_from_url(url.c_str(), bbox, parser) == false) + { + return NULL; + } + + atexit(dataset_deliverer::release); + last_bbox = bbox; + } + else if (bbox != last_bbox) + { #ifdef MAPNIK_DEBUG - cerr<<"BBOXES ARE DIFFERENT: " << last_bbox<<","<clear(); - if(dataset->load_from_url(url.c_str(),bbox,parser)==false) - return NULL; - last_bbox = bbox; - } - return dataset; + // Reload the dataset + dataset->clear(); + if (dataset->load_from_url(url.c_str(), bbox, parser) == false) + { + return NULL; + } + + last_bbox = bbox; + } + return dataset; } diff --git a/plugins/input/osm/dataset_deliverer.h b/plugins/input/osm/dataset_deliverer.h index cdcbdee43..82ea029cf 100644 --- a/plugins/input/osm/dataset_deliverer.h +++ b/plugins/input/osm/dataset_deliverer.h @@ -1,3 +1,28 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef DATASET_DELIVERER_H +#define DATASET_DELIVERER_H + #include "osm.h" #include #include @@ -12,13 +37,13 @@ private: static std::string last_filename; public: - static osm_dataset *load_from_file(const string&,const string&); - static osm_dataset *load_from_url - (const string&,const string&,const string&); + static osm_dataset *load_from_file(const string&, const string&); + static osm_dataset *load_from_url(const string&, const string&, const string&); static void release() { - delete dataset; + delete dataset; } }; +#endif // DATASET_DELIVERER_H diff --git a/plugins/input/osm/osm.cpp b/plugins/input/osm/osm.cpp index b15ca98b2..e93b5b128 100644 --- a/plugins/input/osm/osm.cpp +++ b/plugins/input/osm/osm.cpp @@ -1,263 +1,280 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + #include "osm.h" #include "osmparser.h" +#include "basiccurl.h" + #include #include #include #include #include -#include "basiccurl.h" - - -#include -using namespace std; polygon_types osm_way::ptypes; bool osm_dataset::load(const char* filename,const std::string& parser) { - if (parser=="libxml2") - { - return osmparser::parse(this,filename); - } - return false; + if (parser == "libxml2") + { + return osmparser::parse(this, filename); + } + return false; } bool osm_dataset::load_from_url(const std::string& url, - const std::string& bbox, - const std::string& parser) + const std::string& bbox, + const std::string& parser) { - if(parser=="libxml2") - { + if (parser == "libxml2") + { #ifdef MAPNIK_DEBUG - cerr<<"osm_dataset::load_from_url: url=" << url << - " bbox="<nbytes+1]; - memcpy(blx,resp->data,resp->nbytes); - blx[resp->nbytes] = '\0'; + CURL_LOAD_DATA* resp = grab_http_response(str.str().c_str()); + + if (resp != NULL) + { + char *blx = new char[resp->nbytes + 1]; + memcpy(blx, resp->data, resp->nbytes); + blx[resp->nbytes] = '\0'; #ifdef MAPNIK_DEBUG - cerr<< " CURL RESPONSE: " << blx << endl; + std::clog << "Osm Plugin: CURL RESPONSE: " << blx << std::endl; #endif - delete[] blx; - bool success= osmparser::parse(this,resp->data,resp->nbytes); - return success; + delete[] blx; + bool success = osmparser::parse(this, resp->data, resp->nbytes); + return success; + } } - } - return false; + return false; } osm_dataset::~osm_dataset() { - clear(); + clear(); } void osm_dataset::clear() { #ifdef MAPNIK_DEBUG - cerr<<"osm_dataset::clear()"<to_string(); - } - for(unsigned int count=0; countto_string(); - } - return result; + for (unsigned int count = 0; count < nodes.size(); ++count) + { + result += nodes[count]->to_string(); + } + + for (unsigned int count = 0; count < ways.size(); ++count) + { + result += ways[count]->to_string(); + } + + return result; } bounds osm_dataset::get_bounds() { - bounds b (-180,-90,180,90); - for(unsigned int count=0; countlon > b.w) - b.w=nodes[count]->lon; - if(nodes[count]->lon < b.e) - b.e=nodes[count]->lon; - if(nodes[count]->lat > b.s) - b.s=nodes[count]->lat; - if(nodes[count]->lat < b.n) - b.n=nodes[count]->lat; - } - return b; + bounds b (-180, -90, 180, 90); + for (unsigned int count = 0; count < nodes.size(); ++count) + { + if(nodes[count]->lon > b.w) b.w = nodes[count]->lon; + if(nodes[count]->lon < b.e) b.e = nodes[count]->lon; + if(nodes[count]->lat > b.s) b.s = nodes[count]->lat; + if(nodes[count]->lat < b.n) b.n = nodes[count]->lat; + } + return b; } -osm_node *osm_dataset::next_node() +osm_node* osm_dataset::next_node() { - if(node_i!=nodes.end()) - { - return *(node_i++); - } - return NULL; - + if (node_i != nodes.end()) + { + return *(node_i++); + } + return NULL; } -osm_way *osm_dataset::next_way() + +osm_way* osm_dataset::next_way() { - if(way_i!=ways.end()) - { - return *(way_i++); - } - return NULL; + if (way_i != ways.end()) + { + return *(way_i++); + } + return NULL; } -osm_item *osm_dataset::next_item() +osm_item* osm_dataset::next_item() { - osm_item *item=NULL; - if(next_item_mode==Node) - { - item = next_node(); - if(item==NULL) + osm_item* item = NULL; + if (next_item_mode == Node) { - next_item_mode=Way; - rewind_ways(); - item = next_way(); + item = next_node(); + if (item == NULL) + { + next_item_mode = Way; + rewind_ways(); + item = next_way(); + } } - } - else - { - item = next_way(); - } - return item; + else + { + item = next_way(); + } + return item; } std::set osm_dataset::get_keys() { - std::set keys; - for(unsigned int count=0; count::iterator i= - nodes[count]->keyvals.begin(); i!=nodes[count]->keyvals.end(); i++) + std::set keys; + for (unsigned int count = 0; count < nodes.size(); ++count) { - keys.insert(i->first); + for (std::map::iterator i = nodes[count]->keyvals.begin(); + i != nodes[count]->keyvals.end(); i++) + { + keys.insert(i->first); + } } - } - for(unsigned int count=0; count::iterator i= - ways[count]->keyvals.begin(); i!=ways[count]->keyvals.end(); i++) + + for (unsigned int count = 0; count < ways.size(); ++count) { - keys.insert(i->first); + for (std::map::iterator i = ways[count]->keyvals.begin(); + i != ways[count]->keyvals.end(); i++) + { + keys.insert(i->first); + } } - } - return keys; + return keys; } - - std::string osm_item::to_string() { - std::ostringstream strm; - strm << "id=" << id << std::endl << "Keyvals: " << std::endl; - for(std::map::iterator i=keyvals.begin(); - i!=keyvals.end(); i++) - { - strm << "Key " << i->first << " Value " << i->second << std::endl; - } - return strm.str(); + std::ostringstream strm; + strm << "id=" << id << std::endl << "Keyvals: " << std::endl; + + for (std::map::iterator i = keyvals.begin(); + i != keyvals.end(); i++) + { + strm << "Key " << i->first << " Value " << i->second << std::endl; + } + + return strm.str(); } std::string osm_node::to_string() { - std::ostringstream strm; - strm << "Node: "<< osm_item::to_string() << - " Lat=" << lat <<" lon=" <id << " "; + if (nodes[count] != NULL) + { + strm << nodes[count]->id << " "; + } } - } - strm << std::endl; - return strm.str(); + + strm << std::endl; + return strm.str(); } bounds osm_way::get_bounds() { - bounds b (-180,-90,180,90); - for(unsigned int count=0; countlon > b.w) - b.w=nodes[count]->lon; - if(nodes[count]->lon < b.e) - b.e=nodes[count]->lon; - if(nodes[count]->lat > b.s) - b.s=nodes[count]->lat; - if(nodes[count]->lat < b.n) - b.n=nodes[count]->lat; - } - return b; + bounds b (-180, -90, 180, 90); + + for (unsigned int count = 0; count < nodes.size(); ++count) + { + if(nodes[count]->lon > b.w) b.w = nodes[count]->lon; + if(nodes[count]->lon < b.e) b.e = nodes[count]->lon; + if(nodes[count]->lat > b.s) b.s = nodes[count]->lat; + if(nodes[count]->lat < b.n) b.n = nodes[count]->lat; + } + return b; } bool osm_way::is_polygon() { - for(unsigned int count=0; countw = w; this->s = s; @@ -23,39 +45,35 @@ struct bounds class polygon_types { public: - std::vector > ptypes; + std::vector > ptypes; polygon_types() { - ptypes.push_back(std::pair("natural","wood")); - ptypes.push_back(std::pair("natural","water")); - ptypes.push_back(std::pair("natural","heath")); - ptypes.push_back(std::pair("natural","marsh")); - ptypes.push_back(std::pair("military", - "danger_area")); - ptypes.push_back(std::pair - ("landuse","forest")); - ptypes.push_back(std::pair - ("landuse","industrial")); + ptypes.push_back(std::pair("natural", "wood")); + ptypes.push_back(std::pair("natural", "water")); + ptypes.push_back(std::pair("natural", "heath")); + ptypes.push_back(std::pair("natural", "marsh")); + ptypes.push_back(std::pair("military", "danger_area")); + ptypes.push_back(std::pair("landuse","forest")); + ptypes.push_back(std::pair("landuse","industrial")); } }; struct osm_item { long id; - std::map keyvals; + std::map keyvals; virtual std::string to_string(); - virtual ~osm_item() { } + virtual ~osm_item() {} }; - -struct osm_node: public osm_item +struct osm_node : public osm_item { double lat, lon; std::string to_string(); }; -struct osm_way: public osm_item +struct osm_way : public osm_item { std::vector nodes; std::string to_string(); @@ -68,36 +86,48 @@ class osm_dataset { private: int next_item_mode; - enum {Node, Way }; + enum { Node, Way }; std::vector::iterator node_i; std::vector::iterator way_i; std::vector nodes; std::vector ways; public: - osm_dataset() { node_i=nodes.begin(); way_i=ways.begin(); - next_item_mode=Node; } - osm_dataset(const char* name) - { node_i=nodes.begin(); way_i=ways.begin(); - next_item_mode=Node; load(name); } - bool load(const char* name,const std::string& parser="libxml2"); - bool load_from_url(const std::string&,const std::string&, - const std::string& parser="libxml2"); + osm_dataset() + { + node_i = nodes.begin(); + way_i = ways.begin(); + next_item_mode = Node; + } + + osm_dataset(const char* name) + { + node_i = nodes.begin(); + way_i = ways.begin(); + next_item_mode = Node; + load(name); + } + ~osm_dataset(); + + bool load(const char* name, const std::string& parser = "libxml2"); + bool load_from_url(const std::string&, + const std::string&, + const std::string& parser = "libxml2"); void clear(); void add_node(osm_node* n) { nodes.push_back(n); } void add_way(osm_way* w) { ways.push_back(w); } std::string to_string(); bounds get_bounds(); std::set get_keys(); - void rewind_nodes() { node_i=nodes.begin(); } - void rewind_ways() { way_i=ways.begin(); } - void rewind() { rewind_nodes(); rewind_ways(); next_item_mode=Node; } + void rewind_nodes() { node_i = nodes.begin(); } + void rewind_ways() { way_i = ways.begin(); } + void rewind() { rewind_nodes(); rewind_ways(); next_item_mode = Node; } osm_node * next_node(); osm_way * next_way(); osm_item * next_item(); - bool current_item_is_node() { return next_item_mode==Node; } - bool current_item_is_way() { return next_item_mode==Way; } + bool current_item_is_node() { return next_item_mode == Node; } + bool current_item_is_way() { return next_item_mode == Way; } }; #endif // OSM_H diff --git a/plugins/input/osm/osm_datasource.cpp b/plugins/input/osm/osm_datasource.cpp index f286c1f55..f2f64b545 100644 --- a/plugins/input/osm/osm_datasource.cpp +++ b/plugins/input/osm/osm_datasource.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,12 @@ * *****************************************************************************/ +// stl +#include +#include +#include +#include + // mapnik #include #include @@ -27,20 +33,12 @@ // boost #include -// stl -#include -#include -#include -#include - #include "osm_datasource.hpp" #include "osm_featureset.hpp" #include "dataset_deliverer.h" #include "osmtagtypes.h" #include "osmparser.h" -DATASOURCE_PLUGIN(osm_datasource) - using mapnik::String; using mapnik::Double; using mapnik::Integer; @@ -49,10 +47,12 @@ using mapnik::filter_in_box; using mapnik::filter_at_point; using mapnik::attribute_descriptor; -osm_datasource::osm_datasource(const parameters ¶ms, bool bind) - : datasource (params), - type_(datasource::Vector), - desc_(*params_.get("type"), *params_.get("encoding","utf-8")) +DATASOURCE_PLUGIN(osm_datasource) + +osm_datasource::osm_datasource(const parameters& params, bool bind) + : datasource (params), + type_(datasource::Vector), + desc_(*params_.get("type"), *params_.get("encoding", "utf-8")) { if (bind) { @@ -65,62 +65,64 @@ void osm_datasource::bind() const if (is_bound_) return; osm_data_ = NULL; - std::string osm_filename= *params_.get("file",""); - std::string parser = *params_.get("parser","libxml2"); - std::string url = *params_.get("url",""); - std::string bbox = *params_.get("bbox",""); + std::string osm_filename = *params_.get("file", ""); + std::string parser = *params_.get("parser", "libxml2"); + std::string url = *params_.get("url", ""); + std::string bbox = *params_.get("bbox", ""); - bool do_process=false; + bool do_process = false; // load the data // if we supplied a filename, load from file - if (url!="" && bbox!="") + if (url != "" && bbox != "") { // otherwise if we supplied a url and a bounding box, load from the url #ifdef MAPNIK_DEBUG - cerr<<"loading_from_url: url="<rewind(); + // Need code to get the attributes of all the data - std::set keys= osm_data_->get_keys(); + std::set keys = osm_data_->get_keys(); // Add the attributes to the datasource descriptor - assume they are // all of type String - for(std::set::iterator i=keys.begin(); i!=keys.end(); i++) - desc_.add_descriptor(attribute_descriptor(*i,tagtypes.get_type(*i))); + for (std::set::iterator i = keys.begin(); i != keys.end(); i++) + { + desc_.add_descriptor(attribute_descriptor(*i, tagtypes.get_type(*i))); + } // Get the bounds of the data and set extent_ accordingly bounds b = osm_data_->get_bounds(); - extent_ = box2d(b.w,b.s,b.e,b.n); + extent_ = box2d(b.w, b.s, b.e, b.n); } is_bound_ = true; } - osm_datasource::~osm_datasource() { // Do not do as is now static variable and cleaned up at exit @@ -129,59 +131,58 @@ osm_datasource::~osm_datasource() std::string osm_datasource::name() { - return "osm"; + return "osm"; } int osm_datasource::type() const { - return type_; + return type_; } layer_descriptor osm_datasource::get_descriptor() const { - return desc_; + return desc_; } featureset_ptr osm_datasource::features(const query& q) const { - if (!is_bound_) bind(); + if (! is_bound_) bind(); filter_in_box filter(q.get_bbox()); // so we need to filter osm features by bbox here... return boost::make_shared >(filter, - osm_data_, - q.property_names(), - desc_.get_encoding()); + osm_data_, + q.property_names(), + desc_.get_encoding()); } featureset_ptr osm_datasource::features_at_point(coord2d const& pt) const { - if (!is_bound_) bind(); + if (! is_bound_) bind(); - filter_at_point filter(pt); - // collect all attribute names - std::vector const& desc_vector = - desc_.get_descriptors(); - std::vector::const_iterator itr = desc_vector.begin(); - std::vector::const_iterator end = desc_vector.end(); - std::set names; + filter_at_point filter(pt); + // collect all attribute names + std::vector const& desc_vector = desc_.get_descriptors(); + std::vector::const_iterator itr = desc_vector.begin(); + std::vector::const_iterator end = desc_vector.end(); + std::set names; - while (itr != end) - { - names.insert(itr->get_name()); - ++itr; - } + while (itr != end) + { + names.insert(itr->get_name()); + ++itr; + } return boost::make_shared >(filter, - osm_data_, - names, - desc_.get_encoding()); + osm_data_, + names, + desc_.get_encoding()); } box2d osm_datasource::envelope() const { - if (!is_bound_) bind(); + if (! is_bound_) bind(); return extent_; } diff --git a/plugins/input/osm/osm_datasource.hpp b/plugins/input/osm/osm_datasource.hpp index 44b826870..600ccf406 100644 --- a/plugins/input/osm/osm_datasource.hpp +++ b/plugins/input/osm/osm_datasource.hpp @@ -1,8 +1,8 @@ /***************************************************************************** - * + * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,17 +20,15 @@ * *****************************************************************************/ -// $Id$ - #ifndef OSM_DATASOURCE_HPP #define OSM_DATASOURCE_HPP +// mapnik #include #include #include "osm.h" - using mapnik::datasource; using mapnik::parameters; using mapnik::query; @@ -41,26 +39,24 @@ using mapnik::box2d; class osm_datasource : public datasource { - public: - osm_datasource(const parameters ¶ms, bool bind=true); - virtual ~osm_datasource(); - - // these must be overridden - int type() const; - featureset_ptr features(const query& q) const; - featureset_ptr features_at_point(coord2d const& pt) const; - box2d envelope() const; - layer_descriptor get_descriptor() const; +public: + osm_datasource(const parameters& params, bool bind = true); + virtual ~osm_datasource(); + int type() const; + featureset_ptr features(const query& q) const; + featureset_ptr features_at_point(coord2d const& pt) const; + box2d envelope() const; + layer_descriptor get_descriptor() const; static std::string name(); void bind() const; - private: - osm_datasource(const osm_datasource&); - osm_datasource& operator=(const osm_datasource&); - private: - mutable box2d extent_; - mutable osm_dataset * osm_data_; +private: + mutable box2d extent_; + mutable osm_dataset* osm_data_; int type_; mutable layer_descriptor desc_; + // no copying + osm_datasource(const osm_datasource&); + osm_datasource& operator=(const osm_datasource&); }; -#endif //OSM_DATASOURCE_HPP +#endif // OSM_DATASOURCE_HPP diff --git a/plugins/input/osm/osm_featureset.cpp b/plugins/input/osm/osm_featureset.cpp index 3cf7b7b58..e16202046 100644 --- a/plugins/input/osm/osm_featureset.cpp +++ b/plugins/input/osm/osm_featureset.cpp @@ -3,7 +3,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -21,55 +21,53 @@ * *****************************************************************************/ +// stl +#include + // mapnik #include #include #include "osm_featureset.hpp" -// stl -#include - using mapnik::Feature; using mapnik::feature_ptr; using mapnik::geometry_type; using mapnik::feature_factory; -using std::cerr; -using std::endl; template osm_featureset::osm_featureset(const filterT& filter, - osm_dataset * dataset, + osm_dataset* dataset, const std::set& attribute_names, std::string const& encoding) - : filter_(filter), - query_ext_(), - tr_(new transcoder(encoding)), - feature_id_(1), - dataset_ (dataset), - attribute_names_ (attribute_names) + : filter_(filter), + query_ext_(), + tr_(new transcoder(encoding)), + feature_id_(1), + dataset_ (dataset), + attribute_names_ (attribute_names) { dataset_->rewind(); } - template feature_ptr osm_featureset::next() { - osm_item * cur_item = dataset_->next_item(); feature_ptr feature; - bool success=false; - if(cur_item != NULL) + bool success = false; + + osm_item* cur_item = dataset_->next_item(); + if (cur_item != NULL) { - if(dataset_->current_item_is_node()) + if (dataset_->current_item_is_node()) { feature = feature_factory::create(feature_id_); ++feature_id_; double lat = static_cast(cur_item)->lat; double lon = static_cast(cur_item)->lon; - geometry_type * point = new geometry_type(mapnik::Point); - point->move_to(lon,lat); + geometry_type* point = new geometry_type(mapnik::Point); + point->move_to(lon, lat); feature->add_geometry(point); success = true; } @@ -78,40 +76,42 @@ feature_ptr osm_featureset::next() bounds b = static_cast(cur_item)->get_bounds(); // Loop until we find a feature which passes the filter - while(cur_item != NULL && - !filter_.pass(box2d(b.w,b.s,b.e,b.n))) + while (cur_item != NULL && + ! filter_.pass(box2d(b.w, b.s, b.e, b.n))) { cur_item = dataset_->next_item(); - if(cur_item!=NULL) + if (cur_item != NULL) + { b = static_cast(cur_item)->get_bounds(); + } } - if(cur_item != NULL) + if (cur_item != NULL) { - if(static_cast(cur_item)->nodes.size()) + if (static_cast(cur_item)->nodes.size()) { feature = feature_factory::create(feature_id_); ++feature_id_; - geometry_type *geom; - if(static_cast(cur_item)->is_polygon()) - geom = new geometry_type(mapnik::Polygon); - else - geom = new geometry_type(mapnik::LineString); - - geom->set_capacity(static_cast(cur_item)-> - nodes.size()); - geom->move_to(static_cast(cur_item)-> - nodes[0]->lon, - static_cast(cur_item)-> - nodes[0]->lat); - - for(unsigned int count=1; count(cur_item) - ->nodes.size(); count++) + geometry_type* geom; + if (static_cast(cur_item)->is_polygon()) { - geom->line_to(static_cast(cur_item) - ->nodes[count]->lon, - static_cast(cur_item) - ->nodes[count]->lat); + geom = new geometry_type(mapnik::Polygon); + } + else + { + geom = new geometry_type(mapnik::LineString); + } + + geom->set_capacity(static_cast(cur_item)->nodes.size()); + geom->move_to(static_cast(cur_item)->nodes[0]->lon, + static_cast(cur_item)->nodes[0]->lat); + + for (unsigned int count = 1; + count < static_cast(cur_item)->nodes.size(); + count++) + { + geom->line_to(static_cast(cur_item)->nodes[count]->lon, + static_cast(cur_item)->nodes[count]->lat); } feature->add_geometry(geom); success = true; @@ -120,31 +120,31 @@ feature_ptr osm_featureset::next() } // can feature_ptr be compared to NULL? - no - if(success) + if (success) { - std::map::iterator i= - cur_item->keyvals.begin(); + std::map::iterator i = cur_item->keyvals.begin(); // add the keyvals to the feature. the feature seems to be a map // of some sort so this should work - see dbf_file::add_attribute() - while(i != cur_item->keyvals.end()) + while (i != cur_item->keyvals.end()) { - //only add if in the specified set of attribute names - if(attribute_names_.find(i->first) != attribute_names_.end()) + // only add if in the specified set of attribute names + if (attribute_names_.find(i->first) != attribute_names_.end()) + { (*feature)[i->first] = tr_->transcode(i->second.c_str()); + } + i++; } + return feature; } } return feature_ptr(); } - template osm_featureset::~osm_featureset() {} template class osm_featureset; template class osm_featureset; - - diff --git a/plugins/input/osm/osm_featureset.hpp b/plugins/input/osm/osm_featureset.hpp index a1251e221..cefd63e7d 100644 --- a/plugins/input/osm/osm_featureset.hpp +++ b/plugins/input/osm/osm_featureset.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,14 +23,20 @@ #ifndef OSM_FS_HH #define OSM_FS_HH +// stl +#include + +// boost #include + +// mapnik #include -#include "osm.h" #include #include #include #include -#include + +#include "osm.h" using mapnik::Featureset; using mapnik::box2d; @@ -40,27 +46,26 @@ using mapnik::transcoder; template class osm_featureset : public Featureset { - filterT filter_; - box2d query_ext_; - boost::scoped_ptr tr_; - std::vector attr_ids_; - mutable box2d feature_ext_; - mutable int total_geom_size; - mutable int feature_id_; - osm_dataset *dataset_; - std::set attribute_names_; - - public: - osm_featureset(const filterT& filter, - osm_dataset *dataset, - const std::set& attribute_names, - std::string const& encoding); - virtual ~osm_featureset(); - feature_ptr next(); - private: - osm_featureset(const osm_featureset&); - const osm_featureset& operator=(const osm_featureset&); - +public: + osm_featureset(const filterT& filter, + osm_dataset* dataset, + const std::set& attribute_names, + std::string const& encoding); + virtual ~osm_featureset(); + feature_ptr next(); +private: + filterT filter_; + box2d query_ext_; + boost::scoped_ptr tr_; + std::vector attr_ids_; + mutable box2d feature_ext_; + mutable int total_geom_size; + mutable int feature_id_; + osm_dataset *dataset_; + std::set attribute_names_; + // no copying + osm_featureset(const osm_featureset&); + const osm_featureset& operator=(const osm_featureset&); }; -#endif //OSM_FS_HH +#endif // OSM_FS_HH diff --git a/plugins/input/osm/osmparser.h b/plugins/input/osm/osmparser.h index 5ffa0477f..5cc00e24a 100644 --- a/plugins/input/osm/osmparser.h +++ b/plugins/input/osm/osmparser.h @@ -1,3 +1,28 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#ifndef OSMPARSER_H +#define OSMPARSER_H + #include #include #include @@ -6,24 +31,24 @@ #include "osm.h" #include - class osmparser { +public: + static void processNode(xmlTextReaderPtr reader); + static void startElement(xmlTextReaderPtr reader, const xmlChar* name); + static void endElement(const xmlChar* name); + static bool parse(osm_dataset* ds, const char* filename); + static bool parse(osm_dataset* ds, char* data, int nbytes); + private: static osm_item *cur_item; static long curID; - static bool in_node, in_way; + static bool in_node, in_way; static osm_dataset* components; static std::string error; - static std::map tmp_node_store; + static std::map tmp_node_store; - static int do_parse(xmlTextReaderPtr); - -public: - static void processNode(xmlTextReaderPtr reader); - static void startElement(xmlTextReaderPtr reader, const xmlChar *name); - static void endElement(const xmlChar* name); - static bool parse(osm_dataset *ds, const char* filename); - static bool parse(osm_dataset *ds, char* data,int nbytes); + static int do_parse(xmlTextReaderPtr); }; +#endif // OSMPARSER_H diff --git a/plugins/input/osm/osmtagtypes.h b/plugins/input/osm/osmtagtypes.h index d486946a8..191514757 100644 --- a/plugins/input/osm/osmtagtypes.h +++ b/plugins/input/osm/osmtagtypes.h @@ -1,28 +1,50 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + #ifndef OSMTAGTYPES_H #define OSMTAGTYPES_H // osmtagtypes.h // for finding the types of particular tags +// mapnik #include class osm_tag_types { -private: - std::map types; - public: - void add_type(std::string tag, mapnik::eAttributeType type) - { - types[tag]=type; - } + void add_type(std::string tag, mapnik::eAttributeType type) + { + types[tag] = type; + } - mapnik::eAttributeType get_type(std::string tag) - { - std::map::iterator i = - types.find(tag); - return (i==types.end()) ? mapnik::String: i->second; - } + mapnik::eAttributeType get_type(std::string tag) + { + std::map::iterator i = types.find(tag); + return (i == types.end()) ? mapnik::String : i->second; + } + +private: + std::map types; }; #endif // OSMTAGTYPES_H diff --git a/plugins/input/osm/render.cpp b/plugins/input/osm/render.cpp index b55e8dd53..30583346a 100644 --- a/plugins/input/osm/render.cpp +++ b/plugins/input/osm/render.cpp @@ -1,3 +1,30 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2011 Artem Pavlenko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +// stl +#include +#include + +// mapnik #include #include #include @@ -8,52 +35,41 @@ #include #include -using namespace mapnik; - -#include -#include -using namespace std; - - int main(int argc,char *argv[]) { - if(argc < 6) - { - std::cerr<<"Usage: render XMLfile w s e n [OSMfile]" << std::endl; - exit(0); - } - - datasource_cache::instance()->register_datasources - ("/usr/local/lib/mapnik/input"); - freetype_engine::register_font - ("/usr/local/lib/mapnik/fonts/DejaVuSans.ttf"); - - Map m (800,800); - load_map(m,argv[1]); - - if(argc>6) - { - parameters p; - p["type"] = "osm"; - p["file"] = argv[6]; - for(int count=0; countparams(); - m.getLayer(count).set_datasource(datasource_cache::instance()-> - create(p)); + std::cerr << "Usage: render XMLfile w s e n [OSMfile]" << std::endl; + exit(0); } - } - box2d bbox (atof(argv[2]),atof(argv[3]), - atof(argv[4]),atof(argv[5])); + mapnik::datasource_cache::instance()->register_datasources("/usr/local/lib/mapnik/input"); + mapnik::freetype_engine::register_font("/usr/local/lib/mapnik/fonts/DejaVuSans.ttf"); + + mapnik::Map m(800, 800); + mapnik::load_map(m, argv[1]); + + if (argc > 6) + { + mapnik::parameters p; + p["type"] = "osm"; + p["file"] = argv[6]; + for (int count = 0; count < m.layer_count(); count++) + { + mapnik::parameters q = m.getLayer(count).datasource()->params(); + m.getLayer(count).set_datasource(mapnik::datasource_cache::instance()->create(p)); + } + } + + mapnik::box2d bbox (atof(argv[2]), atof(argv[3]), atof(argv[4]), atof(argv[5])); - m.zoom_to_box(bbox); + m.zoom_to_box(bbox); - image_32 buf (m.width(), m.height()); - agg_renderer r(m,buf); - r.apply(); + mapnik::image_32 buf (m.width(), m.height()); + mapnik::agg_renderer r(m, buf); + r.apply(); - save_to_file(buf.data(),"blah.png","png"); + mapnik::save_to_file(buf.data(), "blah.png", "png"); - return 0; + return 0; } diff --git a/plugins/input/postgis/connection.hpp b/plugins/input/postgis/connection.hpp index 6a8239cbe..1a056dfa4 100644 --- a/plugins/input/postgis/connection.hpp +++ b/plugins/input/postgis/connection.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,17 +20,14 @@ * *****************************************************************************/ -//$Id: connection.hpp 17 2005-03-08 23:58:43Z pavlenko $ - #ifndef CONNECTION_HPP #define CONNECTION_HPP #include #include -extern "C" -{ -#include "libpq-fe.h" +extern "C" { + #include "libpq-fe.h" } #include "resultset.hpp" diff --git a/plugins/input/postgis/connection_manager.hpp b/plugins/input/postgis/connection_manager.hpp index 35bba4f2a..9ec259495 100644 --- a/plugins/input/postgis/connection_manager.hpp +++ b/plugins/input/postgis/connection_manager.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,6 @@ * *****************************************************************************/ -//$Id: connection_manager.hpp 17 2005-03-08 23:58:43Z pavlenko $ - #ifndef CONNECTION_MANAGER_HPP #define CONNECTION_MANAGER_HPP diff --git a/plugins/input/postgis/postgis_datasource.cpp b/plugins/input/postgis/postgis_datasource.cpp index b02dc9c17..343cdd9e1 100644 --- a/plugins/input/postgis/postgis_datasource.cpp +++ b/plugins/input/postgis/postgis_datasource.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,17 +20,15 @@ * *****************************************************************************/ -//$Id: postgis.cc 44 2005-04-22 18:53:54Z pavlenko $ +#include "connection_manager.hpp" +#include "postgis_datasource.hpp" +#include "postgis_featureset.hpp" // mapnik #include #include #include -#include "connection_manager.hpp" -#include "postgis_datasource.hpp" -#include "postgis_featureset.hpp" - // boost #include #include diff --git a/plugins/input/postgis/postgis_datasource.hpp b/plugins/input/postgis/postgis_datasource.hpp index eade5781f..f371f86a1 100644 --- a/plugins/input/postgis/postgis_datasource.hpp +++ b/plugins/input/postgis/postgis_datasource.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/plugins/input/postgis/postgis_featureset.cpp b/plugins/input/postgis/postgis_featureset.cpp index 98dc8c928..801815173 100644 --- a/plugins/input/postgis/postgis_featureset.cpp +++ b/plugins/input/postgis/postgis_featureset.cpp @@ -20,7 +20,9 @@ * *****************************************************************************/ -//$Id$ +#include "postgis_featureset.hpp" +#include "resultset.hpp" +#include "cursorresultset.hpp" // mapnik #include @@ -29,10 +31,6 @@ #include #include -#include "postgis_featureset.hpp" -#include "resultset.hpp" -#include "cursorresultset.hpp" - // boost #include #include diff --git a/plugins/input/postgis/resultset.hpp b/plugins/input/postgis/resultset.hpp index 25cc20148..340258e9e 100644 --- a/plugins/input/postgis/resultset.hpp +++ b/plugins/input/postgis/resultset.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,15 +20,11 @@ * *****************************************************************************/ -//$Id: resultset.hpp 17 2005-03-08 23:58:43Z pavlenko $ - - #ifndef RESULTSET_HPP #define RESULTSET_HPP -extern "C" -{ -#include "libpq-fe.h" +extern "C" { + #include "libpq-fe.h" } class IResultSet diff --git a/plugins/input/raster/raster_datasource.cpp b/plugins/input/raster/raster_datasource.cpp index 20b363650..ea28bb3d1 100644 --- a/plugins/input/raster/raster_datasource.cpp +++ b/plugins/input/raster/raster_datasource.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id: raster_datasource.cc 44 2005-04-22 18:53:54Z pavlenko $ // boost #include @@ -33,12 +32,6 @@ #include "raster_info.hpp" #include "raster_datasource.hpp" -using mapnik::datasource; -using mapnik::parameters; -using mapnik::image_reader; - -DATASOURCE_PLUGIN(raster_datasource) - using boost::lexical_cast; using boost::bad_lexical_cast; using mapnik::layer_descriptor; @@ -46,11 +39,16 @@ using mapnik::featureset_ptr; using mapnik::query; using mapnik::coord2d; using mapnik::datasource_exception; +using mapnik::datasource; +using mapnik::parameters; +using mapnik::image_reader; + +DATASOURCE_PLUGIN(raster_datasource) raster_datasource::raster_datasource(const parameters& params, bool bind) - : datasource(params), - desc_(*params.get("type"),"utf-8"), - extent_initialized_(false) + : datasource(params), + desc_(*params.get("type"), "utf-8"), + extent_initialized_(false) { #ifdef MAPNIK_DEBUG std::clog << "Raster Plugin: Initializing..." << std::endl; @@ -69,7 +67,7 @@ raster_datasource::raster_datasource(const parameters& params, bool bind) tile_size_ = *params_.get("tile_size", 256); tile_stride_ = *params_.get("tile_stride", 1); - format_=*params_.get("format","tiff"); + format_ = *params_.get("format","tiff"); boost::optional lox = params_.get("lox"); boost::optional loy = params_.get("loy"); @@ -88,7 +86,9 @@ raster_datasource::raster_datasource(const parameters& params, bool bind) } if (! extent_initialized_) + { throw datasource_exception("Raster Plugin: valid or are required"); + } if (bind) { @@ -102,42 +102,46 @@ void raster_datasource::bind() const if (multi_tiles_) { - boost::optional x_width = params_.get("x_width"); - boost::optional y_width = params_.get("y_width"); + boost::optional x_width = params_.get("x_width"); + boost::optional y_width = params_.get("y_width"); - if (!x_width) - throw datasource_exception("Raster Plugin: x-width parameter not supplied for multi-tiled data source."); + if (! x_width) + { + throw datasource_exception("Raster Plugin: x-width parameter not supplied for multi-tiled data source."); + } - if (!y_width) - throw datasource_exception("Raster Plugin: y-width parameter not supplied for multi-tiled data source."); + if (! y_width) + { + throw datasource_exception("Raster Plugin: y-width parameter not supplied for multi-tiled data source."); + } - width_ = x_width.get() * tile_size_; - height_ = y_width.get() * tile_size_; + width_ = x_width.get() * tile_size_; + height_ = y_width.get() * tile_size_; } else { - if (! boost::filesystem::exists(filename_)) - throw datasource_exception("Raster Plugin: " + filename_ + " does not exist"); + if (! boost::filesystem::exists(filename_)) + { + throw datasource_exception("Raster Plugin: " + filename_ + " does not exist"); + } - try - { - std::auto_ptr reader(mapnik::get_image_reader(filename_, format_)); - if (reader.get()) - { - width_ = reader->width(); - height_ = reader->height(); - } - } - catch (mapnik::image_reader_exception const& ex) - { - std::cerr << "Raster Plugin: image reader exception caught: " << ex.what() << std::endl; - throw; - } - catch (...) - { - std::cerr << "Raster Plugin: exception caught" << std::endl; - throw; - } + try + { + std::auto_ptr reader(mapnik::get_image_reader(filename_, format_)); + if (reader.get()) + { + width_ = reader->width(); + height_ = reader->height(); + } + } + catch (mapnik::image_reader_exception const& ex) + { + throw datasource_exception("Raster Plugin: image reader exception: " + std::string(ex.what())); + } + catch (...) + { + throw datasource_exception("Raster Plugin: image reader unknown exception caught"); + } } #ifdef MAPNIK_DEBUG @@ -193,6 +197,7 @@ featureset_ptr raster_datasource::features(query const& q) const #endif tiled_multi_file_policy policy(filename_, format_, tile_size_, extent_, q.get_bbox(), width_, height_, tile_stride_); + return boost::make_shared >(policy, extent_, q); } else if (width * height > 512*512) @@ -202,6 +207,7 @@ featureset_ptr raster_datasource::features(query const& q) const #endif tiled_file_policy policy(filename_, format_, 256, extent_, q.get_bbox(), width_, height_); + return boost::make_shared >(policy, extent_, q); } else @@ -212,13 +218,16 @@ featureset_ptr raster_datasource::features(query const& q) const raster_info info(filename_, format_, extent_, width_, height_); single_file_policy policy(info); + return boost::make_shared >(policy, extent_, q); } } featureset_ptr raster_datasource::features_at_point(coord2d const&) const { - std::clog << "Raster Plugin: ##WARNING: feature_at_point not supported for raster.input" << std::endl; +#ifdef MAPNIK_DEBUG + std::clog << "Raster Plugin: feature_at_point not supported for raster.input" << std::endl; +#endif + return featureset_ptr(); } - diff --git a/plugins/input/raster/raster_datasource.hpp b/plugins/input/raster/raster_datasource.hpp index d88c45a96..51c723ffe 100644 --- a/plugins/input/raster/raster_datasource.hpp +++ b/plugins/input/raster/raster_datasource.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id: raster_datasource.hh 44 2005-04-22 18:53:54Z pavlenko $ #ifndef RASTER_DATASOURCE_HPP #define RASTER_DATASOURCE_HPP @@ -31,31 +30,30 @@ class raster_datasource : public mapnik::datasource { - private: - mapnik::layer_descriptor desc_; - std::string filename_; - std::string format_; - mapnik::box2d extent_; - bool extent_initialized_; - bool multi_tiles_; - unsigned tile_size_; - unsigned tile_stride_; - mutable unsigned width_; - mutable unsigned height_; - public: - raster_datasource(const mapnik::parameters& params, bool bind=true); - virtual ~raster_datasource(); - int type() const; - static std::string name(); - mapnik::featureset_ptr features(const mapnik::query& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const; - mapnik::box2d envelope() const; - mapnik::layer_descriptor get_descriptor() const; - void bind() const; - private: - //no copying - raster_datasource(const raster_datasource&); - raster_datasource& operator=(const raster_datasource&); +public: + raster_datasource(const mapnik::parameters& params, bool bind=true); + virtual ~raster_datasource(); + int type() const; + static std::string name(); + mapnik::featureset_ptr features(const mapnik::query& q) const; + mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const; + mapnik::box2d envelope() const; + mapnik::layer_descriptor get_descriptor() const; + void bind() const; +private: + mapnik::layer_descriptor desc_; + std::string filename_; + std::string format_; + mapnik::box2d extent_; + bool extent_initialized_; + bool multi_tiles_; + unsigned tile_size_; + unsigned tile_stride_; + mutable unsigned width_; + mutable unsigned height_; + //no copying + raster_datasource(const raster_datasource&); + raster_datasource& operator=(const raster_datasource&); }; -#endif //RASTER_DATASOURCE_HPP +#endif // RASTER_DATASOURCE_HPP diff --git a/plugins/input/raster/raster_featureset.cpp b/plugins/input/raster/raster_featureset.cpp index 1c463a92b..88800ebe1 100644 --- a/plugins/input/raster/raster_featureset.cpp +++ b/plugins/input/raster/raster_featureset.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,10 +25,11 @@ #include #include -#include "raster_featureset.hpp" - +// boost #include +#include "raster_featureset.hpp" + using mapnik::query; using mapnik::CoordTransform; using mapnik::image_reader; @@ -42,101 +43,108 @@ template raster_featureset::raster_featureset(LookupPolicy const& policy, box2d const& extent, query const& q) - : policy_(policy), - feature_id_(1), - extent_(extent), - bbox_(q.get_bbox()), - curIter_(policy_.begin()), - endIter_(policy_.end()) -{} + : policy_(policy), + feature_id_(1), + extent_(extent), + bbox_(q.get_bbox()), + curIter_(policy_.begin()), + endIter_(policy_.end()) +{ +} template -raster_featureset::~raster_featureset() {} +raster_featureset::~raster_featureset() +{ +} template feature_ptr raster_featureset::next() { - if (curIter_!=endIter_) - { - feature_ptr feature(feature_factory::create(feature_id_)); - ++feature_id_; - try - { - std::auto_ptr reader(mapnik::get_image_reader(curIter_->file(),curIter_->format())); + if (curIter_ != endIter_) + { + feature_ptr feature(feature_factory::create(feature_id_)); + ++feature_id_; + + try + { + std::auto_ptr reader(mapnik::get_image_reader(curIter_->file(),curIter_->format())); #ifdef MAPNIK_DEBUG - std::clog << "Raster Plugin: READER = " << curIter_->format() << " " << curIter_->file() - << " size(" << curIter_->width() << "," << curIter_->height() << ")" << std::endl; + std::clog << "Raster Plugin: READER = " << curIter_->format() << " " << curIter_->file() + << " size(" << curIter_->width() << "," << curIter_->height() << ")" << std::endl; #endif - if (reader.get()) - { - int image_width = policy_.img_width(reader->width()); - int image_height = policy_.img_height(reader->height()); - - if (image_width>0 && image_height>0) + if (reader.get()) { - CoordTransform t(image_width,image_height,extent_,0,0); - box2d intersect=bbox_.intersect(curIter_->envelope()); - box2d ext=t.forward(intersect); - box2d rem=policy_.transform(ext); - if ( ext.width()>0.5 && ext.height()>0.5 ) - { - //select minimum raster containing whole ext - int x_off = static_cast(floor(ext.minx())); - int y_off = static_cast(floor(ext.miny())); - int end_x = static_cast(ceil(ext.maxx())); - int end_y = static_cast(ceil(ext.maxy())); - //clip to available data - if (x_off < 0) - x_off = 0; - if (y_off < 0) - y_off = 0; - if (end_x > image_width) - end_x = image_width; - if (end_y > image_height) - end_y = image_height; - int width = end_x - x_off; - int height = end_y - y_off; - //calculate actual box2d of returned raster - box2d feature_raster_extent(rem.minx() + x_off, rem.miny() + y_off, - rem.maxx() + x_off + width, rem.maxy() + y_off + height); - intersect = t.backward(feature_raster_extent); + int image_width = policy_.img_width(reader->width()); + int image_height = policy_.img_height(reader->height()); + + if (image_width > 0 && image_height > 0) + { + CoordTransform t(image_width, image_height, extent_, 0, 0); + box2d intersect = bbox_.intersect(curIter_->envelope()); + box2d ext = t.forward(intersect); + box2d rem = policy_.transform(ext); + if (ext.width() > 0.5 && ext.height() > 0.5 ) + { + // select minimum raster containing whole ext + int x_off = static_cast(floor(ext.minx())); + int y_off = static_cast(floor(ext.miny())); + int end_x = static_cast(ceil(ext.maxx())); + int end_y = static_cast(ceil(ext.maxy())); - image_data_32 image(width,height); - reader->read(x_off,y_off,image); - feature->set_raster(boost::make_shared(intersect,image)); - } + // clip to available data + if (x_off < 0) + x_off = 0; + if (y_off < 0) + y_off = 0; + if (end_x > image_width) + end_x = image_width; + if (end_y > image_height) + end_y = image_height; + int width = end_x - x_off; + int height = end_y - y_off; + + // calculate actual box2d of returned raster + box2d feature_raster_extent(rem.minx() + x_off, + rem.miny() + y_off, + rem.maxx() + x_off + width, + rem.maxy() + y_off + height); + intersect = t.backward(feature_raster_extent); + + image_data_32 image(width,height); + reader->read(x_off, y_off, image); + feature->set_raster(boost::make_shared(intersect, image)); + } + } } - } - } - catch (mapnik::image_reader_exception const& ex) - { - std::cerr << "Raster Plugin: image reader exception caught:" << ex.what() << std::endl; - } - catch (...) - { - std::cerr << "Raster Plugin: exception caught" << std::endl; - } + } + catch (mapnik::image_reader_exception const& ex) + { + std::cerr << "Raster Plugin: image reader exception caught:" << ex.what() << std::endl; + } + catch (...) + { + std::cerr << "Raster Plugin: exception caught" << std::endl; + } - ++curIter_; - return feature; - } - return feature_ptr(); + ++curIter_; + return feature; + } + return feature_ptr(); } -std::string -tiled_multi_file_policy::interpolate(std::string const &pattern, int x, int y) const +std::string tiled_multi_file_policy::interpolate(std::string const& pattern, int x, int y) const { - // TODO: make from some sort of configurable interpolation - int tms_y = tile_stride_ * ((image_height_ / tile_size_) - y - 1); - int tms_x = tile_stride_ * x; - std::string xs = (boost::format("%03d/%03d/%03d") % (tms_x / 1000000) % ((tms_x / 1000) % 1000) % (tms_x % 1000)).str(); - std::string ys = (boost::format("%03d/%03d/%03d") % (tms_y / 1000000) % ((tms_y / 1000) % 1000) % (tms_y % 1000)).str(); - std::string rv(pattern); - boost::algorithm::replace_all(rv, "${x}", xs); - boost::algorithm::replace_all(rv, "${y}", ys); - return rv; + // TODO: make from some sort of configurable interpolation + int tms_y = tile_stride_ * ((image_height_ / tile_size_) - y - 1); + int tms_x = tile_stride_ * x; + std::string xs = (boost::format("%03d/%03d/%03d") % (tms_x / 1000000) % ((tms_x / 1000) % 1000) % (tms_x % 1000)).str(); + std::string ys = (boost::format("%03d/%03d/%03d") % (tms_y / 1000000) % ((tms_y / 1000) % 1000) % (tms_y % 1000)).str(); + std::string rv(pattern); + boost::algorithm::replace_all(rv, "${x}", xs); + boost::algorithm::replace_all(rv, "${y}", ys); + return rv; } template class raster_featureset; diff --git a/plugins/input/raster/raster_featureset.hpp b/plugins/input/raster/raster_featureset.hpp index 4c2bb9816..7936edc4e 100644 --- a/plugins/input/raster/raster_featureset.hpp +++ b/plugins/input/raster/raster_featureset.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,14 +19,16 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ + #ifndef RASTER_FEATURESET_HPP #define RASTER_FEATURESET_HPP -#include - #include "raster_datasource.hpp" #include "raster_info.hpp" +// stl +#include + // boost #include #include @@ -42,19 +44,19 @@ public: const single_file_policy* p_; public: explicit const_iterator(const single_file_policy* p) - :status_(start), - p_(p) {} + : status_(start), + p_(p) {} const_iterator() - :status_(end){} + : status_(end) {} const_iterator(const const_iterator& other) - :status_(other.status_), - p_(other.p_) {} + : status_(other.status_), + p_(other.p_) {} const_iterator& operator++() { - status_=end; + status_ = end; return *this; } @@ -70,12 +72,12 @@ public: bool operator!=(const const_iterator& itr) { - return status_!=itr.status_; + return status_ != itr.status_; } }; explicit single_file_policy(const raster_info& info) - :info_(info) {} + : info_(info) {} const_iterator begin() { @@ -96,213 +98,226 @@ public: return const_iterator(); } - inline int img_width(int reader_width) const - { - return reader_width; - } + inline int img_width(int reader_width) const + { + return reader_width; + } - inline int img_height(int reader_height) const - { - return reader_height; - } + inline int img_height(int reader_height) const + { + return reader_height; + } - inline box2d transform(box2d &) const - { - return box2d(0, 0, 0, 0); - } + inline box2d transform(box2d &) const + { + return box2d(0, 0, 0, 0); + } }; class tiled_file_policy { public: - typedef std::vector::const_iterator const_iterator; + typedef std::vector::const_iterator const_iterator; - tiled_file_policy(std::string const& file, std::string const& format, unsigned tile_size, - box2d extent, box2d bbox,unsigned width, unsigned height) - { - - double lox = extent.minx(); - double loy = extent.miny(); + tiled_file_policy(std::string const& file, + std::string const& format, + unsigned tile_size, + box2d extent, + box2d bbox, + unsigned width, + unsigned height) + { + double lox = extent.minx(); + double loy = extent.miny(); - int max_x = int(std::ceil(double(width)/double(tile_size))); - int max_y = int(std::ceil(double(height)/double(tile_size))); + int max_x = int(std::ceil(double(width) / double(tile_size))); + int max_y = int(std::ceil(double(height) / double(tile_size))); - double pixel_x = extent.width()/double(width); - double pixel_y = extent.height()/double(height); + double pixel_x = extent.width() / double(width); + double pixel_y = extent.height() / double(height); #ifdef MAPNIK_DEBUG - std::clog << "Raster Plugin: PIXEL SIZE("<< pixel_x << "," << pixel_y << ")" << std::endl; + std::clog << "Raster Plugin: PIXEL SIZE("<< pixel_x << "," << pixel_y << ")" << std::endl; #endif - box2d e = bbox.intersect(extent); + box2d e = bbox.intersect(extent); - for (int x = 0 ; x < max_x ; ++x) - { - for (int y = 0 ; y < max_y ; ++y) - { - double x0 = lox + x*tile_size*pixel_x; - double y0 = loy + y*tile_size*pixel_y; - double x1 = x0 + tile_size*pixel_x; - double y1 = y0 + tile_size*pixel_y; - - if (e.intersects(box2d(x0,y0,x1,y1))) + for (int x = 0; x < max_x; ++x) + { + for (int y = 0; y < max_y; ++y) { - box2d tile_box = e.intersect(box2d(x0,y0,x1,y1)); - raster_info info(file,format,tile_box,tile_size,tile_size); - infos_.push_back(info); + double x0 = lox + x * tile_size * pixel_x; + double y0 = loy + y * tile_size * pixel_y; + double x1 = x0 + tile_size * pixel_x; + double y1 = y0 + tile_size * pixel_y; + + if (e.intersects(box2d(x0, y0, x1, y1))) + { + box2d tile_box = e.intersect(box2d(x0,y0,x1,y1)); + raster_info info(file,format,tile_box,tile_size,tile_size); + infos_.push_back(info); + } } - } - } + } #ifdef MAPNIK_DEBUG - std::clog << "Raster Plugin: INFO SIZE=" << infos_.size() << " " << file << std::endl; + std::clog << "Raster Plugin: INFO SIZE=" << infos_.size() << " " << file << std::endl; #endif - } + } - const_iterator begin() - { - return infos_.begin(); - } + const_iterator begin() + { + return infos_.begin(); + } - const_iterator end() - { - return infos_.end(); - } + const_iterator end() + { + return infos_.end(); + } - inline int img_width(int reader_width) const - { - return reader_width; - } + inline int img_width(int reader_width) const + { + return reader_width; + } - inline int img_height(int reader_height) const - { - return reader_height; - } + inline int img_height(int reader_height) const + { + return reader_height; + } - inline box2d transform(box2d &) const - { - return box2d(0, 0, 0, 0); - } + inline box2d transform(box2d&) const + { + return box2d(0, 0, 0, 0); + } private: - std::vector infos_; + std::vector infos_; }; class tiled_multi_file_policy { public: - typedef std::vector::const_iterator const_iterator; + typedef std::vector::const_iterator const_iterator; - tiled_multi_file_policy(std::string const& file_pattern, std::string const& format, unsigned tile_size, - box2d extent, box2d bbox,unsigned width, unsigned height, - unsigned tile_stride) - : image_width_(width), image_height_(height), tile_size_(tile_size), tile_stride_(tile_stride) - { - - double lox = extent.minx(); - double loy = extent.miny(); + tiled_multi_file_policy(std::string const& file_pattern, + std::string const& format, + unsigned tile_size, + box2d extent, + box2d bbox, + unsigned width, + unsigned height, + unsigned tile_stride) + : image_width_(width), + image_height_(height), + tile_size_(tile_size), + tile_stride_(tile_stride) + { + double lox = extent.minx(); + double loy = extent.miny(); - int max_x = int(std::ceil(double(width)/double(tile_size))); - int max_y = int(std::ceil(double(height)/double(tile_size))); + //int max_x = int(std::ceil(double(width) / double(tile_size))); + //int max_y = int(std::ceil(double(height) / double(tile_size))); - double pixel_x = extent.width()/double(width); - double pixel_y = extent.height()/double(height); + double pixel_x = extent.width() / double(width); + double pixel_y = extent.height() / double(height); #ifdef MAPNIK_DEBUG - std::clog << "Raster Plugin: PIXEL SIZE("<< pixel_x << "," << pixel_y << ")" << std::endl; + std::clog << "Raster Plugin: PIXEL SIZE("<< pixel_x << "," << pixel_y << ")" << std::endl; #endif - // intersection of query with extent => new query - box2d e = bbox.intersect(extent); + // intersection of query with extent => new query + box2d e = bbox.intersect(extent); - const int x_min = int(std::floor((e.minx() - lox) / (tile_size * pixel_x))); - const int y_min = int(std::floor((e.miny() - loy) / (tile_size * pixel_y))); - const int x_max = int(std::ceil((e.maxx() - lox) / (tile_size * pixel_x))); - const int y_max = int(std::ceil((e.maxy() - loy) / (tile_size * pixel_y))); + const int x_min = int(std::floor((e.minx() - lox) / (tile_size * pixel_x))); + const int y_min = int(std::floor((e.miny() - loy) / (tile_size * pixel_y))); + const int x_max = int(std::ceil((e.maxx() - lox) / (tile_size * pixel_x))); + const int y_max = int(std::ceil((e.maxy() - loy) / (tile_size * pixel_y))); - for (int x = x_min ; x < x_max ; ++x) - { - for (int y = y_min ; y < y_max ; ++y) - { - // x0, y0, x1, y1 => projection-space image coordinates. - double x0 = lox + x*tile_size*pixel_x; - double y0 = loy + y*tile_size*pixel_y; - double x1 = x0 + tile_size*pixel_x; - double y1 = y0 + tile_size*pixel_y; - - // check if it intersects the query - if (e.intersects(box2d(x0,y0,x1,y1))) + for (int x = x_min; x < x_max; ++x) + { + for (int y = y_min; y < y_max; ++y) { - // tile_box => intersection of tile with query in projection-space. - box2d tile_box = e.intersect(box2d(x0,y0,x1,y1)); - std::string file = interpolate(file_pattern, x, y); - raster_info info(file,format,tile_box,tile_size,tile_size); - infos_.push_back(info); + // x0, y0, x1, y1 => projection-space image coordinates. + double x0 = lox + x*tile_size*pixel_x; + double y0 = loy + y*tile_size*pixel_y; + double x1 = x0 + tile_size*pixel_x; + double y1 = y0 + tile_size*pixel_y; + + // check if it intersects the query + if (e.intersects(box2d(x0,y0,x1,y1))) + { + // tile_box => intersection of tile with query in projection-space. + box2d tile_box = e.intersect(box2d(x0,y0,x1,y1)); + std::string file = interpolate(file_pattern, x, y); + raster_info info(file,format,tile_box,tile_size,tile_size); + infos_.push_back(info); + } } - } - } + } #ifdef MAPNIK_DEBUG - std::clog << "Raster Plugin: INFO SIZE=" << infos_.size() << " " << file_pattern << std::endl; + std::clog << "Raster Plugin: INFO SIZE=" << infos_.size() << " " << file_pattern << std::endl; #endif - } + } - const_iterator begin() - { - return infos_.begin(); - } - - const_iterator end() - { - return infos_.end(); - } + const_iterator begin() + { + return infos_.begin(); + } + + const_iterator end() + { + return infos_.end(); + } - inline int img_width(int) const - { - return image_width_; - } + inline int img_width(int) const + { + return image_width_; + } - inline int img_height(int) const - { - return image_height_; - } + inline int img_height(int) const + { + return image_height_; + } - inline box2d transform(box2d &box) const - { - int x_offset = int(std::floor(box.minx() / tile_size_)); - int y_offset = int(std::floor(box.miny() / tile_size_)); - box2d rem(x_offset * tile_size_, y_offset * tile_size_, - x_offset * tile_size_, y_offset * tile_size_); - box.init(box.minx() - rem.minx(), - box.miny() - rem.miny(), - box.maxx() - rem.maxx(), - box.maxy() - rem.maxy()); - return rem; - } + inline box2d transform(box2d& box) const + { + int x_offset = int(std::floor(box.minx() / tile_size_)); + int y_offset = int(std::floor(box.miny() / tile_size_)); + box2d rem(x_offset * tile_size_, + y_offset * tile_size_, + x_offset * tile_size_, + y_offset * tile_size_); + box.init(box.minx() - rem.minx(), + box.miny() - rem.miny(), + box.maxx() - rem.maxx(), + box.maxy() - rem.maxy()); + return rem; + } private: - std::string interpolate(std::string const &pattern, int x, int y) const; + std::string interpolate(std::string const& pattern, int x, int y) const; - unsigned int image_width_, image_height_, tile_size_, tile_stride_; - std::vector infos_; + unsigned int image_width_, image_height_, tile_size_, tile_stride_; + std::vector infos_; }; template class raster_featureset : public mapnik::Featureset { - typedef typename LookupPolicy::const_iterator iterator_type; - LookupPolicy policy_; - int feature_id_; - mapnik::box2d extent_; - mapnik::box2d bbox_; - iterator_type curIter_; - iterator_type endIter_; + typedef typename LookupPolicy::const_iterator iterator_type; + LookupPolicy policy_; + int feature_id_; + mapnik::box2d extent_; + mapnik::box2d bbox_; + iterator_type curIter_; + iterator_type endIter_; public: - raster_featureset(LookupPolicy const& policy,box2d const& exttent, mapnik::query const& q); - virtual ~raster_featureset(); - mapnik::feature_ptr next(); + raster_featureset(LookupPolicy const& policy,box2d const& exttent, mapnik::query const& q); + virtual ~raster_featureset(); + mapnik::feature_ptr next(); }; -#endif //RASTER_FEATURESET_HPP +#endif // RASTER_FEATURESET_HPP diff --git a/plugins/input/raster/raster_info.cpp b/plugins/input/raster/raster_info.cpp index 72ec49a59..ea3d219ab 100644 --- a/plugins/input/raster/raster_info.cpp +++ b/plugins/input/raster/raster_info.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,32 +19,38 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id: raster_info.cc 17 2005-03-08 23:58:43Z pavlenko $ #include "raster_info.hpp" -raster_info::raster_info(std::string const& file, std::string const& format, - mapnik::box2d const& extent, unsigned width, unsigned height) - :file_(file), - format_(format), - extent_(extent), - width_(width), - height_(height) {} +raster_info::raster_info(std::string const& file, + std::string const& format, + mapnik::box2d const& extent, + unsigned width, + unsigned height) + : file_(file), + format_(format), + extent_(extent), + width_(width), + height_(height) +{ +} raster_info::raster_info(const raster_info& rhs) - :file_(rhs.file_), - format_(rhs.format_), - extent_(rhs.extent_), - width_(rhs.width_), - height_(rhs.height_) {} + : file_(rhs.file_), + format_(rhs.format_), + extent_(rhs.extent_), + width_(rhs.width_), + height_(rhs.height_) +{ +} void raster_info::swap(raster_info& other) throw() { - file_=other.file_; - format_=other.format_; - extent_=other.extent_; - width_=other.width_; - height_=other.height_; + file_ = other.file_; + format_ = other.format_; + extent_ = other.extent_; + width_ = other.width_; + height_ = other.height_; } @@ -54,6 +60,3 @@ raster_info& raster_info::operator=(const raster_info& rhs) swap(tmp); return *this; } - - - diff --git a/plugins/input/raster/raster_info.hpp b/plugins/input/raster/raster_info.hpp index 63ff43e18..40a650e83 100644 --- a/plugins/input/raster/raster_info.hpp +++ b/plugins/input/raster/raster_info.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,25 +19,25 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id: raster_info.hh 17 2005-03-08 23:58:43Z pavlenko $ #ifndef RASTER_INFO_HPP #define RASTER_INFO_HPP #include "raster_datasource.hpp" + +// stl #include using mapnik::box2d; class raster_info { - std::string file_; - std::string format_; - box2d extent_; - unsigned width_; - unsigned height_; public: - raster_info(const std::string& file,const std::string& format, const box2d& extent, unsigned width, unsigned height); + raster_info(const std::string& file, + const std::string& format, + const box2d& extent, + unsigned width, + unsigned height); raster_info(const raster_info& rhs); raster_info& operator=(const raster_info& rhs); inline box2d const& envelope() const {return extent_;} @@ -48,6 +48,12 @@ public: private: void swap(raster_info& other) throw(); + + std::string file_; + std::string format_; + box2d extent_; + unsigned width_; + unsigned height_; }; -#endif //RASTER_INFO_HPP +#endif // RASTER_INFO_HPP diff --git a/plugins/input/rasterlite/rasterlite_datasource.cpp b/plugins/input/rasterlite/rasterlite_datasource.cpp index 8fadb4e0b..eb68c2680 100644 --- a/plugins/input/rasterlite/rasterlite_datasource.cpp +++ b/plugins/input/rasterlite/rasterlite_datasource.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2007 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/plugins/input/rasterlite/rasterlite_datasource.hpp b/plugins/input/rasterlite/rasterlite_datasource.hpp index b3acd0117..85b0d6b9e 100644 --- a/plugins/input/rasterlite/rasterlite_datasource.hpp +++ b/plugins/input/rasterlite/rasterlite_datasource.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2007 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,36 +19,39 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef RASTERLITE_DATASOURCE_HPP #define RASTERLITE_DATASOURCE_HPP +// mapnik #include + +// boost #include #include "rasterlite_include.hpp" class rasterlite_datasource : public mapnik::datasource { - public: - rasterlite_datasource(mapnik::parameters const& params, bool bind=true); - virtual ~rasterlite_datasource (); - int type() const; - static std::string name(); - mapnik::featureset_ptr features(mapnik::query const& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const; - mapnik::box2d envelope() const; - mapnik::layer_descriptor get_descriptor() const; - void bind() const; - private: - inline void *open_dataset() const; - mutable mapnik::box2d extent_; - std::string dataset_name_; - std::string table_name_; - mapnik::layer_descriptor desc_; - unsigned width_; - unsigned height_; +public: + rasterlite_datasource(mapnik::parameters const& params, bool bind = true); + virtual ~rasterlite_datasource (); + int type() const; + static std::string name(); + mapnik::featureset_ptr features(mapnik::query const& q) const; + mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const; + mapnik::box2d envelope() const; + mapnik::layer_descriptor get_descriptor() const; + void bind() const; + +private: + inline void* open_dataset() const; + mutable mapnik::box2d extent_; + std::string dataset_name_; + std::string table_name_; + mapnik::layer_descriptor desc_; + unsigned width_; + unsigned height_; }; #endif // RASTERLITE_DATASOURCE_HPP diff --git a/plugins/input/rasterlite/rasterlite_featureset.cpp b/plugins/input/rasterlite/rasterlite_featureset.cpp index 69b11c964..8feb925ca 100644 --- a/plugins/input/rasterlite/rasterlite_featureset.cpp +++ b/plugins/input/rasterlite/rasterlite_featureset.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2007 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #include "rasterlite_featureset.hpp" @@ -43,9 +42,9 @@ using mapnik::feature_factory; rasterlite_featureset::rasterlite_featureset(void* dataset, rasterlite_query q) - : dataset_(dataset), - gquery_(q), - first_(true) + : dataset_(dataset), + gquery_(q), + first_(true) { rasterliteSetBackgroundColor(dataset_, 255, 0, 255); rasterliteSetTransparentColor(dataset_, 255, 0, 255); @@ -67,11 +66,15 @@ feature_ptr rasterlite_featureset::next() first_ = false; query *q = boost::get(&gquery_); - if(q) { + if (q) + { return get_feature(*q); - } else { + } + else + { coord2d *p = boost::get(&gquery_); - if(p) { + if (p) + { return get_feature_at_point(*p); } } @@ -91,7 +94,7 @@ feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q) double x0, y0, x1, y1; rasterliteGetExtent (dataset_, &x0, &y0, &x1, &y1); - box2d raster_extent(x0,y0,x1,y1); + box2d raster_extent(x0, y0, x1, y1); box2d intersect = raster_extent.intersect(q.get_bbox()); const int width = static_cast(boost::get<0>(q.resolution()) * intersect.width() + 0.5); @@ -104,8 +107,8 @@ feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q) std::clog << "Rasterlite Plugin: Raster extent=" << raster_extent << std::endl; std::clog << "Rasterlite Plugin: View extent=" << q.get_bbox() << std::endl; std::clog << "Rasterlite Plugin: Intersect extent=" << intersect << std::endl; - std::clog << "Rasterlite Plugin: Query resolution=" << boost::get<0>(q.resolution()) - << "," << boost::get<1>(q.resolution()) << std::endl; + std::clog << "Rasterlite Plugin: Query resolution=" + << boost::get<0>(q.resolution()) << "," << boost::get<1>(q.resolution()) << std::endl; std::clog << "Rasterlite Plugin: Size=" << width << " " << height << std::endl; std::clog << "Rasterlite Plugin: Pixel Size=" << pixel_size << std::endl; #endif @@ -113,11 +116,19 @@ feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q) if (width > 0 && height > 0) { int size = 0; - void *raster = 0; + void* raster = 0; if (rasterliteGetRawImageByRect(dataset_, - intersect.minx(), intersect.miny(), intersect.maxx(), intersect.maxy(), - pixel_size, width, height, GAIA_RGBA_ARRAY, &raster, &size) == RASTERLITE_OK) + intersect.minx(), + intersect.miny(), + intersect.maxx(), + intersect.maxy(), + pixel_size, + width, + height, + GAIA_RGBA_ARRAY, + &raster, + &size) == RASTERLITE_OK) { if (size > 0) { @@ -150,9 +161,7 @@ feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q) return feature_ptr(); } - feature_ptr rasterlite_featureset::get_feature_at_point(mapnik::coord2d const& pt) { return feature_ptr(); } - diff --git a/plugins/input/rasterlite/rasterlite_featureset.hpp b/plugins/input/rasterlite/rasterlite_featureset.hpp index 0db77cce2..9b83c1fa2 100644 --- a/plugins/input/rasterlite/rasterlite_featureset.hpp +++ b/plugins/input/rasterlite/rasterlite_featureset.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2007 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,12 +19,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef RASTERLITE_FEATURESET_HPP #define RASTERLITE_FEATURESET_HPP +// mapnik #include + +// boost #include #include "rasterlite_include.hpp" @@ -33,16 +35,17 @@ typedef boost::variant rasterlite_query; class rasterlite_featureset : public mapnik::Featureset { - public: - rasterlite_featureset(void* dataset, rasterlite_query q); - virtual ~rasterlite_featureset(); - mapnik::feature_ptr next(); - private: - mapnik::feature_ptr get_feature(mapnik::query const& q); - mapnik::feature_ptr get_feature_at_point(mapnik::coord2d const& p); - void* dataset_; - rasterlite_query gquery_; - bool first_; +public: + rasterlite_featureset(void* dataset, rasterlite_query q); + virtual ~rasterlite_featureset(); + mapnik::feature_ptr next(); + +private: + mapnik::feature_ptr get_feature(mapnik::query const& q); + mapnik::feature_ptr get_feature_at_point(mapnik::coord2d const& p); + void* dataset_; + rasterlite_query gquery_; + bool first_; }; #endif // RASTERLITE_FEATURESET_HPP diff --git a/plugins/input/rasterlite/rasterlite_include.hpp b/plugins/input/rasterlite/rasterlite_include.hpp index c1c953768..843d01ca2 100644 --- a/plugins/input/rasterlite/rasterlite_include.hpp +++ b/plugins/input/rasterlite/rasterlite_include.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2007 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,14 +19,13 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef RASTERLITE_INCLUDE_HPP #define RASTERLITE_INCLUDE_HPP extern "C" { - #include - #include + #include + #include } -#endif // RASTERLITE_FEATURESET_HPP +#endif // RASTERLITE_INCLUDE_HPP diff --git a/plugins/input/shape/dbf_test.cpp b/plugins/input/shape/dbf_test.cpp index c59a4d064..5a5d48fbf 100644 --- a/plugins/input/shape/dbf_test.cpp +++ b/plugins/input/shape/dbf_test.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/plugins/input/shape/dbfile.cpp b/plugins/input/shape/dbfile.cpp index 63b390637..47a67d8e7 100644 --- a/plugins/input/shape/dbfile.cpp +++ b/plugins/input/shape/dbfile.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/plugins/input/shape/dbfile.hpp b/plugins/input/shape/dbfile.hpp index f2e4e3dab..f855c9a1e 100644 --- a/plugins/input/shape/dbfile.hpp +++ b/plugins/input/shape/dbfile.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/plugins/input/shape/shape_datasource.cpp b/plugins/input/shape/shape_datasource.cpp index f6ca9abfb..45f2b3158 100644 --- a/plugins/input/shape/shape_datasource.cpp +++ b/plugins/input/shape/shape_datasource.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/plugins/input/shape/shape_datasource.hpp b/plugins/input/shape/shape_datasource.hpp index 5fc85d0ed..477b8035b 100644 --- a/plugins/input/shape/shape_datasource.hpp +++ b/plugins/input/shape/shape_datasource.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/plugins/input/shape/shape_featureset.cpp b/plugins/input/shape/shape_featureset.cpp index efb95aec5..6fbcf5820 100644 --- a/plugins/input/shape/shape_featureset.cpp +++ b/plugins/input/shape/shape_featureset.cpp @@ -3,7 +3,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -21,15 +21,15 @@ * *****************************************************************************/ +// stl +#include + // mapnik #include // boost #include -// stl -#include - #include "shape_featureset.hpp" using mapnik::geometry_type; @@ -42,22 +42,23 @@ shape_featureset::shape_featureset(const filterT& filter, std::string const& encoding, long file_length, int row_limit) - : filter_(filter), - //shape_type_(shape_io::shape_null), - shape_(shape_name, false), - query_ext_(), - tr_(new transcoder(encoding)), - file_length_(file_length), - count_(0), - row_limit_(row_limit) + : filter_(filter), + //shape_type_(shape_io::shape_null), + shape_(shape_name, false), + query_ext_(), + tr_(new transcoder(encoding)), + file_length_(file_length), + count_(0), + row_limit_(row_limit) { shape_.shp().skip(100); + //attributes - typename std::set::const_iterator pos=attribute_names.begin(); - while (pos!=attribute_names.end()) + typename std::set::const_iterator pos = attribute_names.begin(); + while (pos != attribute_names.end()) { bool found_name = false; - for (int i=0;i::shape_featureset(const filterT& filter, break; } } - if (!found_name) + + if (! found_name) { std::ostringstream s; s << "no attribute '" << *pos << "' in '" << shape_name << "'. Valid attributes are: "; + std::vector list; - for (int i=0;i feature_ptr shape_featureset::next() { if (row_limit_ && count_ > row_limit_) + { return feature_ptr(); + } + + std::streampos pos = shape_.shp().pos(); - std::streampos pos=shape_.shp().pos(); // skip null shapes while (pos > 0 && pos < std::streampos(file_length_ * 2)) { shape_.move_to(pos); - if (shape_.type() == shape_io::shape_null) + if (shape_.type() == shape_io::shape_null) { pos += std::streampos(12); } - else break; + else + { + break; + } } if (pos < std::streampos(file_length_ * 2)) { - int type=shape_.type(); + int type = shape_.type(); feature_ptr feature(feature_factory::create(shape_.id_)); if (type == shape_io::shape_point) { - double x=shape_.shp().read_double(); - double y=shape_.shp().read_double(); - geometry_type * point = new geometry_type(mapnik::Point); - point->move_to(x,y); + double x = shape_.shp().read_double(); + double y = shape_.shp().read_double(); + geometry_type* point = new geometry_type(mapnik::Point); + point->move_to(x, y); feature->add_geometry(point); ++count_; } else if (type == shape_io::shape_pointm) { - double x=shape_.shp().read_double(); - double y=shape_.shp().read_double(); - shape_.shp().skip(8); //m - geometry_type * point = new geometry_type(mapnik::Point); - point->move_to(x,y); + double x = shape_.shp().read_double(); + double y = shape_.shp().read_double(); + // skip m + shape_.shp().skip(8); + geometry_type* point = new geometry_type(mapnik::Point); + point->move_to(x, y); feature->add_geometry(point); ++count_; } else if (type == shape_io::shape_pointz) { - double x=shape_.shp().read_double(); - double y=shape_.shp().read_double(); + double x = shape_.shp().read_double(); + double y = shape_.shp().read_double(); // skip z shape_.shp().skip(8); - - //skip m if exists - if ( shape_.reclength_ == 8 + 36) + // skip m if exists + if (shape_.reclength_ == 8 + 36) { shape_.shp().skip(8); } - geometry_type * point = new geometry_type(mapnik::Point); - point->move_to(x,y); + geometry_type* point = new geometry_type(mapnik::Point); + point->move_to(x, y); feature->add_geometry(point); ++count_; } @@ -153,11 +161,19 @@ feature_ptr shape_featureset::next() std::streampos pos = shape_.shp().pos(); if (shape_.type() == shape_io::shape_null) { - pos += std::streampos(12); + pos += std::streampos(12); + // TODO handle the shapes std::cerr << "NULL SHAPE len=" << shape_.reclength_ << std::endl; - } - else if (filter_.pass(shape_.current_extent())) break; - else pos += std::streampos(2 * shape_.reclength_ - 36); + } + else if (filter_.pass(shape_.current_extent())) + { + break; + } + else + { + pos += std::streampos(2 * shape_.reclength_ - 36); + } + if (pos > 0 && pos < std::streampos(file_length_ * 2)) { shape_.move_to(pos); @@ -176,97 +192,104 @@ feature_ptr shape_featureset::next() case shape_io::shape_multipoint: { int num_points = shape_.shp().read_ndr_integer(); - for (int i=0; i< num_points;++i) + for (int i = 0; i < num_points; ++i) { - double x=shape_.shp().read_double(); - double y=shape_.shp().read_double(); - geometry_type * point = new geometry_type(mapnik::Point); - point->move_to(x,y); + double x = shape_.shp().read_double(); + double y = shape_.shp().read_double(); + geometry_type* point = new geometry_type(mapnik::Point); + point->move_to(x, y); feature->add_geometry(point); } ++count_; break; } + case shape_io::shape_multipointm: { int num_points = shape_.shp().read_ndr_integer(); - for (int i=0; i< num_points;++i) + for (int i = 0; i < num_points; ++i) { - double x=shape_.shp().read_double(); - double y=shape_.shp().read_double(); - geometry_type * point = new geometry_type(mapnik::Point); - point->move_to(x,y); + double x = shape_.shp().read_double(); + double y = shape_.shp().read_double(); + geometry_type* point = new geometry_type(mapnik::Point); + point->move_to(x, y); feature->add_geometry(point); } - - // skip m - shape_.shp().skip(2*8 + 8*num_points); + + // skip m + shape_.shp().skip(2 * 8 + 8 * num_points); ++count_; break; } + case shape_io::shape_multipointz: { - unsigned num_points = shape_.shp().read_ndr_integer(); - for (unsigned i=0; i< num_points;++i) + int num_points = shape_.shp().read_ndr_integer(); + for (int i = 0; i < num_points; ++i) { - double x=shape_.shp().read_double(); - double y=shape_.shp().read_double(); - geometry_type * point = new geometry_type(mapnik::Point); - point->move_to(x,y); + double x = shape_.shp().read_double(); + double y = shape_.shp().read_double(); + geometry_type* point = new geometry_type(mapnik::Point); + point->move_to(x, y); feature->add_geometry(point); } - + // skip z - shape_.shp().skip(2*8 + 8*num_points); + shape_.shp().skip(2 * 8 + 8 * num_points); // check if we have measure data - - if ( shape_.reclength_ == num_points * 16 + 36) + if (shape_.reclength_ == (unsigned)(num_points * 16 + 36)) { // skip m - shape_.shp().skip(2*8 + 8*num_points); + shape_.shp().skip(2 * 8 + 8 * num_points); } ++count_; break; } + case shape_io::shape_polyline: { - geometry_type * line = shape_.read_polyline(); + geometry_type* line = shape_.read_polyline(); feature->add_geometry(line); ++count_; break; } + case shape_io::shape_polylinem: { - geometry_type * line = shape_.read_polylinem(); + geometry_type* line = shape_.read_polylinem(); feature->add_geometry(line); ++count_; break; } + case shape_io::shape_polylinez: { - geometry_type * line = shape_.read_polylinez(); + geometry_type* line = shape_.read_polylinez(); feature->add_geometry(line); ++count_; break; } + case shape_io::shape_polygon: { - geometry_type * poly = shape_.read_polygon(); + geometry_type* poly = shape_.read_polygon(); feature->add_geometry(poly); ++count_; break; } + case shape_io::shape_polygonm: { - geometry_type * poly = shape_.read_polygonm(); + geometry_type* poly = shape_.read_polygonm(); feature->add_geometry(poly); ++count_; break; } + case shape_io::shape_polygonz: { - geometry_type * poly = shape_.read_polygonz(); + geometry_type* poly = shape_.read_polygonz(); feature->add_geometry(poly); ++count_; break; @@ -278,13 +301,13 @@ feature_ptr shape_featureset::next() if (attr_ids_.size()) { shape_.dbf().move_to(shape_.id_); - std::vector::const_iterator itr=attr_ids_.begin(); - std::vector::const_iterator end=attr_ids_.end(); + std::vector::const_iterator itr = attr_ids_.begin(); + std::vector::const_iterator end = attr_ids_.end(); try { - for (;itr!=end;++itr) + for (; itr != end; ++itr) { - shape_.dbf().add_attribute(*itr,*tr_,*feature);//TODO optimize!!! + shape_.dbf().add_attribute(*itr, *tr_, *feature); //TODO optimize!!! } } catch (...) @@ -292,6 +315,7 @@ feature_ptr shape_featureset::next() std::clog << "Shape Plugin: error processing attributes " << std::endl; } } + return feature; } else @@ -308,5 +332,3 @@ shape_featureset::~shape_featureset() {} template class shape_featureset; template class shape_featureset; - - diff --git a/plugins/input/shape/shape_featureset.hpp b/plugins/input/shape/shape_featureset.hpp index 285e74fa7..ec8e6d0c5 100644 --- a/plugins/input/shape/shape_featureset.hpp +++ b/plugins/input/shape/shape_featureset.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/plugins/input/shape/shape_index_featureset.cpp b/plugins/input/shape/shape_index_featureset.cpp index 20a0b2e7c..c14f04d6c 100644 --- a/plugins/input/shape/shape_index_featureset.cpp +++ b/plugins/input/shape/shape_index_featureset.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,8 @@ * *****************************************************************************/ -//$Id: shape_index_featureset.cc 36 2005-04-05 14:32:18Z pavlenko $ +// stl +#include // mapnik #include @@ -29,9 +30,6 @@ #include #include -// stl -#include - #include "shape_index_featureset.hpp" using mapnik::feature_factory; @@ -44,26 +42,27 @@ shape_index_featureset::shape_index_featureset(const filterT& filter, std::string const& encoding, std::string const& shape_name, int row_limit) - : filter_(filter), - //shape_type_(0), - shape_(shape), - tr_(new transcoder(encoding)), - count_(0), - row_limit_(row_limit) - + : filter_(filter), + //shape_type_(0), + shape_(shape), + tr_(new transcoder(encoding)), + count_(0), + row_limit_(row_limit) { shape_.shp().skip(100); + boost::shared_ptr index = shape_.index(); if (index) { #ifdef SHAPE_MEMORY_MAPPED_FILE - //shp_index >::query(filter,index->file(),ids_); - shp_index::query(filter,index->file(),ids_); + //shp_index >::query(filter, index->file(), ids_); + shp_index::query(filter, index->file(), ids_); #else - shp_index::query(filter,index->file(),ids_); + shp_index::query(filter, index->file(), ids_); #endif } - std::sort(ids_.begin(),ids_.end()); + + std::sort(ids_.begin(), ids_.end()); #ifdef MAPNIK_DEBUG std::clog << "Shape Plugin: query size=" << ids_.size() << std::endl; @@ -72,11 +71,11 @@ shape_index_featureset::shape_index_featureset(const filterT& filter, itr_ = ids_.begin(); // deal with attributes - std::set::const_iterator pos=attribute_names.begin(); - while (pos!=attribute_names.end()) + std::set::const_iterator pos = attribute_names.begin(); + while (pos != attribute_names.end()) { bool found_name = false; - for (int i=0;i::shape_index_featureset(const filterT& filter, break; } } - if (!found_name) + + if (! found_name) { std::ostringstream s; + s << "no attribute '" << *pos << "' in '" << shape_name << "'. Valid attributes are: "; - s << "no attribute '" << *pos << "' in '" - << shape_name << "'. Valid attributes are: "; std::vector list; - for (int i=0;i feature_ptr shape_index_featureset::next() { if (row_limit_ && count_ > row_limit_) - return feature_ptr(); - - if (itr_!=ids_.end()) { - int pos=*itr_++; + return feature_ptr(); + } + + if (itr_ != ids_.end()) + { + int pos = *itr_++; shape_.move_to(pos); - int type=shape_.type(); + + int type = shape_.type(); feature_ptr feature(feature_factory::create(shape_.id_)); if (type == shape_io::shape_point) { - double x=shape_.shp().read_double(); - double y=shape_.shp().read_double(); - geometry_type * point = new geometry_type(mapnik::Point); - point->move_to(x,y); + double x = shape_.shp().read_double(); + double y = shape_.shp().read_double(); + geometry_type* point = new geometry_type(mapnik::Point); + point->move_to(x, y); feature->add_geometry(point); ++count_; } - else if (type == shape_io::shape_pointm) { - double x=shape_.shp().read_double(); - double y=shape_.shp().read_double(); - shape_.shp().skip(8);// skip m - geometry_type * point = new geometry_type(mapnik::Point); - point->move_to(x,y); + double x = shape_.shp().read_double(); + double y = shape_.shp().read_double(); + // skip m + shape_.shp().skip(8); + geometry_type* point = new geometry_type(mapnik::Point); + point->move_to(x, y); feature->add_geometry(point); ++count_; } else if (type == shape_io::shape_pointz) { - double x=shape_.shp().read_double(); - double y=shape_.shp().read_double(); + double x = shape_.shp().read_double(); + double y = shape_.shp().read_double(); // skip z shape_.shp().skip(8); - - //skip m if exists - if ( shape_.reclength_ == 8 + 36) + // skip m if exists + if (shape_.reclength_ == 8 + 36) { shape_.shp().skip(8); } - geometry_type * point = new geometry_type(mapnik::Point); - point->move_to(x,y); + geometry_type* point = new geometry_type(mapnik::Point); + point->move_to(x, y); feature->add_geometry(point); ++count_; } else { - while(!filter_.pass(shape_.current_extent()) && - itr_!=ids_.end()) + while(! filter_.pass(shape_.current_extent()) && + itr_ != ids_.end()) { if (shape_.type() != shape_io::shape_null) { - pos=*itr_++; + pos = *itr_++; shape_.move_to(pos); } else @@ -176,56 +179,62 @@ feature_ptr shape_index_featureset::next() case shape_io::shape_multipointz: { int num_points = shape_.shp().read_ndr_integer(); - for (int i=0; i< num_points;++i) + for (int i = 0; i < num_points; ++i) { - double x=shape_.shp().read_double(); - double y=shape_.shp().read_double(); - geometry_type * point = new geometry_type(mapnik::Point); - point->move_to(x,y); + double x = shape_.shp().read_double(); + double y = shape_.shp().read_double(); + geometry_type* point = new geometry_type(mapnik::Point); + point->move_to(x, y); feature->add_geometry(point); } // ignore m and z for now ++count_; break; } + case shape_io::shape_polyline: { - geometry_type * line = shape_.read_polyline(); + geometry_type* line = shape_.read_polyline(); feature->add_geometry(line); ++count_; break; } + case shape_io::shape_polylinem: { - geometry_type * line = shape_.read_polylinem(); + geometry_type* line = shape_.read_polylinem(); feature->add_geometry(line); ++count_; break; } + case shape_io::shape_polylinez: { - geometry_type * line = shape_.read_polylinez(); + geometry_type* line = shape_.read_polylinez(); feature->add_geometry(line); ++count_; break; } + case shape_io::shape_polygon: { - geometry_type * poly = shape_.read_polygon(); + geometry_type* poly = shape_.read_polygon(); feature->add_geometry(poly); ++count_; break; } + case shape_io::shape_polygonm: { - geometry_type * poly = shape_.read_polygonm(); + geometry_type* poly = shape_.read_polygonm(); feature->add_geometry(poly); ++count_; break; } + case shape_io::shape_polygonz: { - geometry_type * poly = shape_.read_polygonz(); + geometry_type* poly = shape_.read_polygonz(); feature->add_geometry(poly); ++count_; break; @@ -237,18 +246,18 @@ feature_ptr shape_index_featureset::next() if (attr_ids_.size()) { shape_.dbf().move_to(shape_.id_); - std::set::const_iterator itr=attr_ids_.begin(); - std::set::const_iterator end=attr_ids_.end(); + std::set::const_iterator itr = attr_ids_.begin(); + std::set::const_iterator end = attr_ids_.end(); try { - for ( ; itr!=end; ++itr) + for (; itr!=end; ++itr) { - shape_.dbf().add_attribute(*itr,*tr_,*feature); + shape_.dbf().add_attribute(*itr, *tr_, *feature); } } catch (...) { - std::clog << "Shape Plugin: error processing attributes" << std::endl; + std::cerr << "Shape Plugin: error processing attributes" << std::endl; } } return feature; @@ -269,4 +278,3 @@ shape_index_featureset::~shape_index_featureset() {} template class shape_index_featureset; template class shape_index_featureset; - diff --git a/plugins/input/shape/shape_index_featureset.hpp b/plugins/input/shape/shape_index_featureset.hpp index c73fdd1cb..abc889075 100644 --- a/plugins/input/shape/shape_index_featureset.hpp +++ b/plugins/input/shape/shape_index_featureset.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,13 +23,18 @@ #ifndef SHAPE_INDEX_FEATURESET_HPP #define SHAPE_INDEX_FEATURESET_HPP +// stl +#include +#include + +// mapnik #include + +// boost #include #include "shape_datasource.hpp" #include "shape_io.hpp" -#include -#include using mapnik::Featureset; using mapnik::box2d; @@ -38,32 +43,31 @@ using mapnik::feature_ptr; template class shape_index_featureset : public Featureset { - filterT filter_; - //int shape_type_; - shape_io & shape_; - boost::scoped_ptr tr_; - std::vector ids_; - std::vector::iterator itr_; - std::set attr_ids_; - mutable box2d feature_ext_; - mutable int total_geom_size; - mutable int count_; - const int row_limit_; +public: + shape_index_featureset(const filterT& filter, + shape_io& shape, + const std::set& attribute_names, + std::string const& encoding, + std::string const& shape_name, + int row_limit); + virtual ~shape_index_featureset(); + feature_ptr next(); - public: - shape_index_featureset(const filterT& filter, - shape_io& shape, - const std::set& attribute_names, - std::string const& encoding, - std::string const& shape_name, - int row_limit); - virtual ~shape_index_featureset(); - feature_ptr next(); - - private: - //no copying - shape_index_featureset(const shape_index_featureset&); - shape_index_featureset& operator=(const shape_index_featureset&); +private: + filterT filter_; + //int shape_type_; + shape_io & shape_; + boost::scoped_ptr tr_; + std::vector ids_; + std::vector::iterator itr_; + std::set attr_ids_; + mutable box2d feature_ext_; + mutable int total_geom_size; + mutable int count_; + const int row_limit_; + //no copying + shape_index_featureset(const shape_index_featureset&); + shape_index_featureset& operator=(const shape_index_featureset&); }; -#endif //SHAPE_INDEX_FEATURESET_HPP +#endif // SHAPE_INDEX_FEATURESET_HPP diff --git a/plugins/input/shape/shape_io.cpp b/plugins/input/shape/shape_io.cpp index a6251733c..d219c8b78 100644 --- a/plugins/input/shape/shape_io.cpp +++ b/plugins/input/shape/shape_io.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,9 @@ * *****************************************************************************/ -//$Id: shape_io.cc 26 2005-03-29 19:18:59Z pavlenko $ - #include "shape_io.hpp" +// mapnik #include // boost @@ -38,22 +37,22 @@ const std::string shape_io::DBF = ".dbf"; const std::string shape_io::INDEX = ".index"; shape_io::shape_io(const std::string& shape_name, bool open_index) - : type_(shape_null), - shp_(shape_name + SHP), - dbf_(shape_name + DBF), - reclength_(0), - id_(0) + : type_(shape_null), + shp_(shape_name + SHP), + dbf_(shape_name + DBF), + reclength_(0), + id_(0) { bool ok = (shp_.is_open() && dbf_.is_open()); - if (!ok) + if (! ok) { throw datasource_exception("Shape Plugin: cannot read shape file '" + shape_name + "'"); } + if (open_index) { try { - index_= boost::make_shared(shape_name + INDEX); } catch (...) @@ -67,370 +66,398 @@ shape_io::shape_io(const std::string& shape_name, bool open_index) shape_io::~shape_io() {} -void shape_io::move_to (int pos) +void shape_io::move_to(int pos) { - shp_.seek(pos); - id_ = shp_.read_xdr_integer(); - reclength_ = shp_.read_xdr_integer(); - type_ = shp_.read_ndr_integer(); + shp_.seek(pos); + id_ = shp_.read_xdr_integer(); + reclength_ = shp_.read_xdr_integer(); + type_ = shp_.read_ndr_integer(); - if (type_!= shape_null && type_ != shape_point && type_ != shape_pointm && type_ != shape_pointz) - { - shp_.read_envelope(cur_extent_); - } + if (type_ != shape_null && type_ != shape_point && type_ != shape_pointm && type_ != shape_pointz) + { + shp_.read_envelope(cur_extent_); + } } int shape_io::type() const { - return type_; + return type_; } const box2d& shape_io::current_extent() const { - return cur_extent_; + return cur_extent_; } shape_file& shape_io::shp() { - return shp_; + return shp_; } -/*shape_file& shape_io::shx() +#if 0 +shape_file& shape_io::shx() { - return shx_; -}*/ - + return shx_; +} +#endif dbf_file& shape_io::dbf() { - return dbf_; + return dbf_; } -geometry_type * shape_io::read_polyline() +geometry_type* shape_io::read_polyline() { - shape_file::record_type record(reclength_*2-36); - shp_.read_record(record); - int num_parts=record.read_ndr_integer(); - int num_points=record.read_ndr_integer(); - geometry_type * line = new geometry_type(mapnik::LineString); - line->set_capacity(num_points + num_parts); - if (num_parts == 1) - { - line->set_capacity(num_points + 1); - record.skip(4); - double x=record.read_double(); - double y=record.read_double(); - line->move_to(x,y); - for (int i=1;iline_to(x,y); - } - } - else - { - std::vector parts(num_parts); - for (int i=0;iset_capacity(num_points + num_parts); + if (num_parts == 1) + { + line->set_capacity(num_points + 1); + record.skip(4); + double x = record.read_double(); + double y = record.read_double(); + line->move_to(x, y); + for (int i = 1; i < num_points; ++i) + { + x = record.read_double(); + y = record.read_double(); + line->line_to(x, y); + } + } + else + { + std::vector parts(num_parts); + for (int i = 0; i < num_parts; ++i) + { + parts[i] = record.read_ndr_integer(); + } + + int start, end; + for (int k = 0; k < num_parts; ++k) + { + start = parts[k]; + if (k == num_parts - 1) + { + end = num_points; + } + else + { + end = parts[k + 1]; + } - double x=record.read_double(); - double y=record.read_double(); - line->move_to(x,y); + double x = record.read_double(); + double y = record.read_double(); + line->move_to(x, y); - for (int j=start+1;jline_to(x,y); - } - } - } - return line; + for (int j = start + 1; j < end; ++j) + { + x = record.read_double(); + y = record.read_double(); + line->line_to(x, y); + } + } + } + return line; } -geometry_type * shape_io::read_polylinem() +geometry_type* shape_io::read_polylinem() { - shape_file::record_type record(reclength_*2-36); + shape_file::record_type record(reclength_ * 2 - 36); + shp_.read_record(record); + + int num_parts = record.read_ndr_integer(); + int num_points = record.read_ndr_integer(); + geometry_type* line = new geometry_type(mapnik::LineString); + line->set_capacity(num_points + num_parts); + if (num_parts == 1) + { + record.skip(4); + double x = record.read_double(); + double y = record.read_double(); + line->move_to(x, y); + for (int i = 1; i < num_points; ++i) + { + x = record.read_double(); + y = record.read_double(); + line->line_to(x, y); + } + } + else + { + std::vector parts(num_parts); + for (int i = 0; i < num_parts; ++i) + { + parts[i] = record.read_ndr_integer(); + } + + int start, end; + for (int k = 0; k < num_parts; ++k) + { + start = parts[k]; + if (k == num_parts - 1) + { + end = num_points; + } + else + { + end = parts[k + 1]; + } + + double x = record.read_double(); + double y = record.read_double(); + line->move_to(x, y); + + for (int j = start + 1; j < end; ++j) + { + x = record.read_double(); + y = record.read_double(); + line->line_to(x, y); + } + } + } + + // m-range + //double m0=record.read_double(); + //double m1=record.read_double(); + + //for (int i=0;iset_capacity(num_points + num_parts); if (num_parts == 1) { record.skip(4); - double x=record.read_double(); - double y=record.read_double(); - line->move_to(x,y); - for (int i=1;imove_to(x, y); + for (int i = 1; i < num_points; ++i) { - x=record.read_double(); - y=record.read_double(); - line->line_to(x,y); + x = record.read_double(); + y = record.read_double(); + line->line_to(x, y); } } else { std::vector parts(num_parts); - for (int i=0;imove_to(x,y); - - for (int j=start+1;jline_to(x,y); - } - } - } - // m-range - //double m0=record.read_double(); - //double m1=record.read_double(); - - //for (int i=0;iset_capacity(num_points + num_parts); - if (num_parts == 1) - { - record.skip(4); - double x=record.read_double(); - double y=record.read_double(); - line->move_to(x,y); - for (int i=1;iline_to(x,y); - } - } - else - { - std::vector parts(num_parts); - for (int i=0;imove_to(x,y); + double x = record.read_double(); + double y = record.read_double(); + line->move_to(x, y); - for (int j=start+1;jline_to(x,y); - } - } - } - // z-range - //double z0=record.read_double(); - //double z1=record.read_double(); - //for (int i=0;iline_to(x, y); + } + } + } + + // z-range + //double z0=record.read_double(); + //double z1=record.read_double(); + //for (int i=0;i parts(num_parts); - geometry_type * poly = new geometry_type(mapnik::Polygon); - poly->set_capacity(num_points + num_parts); - for (int i=0;imove_to(x,y); + int num_parts = record.read_ndr_integer(); + int num_points = record.read_ndr_integer(); + std::vector parts(num_parts); + geometry_type* poly = new geometry_type(mapnik::Polygon); + poly->set_capacity(num_points + num_parts); + for (int i = 0; i < num_parts; ++i) + { + parts[i] = record.read_ndr_integer(); + } + + for (int k = 0; k < num_parts; k++) + { + int start = parts[k]; + int end; + if (k == num_parts - 1) + { + end = num_points; + } + else + { + end = parts[k + 1]; + } + + double x = record.read_double(); + double y = record.read_double(); + poly->move_to(x, y); - for (int j=start+1;jline_to(x,y); - } - } - return poly; + for (int j=start+1;jline_to(x, y); + } + } + return poly; } -geometry_type * shape_io::read_polygonm() +geometry_type* shape_io::read_polygonm() { - shape_file::record_type record(reclength_*2-36); - shp_.read_record(record); - int num_parts=record.read_ndr_integer(); - int num_points=record.read_ndr_integer(); - std::vector parts(num_parts); - geometry_type * poly = new geometry_type(mapnik::Polygon); - poly->set_capacity(num_points + num_parts); - for (int i=0;i parts(num_parts); + geometry_type* poly = new geometry_type(mapnik::Polygon); + poly->set_capacity(num_points + num_parts); + for (int i = 0; i < num_parts; ++i) + { + parts[i] = record.read_ndr_integer(); + } - for (int k=0;kmove_to(x,y); + for (int k = 0; k < num_parts; k++) + { + int start = parts[k]; + int end; + if (k == num_parts - 1) + { + end = num_points; + } + else + { + end = parts[k + 1]; + } + + double x = record.read_double(); + double y = record.read_double(); + poly->move_to(x, y); - for (int j=start+1;jline_to(x,y); - } - } - // m-range - //double m0=record.read_double(); - //double m1=record.read_double(); - - //for (int i=0;iline_to(x, y); + } + } + + // m-range + //double m0=record.read_double(); + //double m1=record.read_double(); + + //for (int i=0;i parts(num_parts); - geometry_type * poly = new geometry_type(mapnik::Polygon); - poly->set_capacity(num_points + num_parts); - for (int i=0;i parts(num_parts); + geometry_type* poly = new geometry_type(mapnik::Polygon); + poly->set_capacity(num_points + num_parts); + for (int i = 0; i < num_parts; ++i) + { + parts[i] = record.read_ndr_integer(); + } - for (int k=0;kmove_to(x,y); + for (int k = 0; k < num_parts; k++) + { + int start = parts[k]; + int end; + if (k == num_parts - 1) + { + end = num_points; + } + else + { + end = parts[k + 1]; + } + + double x = record.read_double(); + double y = record.read_double(); + poly->move_to(x, y); - for (int j=start+1;jline_to(x,y); - } - } - // z-range - //double z0=record.read_double(); - //double z1=record.read_double(); - //for (int i=0;iline_to(x, y); + } + } + + // z-range + //double z0=record.read_double(); + //double z1=record.read_double(); + //for (int i=0;i #include +#include "dbfile.hpp" +#include "shapefile.hpp" +#include "shp_index.hpp" + struct shape_io : boost::noncopyable { - static const std::string SHP; - //static const std::string SHX; - static const std::string DBF; - static const std::string INDEX; - unsigned type_; - shape_file shp_; - //shape_file shx_; - dbf_file dbf_; - boost::shared_ptr index_; - unsigned reclength_; - unsigned id_; - box2d cur_extent_; - public: enum shapeType { @@ -67,6 +54,7 @@ public: shape_io(const std::string& shape_name, bool open_index=true); ~shape_io(); + shape_file& shp(); //shape_file& shx(); dbf_file& dbf(); @@ -84,12 +72,26 @@ public: void move_to(int id); int type() const; const box2d& current_extent() const; - mapnik::geometry_type * read_polyline(); - mapnik::geometry_type * read_polylinem(); - mapnik::geometry_type * read_polylinez(); - mapnik::geometry_type * read_polygon(); - mapnik::geometry_type * read_polygonm(); - mapnik::geometry_type * read_polygonz(); + mapnik::geometry_type* read_polyline(); + mapnik::geometry_type* read_polylinem(); + mapnik::geometry_type* read_polylinez(); + mapnik::geometry_type* read_polygon(); + mapnik::geometry_type* read_polygonm(); + mapnik::geometry_type* read_polygonz(); + + unsigned type_; + shape_file shp_; + //shape_file shx_; + dbf_file dbf_; + boost::shared_ptr index_; + unsigned reclength_; + unsigned id_; + box2d cur_extent_; + + static const std::string SHP; + //static const std::string SHX; + static const std::string DBF; + static const std::string INDEX; }; #endif //SHAPE_IO_HPP diff --git a/plugins/input/shape/shapefile.hpp b/plugins/input/shape/shapefile.hpp index fba659982..4626952b2 100644 --- a/plugins/input/shape/shapefile.hpp +++ b/plugins/input/shape/shapefile.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,11 +20,13 @@ * *****************************************************************************/ -//$Id: shapefile.hpp 33 2005-04-04 13:01:03Z pavlenko $ - #ifndef SHAPEFILE_HPP #define SHAPEFILE_HPP +// stl +#include +#include + // mapnik #include #include @@ -35,10 +37,6 @@ #include #include -// stl -#include -#include - using mapnik::box2d; using mapnik::read_int32_ndr; using mapnik::read_int32_xdr; @@ -63,7 +61,7 @@ struct RecordTag struct MappedRecordTag { typedef const char* data_type; - static data_type alloc(unsigned) { return 0;} + static data_type alloc(unsigned) { return 0; } static void dealloc(data_type ) {} }; @@ -73,12 +71,18 @@ struct shape_record typename Tag::data_type data; size_t size; mutable size_t pos; + explicit shape_record(size_t size) - : - data(Tag::alloc(size)), + : data(Tag::alloc(size)), size(size), - pos(0) {} - + pos(0) + {} + + ~shape_record() + { + Tag::dealloc(data); + } + void set_data(typename Tag::data_type data_) { data = data_; @@ -91,42 +95,37 @@ struct shape_record void skip(unsigned n) { - pos+=n; + pos += n; } int read_ndr_integer() { boost::int32_t val; - read_int32_ndr(&data[pos],val); - pos+=4; + read_int32_ndr(&data[pos], val); + pos += 4; return val; } int read_xdr_integer() { boost::int32_t val; - read_int32_xdr(&data[pos],val); - pos+=4; + read_int32_xdr(&data[pos], val); + pos += 4; return val; } double read_double() { double val; - read_double_ndr(&data[pos],val); - pos+=8; + read_double_ndr(&data[pos], val); + pos += 8; return val; } + long remains() { - return (size-pos); - } - - ~shape_record() - { - Tag::dealloc(data); - } - + return (size - pos); + } }; using namespace boost::interprocess; @@ -144,10 +143,10 @@ public: #endif file_source_type file_; + shape_file() {} - shape_file(std::string const& file_name) - : + shape_file(std::string const& file_name) : #ifdef SHAPE_MEMORY_MAPPED_FILE file_() #else @@ -155,18 +154,19 @@ public: #endif { #ifdef SHAPE_MEMORY_MAPPED_FILE - - boost::optional memory = mapnik::mapped_memory_cache::find(file_name.c_str(),true); + boost::optional memory = + mapnik::mapped_memory_cache::find(file_name.c_str(),true); + if (memory) { - file_.buffer(static_cast((*memory)->get_address()),(*memory)->get_size()); + file_.buffer(static_cast((*memory)->get_address()), (*memory)->get_size()); } #endif } ~shape_file() {} - inline file_source_type & file() + inline file_source_type& file() { return file_; } @@ -184,9 +184,9 @@ public: { #ifdef SHAPE_MEMORY_MAPPED_FILE rec.set_data(file_.buffer().first + file_.tellg()); - file_.seekg(rec.size,std::ios::cur); + file_.seekg(rec.size, std::ios::cur); #else - file_.read(rec.get_data(),rec.size); + file_.read(rec.get_data(), rec.size); #endif } @@ -195,16 +195,16 @@ public: char b[4]; file_.read(b, 4); boost::int32_t val; - read_int32_xdr(b,val); + read_int32_xdr(b, val); return val; } inline int read_ndr_integer() { char b[4]; - file_.read(b,4); + file_.read(b, 4); boost::int32_t val; - read_int32_ndr(b,val); + read_int32_ndr(b, val); return val; } @@ -212,11 +212,11 @@ public: { double val; #ifndef MAPNIK_BIG_ENDIAN - file_.read(reinterpret_cast(&val),8); + file_.read(reinterpret_cast(&val), 8); #else char b[8]; - file_.read(b,8); - read_double_ndr(b,val); + file_.read(b, 8); + read_double_ndr(b, val); #endif return val; } @@ -224,22 +224,22 @@ public: inline void read_envelope(box2d& envelope) { #ifndef MAPNIK_BIG_ENDIAN - file_.read(reinterpret_cast(&envelope),sizeof(envelope)); + file_.read(reinterpret_cast(&envelope), sizeof(envelope)); #else - char data[4*8]; - file_.read(data,4*8); - double minx,miny,maxx,maxy; - read_double_ndr(data + 0*8,minx); - read_double_ndr(data + 1*8,miny); - read_double_ndr(data + 2*8,maxx); - read_double_ndr(data + 3*8,maxy); - envelope.init(minx,miny,maxx,maxy); + char data[4 * 8]; + file_.read(data,4 * 8); + double minx, miny, maxx, maxy; + read_double_ndr(data + 0 * 8, minx); + read_double_ndr(data + 1 * 8, miny); + read_double_ndr(data + 2 * 8, maxx); + read_double_ndr(data + 3 * 8, maxy); + envelope.init(minx, miny, maxx, maxy); #endif } inline void skip(std::streampos bytes) { - file_.seekg(bytes,std::ios::cur); + file_.seekg(bytes, std::ios::cur); } inline void rewind() @@ -249,7 +249,7 @@ public: inline void seek(std::streampos pos) { - file_.seekg(pos,std::ios::beg); + file_.seekg(pos, std::ios::beg); } inline std::streampos pos() @@ -263,4 +263,4 @@ public: } }; -#endif //SHAPEFILE_HPP +#endif // SHAPEFILE_HPP diff --git a/plugins/input/shape/shp_index.hpp b/plugins/input/shape/shp_index.hpp index 37661dd12..ebd424103 100644 --- a/plugins/input/shape/shp_index.hpp +++ b/plugins/input/shape/shp_index.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,9 +23,10 @@ #ifndef SHP_INDEX_HH #define SHP_INDEX_HH -// st +// stl #include #include + // mapnik #include #include @@ -43,63 +44,60 @@ private: ~shp_index(); shp_index(const shp_index&); shp_index& operator=(const shp_index&); - static int read_ndr_integer(IStream & in); - static void read_envelope(IStream & in,box2d &envelope); - static void query_node(const filterT& filter,IStream & in,std::vector& pos); + static int read_ndr_integer(IStream& in); + static void read_envelope(IStream& in, box2d& envelope); + static void query_node(const filterT& filter, IStream& in, std::vector& pos); }; -template -void shp_index::query(const filterT& filter,IStream & file,std::vector& pos) +template +void shp_index::query(const filterT& filter, IStream& file, std::vector& pos) { - file.seekg(16,std::ios::beg); - query_node(filter,file,pos); + file.seekg(16, std::ios::beg); + query_node(filter, file, pos); } template -void shp_index::query_node(const filterT& filter,IStream & file,std::vector& ids) +void shp_index::query_node(const filterT& filter, IStream& file, std::vector& ids) { - int offset=read_ndr_integer(file); + int offset = read_ndr_integer(file); box2d node_ext; - read_envelope(file,node_ext); + read_envelope(file, node_ext); - int num_shapes=read_ndr_integer(file); + int num_shapes = read_ndr_integer(file); - if (!filter.pass(node_ext)) + if (! filter.pass(node_ext)) { - file.seekg(offset+num_shapes*4+4,std::ios::cur); + file.seekg(offset + num_shapes * 4 + 4, std::ios::cur); return; } - for (int i=0;i -int shp_index::read_ndr_integer(IStream & file) +template +int shp_index::read_ndr_integer(IStream& file) { char b[4]; - file.read(b,4); - return (b[0]&0xff) | (b[1]&0xff)<<8 | (b[2]&0xff)<<16 | (b[3]&0xff)<<24; + file.read(b, 4); + return (b[0] & 0xff) | (b[1] & 0xff) << 8 | (b[2] & 0xff) << 16 | (b[3] & 0xff) << 24; } - -template -void shp_index::read_envelope(IStream & file,box2d& envelope) +template +void shp_index::read_envelope(IStream& file, box2d& envelope) { - file.read(reinterpret_cast(&envelope),sizeof(envelope)); + file.read(reinterpret_cast(&envelope), sizeof(envelope)); } - -#endif //SHP_INDEX_HH +#endif // SHP_INDEX_HH diff --git a/plugins/input/sqlite/sqlite_datasource.cpp b/plugins/input/sqlite/sqlite_datasource.cpp index c36767cf7..4e6f3b8aa 100644 --- a/plugins/input/sqlite/sqlite_datasource.cpp +++ b/plugins/input/sqlite/sqlite_datasource.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -// $Id$ #include "sqlite_datasource.hpp" #include "sqlite_featureset.hpp" @@ -27,9 +26,7 @@ // mapnik #include #include - -// to enable extent fallback hack -#include +#include // to enable extent fallback hack // boost #include @@ -39,15 +36,9 @@ #include #include - using boost::lexical_cast; using boost::bad_lexical_cast; -using mapnik::datasource; -using mapnik::parameters; - -DATASOURCE_PLUGIN(sqlite_datasource) - using mapnik::box2d; using mapnik::coord2d; using mapnik::query; @@ -55,31 +46,34 @@ using mapnik::featureset_ptr; using mapnik::layer_descriptor; using mapnik::attribute_descriptor; using mapnik::datasource_exception; +using mapnik::datasource; +using mapnik::parameters; +DATASOURCE_PLUGIN(sqlite_datasource) sqlite_datasource::sqlite_datasource(parameters const& params, bool bind) - : datasource(params), - extent_(), - extent_initialized_(false), - type_(datasource::Vector), - table_(*params_.get("table","")), - fields_(*params_.get("fields","*")), - metadata_(*params_.get("metadata","")), - geometry_table_(*params_.get("geometry_table","")), - geometry_field_(*params_.get("geometry_field","")), - index_table_(*params_.get("index_table","")), - key_field_(*params_.get("key_field","")), - row_offset_(*params_.get("row_offset",0)), - row_limit_(*params_.get("row_limit",0)), - desc_(*params_.get("type"), *params_.get("encoding","utf-8")), - format_(mapnik::wkbAuto) + : datasource(params), + extent_(), + extent_initialized_(false), + type_(datasource::Vector), + table_(*params_.get("table", "")), + fields_(*params_.get("fields", "*")), + metadata_(*params_.get("metadata", "")), + geometry_table_(*params_.get("geometry_table", "")), + geometry_field_(*params_.get("geometry_field", "")), + index_table_(*params_.get("index_table", "")), + key_field_(*params_.get("key_field", "")), + row_offset_(*params_.get("row_offset", 0)), + row_limit_(*params_.get("row_limit", 0)), + desc_(*params_.get("type"), *params_.get("encoding", "utf-8")), + format_(mapnik::wkbAuto) { // TODO // - change param from 'file' to 'dbname' // - ensure that the supplied key_field is a valid "integer primary key" boost::optional file = params_.get("file"); - if (!file) throw datasource_exception("Sqlite Plugin: missing parameter"); + if (! file) throw datasource_exception("Sqlite Plugin: missing parameter"); if (table_.empty()) { @@ -144,27 +138,27 @@ void sqlite_datasource::bind() const boost::optional attachdb = params_.get("attachdb"); if (attachdb) { - parse_attachdb(*attachdb); + parse_attachdb(*attachdb); } boost::optional initdb = params_.get("initdb"); if (initdb) { - init_statements_.push_back(*initdb); + init_statements_.push_back(*initdb); } if (!boost::filesystem::exists(dataset_name_)) throw datasource_exception("Sqlite Plugin: " + dataset_name_ + " does not exist"); - dataset_ = new sqlite_connection (dataset_name_); + dataset_ = new sqlite_connection(dataset_name_); // Execute init_statements_ for (std::vector::const_iterator iter = init_statements_.begin(); iter != init_statements_.end(); ++iter) { - #ifdef MAPNIK_DEBUG +#ifdef MAPNIK_DEBUG std::clog << "Sqlite Plugin: Execute init sql: " << *iter << std::endl; - #endif +#endif dataset_->execute(*iter); } @@ -197,10 +191,10 @@ void sqlite_datasource::bind() const boost::scoped_ptr rs(dataset_->execute_query(s.str())); if (rs->is_valid() && rs->step_next()) { - for (int i = 0; i < rs->column_count (); ++i) + for (int i = 0; i < rs->column_count(); ++i) { - const int type_oid = rs->column_type (i); - const char* fld_name = rs->column_name (i); + const int type_oid = rs->column_type(i); + const char* fld_name = rs->column_name(i); switch (type_oid) { case SQLITE_INTEGER: @@ -233,9 +227,9 @@ void sqlite_datasource::bind() const break; default: - #ifdef MAPNIK_DEBUG +#ifdef MAPNIK_DEBUG std::clog << "Sqlite Plugin: unknown type_oid=" << type_oid << std::endl; - #endif +#endif break; } } @@ -252,13 +246,15 @@ void sqlite_datasource::bind() const if (key_field_.empty()) { - use_pragma_table_info = true; + use_pragma_table_info = true; } else { - // TODO - we can't trust so much the rowid here - if (key_field_ == "rowid") - desc_.add_descriptor(attribute_descriptor("rowid", mapnik::Integer)); + // TODO - we can't trust so much the rowid here + if (key_field_ == "rowid") + { + desc_.add_descriptor(attribute_descriptor("rowid", mapnik::Integer)); + } } if (use_pragma_table_info) @@ -325,7 +321,7 @@ void sqlite_datasource::bind() const desc_.add_descriptor(attribute_descriptor(fld_name, mapnik::String)); } } - #ifdef MAPNIK_DEBUG +#ifdef MAPNIK_DEBUG else { // "Column Affinity" says default to "Numeric" but for now we pass.. @@ -338,7 +334,7 @@ void sqlite_datasource::bind() const << "' unhandled due to unknown type: " << fld_type << std::endl; } - #endif +#endif } if (! found_table) @@ -377,12 +373,12 @@ void sqlite_datasource::bind() const { has_spatial_index_ = true; } - #ifdef MAPNIK_DEBUG +#ifdef MAPNIK_DEBUG else { std::clog << "SQLite Plugin: rtree index lookup did not succeed: '" << sqlite3_errmsg(*(*dataset_)) << "'\n"; } - #endif +#endif } if (! metadata_.empty() && ! extent_initialized_) @@ -399,7 +395,7 @@ void sqlite_datasource::bind() const double xmax = rs->column_double (2); double ymax = rs->column_double (3); - extent_.init (xmin,ymin,xmax,ymax); + extent_.init (xmin, ymin, xmax, ymax); extent_initialized_ = true; } } @@ -421,10 +417,10 @@ void sqlite_datasource::bind() const double ymin = lexical_cast(rs->column_double(1)); double xmax = lexical_cast(rs->column_double(2)); double ymax = lexical_cast(rs->column_double(3)); - extent_.init (xmin,ymin,xmax,ymax); + extent_.init(xmin, ymin, xmax, ymax); extent_initialized_ = true; } - catch (bad_lexical_cast &ex) + catch (bad_lexical_cast& ex) { std::clog << boost::format("SQLite Plugin: warning: could not determine extent from query: %s\nError was: '%s'\n") % s.str() % ex.what() << std::endl; } @@ -503,7 +499,7 @@ void sqlite_datasource::bind() const while (rs->is_valid() && rs->step_next()) { int size; - const char* data = (const char *) rs->column_blob (0, size); + const char* data = (const char*) rs->column_blob(0, size); if (data) { // create a tmp feature to be able to parse geometry @@ -534,8 +530,8 @@ void sqlite_datasource::bind() const { std::ostringstream type_error; type_error << "Sqlite Plugin: invalid type for key field '" - << key_field_ << "' when creating index '" << index_table_ - << "' type was: " << type_oid << ""; + << key_field_ << "' when creating index '" << index_table_ + << "' type was: " << type_oid << ""; throw datasource_exception(type_error.str()); } @@ -680,24 +676,24 @@ int sqlite_datasource::type() const box2d sqlite_datasource::envelope() const { - if (!is_bound_) bind(); + if (! is_bound_) bind(); return extent_; } layer_descriptor sqlite_datasource::get_descriptor() const { - if (!is_bound_) bind(); + if (! is_bound_) bind(); return desc_; } featureset_ptr sqlite_datasource::features(query const& q) const { - if (!is_bound_) bind(); + if (! is_bound_) bind(); - if (dataset_) - { + if (dataset_) + { mapnik::box2d const& e = q.get_bbox(); std::ostringstream s; @@ -752,10 +748,10 @@ featureset_ptr sqlite_datasource::features(query const& q) const s << " OFFSET " << row_offset_; } - #ifdef MAPNIK_DEBUG +#ifdef MAPNIK_DEBUG std::clog << "Sqlite Plugin: table: " << table_ << "\n\n"; std::clog << "Sqlite Plugin: query:" << s.str() << "\n\n"; - #endif +#endif boost::shared_ptr rs(dataset_->execute_query(s.str())); @@ -771,12 +767,12 @@ featureset_ptr sqlite_datasource::features(query const& q) const featureset_ptr sqlite_datasource::features_at_point(coord2d const& pt) const { - if (!is_bound_) bind(); + if (! is_bound_) bind(); - if (dataset_) - { + if (dataset_) + { // TODO - need tolerance - mapnik::box2d const e(pt.x,pt.y,pt.x,pt.y); + mapnik::box2d const e(pt.x, pt.y, pt.x, pt.y); std::ostringstream s; s << "SELECT " << geometry_field_ << "," << key_field_; @@ -795,7 +791,7 @@ featureset_ptr sqlite_datasource::features_at_point(coord2d const& pt) const s << " FROM "; - std::string query (table_); + std::string query(table_); if (has_spatial_index_) { @@ -826,9 +822,9 @@ featureset_ptr sqlite_datasource::features_at_point(coord2d const& pt) const s << " OFFSET " << row_offset_; } - #ifdef MAPNIK_DEBUG +#ifdef MAPNIK_DEBUG std::clog << "Sqlite Plugin: " << s.str() << std::endl; - #endif +#endif boost::shared_ptr rs(dataset_->execute_query(s.str())); diff --git a/plugins/input/sqlite/sqlite_datasource.hpp b/plugins/input/sqlite/sqlite_datasource.hpp index 6f20ef943..9d83b2855 100644 --- a/plugins/input/sqlite/sqlite_datasource.hpp +++ b/plugins/input/sqlite/sqlite_datasource.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2007 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef SQLITE_DATASOURCE_HPP #define SQLITE_DATASOURCE_HPP @@ -38,47 +37,45 @@ #include "sqlite_types.hpp" -//============================================================================== - class sqlite_datasource : public mapnik::datasource { - public: - sqlite_datasource(mapnik::parameters const& params, bool bind=true); - virtual ~sqlite_datasource (); - int type() const; - static std::string name(); - mapnik::featureset_ptr features(mapnik::query const& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const; - mapnik::box2d envelope() const; - mapnik::layer_descriptor get_descriptor() const; - void bind() const; - private: - mutable mapnik::box2d extent_; - mutable bool extent_initialized_; - int type_; - mutable std::string dataset_name_; - mutable sqlite_connection* dataset_; - std::string table_; - std::string fields_; - std::string metadata_; - mutable std::string geometry_table_; - mutable std::string geometry_field_; - mutable std::string index_table_; - mutable std::string key_field_; - mutable int row_offset_; - mutable int row_limit_; - mutable mapnik::layer_descriptor desc_; - mutable mapnik::wkbFormat format_; - mutable bool multiple_geometries_; - mutable bool use_spatial_index_; - mutable bool has_spatial_index_; - mutable bool using_subquery_; - mutable std::vector init_statements_; - - // Fill init_statements with any statements - // needed to attach auxillary databases - void parse_attachdb(std::string const& attachdb) const; +public: + sqlite_datasource(mapnik::parameters const& params, bool bind = true); + virtual ~sqlite_datasource (); + int type() const; + static std::string name(); + mapnik::featureset_ptr features(mapnik::query const& q) const; + mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const; + mapnik::box2d envelope() const; + mapnik::layer_descriptor get_descriptor() const; + void bind() const; + +private: + mutable mapnik::box2d extent_; + mutable bool extent_initialized_; + int type_; + mutable std::string dataset_name_; + mutable sqlite_connection* dataset_; + std::string table_; + std::string fields_; + std::string metadata_; + mutable std::string geometry_table_; + mutable std::string geometry_field_; + mutable std::string index_table_; + mutable std::string key_field_; + mutable int row_offset_; + mutable int row_limit_; + mutable mapnik::layer_descriptor desc_; + mutable mapnik::wkbFormat format_; + mutable bool multiple_geometries_; + mutable bool use_spatial_index_; + mutable bool has_spatial_index_; + mutable bool using_subquery_; + mutable std::vector init_statements_; + + // Fill init_statements with any statements + // needed to attach auxillary databases + void parse_attachdb(std::string const& attachdb) const; }; - #endif // SQLITE_DATASOURCE_HPP diff --git a/plugins/input/sqlite/sqlite_featureset.cpp b/plugins/input/sqlite/sqlite_featureset.cpp index 4ca836722..7e7dfd4b3 100644 --- a/plugins/input/sqlite/sqlite_featureset.cpp +++ b/plugins/input/sqlite/sqlite_featureset.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2007 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ // mapnik #include @@ -49,35 +48,37 @@ sqlite_featureset::sqlite_featureset(boost::shared_ptr rs, mapnik::wkbFormat format, bool multiple_geometries, bool using_subquery) - : rs_(rs), - tr_(new transcoder(encoding)), - format_(format), - multiple_geometries_(multiple_geometries), - using_subquery_(using_subquery) + : rs_(rs), + tr_(new transcoder(encoding)), + format_(format), + multiple_geometries_(multiple_geometries), + using_subquery_(using_subquery) { } -sqlite_featureset::~sqlite_featureset() {} +sqlite_featureset::~sqlite_featureset() +{ +} feature_ptr sqlite_featureset::next() { if (rs_->is_valid () && rs_->step_next ()) { int size; - const char* data = (const char *) rs_->column_blob (0, size); + const char* data = (const char*) rs_->column_blob(0, size); if (! data) { return feature_ptr(); } - int feature_id = rs_->column_integer (1); + int feature_id = rs_->column_integer(1); feature_ptr feature(feature_factory::create(feature_id)); geometry_utils::from_wkb(feature->paths(), data, size, multiple_geometries_, format_); - for (int i = 2; i < rs_->column_count (); ++i) + for (int i = 2; i < rs_->column_count(); ++i) { - const int type_oid = rs_->column_type (i); + const int type_oid = rs_->column_type(i); const char* fld_name = rs_->column_name(i); if (! fld_name) @@ -95,13 +96,13 @@ feature_ptr sqlite_featureset::next() { case SQLITE_INTEGER: { - boost::put(*feature, fld_name_str, rs_->column_integer (i)); + boost::put(*feature, fld_name_str, rs_->column_integer(i)); break; } case SQLITE_FLOAT: { - boost::put(*feature, fld_name_str, rs_->column_double (i)); + boost::put(*feature, fld_name_str, rs_->column_double(i)); break; } diff --git a/plugins/input/sqlite/sqlite_featureset.hpp b/plugins/input/sqlite/sqlite_featureset.hpp index fced45801..b24274bd9 100644 --- a/plugins/input/sqlite/sqlite_featureset.hpp +++ b/plugins/input/sqlite/sqlite_featureset.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2007 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef SQLITE_FEATURESET_HPP #define SQLITE_FEATURESET_HPP @@ -36,26 +35,24 @@ // sqlite #include "sqlite_types.hpp" - -//============================================================================== class sqlite_featureset : public mapnik::Featureset { - public: - sqlite_featureset(boost::shared_ptr rs, - std::string const& encoding, - mapnik::wkbFormat format, - bool multiple_geometries, - bool using_subquery); - virtual ~sqlite_featureset(); - mapnik::feature_ptr next(); - private: - boost::shared_ptr rs_; - boost::scoped_ptr tr_; - mapnik::wkbFormat format_; - bool multiple_geometries_; - bool using_subquery_; +public: + sqlite_featureset(boost::shared_ptr rs, + std::string const& encoding, + mapnik::wkbFormat format, + bool multiple_geometries, + bool using_subquery); + virtual ~sqlite_featureset(); + mapnik::feature_ptr next(); + +private: + boost::shared_ptr rs_; + boost::scoped_ptr tr_; + mapnik::wkbFormat format_; + bool multiple_geometries_; + bool using_subquery_; }; - #endif // SQLITE_FEATURESET_HPP diff --git a/plugins/input/sqlite/sqlite_types.hpp b/plugins/input/sqlite/sqlite_types.hpp index ba06b0c18..3da0e55b3 100644 --- a/plugins/input/sqlite/sqlite_types.hpp +++ b/plugins/input/sqlite/sqlite_types.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2007 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,13 +19,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ -//$Id$ #ifndef SQLITE_TYPES_HPP #define SQLITE_TYPES_HPP -// stdc++ -#include +// stl +#include // mapnik #include @@ -40,32 +39,25 @@ extern "C" { } -//============================================================================== - class sqlite_utils { public: - - static void dequote(std::string & z) + static void dequote(std::string& z) { - boost::algorithm::trim_if(z,boost::algorithm::is_any_of("[]'\"`")); + boost::algorithm::trim_if(z, boost::algorithm::is_any_of("[]'\"`")); } - }; -//============================================================================== - class sqlite_resultset { public: - - sqlite_resultset (sqlite3_stmt* stmt) + sqlite_resultset(sqlite3_stmt* stmt) : stmt_(stmt) { } - ~sqlite_resultset () + virtual ~sqlite_resultset() { if (stmt_) { @@ -73,14 +65,14 @@ public: } } - bool is_valid () + bool is_valid() { return stmt_ != 0; } - bool step_next () + bool step_next() { - const int status = sqlite3_step (stmt_); + const int status = sqlite3_step(stmt_); if (status != SQLITE_ROW && status != SQLITE_DONE) { std::ostringstream s; @@ -97,56 +89,56 @@ public: return status == SQLITE_ROW; } - int column_count () + int column_count() { - return sqlite3_column_count (stmt_); + return sqlite3_column_count(stmt_); } - int column_type (int col) + int column_type(int col) { - return sqlite3_column_type (stmt_, col); + return sqlite3_column_type(stmt_, col); } - const char* column_name (int col) + const char* column_name(int col) { - return sqlite3_column_name (stmt_, col); + return sqlite3_column_name(stmt_, col); } - bool column_isnull (int col) + bool column_isnull(int col) { - return sqlite3_column_type (stmt_, col) == SQLITE_NULL; + return sqlite3_column_type(stmt_, col) == SQLITE_NULL; } - int column_integer (int col) + int column_integer(int col) { - return sqlite3_column_int (stmt_, col); + return sqlite3_column_int(stmt_, col); } - int column_integer64 (int col) + int column_integer64(int col) { - return sqlite3_column_int64 (stmt_, col); + return sqlite3_column_int64(stmt_, col); } - double column_double (int col) + double column_double(int col) { - return sqlite3_column_double (stmt_, col); + return sqlite3_column_double(stmt_, col); } - const char* column_text (int col, int& len) + const char* column_text(int col, int& len) { - len = sqlite3_column_bytes (stmt_, col); - return (const char*) sqlite3_column_text (stmt_, col); + len = sqlite3_column_bytes(stmt_, col); + return (const char*) sqlite3_column_text(stmt_, col); } - const char* column_text (int col) + const char* column_text(int col) { - return (const char*) sqlite3_column_text (stmt_, col); + return (const char*) sqlite3_column_text(stmt_, col); } - const void* column_blob (int col, int& bytes) + const void* column_blob(int col, int& bytes) { - bytes = sqlite3_column_bytes (stmt_, col); - return (const char*) sqlite3_column_blob (stmt_, col); + bytes = sqlite3_column_bytes(stmt_, col); + return (const char*) sqlite3_column_blob(stmt_, col); } sqlite3_stmt* get_statement() @@ -160,13 +152,11 @@ private: }; -//============================================================================== - class sqlite_connection { public: - sqlite_connection (const std::string& file) + sqlite_connection(const std::string& file) : db_(0) { // sqlite3_open_v2 is available earlier but @@ -175,28 +165,28 @@ public: const int rc = sqlite3_enable_shared_cache(1); if (rc != SQLITE_OK) { - throw mapnik::datasource_exception (sqlite3_errmsg (db_)); + throw mapnik::datasource_exception(sqlite3_errmsg (db_)); } int mode = SQLITE_OPEN_READWRITE | SQLITE_OPEN_NOMUTEX | SQLITE_OPEN_SHAREDCACHE; - if (sqlite3_open_v2 (file.c_str(), &db_, mode, NULL)) + if (sqlite3_open_v2(file.c_str(), &db_, mode, NULL)) #else #warning "Mapnik's sqlite plugin is compiling against a version of sqlite older than 3.6.18 which may make rendering slow..." - if (sqlite3_open (file.c_str(), &db_)) + if (sqlite3_open(file.c_str(), &db_)) #endif { std::ostringstream s; - s << "Sqlite Plugin: " << sqlite3_errmsg (db_); + s << "Sqlite Plugin: " << sqlite3_errmsg(db_); - throw mapnik::datasource_exception (s.str()); + throw mapnik::datasource_exception(s.str()); } } - virtual ~sqlite_connection () + virtual ~sqlite_connection() { if (db_) { - sqlite3_close (db_); + sqlite3_close(db_); } } @@ -204,10 +194,16 @@ public: { std::ostringstream s; s << "Sqlite Plugin: "; + if (db_) + { s << "'" << sqlite3_errmsg(db_) << "'"; + } else + { s << "unknown error, lost connection"; + } + s << "\nFull sql was: '" << sql << "'\n"; throw mapnik::datasource_exception (s.str()); @@ -217,7 +213,7 @@ public: { sqlite3_stmt* stmt = 0; - const int rc = sqlite3_prepare_v2 (db_, sql.c_str(), -1, &stmt, 0); + const int rc = sqlite3_prepare_v2(db_, sql.c_str(), -1, &stmt, 0); if (rc != SQLITE_OK) { throw_sqlite_error(sql); @@ -251,5 +247,4 @@ private: sqlite3* db_; }; - -#endif //SQLITE_TYPES_HPP +#endif // SQLITE_TYPES_HPP diff --git a/src/agg/agg_renderer.cpp b/src/agg/agg_renderer.cpp index ae482aa32..9275c0d76 100644 --- a/src/agg/agg_renderer.cpp +++ b/src/agg/agg_renderer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/agg/process_building_symbolizer.cpp b/src/agg/process_building_symbolizer.cpp index dda8090d8..a9b8b0dbd 100644 --- a/src/agg/process_building_symbolizer.cpp +++ b/src/agg/process_building_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/agg/process_glyph_symbolizer.cpp b/src/agg/process_glyph_symbolizer.cpp index 674c2eed7..4a82cdb4b 100644 --- a/src/agg/process_glyph_symbolizer.cpp +++ b/src/agg/process_glyph_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -59,9 +59,9 @@ void agg_renderer::process(glyph_symbolizer const& sym, } // set font size - unsigned size = sym.eval_size(feature); - ren.set_pixel_size(size * scale_factor_); - faces->set_pixel_sizes(size * scale_factor_); + float size = sym.eval_size(feature); + ren.set_character_size(size * scale_factor_); + faces->set_character_sizes(size * scale_factor_); // Get and render text path // diff --git a/src/agg/process_line_pattern_symbolizer.cpp b/src/agg/process_line_pattern_symbolizer.cpp index 99559f167..17f9cd191 100644 --- a/src/agg/process_line_pattern_symbolizer.cpp +++ b/src/agg/process_line_pattern_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/agg/process_line_symbolizer.cpp b/src/agg/process_line_symbolizer.cpp index a4de58dd8..c44cb273c 100644 --- a/src/agg/process_line_symbolizer.cpp +++ b/src/agg/process_line_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/agg/process_markers_symbolizer.cpp b/src/agg/process_markers_symbolizer.cpp index cd9757a01..0765bcf6f 100644 --- a/src/agg/process_markers_symbolizer.cpp +++ b/src/agg/process_markers_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/agg/process_point_symbolizer.cpp b/src/agg/process_point_symbolizer.cpp index d9974d82e..fb3035d8e 100644 --- a/src/agg/process_point_symbolizer.cpp +++ b/src/agg/process_point_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/agg/process_polygon_pattern_symbolizer.cpp b/src/agg/process_polygon_pattern_symbolizer.cpp index 23ea90043..a9a036ae5 100644 --- a/src/agg/process_polygon_pattern_symbolizer.cpp +++ b/src/agg/process_polygon_pattern_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/agg/process_polygon_symbolizer.cpp b/src/agg/process_polygon_symbolizer.cpp index e284a5c32..c376d9544 100644 --- a/src/agg/process_polygon_symbolizer.cpp +++ b/src/agg/process_polygon_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/agg/process_raster_symbolizer.cpp b/src/agg/process_raster_symbolizer.cpp index af1329b96..0f3e062f0 100644 --- a/src/agg/process_raster_symbolizer.cpp +++ b/src/agg/process_raster_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/agg/process_shield_symbolizer.cpp b/src/agg/process_shield_symbolizer.cpp index 4a104d69c..7d2c02741 100644 --- a/src/agg/process_shield_symbolizer.cpp +++ b/src/agg/process_shield_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -129,7 +129,7 @@ void agg_renderer::process(shield_symbolizer const& sym, { text_renderer ren(pixmap_, faces, *strk); - ren.set_pixel_size(sym.get_text_size() * scale_factor_); + ren.set_character_size(sym.get_text_size() * scale_factor_); ren.set_fill(sym.get_fill()); ren.set_halo_fill(sym.get_halo_fill()); ren.set_halo_radius(sym.get_halo_radius() * scale_factor_); diff --git a/src/agg/process_text_symbolizer.cpp b/src/agg/process_text_symbolizer.cpp index 3d7440c19..f58d73289 100644 --- a/src/agg/process_text_symbolizer.cpp +++ b/src/agg/process_text_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -103,12 +103,13 @@ void agg_renderer::process(text_symbolizer const& sym, throw config_error("Unable to find specified font face '" + sym.get_face_name() + "'"); } text_renderer ren(pixmap_, faces, *strk); - ren.set_pixel_size(placement_options->text_size * scale_factor_); + + ren.set_character_size(placement_options->text_size * scale_factor_); ren.set_fill(fill); ren.set_halo_fill(sym.get_halo_fill()); ren.set_halo_radius(sym.get_halo_radius() * scale_factor_); ren.set_opacity(sym.get_text_opacity()); - + box2d dims(0,0,width_,height_); placement_finder finder(*detector_,dims); diff --git a/src/arrow.cpp b/src/arrow.cpp index bf577da22..593452e4b 100644 --- a/src/arrow.cpp +++ b/src/arrow.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/box2d.cpp b/src/box2d.cpp index 4998994cc..16fe3148b 100644 --- a/src/box2d.cpp +++ b/src/box2d.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/build.py b/src/build.py index b5e0bd834..31ffc2cb7 100644 --- a/src/build.py +++ b/src/build.py @@ -53,9 +53,11 @@ ABI_VERSION = env['ABI_VERSION'] filesystem = 'boost_filesystem%s' % env['BOOST_APPEND'] regex = 'boost_regex%s' % env['BOOST_APPEND'] +system = 'boost_system%s' % env['BOOST_APPEND'] # clear out and re-set libs for this env -lib_env['LIBS'] = ['freetype','ltdl','png','tiff','z','jpeg','proj',env['ICU_LIB_NAME'],filesystem,regex] +lib_env['LIBS'] = ['freetype','ltdl','png','tiff','z','jpeg','proj',env['ICU_LIB_NAME'],filesystem,system,regex] + if len(env['EXTRA_FREETYPE_LIBS']): lib_env['LIBS'].extend(copy(env['EXTRA_FREETYPE_LIBS'])) @@ -67,8 +69,6 @@ lib_env['LIBS'].append('xml2') if env['THREADING'] == 'multi': lib_env['LIBS'].append('boost_thread%s' % env['BOOST_APPEND']) -if env['HAS_BOOST_SYSTEM']: - lib_env['LIBS'].append('boost_system%s' % env['BOOST_APPEND']) if not env['RUNTIME_LINK'] == 'static': diff --git a/src/cairo_renderer.cpp b/src/cairo_renderer.cpp index e1976f547..668c8ebbd 100644 --- a/src/cairo_renderer.cpp +++ b/src/cairo_renderer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2008 Tom Hughes + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -1138,7 +1138,7 @@ void cairo_renderer_base::process(shield_symbolizer const& sym, placement_finder finder(detector_); - faces->set_pixel_sizes(placement_options->text_size); + faces->set_character_sizes(placement_options->text_size); faces->get_string_info(info); int w = (*marker)->width(); @@ -1466,7 +1466,7 @@ void cairo_renderer_base::process(glyph_symbolizer const& sym, // set font size unsigned size = sym.eval_size(feature); - faces->set_pixel_sizes(size); + faces->set_character_sizes(size); // Get and render text path // @@ -1563,7 +1563,7 @@ void cairo_renderer_base::process(text_symbolizer const& sym, cairo_context context(context_); string_info info(text); - faces->set_pixel_sizes(placement_options->text_size); + faces->set_character_sizes(placement_options->text_size); faces->get_string_info(info); placement_finder finder(detector_); diff --git a/src/color.cpp b/src/color.cpp index 368d50d14..dde0575c5 100644 --- a/src/color.cpp +++ b/src/color.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2009 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/datasource_cache.cpp b/src/datasource_cache.cpp index 5c0b8620b..a3847ee2f 100644 --- a/src/datasource_cache.cpp +++ b/src/datasource_cache.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/distance.cpp b/src/distance.cpp index 1fff44143..683c69230 100644 --- a/src/distance.cpp +++ b/src/distance.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/expression_string.cpp b/src/expression_string.cpp index b3d5dcc0b..78932bdf0 100644 --- a/src/expression_string.cpp +++ b/src/expression_string.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2009 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/feature_type_style.cpp b/src/feature_type_style.cpp index f9047f595..6350c4b39 100644 --- a/src/feature_type_style.cpp +++ b/src/feature_type_style.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/filter_factory.cpp b/src/filter_factory.cpp index 97e7e6129..f55cd096c 100644 --- a/src/filter_factory.cpp +++ b/src/filter_factory.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/font_engine_freetype.cpp b/src/font_engine_freetype.cpp index a1b586192..769abcbe7 100644 --- a/src/font_engine_freetype.cpp +++ b/src/font_engine_freetype.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/font_set.cpp b/src/font_set.cpp index f1a975ba4..df24f4c37 100644 --- a/src/font_set.cpp +++ b/src/font_set.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/glyph_symbolizer.cpp b/src/glyph_symbolizer.cpp index b94bb7766..8ef41c638 100644 --- a/src/glyph_symbolizer.cpp +++ b/src/glyph_symbolizer.cpp @@ -97,7 +97,7 @@ unsigned glyph_symbolizer::eval_size(Feature const& feature) const #ifdef MAPNIK_DEBUG std::clog << "size_result=" << result.to_string() << "\n"; #endif - unsigned size = static_cast(result.to_int()); + float size = static_cast(result.to_double()); #ifdef MAPNIK_DEBUG std::clog << "size=" << size << "\n"; #endif diff --git a/src/gradient.cpp b/src/gradient.cpp index 35dc2ccc5..8e9c7278c 100644 --- a/src/gradient.cpp +++ b/src/gradient.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavelenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/graphics.cpp b/src/graphics.cpp index 46f30d3c7..90099da1b 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/grid/process_markers_symbolizer.cpp b/src/grid/process_markers_symbolizer.cpp index 84b2da613..347324326 100644 --- a/src/grid/process_markers_symbolizer.cpp +++ b/src/grid/process_markers_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/grid/process_shield_symbolizer.cpp b/src/grid/process_shield_symbolizer.cpp index 182412f22..d0f61cd67 100644 --- a/src/grid/process_shield_symbolizer.cpp +++ b/src/grid/process_shield_symbolizer.cpp @@ -110,7 +110,7 @@ void grid_renderer::process(shield_symbolizer const& sym, { text_renderer ren(pixmap_, faces, *strk); - ren.set_pixel_size(sym.get_text_size() * scale_factor_ * (1.0/pixmap_.get_resolution())); + ren.set_character_size(sym.get_text_size() * scale_factor_ * (1.0/pixmap_.get_resolution())); ren.set_fill(sym.get_fill()); ren.set_halo_fill(sym.get_halo_fill()); ren.set_halo_radius(sym.get_halo_radius() * scale_factor_); diff --git a/src/grid/process_text_symbolizer.cpp b/src/grid/process_text_symbolizer.cpp index 6e3c1b5dc..e88aed6c5 100644 --- a/src/grid/process_text_symbolizer.cpp +++ b/src/grid/process_text_symbolizer.cpp @@ -77,7 +77,7 @@ void grid_renderer::process(text_symbolizer const& sym, throw config_error("Unable to find specified font face '" + sym.get_face_name() + "'"); } text_renderer ren(pixmap_, faces, *strk); - ren.set_pixel_size(placement_options->text_size * (scale_factor_ * (1.0/pixmap_.get_resolution()))); + ren.set_character_size(placement_options->text_size * (scale_factor_ * (1.0/pixmap_.get_resolution()))); ren.set_fill(fill); ren.set_halo_fill(sym.get_halo_fill()); ren.set_halo_radius(sym.get_halo_radius() * scale_factor_); diff --git a/src/image_reader.cpp b/src/image_reader.cpp index 504538096..75f98d881 100644 --- a/src/image_reader.cpp +++ b/src/image_reader.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/image_util.cpp b/src/image_util.cpp index dc1fbbebe..39ffa9163 100644 --- a/src/image_util.cpp +++ b/src/image_util.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/jpeg_reader.cpp b/src/jpeg_reader.cpp index 6f665daa8..2828ca2d0 100644 --- a/src/jpeg_reader.cpp +++ b/src/jpeg_reader.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/layer.cpp b/src/layer.cpp index ba40a85f6..1700dec9f 100644 --- a/src/layer.cpp +++ b/src/layer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/libxml2_loader.cpp b/src/libxml2_loader.cpp index ec9392c33..f935243ce 100644 --- a/src/libxml2_loader.cpp +++ b/src/libxml2_loader.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2007 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/line_pattern_symbolizer.cpp b/src/line_pattern_symbolizer.cpp index 4703f98d5..f03cc90ae 100644 --- a/src/line_pattern_symbolizer.cpp +++ b/src/line_pattern_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/line_symbolizer.cpp b/src/line_symbolizer.cpp index d6ae7e08f..ccece0f8a 100644 --- a/src/line_symbolizer.cpp +++ b/src/line_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/load_map.cpp b/src/load_map.cpp index f31767583..9b25dec5f 100644 --- a/src/load_map.cpp +++ b/src/load_map.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -1244,10 +1244,10 @@ void map_parser::parse_text_symbolizer( rule & rule, ptree const & sym ) optional fontset_name = get_opt_attr(sym, "fontset-name"); - unsigned size = get_attr(sym, "size", 10U); - + float size = get_attr(sym, "size", 10.0f); + color c = get_attr(sym, "fill", color(0,0,0)); - + text_symbolizer text_symbol = text_symbolizer(parse_expression(name, "utf8"), size, c, placement_finder); optional orientation = get_opt_attr(sym, "orientation"); @@ -1486,7 +1486,7 @@ void map_parser::parse_shield_symbolizer( rule & rule, ptree const & sym ) optional fontset_name = get_opt_attr(sym, "fontset-name"); - unsigned size = get_attr(sym, "size", 10U); + float size = get_attr(sym, "size", 10.0f); color fill = get_attr(sym, "fill", color(0,0,0)); std::string image_file = get_attr(sym, "file"); diff --git a/src/map.cpp b/src/map.cpp index 951b76a90..2f6e7af43 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/marker_cache.cpp b/src/marker_cache.cpp index 16a1d1e63..b93ce663c 100644 --- a/src/marker_cache.cpp +++ b/src/marker_cache.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/markers_symbolizer.cpp b/src/markers_symbolizer.cpp index 7588d66e9..bd30cf47e 100644 --- a/src/markers_symbolizer.cpp +++ b/src/markers_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/memory.cpp b/src/memory.cpp index 92a5c14ad..7869a0fe6 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/memory_datasource.cpp b/src/memory_datasource.cpp index d22bcbd8a..bc60255cd 100644 --- a/src/memory_datasource.cpp +++ b/src/memory_datasource.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/metawriter.cpp b/src/metawriter.cpp index 25022b507..51a56b247 100644 --- a/src/metawriter.cpp +++ b/src/metawriter.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Hermann Kraus + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/metawriter_factory.cpp b/src/metawriter_factory.cpp index fc4ebbc26..fbb33afc3 100644 --- a/src/metawriter_factory.cpp +++ b/src/metawriter_factory.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2011 MapQuest + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/metawriter_inmem.cpp b/src/metawriter_inmem.cpp index b0ca16d1f..27025cde0 100644 --- a/src/metawriter_inmem.cpp +++ b/src/metawriter_inmem.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2011 MapQuest + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/palette.cpp b/src/palette.cpp index 8ef8018fc..0dccde3b7 100644 --- a/src/palette.cpp +++ b/src/palette.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -110,7 +110,9 @@ unsigned rgba_palette::quantize(rgba const& c) const da = sorted_pal_[i].a - c.a; // stop criteria based on properties of used sorting if ((dr+db+dg+da) * (dr+db+dg+da) / 4 > dist) + { break; + } newdist = dr*dr + dg*dg + db*db + da*da; if (newdist < dist) { @@ -118,6 +120,7 @@ unsigned rgba_palette::quantize(rgba const& c) const dist = newdist; } } + for (unsigned i = poz + 1; i < sorted_pal_.size(); i++) { dr = sorted_pal_[i].r - c.r; @@ -126,7 +129,9 @@ unsigned rgba_palette::quantize(rgba const& c) const da = sorted_pal_[i].a - c.a; // stop criteria based on properties of used sorting if ((dr+db+dg+da) * (dr+db+dg+da) / 4 > dist) + { break; + } newdist = dr*dr + dg*dg + db*db + da*da; if (newdist < dist) { @@ -144,7 +149,7 @@ unsigned rgba_palette::quantize(rgba const& c) const void rgba_palette::parse(std::string const& pal, palette_type type) { - int length = pal.length(); + unsigned length = pal.length(); if ((type == PALETTE_RGBA && length % 4 > 0) || (type == PALETTE_RGB && length % 3 > 0) || @@ -163,18 +168,26 @@ void rgba_palette::parse(std::string const& pal, palette_type type) rgb_pal_.clear(); alpha_pal_.clear(); - if (type == PALETTE_RGBA) for (unsigned i = 0; i < length; i += 4) + if (type == PALETTE_RGBA) { - sorted_pal_.push_back(rgba(pal[i], pal[i + 1], pal[i + 2], pal[i + 3])); + for (unsigned i = 0; i < length; i += 4) + { + sorted_pal_.push_back(rgba(pal[i], pal[i + 1], pal[i + 2], pal[i + 3])); + } } - else for (unsigned i = 0; i < length; i += 3) + else { - sorted_pal_.push_back(rgba(pal[i], pal[i + 1], pal[i + 2], 0xFF)); + for (unsigned i = 0; i < length; i += 3) + { + sorted_pal_.push_back(rgba(pal[i], pal[i + 1], pal[i + 2], 0xFF)); + } } // Make sure we have at least one entry in the palette. if (sorted_pal_.size() == 0) + { sorted_pal_.push_back(rgba(0, 0, 0, 0)); + } colors_ = sorted_pal_.size(); @@ -187,7 +200,10 @@ void rgba_palette::parse(std::string const& pal, palette_type type) rgba c = sorted_pal_[i]; color_hashmap_[c] = i; rgb_pal_.push_back(rgb(c)); - if (c.a < 0xFF) alpha_pal_.push_back(c.a); + if (c.a < 0xFF) + { + alpha_pal_.push_back(c.a); + } } } diff --git a/src/parse_path.cpp b/src/parse_path.cpp index d5ac0a9e4..aa7e1f9fe 100644 --- a/src/parse_path.cpp +++ b/src/parse_path.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/placement_finder.cpp b/src/placement_finder.cpp index 9813dab04..b0dafd56b 100644 --- a/src/placement_finder.cpp +++ b/src/placement_finder.cpp @@ -2,8 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko - * Copyright (C) 2006 10East Corp. + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/plugin.cpp b/src/plugin.cpp index 7e5aa9445..e96d71b52 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/png_reader.cpp b/src/png_reader.cpp index 3dfaab3ea..9e642a91b 100644 --- a/src/png_reader.cpp +++ b/src/png_reader.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/point_symbolizer.cpp b/src/point_symbolizer.cpp index c7d62645d..221f922cd 100644 --- a/src/point_symbolizer.cpp +++ b/src/point_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/polygon_pattern_symbolizer.cpp b/src/polygon_pattern_symbolizer.cpp index 4519670b6..234fc000b 100644 --- a/src/polygon_pattern_symbolizer.cpp +++ b/src/polygon_pattern_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/proj_transform.cpp b/src/proj_transform.cpp index 462453deb..e835adf4c 100644 --- a/src/proj_transform.cpp +++ b/src/proj_transform.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/projection.cpp b/src/projection.cpp index c6a74f32a..ca0344cba 100644 --- a/src/projection.cpp +++ b/src/projection.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/raster_colorizer.cpp b/src/raster_colorizer.cpp index 603273b1f..03f2968f5 100644 --- a/src/raster_colorizer.cpp +++ b/src/raster_colorizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/save_map.cpp b/src/save_map.cpp index 0e885c9ce..2a9e8368e 100644 --- a/src/save_map.cpp +++ b/src/save_map.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/scale_denominator.cpp b/src/scale_denominator.cpp index e9cff6dc6..f79a964a8 100644 --- a/src/scale_denominator.cpp +++ b/src/scale_denominator.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/shield_symbolizer.cpp b/src/shield_symbolizer.cpp index c8102448c..fcf54a73e 100644 --- a/src/shield_symbolizer.cpp +++ b/src/shield_symbolizer.cpp @@ -2,8 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko - * Copyright (C) 2006 10East Corp. + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -38,7 +37,7 @@ namespace mapnik shield_symbolizer::shield_symbolizer( expression_ptr name, std::string const& face_name, - unsigned size, + float size, color const& fill, path_expression_ptr file) : text_symbolizer(name, face_name, size, fill), @@ -51,7 +50,7 @@ shield_symbolizer::shield_symbolizer( shield_symbolizer::shield_symbolizer( expression_ptr name, - unsigned size, + float size, color const& fill, path_expression_ptr file) : text_symbolizer(name, size, fill), diff --git a/src/stroke.cpp b/src/stroke.cpp index 0a9ecb40f..fbce4542d 100644 --- a/src/stroke.cpp +++ b/src/stroke.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/svg/process_building_symbolizer.cpp b/src/svg/process_building_symbolizer.cpp index e35bd7384..da56146b6 100644 --- a/src/svg/process_building_symbolizer.cpp +++ b/src/svg/process_building_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/svg/process_glyph_symbolizer.cpp b/src/svg/process_glyph_symbolizer.cpp index cfcea7ed7..7ac35bb4d 100644 --- a/src/svg/process_glyph_symbolizer.cpp +++ b/src/svg/process_glyph_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/svg/process_line_pattern_symbolizer.cpp b/src/svg/process_line_pattern_symbolizer.cpp index a72bd59d9..8a2274284 100644 --- a/src/svg/process_line_pattern_symbolizer.cpp +++ b/src/svg/process_line_pattern_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/svg/process_line_symbolizer.cpp b/src/svg/process_line_symbolizer.cpp index 0e99eb681..825b08d0b 100644 --- a/src/svg/process_line_symbolizer.cpp +++ b/src/svg/process_line_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/svg/process_markers_symbolizer.cpp b/src/svg/process_markers_symbolizer.cpp index c6e88f091..a4bba39bd 100644 --- a/src/svg/process_markers_symbolizer.cpp +++ b/src/svg/process_markers_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/svg/process_point_symbolizer.cpp b/src/svg/process_point_symbolizer.cpp index 0d586e2ea..bc6ab1a9c 100644 --- a/src/svg/process_point_symbolizer.cpp +++ b/src/svg/process_point_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/svg/process_polygon_pattern_symbolizer.cpp b/src/svg/process_polygon_pattern_symbolizer.cpp index 8ff791a81..b3639b193 100644 --- a/src/svg/process_polygon_pattern_symbolizer.cpp +++ b/src/svg/process_polygon_pattern_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/svg/process_polygon_symbolizer.cpp b/src/svg/process_polygon_symbolizer.cpp index d6a65aef9..0c787d407 100644 --- a/src/svg/process_polygon_symbolizer.cpp +++ b/src/svg/process_polygon_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/svg/process_raster_symbolizer.cpp b/src/svg/process_raster_symbolizer.cpp index d68be6793..ee7e0ab27 100644 --- a/src/svg/process_raster_symbolizer.cpp +++ b/src/svg/process_raster_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/svg/process_shield_symbolizer.cpp b/src/svg/process_shield_symbolizer.cpp index b342b321e..7b9ae0311 100644 --- a/src/svg/process_shield_symbolizer.cpp +++ b/src/svg/process_shield_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/svg/process_symbolizers.cpp b/src/svg/process_symbolizers.cpp index 16adc8b28..afa582e52 100644 --- a/src/svg/process_symbolizers.cpp +++ b/src/svg/process_symbolizers.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/svg/process_text_symbolizer.cpp b/src/svg/process_text_symbolizer.cpp index 1b3549c34..5440b1b01 100644 --- a/src/svg/process_text_symbolizer.cpp +++ b/src/svg/process_text_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/svg/svg_generator.cpp b/src/svg/svg_generator.cpp index f2fe7fbfb..8e626eeea 100644 --- a/src/svg/svg_generator.cpp +++ b/src/svg/svg_generator.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/svg/svg_output_attributes.cpp b/src/svg/svg_output_attributes.cpp index a9b209dde..eac93a891 100644 --- a/src/svg/svg_output_attributes.cpp +++ b/src/svg/svg_output_attributes.cpp @@ -3,7 +3,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/svg/svg_renderer.cpp b/src/svg/svg_renderer.cpp index b38644e89..8834644c4 100644 --- a/src/svg/svg_renderer.cpp +++ b/src/svg/svg_renderer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/svg_parser.cpp b/src/svg_parser.cpp index 3bd614392..73c693eb1 100644 --- a/src/svg_parser.cpp +++ b/src/svg_parser.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/svg_path_parser.cpp b/src/svg_path_parser.cpp index 2949ff34b..18539f42f 100644 --- a/src/svg_path_parser.cpp +++ b/src/svg_path_parser.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/svg_points_parser.cpp b/src/svg_points_parser.cpp index c4d410d4b..d7c6fdbb8 100644 --- a/src/svg_points_parser.cpp +++ b/src/svg_points_parser.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/svg_transform_parser.cpp b/src/svg_transform_parser.cpp index ffe11f575..ea3b9bb4d 100644 --- a/src/svg_transform_parser.cpp +++ b/src/svg_transform_parser.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2010 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/symbolizer.cpp b/src/symbolizer.cpp index 240c1b5db..4eba20036 100644 --- a/src/symbolizer.cpp +++ b/src/symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/text_placements.cpp b/src/text_placements.cpp index a8eb3574e..e0c0bc80a 100644 --- a/src/text_placements.cpp +++ b/src/text_placements.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2011 Hermann Kraus + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/text_symbolizer.cpp b/src/text_symbolizer.cpp index dd55a8953..a328c8f58 100644 --- a/src/text_symbolizer.cpp +++ b/src/text_symbolizer.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -87,7 +87,7 @@ IMPLEMENT_ENUM( text_transform_e, text_transform_strings ) text_symbolizer::text_symbolizer(expression_ptr name, std::string const& face_name, - unsigned size, color const& fill, + float size, color const& fill, text_placements_ptr placements) : symbolizer_base(), name_(name), @@ -120,7 +120,7 @@ text_symbolizer::text_symbolizer(expression_ptr name, std::string const& face_na set_text_size(size); } -text_symbolizer::text_symbolizer(expression_ptr name, unsigned size, color const& fill, +text_symbolizer::text_symbolizer(expression_ptr name, float size, color const& fill, text_placements_ptr placements) : symbolizer_base(), name_(name), @@ -378,12 +378,12 @@ void text_symbolizer::set_max_char_angle_delta(double angle) max_char_angle_delta_ = angle; } -void text_symbolizer::set_text_size(unsigned size) +void text_symbolizer::set_text_size(float size) { placement_options_->set_default_text_size(size); } -unsigned text_symbolizer::get_text_size() const +float text_symbolizer::get_text_size() const { return placement_options_->get_default_text_size(); } diff --git a/src/tiff_reader.cpp b/src/tiff_reader.cpp index 6c000a023..25a5d5724 100644 --- a/src/tiff_reader.cpp +++ b/src/tiff_reader.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/unicode.cpp b/src/unicode.cpp index a768705c3..5665ded5d 100644 --- a/src/unicode.cpp +++ b/src/unicode.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006,2009 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/wkb.cpp b/src/wkb.cpp index 2e434f990..f704971b7 100644 --- a/src/wkb.cpp +++ b/src/wkb.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2006 Artem Pavlenko + * Copyright (C) 2011 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -67,7 +67,7 @@ public: wkbGeometryCollectionZ=1007 }; - wkb_reader(const char* wkb,unsigned size, wkbFormat format) + wkb_reader(const char* wkb, unsigned size, wkbFormat format) : wkb_(wkb), size_(size), pos_(0), @@ -76,16 +76,16 @@ public: // try to determine WKB format automatically if (format_ == wkbAuto) { - if (size >= 44 - && (unsigned char)(wkb_[0]) == (unsigned char)(0x00) - && (unsigned char)(wkb_[38]) == (unsigned char)(0x7C)) - { - format_ = wkbSpatiaLite; - } - else - { - format_ = wkbGeneric; - } + if (size >= 44 + && (unsigned char)(wkb_[0]) == (unsigned char)(0x00) + && (unsigned char)(wkb_[38]) == (unsigned char)(0x7C)) + { + format_ = wkbSpatiaLite; + } + else + { + format_ = wkbGeneric; + } } switch (format_) diff --git a/tests/cpp_tests/svg_renderer_tests/build.py b/tests/cpp_tests/svg_renderer_tests/build.py index 8a1f52f4f..1bac97233 100644 --- a/tests/cpp_tests/svg_renderer_tests/build.py +++ b/tests/cpp_tests/svg_renderer_tests/build.py @@ -10,13 +10,9 @@ system = 'boost_system%s' % env['BOOST_APPEND'] regex = 'boost_regex%s' % env['BOOST_APPEND'] libraries = [filesystem, 'mapnik2'] - -if env['PLATFORM'] == 'Darwin': - libraries.append(env['ICU_LIB_NAME']) - libraries.append(regex) - -if env['HAS_BOOST_SYSTEM']: - libraries.append(system) +libraries.append(env['ICU_LIB_NAME']) +libraries.append(regex) +libraries.append(system) for cpp_test in glob.glob('path_element_test.cpp'): env.Program(cpp_test.replace('.cpp',''), [cpp_test], CPPPATH=headers, LIBS=libraries) \ No newline at end of file diff --git a/tests/data/csv/datacouch_dc8364385fc612b847d66ca7886519749c.csv b/tests/data/csv/datacouch_dc8364385fc612b847d66ca7886519749c.csv new file mode 100644 index 000000000..778505418 --- /dev/null +++ b/tests/data/csv/datacouch_dc8364385fc612b847d66ca7886519749c.csv @@ -0,0 +1,39 @@ +"_id","_rev","city","cross_street","geometry","gpsID","heading","moving","stopped_for","street","time","truck" +"013013bd7417fc4eb1d70053370d698d","1-cc614ed8a795b24945508435763def31","BOSTON",,"{\"type\":\"Point\",\"coordinates\":[-71.09611556,42.33877667]}","10300B7B","382","OTHER","5350","230 FENWAY","2011-10-21T22:56:32.000Z","CheeseForceOne" +"013013bd7417fc4eb1d70053370da624","1-303e3d47832991f13115f1f8fbf7aa30","BOSTON",,"{\"type\":\"Point\",\"coordinates\":[-71.09611556,42.33877667]}","10300B7B","382","OTHER","5400","230 FENWAY","2011-10-21T22:57:23.000Z","CheeseForceOne" +"013013bd7417fc4eb1d700533725c9e7","1-aa06630c2060997cca42d5e5491cec00","BOSTON",,"{\"type\":\"Point\",\"coordinates\":[-71.11798667,42.29640194]}","10300295","382","OTHER","490","WASHINGTON ST","2011-10-21T23:01:06.000Z","Cupcakory" +"013013bd7417fc4eb1d70053372c06c4","1-e5f72c7a5a71e490319257e7bafffe3d","BOSTON",,"{\"type\":\"Point\",\"coordinates\":[-71.11798667,42.29640194]}","10300295","39","MOVING","530","WASHINGTON ST","2011-10-21T23:01:47.000Z","Cupcakory" +"013013bd7417fc4eb1d70053372c2274","1-2680de3cb56db7a8a4a603b9e49a19c6","BOSTON",,"{\"type\":\"Point\",\"coordinates\":[-71.11749917,42.29632694]}","10300295","39","MOVING CONFIRMATION",,"WASHINGTON ST","2011-10-21T23:01:48.000Z","Cupcakory" +"013013bd7417fc4eb1d700533761e1a7","1-cef095aee70aad4819490934450c3328","BOSTON","PORTER ST","{\"type\":\"Point\",\"coordinates\":[-71.10327194,42.31483667]}","10300D5F","382","OTHER","5400","BISMARCK ST","2011-10-21T23:05:56.000Z","StaffMeal" +"013013bd7417fc4eb1d700533762cf34","1-c22129144816e3dcd1190f77bbc5fe31","BOSTON","PORTER ST","{\"type\":\"Point\",\"coordinates\":[-71.1029475,42.31493028]}","10300D5F","84","MOVING CONFIRMATION",,"BISMARCK ST","2011-10-21T23:06:12.000Z","StaffMeal" +"013013bd7417fc4eb1d700533762ed4e","1-4d5403a6228c84fed13ca94fb759eed1","BOSTON","EDINBORO ST","{\"type\":\"Point\",\"coordinates\":[-71.05961167,42.35137889]}","10300B7C","382","OTHER","6430","KINGSTON ST","2011-10-21T23:05:25.000Z","BBQSmith" +"013013bd7417fc4eb1d7005337630613","1-94299d448735b989083f44cf34e98a3d","BOSTON","EDINBORO ST","{\"type\":\"Point\",\"coordinates\":[-71.05961167,42.35137889]}","10300B7C","382","OTHER","6480","KINGSTON ST","2011-10-21T23:06:15.000Z","BBQSmith" +"013013bd7417fc4eb1d7005337631d4c","1-b8b6103d2be1fd64e38b1d6f5d0e76d2","BOSTON","PORTER ST","{\"type\":\"Point\",\"coordinates\":[-71.10327194,42.31483667]}","10300D5F","84","MOVING","5410","BISMARCK ST","2011-10-21T23:06:11.000Z","StaffMeal" +"013013bd7417fc4eb1d7005337650fe7","1-ce161a29970409d24f5a02b7ccf4b615","BOSTON","ELIOT ST","{\"type\":\"Point\",\"coordinates\":[-71.11908333,42.31402278]}","10300295","54","MOVING UPDATE",,"JAMAICAWAY","2011-10-21T23:06:47.000Z","Cupcakory" +"013013bd7417fc4eb1d70053377d841a","1-e0d814cb12f221e43385c16f212fcf20","BOSTON","COLUMBUS AVE","{\"type\":\"Point\",\"coordinates\":[-71.0980425,42.31647306]}","10300D5F","382","STOP",,"W WALNUT PARK","2011-10-21T23:09:49.000Z","StaffMeal" +"013013bd7417fc4eb1d70053377db30b","1-17556dc5b906755396440419b665834d","BOSTON","COLUMBUS AVE","{\"type\":\"Point\",\"coordinates\":[-71.0980425,42.31647306]}","10300D5F","382","OTHER",,"W WALNUT PARK","2011-10-21T23:09:50.000Z","StaffMeal" +"013013bd7417fc4eb1d70053377f3ac7","1-9d1ad161d60eef01ecf1344bad7e14c1","BOSTON","COLUMBUS AVE","{\"type\":\"Point\",\"coordinates\":[-71.09804222,42.31647306]}","10300D5F","382","OTHER","10","W WALNUT PARK","2011-10-21T23:10:00.000Z","StaffMeal" +"013013bd7417fc4eb1d70053377fbf2c","1-c19c6c9e2dc5eb43d4be22144269a598","BOSTON","COLUMBUS AVE","{\"type\":\"Point\",\"coordinates\":[-71.09804222,42.31647306]}","10300D5F","382","OTHER","20","W WALNUT PARK","2011-10-21T23:10:09.000Z","StaffMeal" +"013013bd7417fc4eb1d7005337898fa8","1-7c06e21f544ab04b87c8fbe6d5938e40","BOSTON","CRAFTSON WAY","{\"type\":\"Point\",\"coordinates\":[-71.11125444,42.32992222]}","10300295","342","MOVING UPDATE",,"S HUNTINGTON AVE","2011-10-21T23:11:47.000Z","Cupcakory" +"013013bd7417fc4eb1d700533799de4a","1-e3927379e1939732bc56607a95af7b5b","BOSTON","COLUMBUS AVE","{\"type\":\"Point\",\"coordinates\":[-71.09804222,42.31647306]}","10300D5F","382","OTHER","280","W WALNUT PARK","2011-10-21T23:14:32.000Z","StaffMeal" +"013013bd7417fc4eb1d70053379b4a53","1-3bc9cbe689e9b7b6dc912ff507c9e05d","BOSTON","W WALNUT PARK","{\"type\":\"Point\",\"coordinates\":[-71.09804222,42.31647306]}","10300D5F","213","MOVING","300","COLUMBUS AVE","2011-10-21T23:14:58.000Z","StaffMeal" +"013013bd7417fc4eb1d70053379b5e34","1-c7a60abddc8ce7942f1b6420fa5868a1","BOSTON","WALNUT PARK","{\"type\":\"Point\",\"coordinates\":[-71.09785167,42.31621194]}","10300D5F","213","MOVING CONFIRMATION",,"WASHINGTON ST","2011-10-21T23:14:59.000Z","StaffMeal" +"013013bd7417fc4eb1d70053379cbf2e","1-365e1b480d6ca3e541e758ffa3e3ad11","BOSTON","ST ALBANS RD","{\"type\":\"Point\",\"coordinates\":[-71.10669694,42.3333975]}","10300295","382","STOP",,"HUNTINGTON AVE","2011-10-21T23:15:05.000Z","Cupcakory" +"013013bd7417fc4eb1d70053379cc7cf","1-87e5e6c65f7d214f222ab82a9e8089f0","BOSTON","ST ALBANS RD","{\"type\":\"Point\",\"coordinates\":[-71.10669694,42.3333975]}","10300295","382","OTHER",,"HUNTINGTON AVE","2011-10-21T23:15:06.000Z","Cupcakory" +"02e859331414cf4c7a1081a9fe44fd7c","1-da4c76998ab374a0481a0d38cd61ca01","BOSTON",,"{\"type\":\"Point\",\"coordinates\":[-71.1181225,42.29648722]}","10300B7C","382","STOP","37850","LANESVILLE TER","2011-10-23T12:44:16.000Z","BBQSmith" +"02e859331414cf4c7a1081a9fe954679","1-01e3b255f529757df01e7338f6c4fa9e","BOSTON","PAUL GORE ST","{\"type\":\"Point\",\"coordinates\":[-71.10521278,42.31762583]}","10300D5F","382","STOP","21630","DANFORTH ST","2011-10-23T13:10:19.000Z","StaffMeal" +"02e859331414cf4c7a1081a9feb822e6","1-144266972310f28e6684e24676e9d861","BOSTON",,"{\"type\":\"Point\",\"coordinates\":[-71.11804111,42.29645]}","10300B7B","382","OTHER","20910","LANESVILLE TER","2011-10-23T13:26:35.000Z","CheeseForceOne" +"02e859331414cf4c7a1081a9feb82ab9","1-d49ed0ae34db4aa289b995e71b9d796a","BOSTON",,"{\"type\":\"Point\",\"coordinates\":[-71.11804111,42.29645]}","10300B7B","382","OTHER","20860","LANESVILLE TER","2011-10-23T13:25:43.000Z","CheeseForceOne" +"02e859331414cf4c7a1081a9febd22bc","1-efa9ad2005d635fb90c03ab3d656aa4d","BOSTON",,"{\"type\":\"Point\",\"coordinates\":[-71.1181175,42.29649972]}","10300B5F","382","OTHER","27100","LANESVILLE TER","2011-10-23T13:31:52.000Z","MobileHome" +"02e859331414cf4c7a1081a9febd390f","1-d89b8b61be772c3d0f241ef2dedf5c30","BOSTON",,"{\"type\":\"Point\",\"coordinates\":[-71.1181175,42.29649972]}","10300B5F","382","OTHER","27160","LANESVILLE TER","2011-10-23T13:32:44.000Z","MobileHome" +"02e859331414cf4c7a1081a9fece0a4b","1-721a504bd3368e6f147fe2da0992d88f","BOSTON","PORTER ST","{\"type\":\"Point\",\"coordinates\":[-71.10327,42.31494694]}","10300CE1","382","OTHER","22210","BISMARCK ST","2011-10-23T13:41:51.000Z","RoxysGrilledCheese" +"02e859331414cf4c7a1081a9fece362f","1-cc8ee7a4465a9643ab405f39e1a71979","BOSTON","PORTER ST","{\"type\":\"Point\",\"coordinates\":[-71.10327,42.31494694]}","10300CE1","382","OTHER","22260","BISMARCK ST","2011-10-23T13:42:42.000Z","RoxysGrilledCheese" +"02e859331414cf4c7a1081a9fecec292","1-6611b641ab70e0c9748cda5f14bbf6e0","BOSTON",,"{\"type\":\"Point\",\"coordinates\":[-71.11803111,42.29643222]}","10301014","382","OTHER","27820","LANESVILLE TER","2011-10-23T13:43:11.000Z","10301014" +"02e859331414cf4c7a1081a9fecee8d4","1-733bcff28703a6afd8b9bb6b248436aa","BOSTON",,"{\"type\":\"Point\",\"coordinates\":[-71.11803111,42.29643222]}","10301014","382","OTHER","27870","LANESVILLE TER","2011-10-23T13:44:02.000Z","10301014" +"02e859331414cf4c7a1081a9fed0f4d9","1-37b0856455fc52f71e8062652eb93e9c","BOSTON","PORTER ST","{\"type\":\"Point\",\"coordinates\":[-71.10327,42.31494694]}","10300CE1","382","STOP","22530","BISMARCK ST","2011-10-23T13:47:09.000Z","RoxysGrilledCheese" +"0591b9ad844abb7316785a5f87a07574","1-d9d000a2e997d0b3506ec736f672c126","BOSTON","PAUL GORE ST","{\"type\":\"Point\",\"coordinates\":[-71.1051475,42.31760139]}","10300D5F","382","OTHER","11740","DANFORTH ST","2011-10-21T11:41:07.000Z","StaffMeal" +"0591b9ad844abb7316785a5f87a4ba6e","1-111484ca06567b1cfa59d3bc13565f13","BOSTON",,"{\"type\":\"Point\",\"coordinates\":[-71.11817417,42.29650278]}","10300B7B","382","OTHER","27880","LANESVILLE TER","2011-10-21T11:44:49.000Z","CheeseForceOne" +"0591b9ad844abb7316785a5f87a4d0ad","1-df94632b6a1ee63a6b4d5d356ab178fc","BOSTON",,"{\"type\":\"Point\",\"coordinates\":[-71.11817417,42.29650278]}","10300B7B","382","OTHER","27940","LANESVILLE TER","2011-10-21T11:45:40.000Z","CheeseForceOne" +"0591b9ad844abb7316785a5f87ae8917","1-8601864a7e94c403c87a4a28c03c8978","BOSTON","HIGHLAND ST","{\"type\":\"Point\",\"coordinates\":[-71.11447306,42.253]}","10300295","382","HEALTH","6330","ALBION ST","2011-10-21T11:55:01.000Z","Cupcakory" +"0591b9ad844abb7316785a5f87aea259","1-b17b9ccbcad8a02c20f73ed070521fb4","BOSTON","HIGHLAND ST","{\"type\":\"Point\",\"coordinates\":[-71.11447306,42.253]}","10300295","382","HEALTH","6330","ALBION ST","2011-10-21T11:55:00.000Z","Cupcakory" +"0591b9ad844abb7316785a5f87b4daac","1-2dad5fa38c0332cf0b80e6ee784e9e98","BOSTON",,"{\"type\":\"Point\",\"coordinates\":[-71.11822694,42.29641556]}","10300B5F","382","OTHER","34950","LANESVILLE TER","2011-10-21T12:01:48.000Z","MobileHome" \ No newline at end of file diff --git a/tests/data/good_maps/interior_point.xml b/tests/data/good_maps/interior_point.xml index 332a1fa03..98613e023 100644 --- a/tests/data/good_maps/interior_point.xml +++ b/tests/data/good_maps/interior_point.xml @@ -25,7 +25,6 @@ sqlite ../sqlite/qgis_spatiallite.sqlite multipolygon - spatialite \ No newline at end of file diff --git a/tests/data/good_maps/line_symbolizer2.xml b/tests/data/good_maps/line_symbolizer2.xml index 5de4241bf..1f0430aa5 100644 --- a/tests/data/good_maps/line_symbolizer2.xml +++ b/tests/data/good_maps/line_symbolizer2.xml @@ -3,7 +3,6 @@ sqlite ../sqlite/qgis_spatiallite.sqlite - spatialite true diff --git a/tests/data/good_maps/markers_symbolizer_lines.xml b/tests/data/good_maps/markers_symbolizer_lines.xml index 8eece458c..d3adaefb6 100644 --- a/tests/data/good_maps/markers_symbolizer_lines.xml +++ b/tests/data/good_maps/markers_symbolizer_lines.xml @@ -13,7 +13,6 @@ sqlite ../sqlite/qgis_spatiallite.sqlite lines - spatialite diff --git a/tests/data/good_maps/markers_symbolizer_points.xml b/tests/data/good_maps/markers_symbolizer_points.xml index 75a13db1f..14c53a285 100644 --- a/tests/data/good_maps/markers_symbolizer_points.xml +++ b/tests/data/good_maps/markers_symbolizer_points.xml @@ -37,7 +37,6 @@ sqlite ../sqlite/qgis_spatiallite.sqlite point - spatialite