1 |
# Copyright (c) 2001, 2002, 2003 by Intevation GmbH |
# Copyright (c) 2001-2004 by Intevation GmbH |
2 |
# Authors: |
# Authors: |
3 |
# Jan-Oliver Wagner <[email protected]> |
# Jan-Oliver Wagner <[email protected]> (2004) |
4 |
# Bernhard Herzog <[email protected]> |
# Bernhard Herzog <[email protected]> (2001-2004) |
5 |
# Jonathan Coles <[email protected]> |
# Jonathan Coles <[email protected]> (2003) |
6 |
|
# Frank Koormann <[email protected]> (2003) |
7 |
# |
# |
8 |
# This program is free software under the GPL (>=v2) |
# This program is free software under the GPL (>=v2) |
9 |
# Read the file COPYING coming with Thuban for details. |
# Read the file COPYING coming with Thuban for details. |
13 |
""" |
""" |
14 |
|
|
15 |
__version__ = "$Revision$" |
__version__ = "$Revision$" |
16 |
|
# $Source$ |
17 |
|
# $Id$ |
18 |
|
|
19 |
import os |
import os |
20 |
|
|
26 |
ClassGroupDefault, ClassGroupSingleton, ClassGroupRange, ClassGroupMap |
ClassGroupDefault, ClassGroupSingleton, ClassGroupRange, ClassGroupMap |
27 |
from Thuban.Model.transientdb import AutoTransientTable, TransientJoinedTable |
from Thuban.Model.transientdb import AutoTransientTable, TransientJoinedTable |
28 |
from Thuban.Model.table import DBFTable, FIELDTYPE_STRING |
from Thuban.Model.table import DBFTable, FIELDTYPE_STRING |
29 |
from Thuban.Model.data import DerivedShapeStore, ShapefileStore |
from Thuban.Model.data import DerivedShapeStore, ShapefileStore, \ |
30 |
|
SHAPETYPE_POINT |
31 |
|
|
32 |
from Thuban.Model.xmlwriter import XMLWriter |
from Thuban.Model.xmlwriter import XMLWriter |
33 |
from postgisdb import PostGISConnection, PostGISShapeStore |
from postgisdb import PostGISConnection, PostGISShapeStore |
135 |
def write(self, file_or_filename): |
def write(self, file_or_filename): |
136 |
XMLWriter.write(self, file_or_filename) |
XMLWriter.write(self, file_or_filename) |
137 |
|
|
138 |
self.write_header("session", "thuban-1.0.dtd") |
self.write_header("session", "thuban-1.1.dtd") |
139 |
self.write_session(self.session) |
self.write_session(self.session) |
140 |
self.close() |
self.close() |
141 |
|
|
162 |
attrs["xmlns:" + name] = uri |
attrs["xmlns:" + name] = uri |
163 |
# default name space |
# default name space |
164 |
attrs["xmlns"] = \ |
attrs["xmlns"] = \ |
165 |
"http://thuban.intevation.org/dtds/thuban-1.0rc1.dtd" |
"http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd" |
166 |
self.open_element("session", attrs) |
self.open_element("session", attrs) |
167 |
self.write_db_connections(session) |
self.write_db_connections(session) |
168 |
self.write_data_containers(session) |
self.write_data_containers(session) |
215 |
self.write_element("dbshapesource", |
self.write_element("dbshapesource", |
216 |
{"id": idvalue, |
{"id": idvalue, |
217 |
"dbconn": self.get_id(conn), |
"dbconn": self.get_id(conn), |
218 |
"tablename": container.TableName()}) |
"tablename": container.TableName(), |
219 |
|
"id_column": container.IDColumn().name, |
220 |
|
"geometry_column": |
221 |
|
container.GeometryColumn().name, |
222 |
|
}) |
223 |
elif isinstance(container, DBFTable): |
elif isinstance(container, DBFTable): |
224 |
filename = self.prepare_filename(container.FileName()) |
filename = self.prepare_filename(container.FileName()) |
225 |
self.write_element("filetable", |
self.write_element("filetable", |
348 |
'stroke_width': str(data.GetLineWidth()), |
'stroke_width': str(data.GetLineWidth()), |
349 |
'fill' : data.GetFill().hex()} |
'fill' : data.GetFill().hex()} |
350 |
|
|
351 |
|
# only for point layers write the size attribute |
352 |
|
if layer.ShapeType() == SHAPETYPE_POINT: |
353 |
|
dict['size'] = str(data.GetSize()) |
354 |
|
|
355 |
self.open_element(open_el) |
self.open_element(open_el) |
356 |
self.write_element("cldata", dict) |
self.write_element("cldata", dict) |
357 |
self.close_element(close_el) |
self.close_element(close_el) |