Merge branch 'master' into mapnik-geometry

This commit is contained in:
artemp 2015-03-12 14:55:45 +01:00
commit 50ca6fcbe8
25 changed files with 214 additions and 40 deletions

5
.gitignore vendored
View file

@ -1,4 +1,7 @@
.DS_Store
*.gcov
*.gcda
*.gcno
*~
*.o
*.pyc
@ -14,6 +17,8 @@ bindings/python/mapnik/paths.py
config.cache
config.log
config.py
mason_packages/
.mason/
.sconf_temp/
.sconsign.dblite
demo/viewer/viewer.ini

View file

@ -7,6 +7,9 @@ addons:
matrix:
include:
- os: osx
compiler: clang
env: JOBS=12 COVERAGE=true
- os: osx
compiler: clang
env: JOBS=12
@ -17,6 +20,9 @@ matrix:
compiler: gcc
env: JOBS=6
before_install:
- export COVERAGE=${COVERAGE:-false}
install:
- if [[ $(uname -s) == 'Linux' ]]; then psql -U postgres -c 'create database template_postgis;' -U postgres; psql -U postgres -c 'create extension postgis;' -d template_postgis -U postgres; fi;
@ -24,8 +30,19 @@ script:
- source bootstrap.sh
- wget https://gist.githubusercontent.com/springmeyer/0833fa43794838889139/raw/build_pycairo.sh && chmod +x build_pycairo.sh && ./build_pycairo.sh
- export PYTHONPATH=$(pwd)/mason_packages/.link/lib/python2.7/site-packages:${PYTHONPATH}
- ./configure
- if [[ ${COVERAGE} == true ]]; then
brew update;
brew install pyenv;
eval "$(pyenv init -)";
pyenv install 2.7.6;
pyenv global 2.7.6;
pyenv rehash;
pip install cpp-coveralls;
pyenv rehash;
fi;
- if [[ ${COVERAGE} == true ]]; then ./configure CUSTOM_LDFLAGS='--coverage' CUSTOM_CXXFLAGS='--coverage' CUSTOM_CFLAGS='--coverage' DEBUG=True; else ./configure; fi;
- make
- git clone --depth=1 https://github.com/mapbox/mapnik-test-data tests/data/mapnik-test-data
- make test
- make bench
- if [[ ${COVERAGE} == true ]]; then cpp-coveralls --build-root . --gcov-options '\-lp' --exclude mason_packages --exclude .sconf_temp --exclude benchmark --exclude deps --exclude scons --exclude tests --exclude demo --exclude docs --exclude fonts --exclude utils > /dev/null; fi;
- if [[ ${COVERAGE} != true ]]; then make bench; fi;

View file

@ -67,8 +67,8 @@ void export_grid()
class_<mapnik::grid,std::shared_ptr<mapnik::grid> >(
"Grid",
"This class represents a feature hitgrid.",
init<int,int,std::string,unsigned>(
( boost::python::arg("width"), boost::python::arg("height"),boost::python::arg("key")="__id__", boost::python::arg("resolution")=1 ),
init<int,int,std::string>(
( boost::python::arg("width"), boost::python::arg("height"),boost::python::arg("key")="__id__"),
"Create a mapnik.Grid object\n"
))
.def("painted",&painted)

View file

@ -248,7 +248,7 @@ void write_features(T const& grid_type,
return;
}
std::set<std::string> const& attributes = grid_type.property_names();
std::set<std::string> const& attributes = grid_type.get_fields();
typename T::feature_type::const_iterator feat_end = g_features.end();
for ( std::string const& key_item :key_order )
{
@ -369,7 +369,7 @@ void render_layer_for_grid(mapnik::Map const& map,
boost::python::extract<std::string> name(fields[i]);
if (name.check())
{
grid.add_property_name(name());
grid.add_field(name());
}
else
{
@ -379,8 +379,8 @@ void render_layer_for_grid(mapnik::Map const& map,
}
}
// copy property names
std::set<std::string> attributes = grid.property_names();
// copy field names
std::set<std::string> attributes = grid.get_fields();
// todo - make this a static constant
std::string known_id_key = "__id__";
if (attributes.find(known_id_key) != attributes.end())

View file

@ -61,7 +61,6 @@ private:
unsigned height_;
std::string key_;
data_type data_;
unsigned int resolution_;
std::string id_name_;
bool painted_;
std::set<std::string> names_;
@ -71,7 +70,7 @@ private:
public:
hit_grid(int width, int height, std::string const& key, unsigned int resolution);
hit_grid(int width, int height, std::string const& key);
hit_grid(hit_grid<T> const& rhs);
@ -96,12 +95,12 @@ public:
void add_feature(mapnik::feature_impl const& feature);
inline void add_property_name(std::string const& name)
inline void add_field(std::string const& name)
{
names_.insert(name);
}
inline std::set<std::string> const& property_names() const
inline std::set<std::string> const& get_fields() const
{
return names_;
}
@ -126,16 +125,6 @@ public:
key_ = key;
}
inline unsigned int get_resolution() const
{
return resolution_;
}
inline void set_resolution(unsigned int res)
{
resolution_ = res;
}
inline data_type const& data() const
{
return data_;
@ -164,7 +153,7 @@ public:
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_,names_,f_keys_,features_);
}
private:

View file

@ -55,7 +55,6 @@ public:
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
@ -66,7 +65,6 @@ public:
height_(height),
data_(data),
key_(key),
resolution_(resolution),
id_name_(id_name),
names_(names),
f_keys_(f_keys),
@ -88,7 +86,6 @@ public:
height_(rhs.height_),
data_(rhs.data_),
key_(rhs.key_),
resolution_(rhs.resolution_),
id_name_(rhs.id_name_),
names_(rhs.names_),
f_keys_(rhs.f_keys_),
@ -104,7 +101,6 @@ public:
height_ = rhs.height_;
data_ = rhs.data_;
key_ = rhs.key_;
resolution_ = rhs.resolution_;
id_name_ = rhs.id_name_;
names_ = rhs.names_;
f_keys_ = rhs.f_keys_;
@ -157,7 +153,7 @@ public:
return data_.getBytes();
}
inline std::set<std::string> const& property_names() const
inline std::set<std::string> const& get_fields() const
{
return names_;
}
@ -177,11 +173,6 @@ public:
return key_;
}
inline unsigned int get_resolution() const
{
return resolution_;
}
private:
unsigned x_;
unsigned y_;
@ -189,7 +180,6 @@ private:
unsigned height_;
T const& data_;
std::string const& key_;
unsigned int resolution_;
std::string const& id_name_;
std::set<std::string> const& names_;
feature_key_type const& f_keys_;

View file

@ -108,6 +108,7 @@ struct agg_renderer_process_visitor_l
pattern_source source(image, opacity);
pattern_type pattern (filter,source);
renderer_type ren(ren_base, pattern);
ren.clip_box(0,0,common_.width_,common_.height_);
rasterizer_type ras(ren);
agg::trans_affine tr;
@ -176,6 +177,7 @@ struct agg_renderer_process_visitor_l
pattern_source source(image, opacity);
pattern_type pattern (filter,source);
renderer_type ren(ren_base, pattern);
ren.clip_box(0,0,common_.width_,common_.height_);
rasterizer_type ras(ren);
agg::trans_affine tr;

View file

@ -37,12 +37,11 @@ template <typename T>
const typename hit_grid<T>::value_type hit_grid<T>::base_mask = std::numeric_limits<typename T::type>::min();
template <typename T>
hit_grid<T>::hit_grid(int width, int height, std::string const& key, unsigned int resolution)
hit_grid<T>::hit_grid(int width, int height, std::string const& key)
: width_(width),
height_(height),
key_(key),
data_(width,height),
resolution_(resolution),
id_name_("__id__"),
painted_(false),
names_(),
@ -60,7 +59,6 @@ hit_grid<T>::hit_grid(hit_grid<T> const& rhs)
height_(rhs.height_),
key_(rhs.key_),
data_(rhs.data_),
resolution_(rhs.resolution_),
id_name_("__id__"),
painted_(rhs.painted_),
names_(rhs.names_),

View file

@ -84,7 +84,10 @@ image_reader* get_image_reader(std::string const& filename)
{
return factory<image_reader,std::string,std::string const&>::instance().create_object(*type,filename);
}
return 0;
else
{
throw image_reader_exception("image_reader: can't determine type from input data");
}
}
}

View file

@ -21,10 +21,10 @@
"spaces":"this has spaces",
"double":1.1,
"boolean":true,
"NOM_FR":"Québec",
"NOM_FR":"Qu\u00e9bec",
"object": {"value":{"type":"\u041c\u0430pni\u043a","array": [3,0,"x"]}},
"array" : [ [ [1], ["deux"]],[["\u0442\u0440\u0438","four","\u4e94"]]]
}
}
]
}
}

View file

@ -0,0 +1 @@
{"type":"FeatureCollection","name":"landcover","features":[{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[8.81103515624999,50.1211284189057],[8.81094932556152,50.1211284189057],[8.81060600280761,50.1210183552227],[8.81034851074218,50.1205780979601],[8.79036605358123,50.1205780979601],[8.79043579101562,50.1206331303393],[8.79043579101562,50.1234396977932],[8.79103660583496,50.1238799287382],[8.79258155822753,50.1239349573217],[8.79309654235839,50.1242100992899],[8.79318237304687,50.1259709704353],[8.79301071166991,50.1263011265632],[8.79215240478515,50.1266312804137],[8.79129409790038,50.1273466059435],[8.79069328308105,50.1272915812823],[8.78992080688476,50.1265762549301],[8.78906249999999,50.1265556203574],[8.78906249999999,50.1328590685262],[8.7923240661621,50.1329037708673],[8.79301071166991,50.132573660287],[8.79309654235839,50.1315282950922],[8.79301071166991,50.1313632353423],[8.79180908203124,50.1307029906492],[8.79180908203124,50.1296575845885],[8.79215240478515,50.1293824739347],[8.79301071166991,50.1290523390627],[8.79318237304687,50.1288322478827],[8.79326820373534,50.1278418250474],[8.79455566406249,50.1271815317701],[8.79464149475097,50.1261910747736],[8.79481315612792,50.1259709704353],[8.79567146301269,50.12564081203],[8.79610061645507,50.1252005972803],[8.79670143127441,50.1248704335609],[8.79961967468261,50.1249254610056],[8.80004882812499,50.1251455701519],[8.80056381225585,50.1256958385891],[8.80090713500976,50.1258058915174],[8.80210876464843,50.1258058915174],[8.80279541015624,50.126081022731],[8.80296707153319,50.1264111780997],[8.80296707153319,50.1272365565578],[8.80425453186034,50.1280068969433],[8.80425453186034,50.1298776719727],[8.80468368530273,50.1302628224597],[8.80554199218749,50.1306479698469],[8.80562782287597,50.1326836974001],[8.80597114562987,50.1329587890759],[8.80640029907226,50.1330688253034],[8.81103515624999,50.1331135274485],[8.81103515624999,50.1339250360536],[8.80785942077636,50.133894088944],[8.8073444366455,50.1340041230206],[8.80691528320312,50.134444256797],[8.80631446838378,50.1347743544724],[8.80082130432128,50.1347193383513],[8.80030632019042,50.1348293705302],[8.80004882812499,50.1351044498705],[8.81103515624999,50.1351044498705],[8.81103515624999,50.1211284189057]]]},"properties":{"class":"crop"}}]}

View file

@ -0,0 +1,72 @@
{
"keys": [
""
],
"data": {},
"grid": [
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "
]
}

View file

@ -0,0 +1,72 @@
{
"keys": [
""
],
"data": {},
"grid": [
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View file

@ -0,0 +1,25 @@
<Map background-color="white" srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
<Parameters>
<Parameter name="sizes">256, 256</Parameter>
<Parameter name="bbox">979202.4851673174416646,6469426.4037138856947422,979202.5224900852190331,6469426.4410366592928767</Parameter>
</Parameters>
<Style name="My Style">
<Rule>
<LineSymbolizer stroke="#00FF00"/>
</Rule>
<Rule>
<LinePatternSymbolizer file="../../data/pngsuite/linepattern.png"/>
</Rule>
</Style>
<Layer name="layer" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>My Style</StyleName>
<Datasource>
<Parameter name="type">geojson</Parameter>
<Parameter name="file">../data/landuse.geojson</Parameter>
</Datasource>
</Layer>
</Map>