Mercurial > mxd2map
comparison src/java/de/intevation/mxd/writer/MapScriptWriter.java @ 130:5991c1f90f91
Added data source "SDE" to writer.
author | vc11884admin@VC11884.win.bsh.de |
---|---|
date | Mon, 20 Jun 2011 16:01:17 +0200 |
parents | 0b119169618f |
children | 02df1dbc2166 |
comparison
equal
deleted
inserted
replaced
129:0b119169618f | 130:5991c1f90f91 |
---|---|
14 import edu.umn.gis.mapscript.layerObj; | 14 import edu.umn.gis.mapscript.layerObj; |
15 import edu.umn.gis.mapscript.classObj; | 15 import edu.umn.gis.mapscript.classObj; |
16 | 16 |
17 import edu.umn.gis.mapscript.MS_UNITS; | 17 import edu.umn.gis.mapscript.MS_UNITS; |
18 import edu.umn.gis.mapscript.MS_LAYER_TYPE; | 18 import edu.umn.gis.mapscript.MS_LAYER_TYPE; |
19 import edu.umn.gis.mapscript.MS_CONNECTION_TYPE; | |
19 | 20 |
20 import de.intevation.mxd.utils.XMLUtils; | 21 import de.intevation.mxd.utils.XMLUtils; |
21 | 22 |
22 /** | 23 /** |
23 * The Mapfile Writer. | 24 * The Mapfile Writer. |
37 * Private member. | 38 * Private member. |
38 */ | 39 */ |
39 private Document root; | 40 private Document root; |
40 private mapObj map; | 41 private mapObj map; |
41 private String mapFilename; | 42 private String mapFilename; |
43 private String MS_BINDIR = "c:/ms_6.1-dev/bin"; | |
42 | 44 |
43 public MapScriptWriter() { | 45 public MapScriptWriter() { |
44 map = new mapObj(""); | 46 map = new mapObj(""); |
45 mapFilename = ""; | 47 mapFilename = ""; |
46 } | 48 } |
177 layer.setType(MS_LAYER_TYPE.MS_LAYER_POLYGON); | 179 layer.setType(MS_LAYER_TYPE.MS_LAYER_POLYGON); |
178 } | 180 } |
179 layer.setTileitem(""); | 181 layer.setTileitem(""); |
180 | 182 |
181 //The layer datasource. | 183 //The layer datasource. |
182 String datasource = ""; | 184 String con_type = layerElement.getAttribute("connection_type"); |
183 if(layerElement.hasAttribute("workspace")) { | 185 if(con_type.equals("local")) { |
184 datasource = layerElement.getAttribute("workspace"); | 186 String datasource = ""; |
185 datasource += File.separator; | 187 if(layerElement.hasAttribute("workspace")) { |
186 } | 188 datasource = layerElement.getAttribute("workspace"); |
187 datasource += layerElement.getAttribute("data_source"); | 189 datasource += File.separator; |
188 layer.setData(datasource); | 190 } |
189 | 191 datasource += layerElement.getAttribute("data_source"); |
192 layer.setData(datasource); | |
193 } | |
194 else if(con_type.equals("SDE")) { | |
195 logger.info( | |
196 "SDE datasource found." + | |
197 " Please edit password in mapfile."); | |
198 layer.setConnectionType( | |
199 MS_CONNECTION_TYPE.MS_PLUGIN.swigValue(), | |
200 MS_BINDIR + "/ms/plugins/msplugin_sde_93.dll"); | |
201 layer.setConnection( | |
202 layerElement.getAttribute("server") + "," + | |
203 "port:" + layerElement.getAttribute("instance") + "," + | |
204 layerElement.getAttribute("database") + "," + | |
205 layerElement.getAttribute("user") + ",<PASSWORD>"); | |
206 layer.setData( | |
207 layerElement.getAttribute("data_source") + | |
208 ",SHAPE," + | |
209 layerElement.getAttribute("version")); | |
210 layer.setProcessing("CLOSE_CONNECTION=defer"); | |
211 layer.setProcessing("ATTRIBUTE_QUALIFIED=TRUE"); | |
212 layer.setProcessing( | |
213 "JOINTABLE=" + | |
214 layerElement.getAttribute("join_table")); | |
215 layer.setFilter( | |
216 "where " + | |
217 layerElement.getAttribute("definition_query") + | |
218 " AND " + | |
219 layerElement.getAttribute("join_table_target") + "." + | |
220 layerElement.getAttribute("join_field_target") + "=" + | |
221 layerElement.getAttribute("join_table") + "." + | |
222 layerElement.getAttribute("join_field")); | |
223 | |
224 } | |
190 layer.setTemplate("PleaseInsertAValidTemplateForGFI"); | 225 layer.setTemplate("PleaseInsertAValidTemplateForGFI"); |
191 //Write classes. | 226 //Write classes. |
192 writeClass(layer, layerElement); | 227 writeClass(layer, layerElement); |
193 } | 228 } |
194 | 229 |