mapnik/include/layer.hpp

101 lines
3.4 KiB
C++
Raw Normal View History

2006-03-31 12:32:02 +02:00
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
2005-06-14 17:06:59 +02:00
*
2006-03-31 12:32:02 +02:00
* Copyright (C) 2006 Artem Pavlenko
2005-06-14 17:06:59 +02:00
*
2006-03-31 12:32:02 +02: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,
2005-06-14 17:06:59 +02:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
2006-03-31 12:32:02 +02:00
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
2005-06-14 17:06:59 +02:00
*
2006-03-31 12:32:02 +02: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
*
*****************************************************************************/
2005-06-14 17:06:59 +02:00
//$Id: layer.hpp 39 2005-04-10 20:39:53Z pavlenko $
#ifndef LAYER_HPP
#define LAYER_HPP
#include <vector>
#include "feature.hpp"
#include "datasource.hpp"
#include <boost/shared_ptr.hpp>
#include <boost/serialization/serialization.hpp>
2005-06-14 17:06:59 +02:00
namespace mapnik
{
2006-03-22 16:52:29 +01:00
class MAPNIK_DECL Layer
2005-06-14 17:06:59 +02:00
{
friend class boost::serialization::access;
template <typename Archive>
void serialize(Archive & ar, const unsigned int /*version*/)
{
ar & boost::serialization::make_nvp("name",name_)
& boost::serialization::make_nvp("params",params_)
& boost::serialization::make_nvp("min_zoom",minZoom_)
& boost::serialization::make_nvp("max_zoom",maxZoom_)
& boost::serialization::make_nvp("active",active_)
& boost::serialization::make_nvp("selectable",selectable_)
& boost::serialization::make_nvp("styles",styles_)
;
}
parameters params_;
2005-06-14 17:06:59 +02:00
std::string name_;
double minZoom_;
double maxZoom_;
bool active_;
bool selectable_;
mutable datasource_p ds_;
std::vector<std::string> styles_;
std::string selection_style_;
mutable std::vector<boost::shared_ptr<Feature> > selection_;
2005-06-14 17:06:59 +02:00
public:
Layer();
explicit Layer(const parameters& params);
Layer(Layer const& l);
Layer& operator=(Layer const& l);
bool operator==(Layer const& other) const;
parameters const& params() const;
2005-06-14 17:06:59 +02:00
const std::string& name() const;
void add_style(std::string const& stylename);
std::vector<std::string> const& styles() const;
void selection_style(const std::string& name);
const std::string& selection_style() const;
void setMinZoom(double minZoom);
void setMaxZoom(double maxZoom);
double getMinZoom() const;
double getMaxZoom() const;
void setActive(bool active);
bool isActive() const;
void setSelectable(bool selectable);
bool isSelectable() const;
bool isVisible(double scale) const;
void add_to_selection(boost::shared_ptr<Feature>& feature) const;
std::vector<boost::shared_ptr<Feature> >& selection() const;
2005-06-14 17:06:59 +02:00
void clear_selection() const;
void set_datasource(datasource_p const& ds);
2005-11-24 16:51:29 +01:00
datasource_p const& datasource() const;
2005-12-01 11:06:40 +01:00
Envelope<double> envelope() const;
2005-06-14 17:06:59 +02:00
virtual ~Layer();
private:
void swap(const Layer& other);
};
}
BOOST_CLASS_IMPLEMENTATION(std::vector<std::string>, boost::serialization::object_serializable)
BOOST_CLASS_TRACKING(std::vector<std::string>, boost::serialization::track_never)
BOOST_CLASS_IMPLEMENTATION(mapnik::Layer, boost::serialization::object_serializable)
BOOST_CLASS_TRACKING(mapnik::Layer, boost::serialization::track_never)
#endif //LAYER_HPP