162 |
props.SetLineWidth(data[CLASSES][i][GROUP_PROPS][1]) |
props.SetLineWidth(data[CLASSES][i][GROUP_PROPS][1]) |
163 |
props.SetFill( |
props.SetFill( |
164 |
parse_color(data[CLASSES][i][GROUP_PROPS][2])) |
parse_color(data[CLASSES][i][GROUP_PROPS][2])) |
165 |
|
if len(data[CLASSES][i][GROUP_PROPS]) > 3: |
166 |
|
props.SetSize(data[CLASSES][i][GROUP_PROPS][3]) |
167 |
|
|
168 |
if data[CLASSES][i][GROUP_TYPE] == "default": |
if data[CLASSES][i][GROUP_TYPE] == "default": |
169 |
g = ClassGroupDefault(props, data[CLASSES][i][GROUP_LABEL]) |
g = ClassGroupDefault(props, data[CLASSES][i][GROUP_LABEL]) |
389 |
|
|
390 |
self.check_format() |
self.check_format() |
391 |
|
|
392 |
|
|
393 |
|
class TestSymbolSize(ClassificationTest): |
394 |
|
|
395 |
|
file_contents = '''\ |
396 |
|
<?xml version="1.0" encoding="UTF-8"?> |
397 |
|
<!DOCTYPE session SYSTEM "thuban-1.1.dtd"> |
398 |
|
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd" title="Thuban sample session"> |
399 |
|
<fileshapesource filetype="shapefile" id="D813968480" filename="../../Data/iceland/cultural_landmark-point.shp"/> |
400 |
|
<map title="Iceland map"> |
401 |
|
<layer title="cultural_landmark-point" stroke_width="1" shapestore="D813968480" visible="true" stroke="#000000" fill="#000000"> |
402 |
|
<classification field="CLPTLABEL" field_type="string"> |
403 |
|
<clnull label=""> |
404 |
|
<cldata stroke="#000000" stroke_width="1" size="3" fill="#000000"/> |
405 |
|
</clnull> |
406 |
|
<clpoint label="" value="RUINS"> |
407 |
|
<cldata stroke="#000000" stroke_width="1" size="6" fill="#ffffff"/> |
408 |
|
</clpoint> |
409 |
|
<clpoint label="" value="FARM"> |
410 |
|
<cldata stroke="#000000" stroke_width="1" size="9" fill="#ffff00"/> |
411 |
|
</clpoint> |
412 |
|
</classification> |
413 |
|
</layer> |
414 |
|
</map> |
415 |
|
</session> |
416 |
|
''' |
417 |
|
|
418 |
|
def test(self): |
419 |
|
"""Test that the size attribute for point symbols is correctly |
420 |
|
loaded for a layer.""" |
421 |
|
eq = self.assertEquals |
422 |
|
session = load_session(self.filename()) |
423 |
|
self.session = session |
424 |
|
|
425 |
|
map = session.Maps()[0] # only one map in the sample |
426 |
|
|
427 |
|
expected = [("cultural_landmark-point", 2, |
428 |
|
[("default", (), "", |
429 |
|
("#000000", 1, "#000000", 3)), |
430 |
|
("single", "RUINS", "", |
431 |
|
("#000000", 1, "#ffffff", 6)), |
432 |
|
("single", "FARM", "", |
433 |
|
("#000000", 1, "#ffff00", 9))])] |
434 |
|
|
435 |
|
self.TestLayers(map.Layers(), expected) |
436 |
|
|
437 |
|
self.check_format() |
438 |
|
|
439 |
|
|
440 |
class TestClassification(ClassificationTest): |
class TestClassification(ClassificationTest): |
441 |
|
|