20 |
support.initthuban() |
support.initthuban() |
21 |
|
|
22 |
import shapelib |
import shapelib |
23 |
|
import dbflib |
24 |
|
|
25 |
from Thuban.Model.layer import Layer, SHAPETYPE_POLYGON, SHAPETYPE_ARC, \ |
from Thuban.Model.layer import Layer, SHAPETYPE_POLYGON, SHAPETYPE_ARC, \ |
26 |
SHAPETYPE_POINT |
SHAPETYPE_POINT |
97 |
shapefilename = self.temp_file_name("layer_empty.shp") |
shapefilename = self.temp_file_name("layer_empty.shp") |
98 |
shp = shapelib.create(shapefilename, shapelib.SHPT_POLYGON) |
shp = shapelib.create(shapefilename, shapelib.SHPT_POLYGON) |
99 |
shp.close() |
shp.close() |
100 |
|
# create an empty DBF file too because Thuban can't cope yet |
101 |
|
# with missing DBF file. |
102 |
|
dbffilename = self.temp_file_name("layer_empty.dbf") |
103 |
|
dbf = dbflib.create(dbffilename) |
104 |
|
dbf.add_field("NAME", dbflib.FTString, 20, 0) |
105 |
|
|
106 |
|
# Now try to open it. |
107 |
layer = Layer("Empty Layer", shapefilename) |
layer = Layer("Empty Layer", shapefilename) |
108 |
self.assertEquals(layer.BoundingBox(), None) |
self.assertEquals(layer.BoundingBox(), None) |
109 |
self.assertEquals(layer.LatLongBoundingBox(), None) |
self.assertEquals(layer.LatLongBoundingBox(), None) |