Mercurial > dive4elements > river
changeset 5472:d7bb32f95220
merged.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 27 Mar 2013 15:59:30 +0100 (2013-03-27) |
parents | de3c77d35fef (current diff) 5b75dfc1b637 (diff) |
children | fcecf635b5e3 |
files | |
diffstat | 10 files changed, 149 insertions(+), 60 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/doc/conf/meta-data.xml Wed Mar 27 15:57:44 2013 +0100 +++ b/flys-artifacts/doc/conf/meta-data.xml Wed Mar 27 15:59:30 2013 +0100 @@ -1150,18 +1150,49 @@ </dc:macro> <dc:macro name="flood-map-qps"> <dc:context> + <dc:comment>Grab only the actual first</dc:comment> <dc:statement> - SELECT count(*) as km_exists - FROM cross_section_tracks WHERE river_id = ${river_id} + SELECT DISTINCT + cs.kind_id as kind_id, + ck.name as kind_name + FROM cross_section_tracks cs + JOIN cross_section_track_kinds ck on cs.kind_id = ck.id + WHERE river_id = ${river_id} + AND kind_id=1 </dc:statement> - <dc:elements> - <dc:if test="$km_exists>0"> - <qps> + <dc:if test="dc:has-result()"> + <dc:elements> + <actual> + <dc:attribute name="description" value="${kind_name}"/> <dc:attribute name="factory" value="wmsqpsfactory"/> - <dc:attribute name="ids" value="${river_id}"/> - </qps> - </dc:if> - </dc:elements> + <dc:attribute name="ids" value="${river_id};${kind_name};${kind_id}"/> + </actual> + </dc:elements> + </dc:if> + </dc:context> + <dc:context> + <dc:comment>Now the other tracks</dc:comment> + <dc:statement> + SELECT DISTINCT + cs.kind_id as kind_id, + ck.name as kind_name, + cs.name as layer_name + FROM cross_section_tracks cs + JOIN cross_section_track_kinds ck on cs.kind_id = ck.id + WHERE river_id = ${river_id} + AND kind_id=0 + </dc:statement> + <dc:if test="dc:has-result()"> + <other> + <dc:elements> + <misc-qps> + <dc:attribute name="description" value="${layer_name}"/> + <dc:attribute name="factory" value="wmsqpsfactory"/> + <dc:attribute name="ids" value="${river_id};${layer_name};${kind_id}"/> + </misc-qps> + </dc:elements> + </other> + </dc:if> </dc:context> </dc:macro> <dc:macro name="flood-map-hydr-boundaries"> @@ -1517,7 +1548,6 @@ </hws_points> </dc:macro> - <dc:macro name="flood-map-buildings"> <dc:context> <dc:statement> @@ -1527,7 +1557,7 @@ FROM buildings b JOIN building_kinds bk ON b.kind_id = bk.id WHERE b.river_id = ${river_id} - AND b.kind_id != 0 + AND b.kind_id <> 0 </dc:statement> <dc:elements> <buildings> @@ -1703,6 +1733,26 @@ </calculations> </uesk> </dc:macro> + + <dc:macro name="flood-map-catchments"> + <dc:attribute name="factory" value="externalwmsfactory"/> + <dc:attribute name="ids" value="http://geoportal.bafg.de/wmsproxy/INSPIRE/DrainageBasin;HY.PHYSICALWATERS.CATCHMENTS;Einzugsgebiet"/> + </dc:macro> + + <dc:macro name="flood-map-routing"> + <qps> + <dc:call-macro name="flood-map-qps"/> + </qps> + <riveraxis> + <dc:attribute name="factory" value="riveraxis"/> + <dc:attribute name="ids" value="${river_id}"/> + </riveraxis> + <dc:call-macro name="flood-map-km"/> + <fixpoints> + <dc:call-macro name="flood-map-fixpoints"/> + </fixpoints> + </dc:macro> + <dc:macro name="flood-map-complete"> <buildings> <dc:call-macro name="flood-map-buildings"/> @@ -1710,35 +1760,26 @@ <catchments> <dc:call-macro name="flood-map-catchments"/> </catchments> - <fixpoints> - <dc:call-macro name="flood-map-fixpoints"/> - </fixpoints> + <!-- TODO: HW-Marken --> + <hws> + <dc:call-macro name="hwslines"/> + <dc:call-macro name="hwspoints"/> + </hws> + <route_data> + <dc:call-macro name="flood-map-routing"/> + </route_data> <hydrboundaries> <dc:call-macro name="flood-map-hydr-boundaries"/> <dc:call-macro name="flood-map-floodplain"/> </hydrboundaries> - <kilometrage> - <riveraxis> - <dc:attribute name="factory" value="riveraxis"/> - <dc:attribute name="ids" value="${river_id}"/> - </riveraxis> - <dc:call-macro name="flood-map-km"/> - <dc:call-macro name="flood-map-qps"/> - </kilometrage> - <hws> - <dc:call-macro name="hwslines"/> - <dc:call-macro name="hwspoints"/> - </hws> <dc:call-macro name="flood-map-uesk"/> <gaugelocations> <dc:call-macro name="flood-map-gaugelocations"/> </gaugelocations> - <rastermap> - <background> - <dc:attribute name="factory" value="wmsbackground"/> - <dc:attribute name="ids" value="${river_id}"/> - </background> - </rastermap> + <background> + <dc:attribute name="factory" value="wmsbackground"/> + <dc:attribute name="ids" value="${river_id}"/> + </background> </dc:macro> </dc:if> <dc:if test="dc:contains($artifact-outs, 'minfo-heights')">
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSQPSArtifact.java Wed Mar 27 15:57:44 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSQPSArtifact.java Wed Mar 27 15:59:30 2013 +0100 @@ -77,26 +77,8 @@ private static final Logger logger = Logger.getLogger(WMSQPSState.class); - protected int riverId; - public WMSQPSState(WMSDBArtifact artifact) { super(artifact); - riverId = 0; - } - - public int getRiverId() { - if (riverId == 0) { - String ids = artifact.getDataAsString("ids"); - - try { - riverId = Integer.parseInt(ids); - } - catch (NumberFormatException nfe) { - logger.error("Cannot parse river id from '" + ids + "'"); - } - } - - return riverId; } @Override @@ -118,9 +100,20 @@ @Override protected Envelope getExtent(boolean reproject) { River river = RiverFactory.getRiver(getRiverId()); + List<CrossSectionTrack> qps; - List<CrossSectionTrack> qps = - CrossSectionTrack.getCrossSectionTrack(river.getName()); + String kind = getIdPart(2); + + if (kind != null && kind.equals("1")) { + qps = CrossSectionTrack.getCrossSectionTrack(river.getName(), + Integer.parseInt(kind)); + } else if (kind != null) { + qps = CrossSectionTrack.getCrossSectionTrack(river.getName(), + getName(), Integer.parseInt(kind)); + } else { + qps = CrossSectionTrack.getCrossSectionTrack(river.getName(), + getName()); + } Envelope max = null; @@ -142,7 +135,18 @@ @Override protected String getFilter() { - return "river_id=" + String.valueOf(getRiverId()); + String kind = getIdPart(2); + if (kind != null && kind.equals("1")) { + // There can be several layers named qps that differ in kind + return "river_id=" + String.valueOf(getRiverId()) + + " AND kind_id=" + kind; + } else if (kind != null) { + return "river_id=" + String.valueOf(getRiverId()) + + " AND kind_id=" + kind + + " AND name='" + getName() + "'"; + } + return "river_id=" + String.valueOf(getRiverId()) + + " AND name='" + getName() + "'"; } @Override
--- a/flys-backend/contrib/import_river.sh Wed Mar 27 15:57:44 2013 +0100 +++ b/flys-backend/contrib/import_river.sh Wed Mar 27 15:59:30 2013 +0100 @@ -156,9 +156,9 @@ fi GEW_FILE="$1" -RIVER_NAME=$(grep "Gew.sser" "$1" | awk '{print $2}') +RIVER_NAME=$(grep "Gew.sser" "$1" | sed 's/Gew.sser: //') DATE=$(date +%Y.%m.%d_%H%M) -LOG_DIR=${LOG}/${RIVER_NAME}-$DATE +LOG_DIR=${LOG}/`basename $GEW_FILE .gew`-$DATE mkdir -p ${LOG_DIR} if [ "$POSTGRES" = "TRUE" ]; then
--- a/flys-backend/doc/schema/oracle-minfo.sql Wed Mar 27 15:57:44 2013 +0100 +++ b/flys-backend/doc/schema/oracle-minfo.sql Wed Mar 27 15:59:30 2013 +0100 @@ -291,7 +291,7 @@ reference_gauge_name VARCHAR(64), observation_timerange_id NUMBER(38), operator VARCHAR(64), - description VARCHAR(512), + comment VARCHAR(512), PRIMARY KEY (id), CONSTRAINT fk_ms_river_id FOREIGN KEY (river_id) REFERENCES rivers(id) ON DELETE CASCADE, CONSTRAINT fk_ms_range_id FOREIGN KEY (range_id) REFERENCES ranges(id) ON DELETE CASCADE,
--- a/flys-backend/doc/schema/postgresql-minfo.sql Wed Mar 27 15:57:44 2013 +0100 +++ b/flys-backend/doc/schema/postgresql-minfo.sql Wed Mar 27 15:59:30 2013 +0100 @@ -291,7 +291,7 @@ reference_gauge_name VARCHAR(64), observation_timerange_id int, operator VARCHAR(64), - description VARCHAR(512), + comment VARCHAR(512), PRIMARY KEY (id), CONSTRAINT fk_ms_river_id FOREIGN KEY (river_id) REFERENCES rivers(id) ON DELETE CASCADE, CONSTRAINT fk_ms_range_id FOREIGN KEY (range_id) REFERENCES ranges(id) ON DELETE CASCADE,
--- a/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionTrack.java Wed Mar 27 15:57:44 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionTrack.java Wed Mar 27 15:59:30 2013 +0100 @@ -134,6 +134,41 @@ return query.list(); } + public static List<CrossSectionTrack> getCrossSectionTrack( + String river, + int kind_id + ) { + Session session = SessionHolder.HOLDER.get(); + + Query query = session.createQuery( + "from CrossSectionTrack as cst " + + " where river.name =:river" + + " and kind_id=:kind_id"); + query.setParameter("river", river); + query.setParameter("kind_id", kind_id); + + return query.list(); + } + + public static List<CrossSectionTrack> getCrossSectionTrack( + String river, + String name, + int kind_id + ) { + Session session = SessionHolder.HOLDER.get(); + + Query query = session.createQuery( + "from CrossSectionTrack as cst " + + " where river.name =:river" + + " and cst.name=:name" + + " and kind_id=:kind_id"); + query.setParameter("river", river); + query.setParameter("name", name); + query.setParameter("kind_id", kind_id); + + return query.list(); + } + /** * Returns the nearest CrossSectionTrack of <i>river</i> to a given
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Wed Mar 27 15:57:44 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Wed Mar 27 15:59:30 2013 +0100 @@ -1166,5 +1166,9 @@ String jetties(); + String route_data(); + + String other(); + } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Wed Mar 27 15:57:44 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Wed Mar 27 15:59:30 2013 +0100 @@ -462,6 +462,8 @@ hws_points = Points hws_fed_unknown = Unknown State jetties = Jetties +route_data = Route Data +other = Other startcolor = Colorrange start color endcolor = Colorrange end color
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Wed Mar 27 15:57:44 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Wed Mar 27 15:59:30 2013 +0100 @@ -463,6 +463,8 @@ hws_points = Punktdaten hws_fed_unknown = Unbekanntes Bundesland jetties = Buhnen +route_data = Streckendaten +other = Sonstige startcolor = Farbverlauf Startfarbe endcolor = Farbverlauf Endfarbe
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java Wed Mar 27 15:57:44 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java Wed Mar 27 15:59:30 2013 +0100 @@ -405,9 +405,10 @@ tree.setRoot(root); TreeNode[] nodes = tree.getChildren(root); - for (int i = 0; i < nodes.length; i++) { - if(!tree.hasChildren(nodes[i])) { - nodes[i].setIsFolder(true); + for (TreeNode node: nodes) { + if (node.getAttribute("factory") == null && + !tree.hasChildren(node)) { + node.setIsFolder(true); } }