416 |
('EndDrawing',)]) |
('EndDrawing',)]) |
417 |
|
|
418 |
|
|
419 |
|
def test_point_with_classification(self): |
420 |
|
"""Test BaseRenderer with point layer and classification""" |
421 |
|
table = MemoryTable([("type", FIELDTYPE_STRING), |
422 |
|
("value", FIELDTYPE_DOUBLE), |
423 |
|
("code", FIELDTYPE_INT)], |
424 |
|
[("UNKNOWN", 0.0, 0), |
425 |
|
("UNKNOWN", 0.0, 1)]) |
426 |
|
shapes = [[[(0, 0)]], [[(10, 10)]]] |
427 |
|
store = SimpleShapeStore(SHAPETYPE_POINT, shapes, table) |
428 |
|
|
429 |
|
map = Map("TestBaseRenderer") |
430 |
|
layer = Layer("point layer", store) |
431 |
|
group = ClassGroupSingleton(1) |
432 |
|
group.GetProperties().SetFill(Color(0, 0, 1)) |
433 |
|
layer.GetClassification().AppendGroup(group) |
434 |
|
layer.SetClassificationColumn("code") |
435 |
|
|
436 |
|
map.AddLayer(layer) |
437 |
|
self.to_destroy.append(map) |
438 |
|
|
439 |
|
dc = MockDC() |
440 |
|
renderer = SimpleRenderer(dc, 2, (10, 10)) |
441 |
|
|
442 |
|
renderer.render_map(map) |
443 |
|
|
444 |
|
self.assertEquals(dc.calls, |
445 |
|
[('BeginDrawing',), |
446 |
|
('SetBrush', ('brush', Transparent)), |
447 |
|
('SetPen', ('pen', Color(0, 0, 0), 1)), |
448 |
|
('DrawEllipse', 5, 5, 10, 10), |
449 |
|
('SetBrush', ('brush', Color(0, 0, 1))), |
450 |
|
('SetPen', ('pen', Color(0, 0, 0), 1)), |
451 |
|
('DrawEllipse', 25, -15, 10, 10), |
452 |
|
('SetFont', "label font"), |
453 |
|
('EndDrawing',)]) |
454 |
|
|
455 |
|
|
456 |
if __name__ == "__main__": |
if __name__ == "__main__": |
457 |
support.run_tests() |
support.run_tests() |