/usr/include/mapnik/feature.hpp is in libmapnik2-dev 2.0.0+ds1-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | /*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 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
*
*****************************************************************************/
//$Id: feature.hpp 40 2005-04-13 20:20:46Z pavlenko $
#ifndef FEATURE_HPP
#define FEATURE_HPP
// mapnik
#include <mapnik/value.hpp>
#include <mapnik/geometry.hpp>
#include <mapnik/raster.hpp>
// boost
#include <boost/version.hpp>
#if BOOST_VERSION >= 104000
#include <boost/property_map/property_map.hpp>
#else
#include <boost/property_map.hpp>
#endif
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
// stl
#include <map>
namespace mapnik {
typedef boost::shared_ptr<raster> raster_ptr;
typedef boost::associative_property_map<
std::map<std::string,value
> > properties;
template <typename T1,typename T2>
struct feature : public properties,
private boost::noncopyable
{
public:
typedef T1 geometry_type;
typedef T2 raster_type;
typedef std::map<std::string,value>::value_type value_type;
typedef std::map<std::string,value>::size_type size_type;
typedef std::map<std::string,value>::difference_type difference_type;
private:
int id_;
boost::ptr_vector<geometry_type> geom_cont_;
raster_type raster_;
std::map<std::string,value> props_;
public:
typedef std::map<std::string,value>::iterator iterator;
explicit feature(int id)
: properties(props_),
id_(id),
geom_cont_(),
raster_() {}
int id() const
{
return id_;
}
void set_id(int id)
{
id_ = id;
}
boost::ptr_vector<geometry_type> & paths()
{
return geom_cont_;
}
void add_geometry(geometry_type * geom)
{
geom_cont_.push_back(geom);
}
unsigned num_geometries() const
{
return geom_cont_.size();
}
geometry_type const& get_geometry(unsigned index) const
{
return geom_cont_[index];
}
geometry_type& get_geometry(unsigned index)
{
return geom_cont_[index];
}
box2d<double> envelope() const
{
box2d<double> result;
for (unsigned i=0;i<num_geometries();++i)
{
geometry_type const& geom = get_geometry(i);
if (i==0)
{
box2d<double> box = geom.envelope();
result.init(box.minx(),box.miny(),box.maxx(),box.maxy());
}
else
{
result.expand_to_include(geom.envelope());
}
}
return result;
}
const raster_type& get_raster() const
{
return raster_;
}
void set_raster(raster_type const& raster)
{
raster_=raster;
}
std::map<std::string,value> const& props() const
{
return props_;
}
std::map<std::string,value>& props()
{
return props_;
}
iterator begin()
{
return props_.begin();
}
iterator end()
{
return props_.end();
}
std::string to_string() const
{
std::stringstream ss;
ss << "feature (" << std::endl;
ss << " id:" << id_ << std::endl;
for (std::map<std::string,value>::const_iterator itr=props_.begin();
itr != props_.end();++itr)
{
ss << " " << itr->first << ":" << itr->second << std::endl;
}
ss << ")" << std::endl;
return ss.str();
}
};
typedef feature<geometry_type,raster_ptr> Feature;
inline std::ostream& operator<< (std::ostream & out,Feature const& f)
{
out << f.to_string();
return out;
}
}
#endif //FEATURE_HPP
|