254 |
|
|
255 |
lc = layer.GetClassification() |
lc = layer.GetClassification() |
256 |
|
|
257 |
field = lc.GetField() |
field = layer.GetClassificationField() |
258 |
|
|
259 |
# |
# |
260 |
# there isn't a classification of anything so do nothing |
# there isn't a classification of anything so do nothing |
262 |
if field is None: return |
if field is None: return |
263 |
|
|
264 |
attrs["field"] = field |
attrs["field"] = field |
265 |
attrs["field_type"] = str(lc.GetFieldType()) |
attrs["field_type"] = str(layer.GetFieldType(field)) |
266 |
self.open_element("classification", attrs) |
self.open_element("classification", attrs) |
267 |
|
|
268 |
for g in lc: |
for g in lc: |
270 |
open_el = 'clnull label="%s"' % self.encode(g.GetLabel()) |
open_el = 'clnull label="%s"' % self.encode(g.GetLabel()) |
271 |
close_el = 'clnull' |
close_el = 'clnull' |
272 |
elif isinstance(g, ClassGroupSingleton): |
elif isinstance(g, ClassGroupSingleton): |
273 |
if lc.GetFieldType() == FIELDTYPE_STRING: |
if layer.GetFieldType(field) == FIELDTYPE_STRING: |
274 |
value = self.encode(g.GetValue()) |
value = self.encode(g.GetValue()) |
275 |
else: |
else: |
276 |
value = str(g.GetValue()) |
value = str(g.GetValue()) |