Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/utils/RiverMapfileGenerator.java @ 5319:0324a5dfdfef
Added tag 2.9.13 for changeset 7fa94b793cbe
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 15 Mar 2013 10:15:33 +0100 |
parents | b55975761708 |
children | ae60bb7b8085 |
rev | line source |
---|---|
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.utils; |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
2 |
4809
8062b571884d
Bugs in generated RiverAxis Mapfile fixed. Now the river axes are drawn by the WMS.
Christian Lins <christian.lins@intevation.de>
parents:
4738
diff
changeset
|
3 import com.vividsolutions.jts.geom.Envelope; |
5140
18ef819a7c92
Changed river axis from LineString to MultiLineString.
Raimund Renkert <rrenkert@intevation.de>
parents:
4843
diff
changeset
|
4 import com.vividsolutions.jts.geom.MultiLineString; |
4809
8062b571884d
Bugs in generated RiverAxis Mapfile fixed. Now the river axes are drawn by the WMS.
Christian Lins <christian.lins@intevation.de>
parents:
4738
diff
changeset
|
5 |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.flys.artifacts.model.LayerInfo; |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.flys.artifacts.model.RiverFactory; |
4843
88014b9852d0
Removed obsolete imports and dead code.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4841
diff
changeset
|
8 |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.flys.model.River; |
4809
8062b571884d
Bugs in generated RiverAxis Mapfile fixed. Now the river axes are drawn by the WMS.
Christian Lins <christian.lins@intevation.de>
parents:
4738
diff
changeset
|
10 import de.intevation.flys.model.RiverAxis; |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
11 |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
12 import java.io.File; |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
13 import java.io.FileNotFoundException; |
4843
88014b9852d0
Removed obsolete imports and dead code.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4841
diff
changeset
|
14 |
4702
13abfb1bcb75
Fix typo in class names and correct file path in floodmap.xml.
Christian Lins <christian.lins@intevation.de>
parents:
4656
diff
changeset
|
15 import java.util.ArrayList; |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
16 import java.util.List; |
4843
88014b9852d0
Removed obsolete imports and dead code.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4841
diff
changeset
|
17 |
4841
ad0990a82ab8
Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents:
4809
diff
changeset
|
18 import java.util.regex.Pattern; |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
19 |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
20 import org.apache.log4j.Logger; |
4843
88014b9852d0
Removed obsolete imports and dead code.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4841
diff
changeset
|
21 |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
22 import org.apache.velocity.Template; |
5181
9d36ddf7dbd3
Change IllegalArgumentException to HibernateException.
Raimund Renkert <rrenkert@intevation.de>
parents:
5173
diff
changeset
|
23 import org.hibernate.HibernateException; |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
24 |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
25 public class RiverMapfileGenerator extends MapfileGenerator { |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
26 |
4703
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
27 public static final String XPATH_RIVERMAP_RIVER_PROJECTION = |
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
28 "/artifact-database/rivermap/river[@name=$name]/srid/@value"; |
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
29 |
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
30 public static final String XPATH_RIVERMAP_SHAPEFILE_DIR = |
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
31 "/artifact-database/rivermap/shapefile-path/@value"; |
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
32 |
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
33 public static final String XPATH_RIVERMAP_VELOCITY_LOGFILE = |
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
34 "/artifact-database/rivermap/velocity/logfile/@path"; |
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
35 |
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
36 public static final String XPATH_RIVERMAP_MAPSERVER_URL = |
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
37 "/artifact-database/rivermap/mapserver/server/@path"; |
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
38 |
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
39 public static final String XPATH_RIVERMAP_MAPFILE_PATH = |
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
40 "/artifact-database/rivermap/mapserver/mapfile/@path"; |
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
41 |
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
42 public static final String XPATH_RIVERMAP_MAPFILE_TEMPLATE = |
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
43 "/artifact-database/rivermap/mapserver/map-template/@path"; |
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
44 |
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
45 public static final String XPATH_RIVERMAP_MAPSERVER_TEMPLATE_PATH = |
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
46 "/artifact-database/rivermap/mapserver/templates/@path"; |
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
47 |
4841
ad0990a82ab8
Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents:
4809
diff
changeset
|
48 public static final Pattern DB_URL_PATTERN = |
ad0990a82ab8
Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents:
4809
diff
changeset
|
49 Pattern.compile("(.*)\\/\\/(.*):([0-9]+)\\/([a-zA-Z]+)"); |
ad0990a82ab8
Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents:
4809
diff
changeset
|
50 |
ad0990a82ab8
Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents:
4809
diff
changeset
|
51 public static final Pattern DB_PSQL_URL_PATTERN = |
ad0990a82ab8
Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents:
4809
diff
changeset
|
52 Pattern.compile("(.*)\\/\\/(.*):([0-9]+)\\/([a-zA-Z0-9]+)"); |
ad0990a82ab8
Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents:
4809
diff
changeset
|
53 |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
54 private static Logger logger = Logger.getLogger(RiverMapfileGenerator.class); |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
55 |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
56 /** |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
57 * Generate river axis mapfile. |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
58 */ |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
59 @Override |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
60 public void generate() { |
4702
13abfb1bcb75
Fix typo in class names and correct file path in floodmap.xml.
Christian Lins <christian.lins@intevation.de>
parents:
4656
diff
changeset
|
61 logger.debug("generate()"); |
13abfb1bcb75
Fix typo in class names and correct file path in floodmap.xml.
Christian Lins <christian.lins@intevation.de>
parents:
4656
diff
changeset
|
62 |
13abfb1bcb75
Fix typo in class names and correct file path in floodmap.xml.
Christian Lins <christian.lins@intevation.de>
parents:
4656
diff
changeset
|
63 List<River> rivers = RiverFactory.getRivers(); |
4703
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
64 List<String> riverFiles = new ArrayList<String>(); |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
65 |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
66 for (River river : rivers) { |
4809
8062b571884d
Bugs in generated RiverAxis Mapfile fixed. Now the river axes are drawn by the WMS.
Christian Lins <christian.lins@intevation.de>
parents:
4738
diff
changeset
|
67 // We expect that every river has only one RiverAxis. |
8062b571884d
Bugs in generated RiverAxis Mapfile fixed. Now the river axes are drawn by the WMS.
Christian Lins <christian.lins@intevation.de>
parents:
4738
diff
changeset
|
68 // This is not correct but currently the case here, see |
8062b571884d
Bugs in generated RiverAxis Mapfile fixed. Now the river axes are drawn by the WMS.
Christian Lins <christian.lins@intevation.de>
parents:
4738
diff
changeset
|
69 // RiverAxis.java. |
5170
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
70 List<RiverAxis> riverAxis = null; |
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
71 try { |
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
72 riverAxis = RiverAxis.getRiverAxis(river.getName()); |
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
73 } |
5181
9d36ddf7dbd3
Change IllegalArgumentException to HibernateException.
Raimund Renkert <rrenkert@intevation.de>
parents:
5173
diff
changeset
|
74 catch (HibernateException iae) { |
5170
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
75 logger.error("No valid riveraxis found for " + river.getName()); |
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
76 continue; |
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
77 } |
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
78 |
4809
8062b571884d
Bugs in generated RiverAxis Mapfile fixed. Now the river axes are drawn by the WMS.
Christian Lins <christian.lins@intevation.de>
parents:
4738
diff
changeset
|
79 if (riverAxis == null) { |
8062b571884d
Bugs in generated RiverAxis Mapfile fixed. Now the river axes are drawn by the WMS.
Christian Lins <christian.lins@intevation.de>
parents:
4738
diff
changeset
|
80 logger.warn("River " + river.getName() + " has no river axis!"); |
8062b571884d
Bugs in generated RiverAxis Mapfile fixed. Now the river axes are drawn by the WMS.
Christian Lins <christian.lins@intevation.de>
parents:
4738
diff
changeset
|
81 continue; |
8062b571884d
Bugs in generated RiverAxis Mapfile fixed. Now the river axes are drawn by the WMS.
Christian Lins <christian.lins@intevation.de>
parents:
4738
diff
changeset
|
82 } |
5170
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
83 if (riverAxis.get(0).getGeom() == null) { |
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
84 logger.warn("River " + river.getName() + |
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
85 " has no riveraxis geometry!"); |
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
86 continue; |
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
87 } |
5140
18ef819a7c92
Changed river axis from LineString to MultiLineString.
Raimund Renkert <rrenkert@intevation.de>
parents:
4843
diff
changeset
|
88 MultiLineString geom = riverAxis.get(0).getGeom(); |
4809
8062b571884d
Bugs in generated RiverAxis Mapfile fixed. Now the river axes are drawn by the WMS.
Christian Lins <christian.lins@intevation.de>
parents:
4738
diff
changeset
|
89 Envelope extent = geom.getEnvelopeInternal(); |
8062b571884d
Bugs in generated RiverAxis Mapfile fixed. Now the river axes are drawn by the WMS.
Christian Lins <christian.lins@intevation.de>
parents:
4738
diff
changeset
|
90 |
4703
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
91 createRiverAxisLayer( |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
92 river.getName(), |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
93 river.getId(), |
4809
8062b571884d
Bugs in generated RiverAxis Mapfile fixed. Now the river axes are drawn by the WMS.
Christian Lins <christian.lins@intevation.de>
parents:
4738
diff
changeset
|
94 Integer.toString(geom.getSRID()), |
8062b571884d
Bugs in generated RiverAxis Mapfile fixed. Now the river axes are drawn by the WMS.
Christian Lins <christian.lins@intevation.de>
parents:
4738
diff
changeset
|
95 extent.getMinX() + " " + |
8062b571884d
Bugs in generated RiverAxis Mapfile fixed. Now the river axes are drawn by the WMS.
Christian Lins <christian.lins@intevation.de>
parents:
4738
diff
changeset
|
96 extent.getMinY() + " " + |
8062b571884d
Bugs in generated RiverAxis Mapfile fixed. Now the river axes are drawn by the WMS.
Christian Lins <christian.lins@intevation.de>
parents:
4738
diff
changeset
|
97 extent.getMaxX() + " " + |
8062b571884d
Bugs in generated RiverAxis Mapfile fixed. Now the river axes are drawn by the WMS.
Christian Lins <christian.lins@intevation.de>
parents:
4738
diff
changeset
|
98 extent.getMaxY()); |
8062b571884d
Bugs in generated RiverAxis Mapfile fixed. Now the river axes are drawn by the WMS.
Christian Lins <christian.lins@intevation.de>
parents:
4738
diff
changeset
|
99 |
4703
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
100 riverFiles.add("river-" + river.getName() + ".map"); |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
101 } |
4703
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
102 writeMapfile(riverFiles); |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
103 } |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
104 |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
105 protected void createRiverAxisLayer(String riverName, int riverID, String srid, String extend) { |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
106 LayerInfo layerInfo = new LayerInfo(); |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
107 layerInfo.setName(riverName); |
4841
ad0990a82ab8
Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents:
4809
diff
changeset
|
108 layerInfo.setConnection(MapUtils.getConnection()); |
ad0990a82ab8
Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents:
4809
diff
changeset
|
109 layerInfo.setConnectionType(MapUtils.getConnectionType()); |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
110 layerInfo.setSrid(srid); |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
111 layerInfo.setExtent(extend); |
4738
d93748043cbc
Little work on the RiverMapfileGenerator.
Christian Lins <christian.lins@intevation.de>
parents:
4703
diff
changeset
|
112 layerInfo.setType("line"); |
5304
ffa5eaad3a7b
Fix river_axes maps when using oracle.
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
113 // FIXME: Use templates for that |
ffa5eaad3a7b
Fix river_axes maps when using oracle.
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
114 if (FLYSUtils.isUsingOracle()) { |
ffa5eaad3a7b
Fix river_axes maps when using oracle.
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
115 layerInfo.setData("geom FROM river_axes USING SRID " + srid); |
ffa5eaad3a7b
Fix river_axes maps when using oracle.
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
116 } else { |
ffa5eaad3a7b
Fix river_axes maps when using oracle.
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
117 layerInfo.setData("geom FROM river_axes"); |
ffa5eaad3a7b
Fix river_axes maps when using oracle.
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
118 } |
4738
d93748043cbc
Little work on the RiverMapfileGenerator.
Christian Lins <christian.lins@intevation.de>
parents:
4703
diff
changeset
|
119 layerInfo.setFilter("river_id = " + riverID); |
d93748043cbc
Little work on the RiverMapfileGenerator.
Christian Lins <christian.lins@intevation.de>
parents:
4703
diff
changeset
|
120 layerInfo.setTitle(riverName + " RiverAxis"); |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
121 |
4703
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
122 File layerFile = new File("river-" + riverName + ".map"); |
4738
d93748043cbc
Little work on the RiverMapfileGenerator.
Christian Lins <christian.lins@intevation.de>
parents:
4703
diff
changeset
|
123 Template template = getTemplateByName("riveraxis-layer.vm"); |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
124 if (template == null) { |
4738
d93748043cbc
Little work on the RiverMapfileGenerator.
Christian Lins <christian.lins@intevation.de>
parents:
4703
diff
changeset
|
125 logger.warn("Template riveraxis-layer.vm not found."); |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
126 return; |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
127 } |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
128 |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
129 try { |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
130 writeLayer(layerInfo, layerFile, template); |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
131 } |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
132 catch (FileNotFoundException e) { |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
133 logger.warn(e.getLocalizedMessage(), e); |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
134 } |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
135 } |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
136 |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
137 @Override |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
138 protected String getVelocityLogfile() { |
4703
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
139 return FLYSUtils.getXPathString(XPATH_RIVERMAP_VELOCITY_LOGFILE); |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
140 } |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
141 |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
142 @Override |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
143 protected String getMapserverTemplatePath() { |
4703
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
144 return FLYSUtils.getXPathString(XPATH_RIVERMAP_MAPSERVER_TEMPLATE_PATH); |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
145 } |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
146 |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
147 @Override |
5309
b55975761708
Changed visiblitiy of some methods. TODO: A lot of refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
5304
diff
changeset
|
148 public String getMapserverUrl() { |
4703
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
149 return FLYSUtils.getXPathString(XPATH_RIVERMAP_MAPSERVER_URL); |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
150 } |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
151 |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
152 @Override |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
153 protected String getMapfilePath() { |
4703
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
154 return FLYSUtils.getXPathString(XPATH_RIVERMAP_MAPFILE_PATH); |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
155 } |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
156 |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
157 @Override |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
158 protected String getMapfileTemplate() { |
4703
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
159 return FLYSUtils.getXPathString(XPATH_RIVERMAP_MAPFILE_TEMPLATE); |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
160 } |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
161 } |