mapnik/mapnik — Issue #1115: backwards compatibility for text_symbolizer in python
Author: springmeyer
Created: 2012-03-05 23:41:54+00:00
State: open

With the landing of the `textplacement` branch the interface to the text_symbolizer changed radically to support more flexible formatting and placements.

I don't feel like we need to preserve a backwards incompatible C++ interface, but it would be nice if we did via python.

Therefore I propose adding shim like:

```diff
diff --git a/bindings/python/mapnik/__init__.py b/bindings/python/mapnik/__init__.py
index 9fa0352..c0ed35f 100644
--- a/bindings/python/mapnik/__init__.py
+++ b/bindings/python/mapnik/__init__.py
@@ -77,6 +77,21 @@ class Envelope(Box2d):
DeprecationWarning, 2)
Box2d.__init__(self, *args, **kwargs)

+class _TextSymbolizer(TextSymbolizer,_injector):
+
+ @property
+ def text_size(self):
+ warnings.warn("'text_size' is deprecated, use format.text_size",
+ DeprecationWarning, 2)
+ return self.format.text_size
+
+ @text_size.setter
+ def text_size(self,text_size):
+ warnings.warn("'text_size' is deprecated, use format.text_size",
+ DeprecationWarning, 2)
+ self.format.text_size = text_size
+
+
class _Coord(Coord,_injector):
"""
Represents a point with two coordinates (either lon/lat or x/y).
```