1 |
# Copyright (c) 2002, 2003, 2004 by Intevation GmbH |
# Copyright (c) 2002, 2003, 2004, 2005 by Intevation GmbH |
2 |
# Authors: |
# Authors: |
3 |
# Bernhard Herzog <[email protected]> |
# Bernhard Herzog <[email protected]> |
4 |
# |
# |
32 |
from Thuban.Model.proj import Projection |
from Thuban.Model.proj import Projection |
33 |
from Thuban.Model.data import DerivedShapeStore |
from Thuban.Model.data import DerivedShapeStore |
34 |
from Thuban.Model.classification import Classification, ClassGroupSingleton, \ |
from Thuban.Model.classification import Classification, ClassGroupSingleton, \ |
35 |
ClassGroupRange |
ClassGroupRange, ClassGroupPattern |
36 |
from Thuban.Model.color import Color |
from Thuban.Model.color import Color |
37 |
|
|
38 |
import Thuban.Model.resource |
import Thuban.Model.resource |
191 |
self.assertFloatSeqEqual(layer.ShapesBoundingBox([0]), |
self.assertFloatSeqEqual(layer.ShapesBoundingBox([0]), |
192 |
(90.0, -8.90043373, 120, 11.1616263)) |
(90.0, -8.90043373, 120, 11.1616263)) |
193 |
|
|
194 |
self.assertFloatSeqEqual(layer.ClipBoundingBox((-180, -6, 100, +120)), |
# Test a very large bounding box in the query. Naive inverse |
195 |
(90.0, -6, 100, 11.1616263)) |
# projection will create infs instead of proper coordinate |
196 |
|
# values and a different result (an empty list instead of [0]) |
197 |
shapes = layer.ShapesInRegion((-180, -170, 200, +120)) |
shapes = layer.ShapesInRegion((-180, -170, 200, +120)) |
198 |
self.assertEquals([s.ShapeID() for s in shapes],[0]) |
self.assertEquals([s.ShapeID() for s in shapes],[0]) |
199 |
|
|
416 |
# the layer. |
# the layer. |
417 |
self.failIf(self.layer.WasModified()) |
self.failIf(self.layer.WasModified()) |
418 |
|
|
419 |
def test_set_classification(self): |
def test_set_classification_numerical(self): |
420 |
"""Test Layer.SetClassification""" |
"""Test Layer.SetClassification numerical""" |
421 |
classification = Classification() |
classification = Classification() |
422 |
classification.AppendGroup(ClassGroupRange((0.0, 0.1))) |
classification.AppendGroup(ClassGroupRange((0.0, 0.1))) |
423 |
|
|
437 |
|
|
438 |
self.check_messages([(self.layer, LAYER_CHANGED)]) |
self.check_messages([(self.layer, LAYER_CHANGED)]) |
439 |
self.failUnless(self.layer.WasModified()) |
self.failUnless(self.layer.WasModified()) |
440 |
|
|
441 |
|
def test_set_classification_textual(self): |
442 |
|
"""Test Layer.SetClassification textual""" |
443 |
|
classification = Classification() |
444 |
|
classification.AppendGroup(ClassGroupPattern("I")) |
445 |
|
|
446 |
|
self.layer.SetClassification(classification) |
447 |
|
self.layer.SetClassificationColumn("POPYCOUN") |
448 |
|
|
449 |
|
self.check_messages([(self.layer, LAYER_CHANGED), |
450 |
|
(self.layer, LAYER_CHANGED)]) |
451 |
|
self.failUnless(self.layer.WasModified()) |
452 |
|
|
453 |
|
self.clear_messages() |
454 |
|
self.layer.UnsetModified() |
455 |
|
|
456 |
|
# change only the classification column. This should issue a |
457 |
|
# LAYER_CHANGED message as well. |
458 |
|
self.layer.SetClassificationColumn("POPYREG") |
459 |
|
|
460 |
|
self.check_messages([(self.layer, LAYER_CHANGED)]) |
461 |
|
self.failUnless(self.layer.WasModified()) |
462 |
|
|
463 |
|
|
464 |
def test_tree_info(self): |
def test_tree_info(self): |