mapnik-org/mapnik — Issue #747: Un-initialized box2d<double> behaves differently between dfl ctor and map/layer.
Author: artemp
Created: 2011-10-11 08:10:43+00:00
State: open
Labels: Core_Library

{{{
#!python
>>> from mapnik2 import *
>>> Box2d()
Box2d(0.0,0.0,-1.0,-1.0)
>>> Map(256,256).envelope()
Box2d(-1.0,-1.0,0.0,0.0)
>>> Layer('').envelope()
Box2d(-1.0,-1.0,0.0,0.0)
}}}

I assume the reason (0.0,0.0,-1.0,-1.0) was chosen as the initial values for the default constructor of box2d was so that an un-initialized box could be potentially detected, because technically those values are not valid. The box2d::init function corrects these to be properly minx_ < maxx_, miny_ < maxy_.

But this creates a discrepancy because the copy constructor also calls init internally. Should the copy constructor act more predictably and not internally fix the values when copied?