144 |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
145 |
<session title="single map&layer" |
<session title="single map&layer" |
146 |
xmlns="http://thuban.intevation.org/dtds/thuban-1.0-dev.dtd"> |
xmlns="http://thuban.intevation.org/dtds/thuban-1.0-dev.dtd"> |
147 |
<fileshapesource id="D1" filename="%s" filetype="shapefile"/> |
<fileshapesource id="D1" |
148 |
|
filename="../../Data/iceland/political.shp" |
149 |
|
filetype="shapefile"/> |
150 |
<map title="Test Map"> |
<map title="Test Map"> |
151 |
<projection epsg="32627" name="WGS 84 / UTM zone 27N"> |
<projection epsg="32627" name="WGS 84 / UTM zone 27N"> |
152 |
<parameter value="proj=utm"/> |
<parameter value="proj=utm"/> |
160 |
</map> |
</map> |
161 |
</session>''' |
</session>''' |
162 |
|
|
163 |
expected_contents = expected_template % \ |
expected_contents = expected_template % "true" |
|
(os.path.join("..", "..", "Data", "iceland", "political.shp"), |
|
|
"true") |
|
164 |
|
|
165 |
self.compare_xml(written_contents, expected_contents) |
self.compare_xml(written_contents, expected_contents) |
166 |
|
|
167 |
self.validate_data(written_contents) |
self.validate_data(written_contents) |
168 |
|
|
169 |
|
# Repeat with an invisible layer |
170 |
layer.SetVisible(False) |
layer.SetVisible(False) |
171 |
save_session(session, filename) |
save_session(session, filename) |
172 |
|
|
173 |
file = open(filename) |
file = open(filename) |
174 |
written_contents = file.read() |
written_contents = file.read() |
175 |
file.close() |
file.close() |
176 |
expected_contents = expected_template % \ |
expected_contents = expected_template % "false" |
|
(os.path.join("..", "..", "Data", "iceland", "political.shp"), |
|
|
"false") |
|
177 |
self.compare_xml(written_contents, expected_contents) |
self.compare_xml(written_contents, expected_contents) |
178 |
self.validate_data(written_contents) |
self.validate_data(written_contents) |
179 |
|
|
206 |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
207 |
<session title="single map&layer" |
<session title="single map&layer" |
208 |
xmlns="http://thuban.intevation.org/dtds/thuban-1.0-dev.dtd"> |
xmlns="http://thuban.intevation.org/dtds/thuban-1.0-dev.dtd"> |
209 |
<fileshapesource id="D1" filename="%s" filetype="shapefile"/> |
<fileshapesource id="D1" |
210 |
|
filename="../../Data/iceland/political.shp" |
211 |
|
filetype="shapefile"/> |
212 |
<map title="Test Map"> |
<map title="Test Map"> |
213 |
<projection name="Unknown"> |
<projection name="Unknown"> |
214 |
<parameter value="zone=26"/> |
<parameter value="zone=26"/> |
225 |
</projection> |
</projection> |
226 |
</layer> |
</layer> |
227 |
</map> |
</map> |
228 |
</session>''' % os.path.join("..", "..", "Data", "iceland", |
</session>''' |
|
"political.shp") |
|
229 |
#print written_contents |
#print written_contents |
230 |
#print "********************************************" |
#print "********************************************" |
231 |
#print expected_contents |
#print expected_contents |
256 |
<session title="single map&layer" |
<session title="single map&layer" |
257 |
xmlns="http://thuban.intevation.org/dtds/thuban-1.0-dev.dtd"> |
xmlns="http://thuban.intevation.org/dtds/thuban-1.0-dev.dtd"> |
258 |
<map title="Test Map"> |
<map title="Test Map"> |
259 |
<rasterlayer title="My RasterLayer" filename="%s" |
<rasterlayer title="My RasterLayer" |
260 |
visible="true"> |
filename="../../Data/iceland/island.tif" |
261 |
|
visible="true"> |
262 |
</rasterlayer> |
</rasterlayer> |
263 |
</map> |
</map> |
264 |
</session>''' % os.path.join(os.pardir, os.pardir, "Data", "iceland", |
</session>''' |
|
"island.tif") |
|
265 |
#print written_contents |
#print written_contents |
266 |
#print "********************************************" |
#print "********************************************" |
267 |
#print expected_contents |
#print expected_contents |
318 |
file = open(filename) |
file = open(filename) |
319 |
written_contents = file.read() |
written_contents = file.read() |
320 |
file.close() |
file.close() |
321 |
expected_template = '''<?xml version="1.0" encoding="UTF-8"?> |
expected_contents = '''<?xml version="1.0" encoding="UTF-8"?> |
322 |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
323 |
<session title="Map with Classifications" |
<session title="Map with Classifications" |
324 |
xmlns="http://thuban.intevation.org/dtds/thuban-1.0-dev.dtd"> |
xmlns="http://thuban.intevation.org/dtds/thuban-1.0-dev.dtd"> |
325 |
<fileshapesource id="D1" filename="%s" filetype="shapefile"/> |
<fileshapesource id="D1" |
326 |
|
filename="../../Data/iceland/political.shp" |
327 |
|
filetype="shapefile"/> |
328 |
<map title="Test Map"> |
<map title="Test Map"> |
329 |
<projection name="Unknown"> |
<projection name="Unknown"> |
330 |
<parameter value="zone=26"/> |
<parameter value="zone=26"/> |
332 |
<parameter value="ellps=clrk66"/> |
<parameter value="ellps=clrk66"/> |
333 |
</projection> |
</projection> |
334 |
<layer title="My Layer" shapestore="D1" |
<layer title="My Layer" shapestore="D1" |
335 |
fill="None" stroke="#000000" stroke_width="1" visible="%s"> |
fill="None" stroke="#000000" stroke_width="1" visible="true"> |
336 |
<classification field="AREA" field_type="double"> |
<classification field="AREA" field_type="double"> |
337 |
<clnull label=""> |
<clnull label=""> |
338 |
<cldata fill="None" stroke="#000000" stroke_width="1"/> |
<cldata fill="None" stroke="#000000" stroke_width="1"/> |
366 |
</map> |
</map> |
367 |
</session>''' |
</session>''' |
368 |
|
|
|
expected_contents = expected_template % \ |
|
|
(os.path.join("..", "..", "Data", "iceland", "political.shp"), |
|
|
"true") |
|
|
|
|
369 |
#print written_contents |
#print written_contents |
370 |
#print "********************************************" |
#print "********************************************" |
371 |
#print expected_contents |
#print expected_contents |
389 |
file = open(filename) |
file = open(filename) |
390 |
written_contents = file.read() |
written_contents = file.read() |
391 |
file.close() |
file.close() |
392 |
expected_template = '''<?xml version="1.0" encoding="UTF-8"?> |
expected_contents = '''<?xml version="1.0" encoding="UTF-8"?> |
393 |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
394 |
<session title="a DBF Table session" |
<session title="a DBF Table session" |
395 |
xmlns="http://thuban.intevation.org/dtds/thuban-1.0-dev.dtd"> |
xmlns="http://thuban.intevation.org/dtds/thuban-1.0-dev.dtd"> |
396 |
<filetable id="D1" filename="%s" filetype="DBF" title="political"/> |
<filetable id="D1" filename="../../Data/iceland/political.dbf" |
397 |
|
filetype="DBF" title="political"/> |
398 |
</session>''' |
</session>''' |
399 |
|
|
|
expected_contents = (expected_template |
|
|
% os.path.join(os.pardir, os.pardir, "Data", |
|
|
"iceland", "political.dbf")) |
|
400 |
self.compare_xml(written_contents, expected_contents) |
self.compare_xml(written_contents, expected_contents) |
401 |
self.validate_data(written_contents) |
self.validate_data(written_contents) |
402 |
|
|
447 |
file = open(filename) |
file = open(filename) |
448 |
written_contents = file.read() |
written_contents = file.read() |
449 |
file.close() |
file.close() |
450 |
expected_template = '''<?xml version="1.0" encoding="UTF-8"?> |
expected_contents = '''<?xml version="1.0" encoding="UTF-8"?> |
451 |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
452 |
<session title="A Joined Table session" |
<session title="A Joined Table session" |
453 |
xmlns="http://thuban.intevation.org/dtds/thuban-1.0-dev.dtd"> |
xmlns="http://thuban.intevation.org/dtds/thuban-1.0-dev.dtd"> |
454 |
<fileshapesource filename="%(shpfile)s" |
<fileshapesource filename="../../Data/iceland/roads-line.shp" |
455 |
filetype="shapefile" id="D142197204"/> |
filetype="shapefile" id="D142197204"/> |
456 |
<filetable filename="%(dbffile)s" |
<filetable filename="save_joinedtable.dbf" |
457 |
title="save_joinedtable" |
title="save_joinedtable" |
458 |
filetype="DBF" id="D141881756"/> |
filetype="DBF" id="D141881756"/> |
459 |
<jointable id="D142180284" |
<jointable id="D142180284" |
471 |
</map> |
</map> |
472 |
</session>''' |
</session>''' |
473 |
|
|
|
expected_contents = expected_template % { |
|
|
"dbffile": relative_filename(self.temp_dir(), dbffile), |
|
|
"shpfile": relative_filename(self.temp_dir(), shpfile) |
|
|
} |
|
474 |
self.compare_xml(written_contents, expected_contents) |
self.compare_xml(written_contents, expected_contents) |
475 |
self.validate_data(written_contents) |
self.validate_data(written_contents) |
476 |
finally: |
finally: |