Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/utils/RiverMapfileGenerator.java @ 9751:308a0d822d18 3.2.x
Keep configuration and data in distinct directories
This allows having distinct volumes for configuration and data
(artifact database, generated mapfiles and shapefiles, etc.).
While at it, cleanup MapServer configuration a little bit.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Tue, 11 Oct 2022 11:42:09 +0200 |
parents | afad1fac70fb |
children |
rev | line source |
---|---|
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5865
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5865
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5477
diff
changeset
|
9 package org.dive4elements.river.utils; |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
10 |
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
|
11 import com.vividsolutions.jts.geom.Envelope; |
5140
18ef819a7c92
Changed river axis from LineString to MultiLineString.
Raimund Renkert <rrenkert@intevation.de>
parents:
4843
diff
changeset
|
12 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
|
13 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5477
diff
changeset
|
14 import org.dive4elements.river.artifacts.model.LayerInfo; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5477
diff
changeset
|
15 import org.dive4elements.river.artifacts.model.RiverFactory; |
4843
88014b9852d0
Removed obsolete imports and dead code.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4841
diff
changeset
|
16 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5477
diff
changeset
|
17 import org.dive4elements.river.model.River; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5477
diff
changeset
|
18 import org.dive4elements.river.model.RiverAxis; |
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 java.io.File; |
9751
308a0d822d18
Keep configuration and data in distinct directories
Tom Gottfried <tom@intevation.de>
parents:
9738
diff
changeset
|
21 import java.io.IOException; |
4843
88014b9852d0
Removed obsolete imports and dead code.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4841
diff
changeset
|
22 |
4702
13abfb1bcb75
Fix typo in class names and correct file path in floodmap.xml.
Christian Lins <christian.lins@intevation.de>
parents:
4656
diff
changeset
|
23 import java.util.ArrayList; |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
24 import java.util.List; |
4843
88014b9852d0
Removed obsolete imports and dead code.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4841
diff
changeset
|
25 |
4841
ad0990a82ab8
Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents:
4809
diff
changeset
|
26 import java.util.regex.Pattern; |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
27 |
9726 | 28 import org.apache.logging.log4j.Logger; |
29 import org.apache.logging.log4j.LogManager; | |
4843
88014b9852d0
Removed obsolete imports and dead code.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4841
diff
changeset
|
30 |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
31 import org.apache.velocity.Template; |
5181
9d36ddf7dbd3
Change IllegalArgumentException to HibernateException.
Raimund Renkert <rrenkert@intevation.de>
parents:
5173
diff
changeset
|
32 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
|
33 |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
34 public class RiverMapfileGenerator extends MapfileGenerator { |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
35 |
9751
308a0d822d18
Keep configuration and data in distinct directories
Tom Gottfried <tom@intevation.de>
parents:
9738
diff
changeset
|
36 private static final String XPATH_RIVERMAP_VELOCITY_LOGFILE = |
308a0d822d18
Keep configuration and data in distinct directories
Tom Gottfried <tom@intevation.de>
parents:
9738
diff
changeset
|
37 "/artifact-database/rivermap/velocity/logfile/@path"; |
4703
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
38 |
9751
308a0d822d18
Keep configuration and data in distinct directories
Tom Gottfried <tom@intevation.de>
parents:
9738
diff
changeset
|
39 private static final String XPATH_RIVERMAP_MAPFILE_PATH = |
308a0d822d18
Keep configuration and data in distinct directories
Tom Gottfried <tom@intevation.de>
parents:
9738
diff
changeset
|
40 "/artifact-database/rivermap/mapfile/@path"; |
4703
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
41 |
9751
308a0d822d18
Keep configuration and data in distinct directories
Tom Gottfried <tom@intevation.de>
parents:
9738
diff
changeset
|
42 private static final String XPATH_RIVERMAP_MAPFILE_TEMPLATE = |
308a0d822d18
Keep configuration and data in distinct directories
Tom Gottfried <tom@intevation.de>
parents:
9738
diff
changeset
|
43 "/artifact-database/rivermap/map-template/@path"; |
4703
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
44 |
4841
ad0990a82ab8
Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents:
4809
diff
changeset
|
45 public static final Pattern DB_URL_PATTERN = |
ad0990a82ab8
Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents:
4809
diff
changeset
|
46 Pattern.compile("(.*)\\/\\/(.*):([0-9]+)\\/([a-zA-Z]+)"); |
ad0990a82ab8
Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents:
4809
diff
changeset
|
47 |
ad0990a82ab8
Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents:
4809
diff
changeset
|
48 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
|
49 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
|
50 |
9726 | 51 private static Logger log = LogManager.getLogger(RiverMapfileGenerator.class); |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
52 |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
53 /** |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
54 * Generate river axis mapfile. |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
55 */ |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
56 @Override |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
57 public void generate() { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7977
diff
changeset
|
58 log.debug("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
|
59 |
13abfb1bcb75
Fix typo in class names and correct file path in floodmap.xml.
Christian Lins <christian.lins@intevation.de>
parents:
4656
diff
changeset
|
60 List<River> rivers = RiverFactory.getRivers(); |
4703
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
61 List<String> riverFiles = new ArrayList<String>(); |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
62 |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
63 for (River river : rivers) { |
8747
e9d912c97fa8
We expect that every river has only one RiverAxis of kind 1
Tom Gottfried <tom@intevation.de>
parents:
8202
diff
changeset
|
64 RiverAxis riverAxis = null; |
5170
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
65 try { |
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
66 riverAxis = RiverAxis.getRiverAxis(river.getName()); |
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
67 } |
5181
9d36ddf7dbd3
Change IllegalArgumentException to HibernateException.
Raimund Renkert <rrenkert@intevation.de>
parents:
5173
diff
changeset
|
68 catch (HibernateException iae) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7977
diff
changeset
|
69 log.error("No valid riveraxis found for " + river.getName()); |
5170
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
70 continue; |
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
71 } |
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
72 |
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
|
73 if (riverAxis == null) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7977
diff
changeset
|
74 log.warn("River " + river.getName() + " has no river axis!"); |
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
|
75 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
|
76 } |
8747
e9d912c97fa8
We expect that every river has only one RiverAxis of kind 1
Tom Gottfried <tom@intevation.de>
parents:
8202
diff
changeset
|
77 if (riverAxis.getGeom() == null) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7977
diff
changeset
|
78 log.warn("River " + river.getName() + |
5170
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
79 " has no riveraxis geometry!"); |
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
80 continue; |
c1b60f8c3390
Made river mapfile generator more tolerant.
Raimund Renkert <rrenkert@intevation.de>
parents:
5148
diff
changeset
|
81 } |
8747
e9d912c97fa8
We expect that every river has only one RiverAxis of kind 1
Tom Gottfried <tom@intevation.de>
parents:
8202
diff
changeset
|
82 MultiLineString geom = riverAxis.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
|
83 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
|
84 |
4703
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
85 createRiverAxisLayer( |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
86 river.getName(), |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
87 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
|
88 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
|
89 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
|
90 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
|
91 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
|
92 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
|
93 |
4703
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
94 riverFiles.add("river-" + river.getName() + ".map"); |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
95 } |
4703
38ec171544de
Work on rivers.map Generator.
Christian Lins <christian.lins@intevation.de>
parents:
4702
diff
changeset
|
96 writeMapfile(riverFiles); |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
97 } |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
98 |
8856 | 99 protected void createRiverAxisLayer( |
100 String riverName, | |
101 int riverID, | |
102 String srid, | |
103 String extend | |
104 ) { | |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
105 LayerInfo layerInfo = new LayerInfo(); |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
106 layerInfo.setName(riverName); |
4841
ad0990a82ab8
Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents:
4809
diff
changeset
|
107 layerInfo.setConnection(MapUtils.getConnection()); |
ad0990a82ab8
Insert db connection into riveraxis map files.
Raimund Renkert <rrenkert@intevation.de>
parents:
4809
diff
changeset
|
108 layerInfo.setConnectionType(MapUtils.getConnectionType()); |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
109 layerInfo.setSrid(srid); |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
110 layerInfo.setExtent(extend); |
4738
d93748043cbc
Little work on the RiverMapfileGenerator.
Christian Lins <christian.lins@intevation.de>
parents:
4703
diff
changeset
|
111 layerInfo.setType("line"); |
5304
ffa5eaad3a7b
Fix river_axes maps when using oracle.
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
112 // FIXME: Use templates for that |
5865
73da40528cf2
River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
113 if (RiverUtils.isUsingOracle()) { |
5304
ffa5eaad3a7b
Fix river_axes maps when using oracle.
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
114 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
|
115 } else { |
ffa5eaad3a7b
Fix river_axes maps when using oracle.
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
116 layerInfo.setData("geom FROM river_axes"); |
ffa5eaad3a7b
Fix river_axes maps when using oracle.
Andre Heinecke <aheinecke@intevation.de>
parents:
5181
diff
changeset
|
117 } |
5477
ae60bb7b8085
Add proper handling of multiple river_axes for datacage and rivermapfile
Andre Heinecke <aheinecke@intevation.de>
parents:
5309
diff
changeset
|
118 layerInfo.setFilter("river_id = " + riverID + " and kind_id = 1"); |
4738
d93748043cbc
Little work on the RiverMapfileGenerator.
Christian Lins <christian.lins@intevation.de>
parents:
4703
diff
changeset
|
119 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
|
120 |
4738
d93748043cbc
Little work on the RiverMapfileGenerator.
Christian Lins <christian.lins@intevation.de>
parents:
4703
diff
changeset
|
121 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
|
122 if (template == null) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7977
diff
changeset
|
123 log.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
|
124 return; |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
125 } |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
126 |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
127 try { |
9751
308a0d822d18
Keep configuration and data in distinct directories
Tom Gottfried <tom@intevation.de>
parents:
9738
diff
changeset
|
128 File layerFile = new File( |
308a0d822d18
Keep configuration and data in distinct directories
Tom Gottfried <tom@intevation.de>
parents:
9738
diff
changeset
|
129 getShapefileBaseDir(), |
308a0d822d18
Keep configuration and data in distinct directories
Tom Gottfried <tom@intevation.de>
parents:
9738
diff
changeset
|
130 "river-" + riverName + ".map"); |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
131 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
|
132 } |
9751
308a0d822d18
Keep configuration and data in distinct directories
Tom Gottfried <tom@intevation.de>
parents:
9738
diff
changeset
|
133 catch (IOException e) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7977
diff
changeset
|
134 log.warn(e.getLocalizedMessage(), e); |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
135 } |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
136 } |
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
137 |
4656
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
138 @Override |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
139 protected String getVelocityLogfile() { |
5865
73da40528cf2
River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
140 return RiverUtils.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
|
141 } |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
142 |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
143 @Override |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
144 protected String getMapfilePath() { |
9751
308a0d822d18
Keep configuration and data in distinct directories
Tom Gottfried <tom@intevation.de>
parents:
9738
diff
changeset
|
145 return RiverUtils.getXPathString(RiverUtils.XPATH_MAPFILES_PATH) |
308a0d822d18
Keep configuration and data in distinct directories
Tom Gottfried <tom@intevation.de>
parents:
9738
diff
changeset
|
146 + "/" + RiverUtils.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
|
147 } |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
148 |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
149 @Override |
442fbb290fa8
Introduce river mapfile generation (WARNING: Changes in config xml files required!).
Christian Lins <christian.lins@intevation.de>
parents:
4654
diff
changeset
|
150 protected String getMapfileTemplate() { |
5865
73da40528cf2
River artifacts: Renamed FLYSUtils to RiverUtils.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
151 return RiverUtils.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
|
152 } |
4654
861c47e0a8a0
Refactor Mapserver mapfile generation.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
153 } |