/usr/include/mapnik/marker.hpp is in libmapnik-dev 2.2.0+ds1-6build2.
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 | /*****************************************************************************
*
* 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_MARKER_HPP
#define MAPNIK_MARKER_HPP
// mapnik
#include <mapnik/global.hpp>
#include <mapnik/image_data.hpp>
#include <mapnik/svg/svg_path_attributes.hpp>
#include <mapnik/svg/svg_storage.hpp>
#include <mapnik/svg/svg_path_adapter.hpp>
#include <mapnik/noncopyable.hpp>
// agg
#include "agg_path_storage.h"
// boost
#include <boost/unordered_map.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
#include <boost/make_shared.hpp>
// stl
#include <cassert>
#include <cstring>
namespace mapnik
{
typedef agg::pod_bvector<mapnik::svg::path_attributes> attr_storage;
typedef mapnik::svg::svg_storage<mapnik::svg::svg_path_storage,attr_storage> svg_storage_type;
typedef boost::shared_ptr<svg_storage_type> svg_path_ptr;
typedef boost::shared_ptr<image_data_32> image_ptr;
/**
* A class to hold either vector or bitmap marker data. This allows these to be treated equally
* in the image caches and most of the render paths.
*/
class marker: private mapnik::noncopyable
{
public:
marker()
{
// create default OGC 4x4 black pixel
bitmap_data_ = boost::optional<mapnik::image_ptr>(boost::make_shared<image_data_32>(4,4));
(*bitmap_data_)->set(0xff000000);
}
marker(boost::optional<mapnik::image_ptr> const& data)
: bitmap_data_(data)
{
}
marker(boost::optional<mapnik::svg_path_ptr> const& data)
: vector_data_(data)
{
}
marker(marker const& rhs)
: bitmap_data_(rhs.bitmap_data_),
vector_data_(rhs.vector_data_)
{}
box2d<double> bounding_box() const
{
if (is_vector())
{
return (*vector_data_)->bounding_box();
}
if (is_bitmap())
{
double width = (*bitmap_data_)->width();
double height = (*bitmap_data_)->height();
return box2d<double>(0, 0, width, height);
}
return box2d<double>();
}
inline double width() const
{
if (is_bitmap())
{
return (*bitmap_data_)->width();
}
else if (is_vector())
{
return (*vector_data_)->bounding_box().width();
}
return 0;
}
inline double height() const
{
if (is_bitmap())
{
return (*bitmap_data_)->height();
}
else if (is_vector())
{
return (*vector_data_)->bounding_box().height();
}
return 0;
}
inline bool is_bitmap() const
{
return bitmap_data_;
}
inline bool is_vector() const
{
return vector_data_;
}
boost::optional<mapnik::image_ptr> get_bitmap_data() const
{
return bitmap_data_;
}
boost::optional<mapnik::svg_path_ptr> get_vector_data() const
{
return vector_data_;
}
private:
boost::optional<mapnik::image_ptr> bitmap_data_;
boost::optional<mapnik::svg_path_ptr> vector_data_;
};
}
#endif // MAPNIK_MARKER_HPP
|