2006-03-31 10:32:02 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
*
|
|
|
|
* This file is part of Mapnik (c++ mapping toolkit)
|
2006-01-31 23:09:52 +00:00
|
|
|
*
|
2006-03-31 10:32:02 +00:00
|
|
|
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
|
2006-01-31 23:09:52 +00:00
|
|
|
*
|
2006-03-31 10:32:02 +00:00
|
|
|
* 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,
|
2006-01-31 23:09:52 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2006-03-31 10:32:02 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2006-01-31 23:09:52 +00:00
|
|
|
*
|
2006-03-31 10:32:02 +00:00
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
2006-01-31 23:09:52 +00:00
|
|
|
//$Id: mapnik_layer.cc 17 2005-03-08 23:58:43Z pavlenko $
|
|
|
|
|
|
|
|
|
|
|
|
#include <boost/python.hpp>
|
|
|
|
#include <boost/python/detail/api_placeholder.hpp>
|
|
|
|
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
|
2006-10-04 11:22:18 +00:00
|
|
|
#include <mapnik/layer.hpp>
|
2006-01-31 23:09:52 +00:00
|
|
|
|
|
|
|
using mapnik::Layer;
|
|
|
|
using mapnik::parameters;
|
|
|
|
|
2006-12-20 00:22:45 +00:00
|
|
|
std::vector<std::string> & (mapnik::Layer::*_styles_)() = &mapnik::Layer::styles;
|
|
|
|
|
2006-01-31 23:09:52 +00:00
|
|
|
void export_layer()
|
|
|
|
{
|
|
|
|
using namespace boost::python;
|
2007-11-08 11:06:05 +00:00
|
|
|
class_<std::vector<std::string> >("Names")
|
2006-01-31 23:09:52 +00:00
|
|
|
.def(vector_indexing_suite<std::vector<std::string>,true >())
|
|
|
|
;
|
2006-02-25 11:03:30 +00:00
|
|
|
|
2006-10-16 13:44:52 +00:00
|
|
|
class_<Layer>("Layer", "A map layer.", init<std::string const&,optional<std::string const&> >())
|
2006-10-03 08:44:04 +00:00
|
|
|
.add_property("name",
|
2006-10-16 13:44:52 +00:00
|
|
|
make_function(&Layer::name, return_value_policy<copy_const_reference>()),
|
2006-10-03 08:44:04 +00:00
|
|
|
&Layer::set_name,
|
|
|
|
"Get/Set the name of the layer.")
|
|
|
|
|
|
|
|
.add_property("title",
|
2006-10-16 13:44:52 +00:00
|
|
|
make_function(&Layer::title, return_value_policy<copy_const_reference>()),
|
2006-10-03 08:44:04 +00:00
|
|
|
&Layer::set_title,
|
|
|
|
"Get/Set the title of the layer.")
|
|
|
|
|
|
|
|
.add_property("abstract",
|
2006-10-16 13:44:52 +00:00
|
|
|
make_function(&Layer::abstract,return_value_policy<copy_const_reference>()),
|
2006-10-03 08:44:04 +00:00
|
|
|
&Layer::set_abstract,
|
|
|
|
"Get/Set the abstract of the layer.")
|
|
|
|
|
2006-10-18 23:57:44 +00:00
|
|
|
.add_property("srs",
|
2006-10-16 13:44:52 +00:00
|
|
|
make_function(&Layer::srs,return_value_policy<copy_const_reference>()),
|
|
|
|
&Layer::set_srs,
|
|
|
|
"Get/Set the SRS of the layer.")
|
|
|
|
|
2006-10-03 08:44:04 +00:00
|
|
|
.add_property("minzoom",
|
|
|
|
&Layer::getMinZoom,
|
|
|
|
&Layer::setMinZoom)
|
|
|
|
|
|
|
|
.add_property("maxzoom",
|
|
|
|
&Layer::getMaxZoom,
|
|
|
|
&Layer::setMaxZoom)
|
|
|
|
|
|
|
|
.add_property("styles",
|
2006-12-20 00:22:45 +00:00
|
|
|
make_function(_styles_,
|
2006-10-03 08:44:04 +00:00
|
|
|
return_value_policy<reference_existing_object>()))
|
|
|
|
|
|
|
|
.add_property("datasource",
|
|
|
|
&Layer::datasource,
|
|
|
|
&Layer::set_datasource,
|
|
|
|
"The datasource attached to this layer")
|
2006-12-17 12:08:11 +00:00
|
|
|
|
|
|
|
.add_property("active",
|
|
|
|
&Layer::isActive,
|
|
|
|
&Layer::setActive)
|
2007-01-09 11:23:19 +00:00
|
|
|
.add_property("queryable",
|
|
|
|
&Layer::isQueryable,
|
|
|
|
&Layer::setQueryable)
|
2007-05-01 07:53:20 +00:00
|
|
|
.def("visible", &Layer::isVisible)
|
|
|
|
.add_property("clear_label_cache",
|
|
|
|
&Layer::clear_label_cache,
|
|
|
|
&Layer::set_clear_label_cache)
|
|
|
|
|
|
|
|
.def("envelope",&Layer::envelope,
|
|
|
|
"Return the geographic envelope/bounding box "
|
|
|
|
"of the data in the layer.")
|
2006-01-31 23:09:52 +00:00
|
|
|
;
|
|
|
|
}
|