whitespace fixes
This commit is contained in:
parent
21d05444f7
commit
1cafc03a46
6 changed files with 701 additions and 701 deletions
|
@ -56,7 +56,7 @@ public:
|
|||
typedef std::map<value_type, lookup_type> feature_key_type;
|
||||
typedef std::map<lookup_type, value_type> key_type;
|
||||
typedef std::map<std::string, mapnik::feature_ptr> feature_type;
|
||||
|
||||
|
||||
private:
|
||||
unsigned width_;
|
||||
unsigned height_;
|
||||
|
@ -68,36 +68,36 @@ private:
|
|||
unsigned int resolution_;
|
||||
std::string id_name_;
|
||||
bool painted_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
hit_grid(int width, int height, std::string const& key, unsigned int resolution)
|
||||
:width_(width),
|
||||
height_(height),
|
||||
key_(key),
|
||||
data_(width,height),
|
||||
resolution_(resolution),
|
||||
id_name_("__id__"),
|
||||
painted_(false)
|
||||
{
|
||||
// this only works if each datasource's
|
||||
// feature count starts at 1
|
||||
f_keys_[0] = "";
|
||||
}
|
||||
|
||||
height_(height),
|
||||
key_(key),
|
||||
data_(width,height),
|
||||
resolution_(resolution),
|
||||
id_name_("__id__"),
|
||||
painted_(false)
|
||||
{
|
||||
// this only works if each datasource's
|
||||
// feature count starts at 1
|
||||
f_keys_[0] = "";
|
||||
}
|
||||
|
||||
hit_grid(const hit_grid<T>& rhs)
|
||||
:width_(rhs.width_),
|
||||
height_(rhs.height_),
|
||||
key_(rhs.key_),
|
||||
data_(rhs.data_),
|
||||
resolution_(rhs.resolution_),
|
||||
id_name_("__id__"),
|
||||
painted_(rhs.painted_)
|
||||
{
|
||||
f_keys_[0] = "";
|
||||
}
|
||||
|
||||
height_(rhs.height_),
|
||||
key_(rhs.key_),
|
||||
data_(rhs.data_),
|
||||
resolution_(rhs.resolution_),
|
||||
id_name_("__id__"),
|
||||
painted_(rhs.painted_)
|
||||
{
|
||||
f_keys_[0] = "";
|
||||
}
|
||||
|
||||
~hit_grid() {}
|
||||
|
||||
inline void painted(bool painted)
|
||||
|
@ -117,7 +117,7 @@ public:
|
|||
|
||||
inline void add_feature(mapnik::feature_ptr const& feature)
|
||||
{
|
||||
|
||||
|
||||
// NOTE: currently lookup keys must be strings,
|
||||
// but this should be revisited
|
||||
boost::optional<lookup_type> lookup_value;
|
||||
|
@ -136,7 +136,7 @@ public:
|
|||
else
|
||||
{
|
||||
std::clog << "should not get here: key '" << key_ << "' not found in feature properties\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lookup_value)
|
||||
|
@ -154,12 +154,12 @@ public:
|
|||
{
|
||||
std::clog << "### Warning: key '" << key_ << "' was blank for " << *feature << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inline void add_property_name(std::string const& name)
|
||||
{
|
||||
names_.insert(name);
|
||||
}
|
||||
}
|
||||
|
||||
inline std::set<std::string> const& property_names() const
|
||||
{
|
||||
|
@ -205,12 +205,12 @@ public:
|
|||
{
|
||||
resolution_ = res;
|
||||
}
|
||||
|
||||
|
||||
inline const data_type& data() const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
|
||||
inline data_type& data()
|
||||
{
|
||||
return data_;
|
||||
|
@ -230,11 +230,11 @@ public:
|
|||
{
|
||||
return data_.getRow(row);
|
||||
}
|
||||
|
||||
|
||||
inline mapnik::grid_view get_view(unsigned x, unsigned y, unsigned w, unsigned h)
|
||||
{
|
||||
return mapnik::grid_view(x,y,w,h,
|
||||
data_,key_,id_name_,resolution_,names_,f_keys_,features_);
|
||||
data_,key_,id_name_,resolution_,names_,f_keys_,features_);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -245,7 +245,7 @@ private:
|
|||
}
|
||||
|
||||
hit_grid& operator=(const hit_grid&);
|
||||
|
||||
|
||||
public:
|
||||
inline void setPixel(int x,int y,value_type feature_id)
|
||||
{
|
||||
|
@ -278,7 +278,7 @@ public:
|
|||
unsigned a = (int)((rgba1 & 0xff) * opacity) & 0xff; // adjust for desired opacity
|
||||
#else
|
||||
unsigned a = (int)(((rgba1 >> 24) & 0xff) * opacity) & 0xff; // adjust for desired opacity
|
||||
#endif
|
||||
#endif
|
||||
// if the pixel is more than a tenth
|
||||
// opaque then burn in the feature id
|
||||
if (a >= 25)
|
||||
|
@ -287,7 +287,7 @@ public:
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void set_rectangle(value_type id,image_data_32 const& data,int x0,int y0)
|
||||
{
|
||||
box2d<int> ext0(0,0,width_,height_);
|
||||
|
@ -308,7 +308,7 @@ public:
|
|||
unsigned a = rgba & 0xff;
|
||||
#else
|
||||
unsigned a = (rgba >> 24) & 0xff;
|
||||
#endif
|
||||
#endif
|
||||
// if the pixel is more than a tenth
|
||||
// opaque then burn in the feature id
|
||||
if (a >= 25)
|
||||
|
|
|
@ -28,142 +28,142 @@
|
|||
namespace mapnik
|
||||
{
|
||||
|
||||
//==================================================================gray16
|
||||
struct gray16
|
||||
//==================================================================gray16
|
||||
struct gray16
|
||||
{
|
||||
typedef agg::int16u value_type;
|
||||
typedef agg::int32u calc_type;
|
||||
typedef agg::int64 long_type;
|
||||
enum base_scale_e
|
||||
{
|
||||
typedef agg::int16u value_type;
|
||||
typedef agg::int32u calc_type;
|
||||
typedef agg::int64 long_type;
|
||||
enum base_scale_e
|
||||
base_shift = 16,
|
||||
base_scale = 1 << base_shift,
|
||||
base_mask = base_scale - 1
|
||||
};
|
||||
typedef gray16 self_type;
|
||||
|
||||
value_type v;
|
||||
value_type a;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gray16() {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gray16(unsigned v_, unsigned a_=base_mask) :
|
||||
v(agg::int16u(v_)), a(agg::int16u(a_)) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gray16(const self_type& c, unsigned a_) :
|
||||
v(c.v), a(value_type(a_)) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void clear()
|
||||
{
|
||||
v = a = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const self_type& transparent()
|
||||
{
|
||||
a = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void opacity(double a_)
|
||||
{
|
||||
if(a_ < 0.0) a_ = 0.0;
|
||||
if(a_ > 1.0) a_ = 1.0;
|
||||
a = (value_type)agg::uround(a_ * double(base_mask));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
double opacity() const
|
||||
{
|
||||
return double(a) / double(base_mask);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const self_type& premultiply()
|
||||
{
|
||||
if(a == base_mask) return *this;
|
||||
if(a == 0)
|
||||
{
|
||||
base_shift = 16,
|
||||
base_scale = 1 << base_shift,
|
||||
base_mask = base_scale - 1
|
||||
};
|
||||
typedef gray16 self_type;
|
||||
v = 0;
|
||||
return *this;
|
||||
}
|
||||
v = value_type((calc_type(v) * a) >> base_shift);
|
||||
return *this;
|
||||
}
|
||||
|
||||
value_type v;
|
||||
value_type a;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gray16() {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gray16(unsigned v_, unsigned a_=base_mask) :
|
||||
v(agg::int16u(v_)), a(agg::int16u(a_)) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
gray16(const self_type& c, unsigned a_) :
|
||||
v(c.v), a(value_type(a_)) {}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void clear()
|
||||
//--------------------------------------------------------------------
|
||||
const self_type& premultiply(unsigned a_)
|
||||
{
|
||||
if(a == base_mask && a_ >= base_mask) return *this;
|
||||
if(a == 0 || a_ == 0)
|
||||
{
|
||||
v = a = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const self_type& transparent()
|
||||
{
|
||||
a = 0;
|
||||
return *this;
|
||||
}
|
||||
calc_type v_ = (calc_type(v) * a_) / a;
|
||||
v = value_type((v_ > a_) ? a_ : v_);
|
||||
a = value_type(a_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void opacity(double a_)
|
||||
//--------------------------------------------------------------------
|
||||
const self_type& demultiply()
|
||||
{
|
||||
if(a == base_mask) return *this;
|
||||
if(a == 0)
|
||||
{
|
||||
if(a_ < 0.0) a_ = 0.0;
|
||||
if(a_ > 1.0) a_ = 1.0;
|
||||
a = (value_type)agg::uround(a_ * double(base_mask));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
double opacity() const
|
||||
{
|
||||
return double(a) / double(base_mask);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const self_type& premultiply()
|
||||
{
|
||||
if(a == base_mask) return *this;
|
||||
if(a == 0)
|
||||
{
|
||||
v = 0;
|
||||
return *this;
|
||||
}
|
||||
v = value_type((calc_type(v) * a) >> base_shift);
|
||||
v = 0;
|
||||
return *this;
|
||||
}
|
||||
calc_type v_ = (calc_type(v) * base_mask) / a;
|
||||
v = value_type((v_ > base_mask) ? base_mask : v_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const self_type& premultiply(unsigned a_)
|
||||
//--------------------------------------------------------------------
|
||||
self_type gradient(self_type c, double k) const
|
||||
{
|
||||
self_type ret;
|
||||
calc_type ik = agg::uround(k * base_scale);
|
||||
ret.v = value_type(calc_type(v) + (((calc_type(c.v) - v) * ik) >> base_shift));
|
||||
ret.a = value_type(calc_type(a) + (((calc_type(c.a) - a) * ik) >> base_shift));
|
||||
return ret;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
AGG_INLINE void add(const self_type& c, unsigned cover)
|
||||
{
|
||||
calc_type cv, ca;
|
||||
if(cover == agg::cover_mask)
|
||||
{
|
||||
if(a == base_mask && a_ >= base_mask) return *this;
|
||||
if(a == 0 || a_ == 0)
|
||||
if(c.a == base_mask)
|
||||
{
|
||||
v = a = 0;
|
||||
return *this;
|
||||
}
|
||||
calc_type v_ = (calc_type(v) * a_) / a;
|
||||
v = value_type((v_ > a_) ? a_ : v_);
|
||||
a = value_type(a_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
const self_type& demultiply()
|
||||
{
|
||||
if(a == base_mask) return *this;
|
||||
if(a == 0)
|
||||
{
|
||||
v = 0;
|
||||
return *this;
|
||||
}
|
||||
calc_type v_ = (calc_type(v) * base_mask) / a;
|
||||
v = value_type((v_ > base_mask) ? base_mask : v_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
self_type gradient(self_type c, double k) const
|
||||
{
|
||||
self_type ret;
|
||||
calc_type ik = agg::uround(k * base_scale);
|
||||
ret.v = value_type(calc_type(v) + (((calc_type(c.v) - v) * ik) >> base_shift));
|
||||
ret.a = value_type(calc_type(a) + (((calc_type(c.a) - a) * ik) >> base_shift));
|
||||
return ret;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
AGG_INLINE void add(const self_type& c, unsigned cover)
|
||||
{
|
||||
calc_type cv, ca;
|
||||
if(cover == agg::cover_mask)
|
||||
{
|
||||
if(c.a == base_mask)
|
||||
{
|
||||
*this = c;
|
||||
}
|
||||
else
|
||||
{
|
||||
cv = v + c.v; v = (cv > calc_type(base_mask)) ? calc_type(base_mask) : cv;
|
||||
ca = a + c.a; a = (ca > calc_type(base_mask)) ? calc_type(base_mask) : ca;
|
||||
}
|
||||
*this = c;
|
||||
}
|
||||
else
|
||||
{
|
||||
cv = v + ((c.v * cover + agg::cover_mask/2) >> agg::cover_shift);
|
||||
ca = a + ((c.a * cover + agg::cover_mask/2) >> agg::cover_shift);
|
||||
v = (cv > calc_type(base_mask)) ? calc_type(base_mask) : cv;
|
||||
a = (ca > calc_type(base_mask)) ? calc_type(base_mask) : ca;
|
||||
cv = v + c.v; v = (cv > calc_type(base_mask)) ? calc_type(base_mask) : cv;
|
||||
ca = a + c.a; a = (ca > calc_type(base_mask)) ? calc_type(base_mask) : ca;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cv = v + ((c.v * cover + agg::cover_mask/2) >> agg::cover_shift);
|
||||
ca = a + ((c.a * cover + agg::cover_mask/2) >> agg::cover_shift);
|
||||
v = (cv > calc_type(base_mask)) ? calc_type(base_mask) : cv;
|
||||
a = (ca > calc_type(base_mask)) ? calc_type(base_mask) : ca;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static self_type no_color() { return self_type(0,0); }
|
||||
};
|
||||
//--------------------------------------------------------------------
|
||||
static self_type no_color() { return self_type(0,0); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
|
@ -45,20 +45,20 @@
|
|||
// apps using mapnik do not
|
||||
// need agg headers
|
||||
namespace agg {
|
||||
struct trans_affine;
|
||||
struct trans_affine;
|
||||
}
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
class marker;
|
||||
|
||||
|
||||
struct grid_rasterizer;
|
||||
|
||||
|
||||
template <typename T>
|
||||
class MAPNIK_DECL grid_renderer : public feature_style_processor<grid_renderer<T> >,
|
||||
private boost::noncopyable
|
||||
{
|
||||
|
||||
|
||||
public:
|
||||
grid_renderer(Map const& m, T & pixmap, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0);
|
||||
~grid_renderer();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
|
@ -33,8 +33,8 @@ namespace mapnik {
|
|||
*/
|
||||
|
||||
static inline void scale_grid(mapnik::grid::data_type & target,
|
||||
const mapnik::grid::data_type & source,
|
||||
double x_off_f, double y_off_f)
|
||||
const mapnik::grid::data_type & source,
|
||||
double x_off_f, double y_off_f)
|
||||
{
|
||||
|
||||
int source_width=source.width();
|
||||
|
@ -93,7 +93,7 @@ static inline void scale_grid(mapnik::grid::data_type & target,
|
|||
mapnik::grid::value_type b = source(xs1,ys);
|
||||
mapnik::grid::value_type c = source(xs,ys1);
|
||||
mapnik::grid::value_type d = source(xs1,ys1);
|
||||
|
||||
|
||||
if ((a > 0) && (b > 0))
|
||||
target(x,y) = b;
|
||||
else if ((c > 0) && (d > 0))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2011 Artem Pavlenko
|
||||
|
@ -44,7 +44,7 @@
|
|||
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
|
||||
template <typename T>
|
||||
class hit_grid_view
|
||||
{
|
||||
|
@ -56,17 +56,17 @@ public:
|
|||
typedef std::map<value_type, lookup_type> feature_key_type;
|
||||
typedef std::map<lookup_type, value_type> key_type;
|
||||
typedef std::map<std::string, mapnik::feature_ptr> feature_type;
|
||||
|
||||
hit_grid_view(unsigned x, unsigned y,
|
||||
unsigned width, unsigned height,
|
||||
T const& data,
|
||||
std::string const& key,
|
||||
std::string const& id_name,
|
||||
unsigned resolution,
|
||||
std::set<std::string> const& names,
|
||||
feature_key_type const& f_keys,
|
||||
feature_type const& features
|
||||
)
|
||||
|
||||
hit_grid_view(unsigned x, unsigned y,
|
||||
unsigned width, unsigned height,
|
||||
T const& data,
|
||||
std::string const& key,
|
||||
std::string const& id_name,
|
||||
unsigned resolution,
|
||||
std::set<std::string> const& names,
|
||||
feature_key_type const& f_keys,
|
||||
feature_type const& features
|
||||
)
|
||||
: x_(x),
|
||||
y_(y),
|
||||
width_(width),
|
||||
|
@ -78,16 +78,16 @@ public:
|
|||
names_(names),
|
||||
f_keys_(f_keys),
|
||||
features_(features)
|
||||
|
||||
|
||||
{
|
||||
if (x_ >= data_.width()) x_=data_.width()-1;
|
||||
if (y_ >= data_.height()) x_=data_.height()-1;
|
||||
if (x_ + width_ > data_.width()) width_= data_.width() - x_;
|
||||
if (y_ + height_ > data_.height()) height_= data_.height() - y_;
|
||||
}
|
||||
|
||||
|
||||
~hit_grid_view() {}
|
||||
|
||||
|
||||
hit_grid_view(hit_grid_view<T> const& rhs)
|
||||
: x_(rhs.x_),
|
||||
y_(rhs.y_),
|
||||
|
@ -100,8 +100,8 @@ public:
|
|||
names_(rhs.names_),
|
||||
f_keys_(rhs.f_keys_),
|
||||
features_(rhs.features_)
|
||||
{}
|
||||
|
||||
{}
|
||||
|
||||
hit_grid_view<T> & operator=(hit_grid_view<T> const& rhs)
|
||||
{
|
||||
if (&rhs==this) return *this;
|
||||
|
@ -117,7 +117,7 @@ public:
|
|||
f_keys_ = rhs.f_keys_;
|
||||
features_ = rhs.features_;
|
||||
}
|
||||
|
||||
|
||||
inline unsigned x() const
|
||||
{
|
||||
return x_;
|
||||
|
@ -127,7 +127,7 @@ public:
|
|||
{
|
||||
return y_;
|
||||
}
|
||||
|
||||
|
||||
inline unsigned width() const
|
||||
{
|
||||
return width_;
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
{
|
||||
return id_name_;
|
||||
}
|
||||
|
||||
|
||||
inline const value_type* getRow(unsigned row) const
|
||||
{
|
||||
return data_.getRow(row + y_) + x_;
|
||||
|
|
Loading…
Reference in a new issue