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
|
2006-10-03 10:44:04 +02:00
|
|
|
* 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"
|
2005-12-12 14:15:33 +01:00
|
|
|
#include <boost/shared_ptr.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
|
|
|
{
|
2006-05-19 10:59:50 +02:00
|
|
|
std::string name_;
|
2006-05-22 19:00:35 +02:00
|
|
|
std::string title_;
|
|
|
|
std::string abstract_;
|
2006-05-19 10:59:50 +02:00
|
|
|
double minZoom_;
|
|
|
|
double maxZoom_;
|
|
|
|
bool active_;
|
|
|
|
bool selectable_;
|
2006-10-03 10:44:04 +02:00
|
|
|
|
2006-05-19 10:59:50 +02:00
|
|
|
std::vector<std::string> styles_;
|
|
|
|
std::string selection_style_;
|
2006-10-03 10:44:04 +02:00
|
|
|
|
2006-05-19 10:59:50 +02:00
|
|
|
mutable std::vector<boost::shared_ptr<Feature> > selection_;
|
2006-05-19 14:50:40 +02:00
|
|
|
mutable datasource_p ds_;
|
2005-12-14 18:01:09 +01:00
|
|
|
|
2005-06-14 17:06:59 +02:00
|
|
|
public:
|
2006-10-03 10:44:04 +02:00
|
|
|
explicit Layer(std::string const& name);
|
2006-05-19 10:59:50 +02:00
|
|
|
Layer(Layer const& l);
|
|
|
|
Layer& operator=(Layer const& l);
|
|
|
|
bool operator==(Layer const& other) const;
|
|
|
|
void set_name(std::string const& name);
|
|
|
|
const std::string& name() const;
|
2006-05-22 19:00:35 +02:00
|
|
|
void set_title(std::string const& title);
|
|
|
|
const std::string& title() const;
|
|
|
|
void set_abstract(std::string const& abstract);
|
|
|
|
const std::string& abstract() const;
|
2006-05-19 10:59:50 +02:00
|
|
|
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;
|
|
|
|
void clear_selection() const;
|
|
|
|
void set_datasource(datasource_p const& ds);
|
2006-10-03 10:44:04 +02:00
|
|
|
datasource_p datasource() const;
|
2006-05-19 10:59:50 +02:00
|
|
|
Envelope<double> envelope() const;
|
2006-10-03 10:44:04 +02:00
|
|
|
~Layer();
|
2005-06-14 17:06:59 +02:00
|
|
|
private:
|
2006-05-19 10:59:50 +02:00
|
|
|
void swap(const Layer& other);
|
2005-06-14 17:06:59 +02:00
|
|
|
};
|
|
|
|
}
|
2005-12-14 18:01:09 +01:00
|
|
|
|
2005-12-12 14:15:33 +01:00
|
|
|
#endif //LAYER_HPP
|