178 |
|
|
179 |
for d in descr: |
for d in descr: |
180 |
if d.required and not attrs.has_key(d.fullname): |
if d.required and not attrs.has_key(d.fullname): |
181 |
pass |
raise LoadError("Element %s requires an attribute %r" |
182 |
#raise LoadError("Element %s requires an attribute %r" |
% (element, d.name)) |
|
# % (element, d.name)) |
|
183 |
value = attrs.get(d.fullname, d.default) |
value = attrs.get(d.fullname, d.default) |
184 |
|
|
185 |
if d.conversion == "shapesource": |
if d.conversion == "shapesource": |
362 |
elif fieldType == FIELDTYPE_DOUBLE: |
elif fieldType == FIELDTYPE_DOUBLE: |
363 |
self.conv = float |
self.conv = float |
364 |
|
|
365 |
self.aLayer.GetClassification().SetFieldInfo(field, fieldType) |
self.aLayer.SetClassificationColumn(field) |
366 |
|
|
367 |
def end_classification(self, name, qname): |
def end_classification(self, name, qname): |
368 |
pass |
pass |
380 |
def start_clpoint(self, name, qname, attrs): |
def start_clpoint(self, name, qname, attrs): |
381 |
attrib_value = attrs.get((None, 'value'), "0") |
attrib_value = attrs.get((None, 'value'), "0") |
382 |
|
|
383 |
if self.aLayer.GetClassification().GetFieldType() == FIELDTYPE_STRING: |
field = self.aLayer.GetClassificationColumn() |
384 |
|
if self.aLayer.GetFieldType(field) == FIELDTYPE_STRING: |
385 |
value = self.encode(attrib_value) |
value = self.encode(attrib_value) |
386 |
else: |
else: |
387 |
value = self.conv(attrib_value) |
value = self.conv(attrib_value) |