Ticket #92 (defect)

Opened 2 years ago

Last modified 2 years ago

Inconsistency in BoundingBox internal state

Status: closed (fixed)

Reported by: dokai Assigned to: seang
Priority: major Milestone: 0.11
Component: Spatial and Geometry Version:
Keywords: Cc:

The state of a BoundingBox? object becomes inconsistent if the object geometry is modified. The reason for this is that BoundingBoxes? maintain the geometry information at two different levels: the underlying Polygon base class's geometry and the instance variables for minx, miny, maxx and maxy.

When the base class's geometry is modified the instance variables still maintain their old values.

Steps to reproduce:

from cartography.referencing.transform.proj4 import ProjTransform
from cartography.spatial.geometry import BoundingBox
from cartography.referencing.srs import SpatialReference

source = SpatialReference(epsg=2393)
target = SpatialReference(epsg=4326)

bbox = BoundingBox(3083821.75, 6639903.0, 3733174.25, 7779714.0)

transformation = ProjTransform(target, source)

print "Geometry:", bbox
print "Instance variables:", bbox.totuple()

# This operation modifies the base class's geometry, but not the instance variables
bbox.transform(transformation)

# The values printed here will demonstrate the inconsistency.
print
print "Geometry:", bbox
print "Instance variables:", bbox.totuple()

Change History

10/15/06 13:50:32: Modified by seang

  • status changed from new to assigned.

10/16/06 12:35:56: Modified by seang

  • status changed from assigned to closed.
  • resolution set to fixed.

Fixed in r505. See the new BoundingBox? test in testpygeom.py.