- fix indentation and trailing spaces (generally coding style) in rasterlite plugin partially related to #911

This commit is contained in:
kunitoki 2011-10-22 14:29:54 +02:00
parent d67de4ab4a
commit b03f0fc226
4 changed files with 65 additions and 51 deletions

View file

@ -2,7 +2,7 @@
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2007 Artem Pavlenko
* 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
@ -19,36 +19,39 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
//$Id$
#ifndef RASTERLITE_DATASOURCE_HPP
#define RASTERLITE_DATASOURCE_HPP
// mapnik
#include <mapnik/datasource.hpp>
// boost
#include <boost/shared_ptr.hpp>
#include "rasterlite_include.hpp"
class rasterlite_datasource : public mapnik::datasource
{
public:
rasterlite_datasource(mapnik::parameters const& params, bool bind=true);
virtual ~rasterlite_datasource ();
int type() const;
static std::string name();
mapnik::featureset_ptr features(mapnik::query const& q) const;
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const;
mapnik::box2d<double> envelope() const;
mapnik::layer_descriptor get_descriptor() const;
void bind() const;
private:
inline void *open_dataset() const;
mutable mapnik::box2d<double> extent_;
std::string dataset_name_;
std::string table_name_;
mapnik::layer_descriptor desc_;
unsigned width_;
unsigned height_;
public:
rasterlite_datasource(mapnik::parameters const& params, bool bind = true);
virtual ~rasterlite_datasource ();
int type() const;
static std::string name();
mapnik::featureset_ptr features(mapnik::query const& q) const;
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const;
mapnik::box2d<double> envelope() const;
mapnik::layer_descriptor get_descriptor() const;
void bind() const;
private:
inline void* open_dataset() const;
mutable mapnik::box2d<double> extent_;
std::string dataset_name_;
std::string table_name_;
mapnik::layer_descriptor desc_;
unsigned width_;
unsigned height_;
};
#endif // RASTERLITE_DATASOURCE_HPP

View file

@ -2,7 +2,7 @@
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2007 Artem Pavlenko
* 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
@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
//$Id$
#include "rasterlite_featureset.hpp"
@ -43,9 +42,9 @@ using mapnik::feature_factory;
rasterlite_featureset::rasterlite_featureset(void* dataset, rasterlite_query q)
: dataset_(dataset),
gquery_(q),
first_(true)
: dataset_(dataset),
gquery_(q),
first_(true)
{
rasterliteSetBackgroundColor(dataset_, 255, 0, 255);
rasterliteSetTransparentColor(dataset_, 255, 0, 255);
@ -67,11 +66,15 @@ feature_ptr rasterlite_featureset::next()
first_ = false;
query *q = boost::get<query>(&gquery_);
if(q) {
if (q)
{
return get_feature(*q);
} else {
}
else
{
coord2d *p = boost::get<coord2d>(&gquery_);
if(p) {
if (p)
{
return get_feature_at_point(*p);
}
}
@ -91,7 +94,7 @@ feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q)
double x0, y0, x1, y1;
rasterliteGetExtent (dataset_, &x0, &y0, &x1, &y1);
box2d<double> raster_extent(x0,y0,x1,y1);
box2d<double> raster_extent(x0, y0, x1, y1);
box2d<double> intersect = raster_extent.intersect(q.get_bbox());
const int width = static_cast<int>(boost::get<0>(q.resolution()) * intersect.width() + 0.5);
@ -104,8 +107,8 @@ feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q)
std::clog << "Rasterlite Plugin: Raster extent=" << raster_extent << std::endl;
std::clog << "Rasterlite Plugin: View extent=" << q.get_bbox() << std::endl;
std::clog << "Rasterlite Plugin: Intersect extent=" << intersect << std::endl;
std::clog << "Rasterlite Plugin: Query resolution=" << boost::get<0>(q.resolution())
<< "," << boost::get<1>(q.resolution()) << std::endl;
std::clog << "Rasterlite Plugin: Query resolution="
<< boost::get<0>(q.resolution()) << "," << boost::get<1>(q.resolution()) << std::endl;
std::clog << "Rasterlite Plugin: Size=" << width << " " << height << std::endl;
std::clog << "Rasterlite Plugin: Pixel Size=" << pixel_size << std::endl;
#endif
@ -113,11 +116,19 @@ feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q)
if (width > 0 && height > 0)
{
int size = 0;
void *raster = 0;
void* raster = 0;
if (rasterliteGetRawImageByRect(dataset_,
intersect.minx(), intersect.miny(), intersect.maxx(), intersect.maxy(),
pixel_size, width, height, GAIA_RGBA_ARRAY, &raster, &size) == RASTERLITE_OK)
intersect.minx(),
intersect.miny(),
intersect.maxx(),
intersect.maxy(),
pixel_size,
width,
height,
GAIA_RGBA_ARRAY,
&raster,
&size) == RASTERLITE_OK)
{
if (size > 0)
{
@ -150,9 +161,7 @@ feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q)
return feature_ptr();
}
feature_ptr rasterlite_featureset::get_feature_at_point(mapnik::coord2d const& pt)
{
return feature_ptr();
}

View file

@ -2,7 +2,7 @@
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2007 Artem Pavlenko
* 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
@ -19,12 +19,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
//$Id$
#ifndef RASTERLITE_FEATURESET_HPP
#define RASTERLITE_FEATURESET_HPP
// mapnik
#include <mapnik/datasource.hpp>
// boost
#include <boost/variant.hpp>
#include "rasterlite_include.hpp"
@ -33,16 +35,17 @@ typedef boost::variant<mapnik::query,mapnik::coord2d> rasterlite_query;
class rasterlite_featureset : public mapnik::Featureset
{
public:
rasterlite_featureset(void* dataset, rasterlite_query q);
virtual ~rasterlite_featureset();
mapnik::feature_ptr next();
private:
mapnik::feature_ptr get_feature(mapnik::query const& q);
mapnik::feature_ptr get_feature_at_point(mapnik::coord2d const& p);
void* dataset_;
rasterlite_query gquery_;
bool first_;
public:
rasterlite_featureset(void* dataset, rasterlite_query q);
virtual ~rasterlite_featureset();
mapnik::feature_ptr next();
private:
mapnik::feature_ptr get_feature(mapnik::query const& q);
mapnik::feature_ptr get_feature_at_point(mapnik::coord2d const& p);
void* dataset_;
rasterlite_query gquery_;
bool first_;
};
#endif // RASTERLITE_FEATURESET_HPP

View file

@ -2,7 +2,7 @@
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2007 Artem Pavlenko
* 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
@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
//$Id$
#ifndef RASTERLITE_INCLUDE_HPP
#define RASTERLITE_INCLUDE_HPP
@ -29,4 +28,4 @@ extern "C" {
#include <rasterlite.h>
}
#endif // RASTERLITE_FEATURESET_HPP
#endif // RASTERLITE_INCLUDE_HPP