disable deepcopy in python bindings until this is more solid - refs #1390

This commit is contained in:
Dane Springmeyer 2012-08-15 13:27:44 -07:00
parent 9e85944d93
commit b8a0587c29
2 changed files with 29 additions and 27 deletions

View file

@ -31,7 +31,7 @@
#include <mapnik/projection.hpp>
#include <mapnik/ctrans.hpp>
#include <mapnik/feature_type_style.hpp>
#include <mapnik/util/deepcopy.hpp>
//#include <mapnik/util/deepcopy.hpp>
#include "mapnik_enumeration.hpp"
using mapnik::color;
@ -165,6 +165,7 @@ mapnik::featureset_ptr query_map_point(mapnik::Map const& m, int index, double x
}
// deepcopy
/*
mapnik::Map map_deepcopy(mapnik::Map & m, boost::python::dict memo)
{
// FIXME: ignore memo for now
@ -172,6 +173,7 @@ mapnik::Map map_deepcopy(mapnik::Map & m, boost::python::dict memo)
mapnik::util::deepcopy(m, result);
return result;
}
*/
void set_maximum_extent(mapnik::Map & m, boost::optional<mapnik::box2d<double> > const& box)
{
@ -430,7 +432,7 @@ void export_map()
">>> m.zoom_to_box(extent)\n"
)
.def("__deepcopy__",&map_deepcopy)
//.def("__deepcopy__",&map_deepcopy)
.add_property("parameters",make_function(params_nonconst,return_value_policy<reference_existing_object>()),"TODO")
.add_property("aspect_fix_mode",

View file

@ -11,32 +11,32 @@ def setup():
# from another directory we need to chdir()
os.chdir(execution_path('.'))
def test_map_deepcopy1():
m1 = mapnik.Map(256,256)
m1.append_style('style',mapnik.Style())
m1.append_fontset('fontset',mapnik.FontSet())
m2 = deepcopy(m1)
eq_(m2.width, m1.width)
eq_(m2.height, m2.height)
eq_(m2.srs, m1.srs)
eq_(m2.base, m1.base)
eq_(m2.background, m1.background)
eq_(m2.buffer_size, m1.buffer_size)
eq_(m2.aspect_fix_mode, m1.aspect_fix_mode)
eq_(m2.envelope(),m1.envelope())
eq_(m2.buffered_envelope(),m1.buffered_envelope())
eq_(m2.scale(),m1.scale())
eq_(m2.scale_denominator(),m1.scale_denominator())
eq_(m2.maximum_extent,m1.maximum_extent)
eq_(id(m2.view_transform()),id(m1.view_transform()))
eq_(id(m2.parameters),id(m1.parameters))
eq_(id(m2.layers),id(m1.layers))
eq_(id(m2.layers),id(m1.layers))
eq_(id(m2.find_fontset('fontset')),id(m2.find_fontset('fontset')))
# fails for some reason on linux (not osx)
# but non-critical for now
#eq_(id(m2.find_style('style')),id(m2.find_style('style')))
#def test_map_deepcopy1():
# m1 = mapnik.Map(256,256)
# m1.append_style('style',mapnik.Style())
# m1.append_fontset('fontset',mapnik.FontSet())
# m2 = deepcopy(m1)
# eq_(m2.width, m1.width)
# eq_(m2.height, m2.height)
# eq_(m2.srs, m1.srs)
# eq_(m2.base, m1.base)
# eq_(m2.background, m1.background)
# eq_(m2.buffer_size, m1.buffer_size)
# eq_(m2.aspect_fix_mode, m1.aspect_fix_mode)
# eq_(m2.envelope(),m1.envelope())
# eq_(m2.buffered_envelope(),m1.buffered_envelope())
# eq_(m2.scale(),m1.scale())
# eq_(m2.scale_denominator(),m1.scale_denominator())
# eq_(m2.maximum_extent,m1.maximum_extent)
# eq_(id(m2.view_transform()),id(m1.view_transform()))
# eq_(id(m2.parameters),id(m1.parameters))
# eq_(id(m2.layers),id(m1.layers))
# eq_(id(m2.layers),id(m1.layers))
# eq_(id(m2.find_fontset('fontset')),id(m2.find_fontset('fontset')))
# # fails for some reason on linux (not osx)
# # but non-critical for now
# #eq_(id(m2.find_style('style')),id(m2.find_style('style')))
if __name__ == "__main__":
setup()