changeset 9627:f51e23eb036a

zu pos 20
author dnt_bjoernsen <d.tironi@bjoernsen.de>
date Mon, 14 Oct 2019 16:27:31 +0200
parents ad852be69900
children bc50ecfc58c5
files artifacts/doc/conf/backend-db.xml artifacts/doc/conf/floodmap.xml artifacts/doc/conf/meta-data.xml artifacts/doc/conf/seddb-db.xml artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/Fitting.java artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodInfrastructure.java artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/RiversideRadioChoice.java artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/VegetationWmsResource.java artifacts/src/main/resources/messages.properties artifacts/src/main/resources/messages_de.properties gwt-client/src/main/java/org/dive4elements/river/client/server/auth/was/Authenticator.java
diffstat 11 files changed, 52 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/doc/conf/backend-db.xml	Mon Oct 14 12:55:07 2019 +0200
+++ b/artifacts/doc/conf/backend-db.xml	Mon Oct 14 16:27:31 2019 +0200
@@ -5,7 +5,7 @@
     <password>d4e</password>
     <dialect>org.hibernate.dialect.PostgreSQLDialect</dialect>
     <driver>org.postgresql.Driver</driver>
-    <url>jdbc:postgresql://localhost:5432/d4e</url>
+    <url>jdbc:postgresql://localhost:63333/d4e2</url>
     <validation-query>select 1 from rivers</validation-query>
     <max-wait>30000</max-wait>
 </backend-database>
--- a/artifacts/doc/conf/floodmap.xml	Mon Oct 14 12:55:07 2019 +0200
+++ b/artifacts/doc/conf/floodmap.xml	Mon Oct 14 16:27:31 2019 +0200
@@ -16,5 +16,16 @@
         <srid value="31467"/>
         <river-wms url="http://localhost:8081/cgi-bin/river-wms" layers="Beispielfluss"/>
         <background-wms url="http://osm.intevation.de/bfg/service?" layers="OSM-WMS-Dienst"/>
-    </river> 
+    </river>
+	<river name="Elbe">
+		<srid value="31467"/>
+		<river-wms url="http://localhost:8081/cgi-bin/flys-default/river-wms" layers="Elbe"/>
+		<background-wms url="http://ows.terrestris.de/osm/service?" layers="OSM-WMS"/>
+	</river>
+	<river name="Rhein">
+		<srid value="31467"/>
+		<river-wms url="http://localhost:8081/cgi-bin/flys-default/river-wms" layers="Rhein"/>
+		<background-wms url="http://ows.terrestris.de/osm/service?" layers="OSM-WMS"/>
+	</river>
+    
 </floodmap>
--- a/artifacts/doc/conf/meta-data.xml	Mon Oct 14 12:55:07 2019 +0200
+++ b/artifacts/doc/conf/meta-data.xml	Mon Oct 14 16:27:31 2019 +0200
@@ -1414,9 +1414,8 @@
       </uinfo>
     </dc:macro>
 
-    <!-- XXXXXXX -->
     <dc:macro name="predefined_infrastructures">
-      <infrastructures TODO="i10n">
+      <sinfo.flood_duration.infrastructures>
         <dc:choose>
           <dc:when test="dc:contains($riverside, 'left')">
             <dc:context connection="system">
@@ -1441,7 +1440,7 @@
             </dc:context>
           </dc:otherwise>
         </dc:choose>
-      </infrastructures>
+      </sinfo.flood_duration.infrastructures>
     </dc:macro>
     
     <dc:macro name="infrastructures_groups_fill">
--- a/artifacts/doc/conf/seddb-db.xml	Mon Oct 14 12:55:07 2019 +0200
+++ b/artifacts/doc/conf/seddb-db.xml	Mon Oct 14 16:27:31 2019 +0200
@@ -5,7 +5,7 @@
     <password>seddb</password>
     <dialect>org.hibernate.dialect.PostgreSQLDialect</dialect>
     <driver>org.postgresql.Driver</driver>
-    <url>jdbc:postgresql://localhost:5432/seddb</url>
+    <url>jdbc:postgresql://localhost:63333/seddb2</url>
     <validation-query>select 1 from gewaesser</validation-query>
     <max-wait>30000</max-wait>
     <!--
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/Fitting.java	Mon Oct 14 12:55:07 2019 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/Fitting.java	Mon Oct 14 16:27:31 2019 +0200
@@ -23,6 +23,9 @@
 public class Fitting {
     private static Logger log = Logger.getLogger(Fitting.class);
 
+    private static double[] previousParameters = null; // new double[] { Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE }; Dann schlägt die
+                                                       // Kurvenanpassung fehl! Gernot hat recht!
+
     /** Use instance of this factory to find meta infos for outliers. */
     public interface QWDFactory {
         QWD create(double q, double w, double deltaW, boolean isOutlier);
@@ -121,10 +124,13 @@
                     for (final FittingData fittingData : data)
                         cf.addObservedPoint(fittingData.q, fittingData.w);
 
-                    parameters = cf.fit(function, function.getInitialGuess());
+                    parameters = cf.fit(function, // previousParameters != null ? previousParameters :
+                            function.getInitialGuess());
+
                     break;
                 }
                 catch (final MathException me) {
+
                     if (log.isDebugEnabled()) {
                         log.debug("tolerance " + tolerance + " + failed.", me);
                     }
@@ -140,7 +146,7 @@
                  */
                 return null;
             }
-
+            previousParameters = parameters;
             // This is the parameterized function for a given km.
             instance = function.instantiate(parameters);
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodInfrastructure.java	Mon Oct 14 12:55:07 2019 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodInfrastructure.java	Mon Oct 14 16:27:31 2019 +0200
@@ -25,7 +25,7 @@
 
     private static final long serialVersionUID = 1L;
 
-    protected final String getDatakey() {
+    protected final static String getDatakey() {
         return "flood_infrastructure";
     }
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/RiversideRadioChoice.java	Mon Oct 14 12:55:07 2019 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/RiversideRadioChoice.java	Mon Oct 14 16:27:31 2019 +0200
@@ -8,10 +8,13 @@
 
 package org.dive4elements.river.artifacts.sinfo.flood_duration;
 
+import java.util.Collection;
 import java.util.LinkedHashMap;
 
+import org.dive4elements.artifactdatabase.data.StateData;
 import org.dive4elements.artifacts.Artifact;
 import org.dive4elements.artifacts.CallMeta;
+import org.dive4elements.river.artifacts.sinfo.SINFOArtifact;
 import org.dive4elements.river.artifacts.states.RadioSelect;
 import org.dive4elements.river.model.Attribute.AttributeKey;
 
@@ -59,9 +62,24 @@
         entries.put(RiversideChoiceKey.LEFT.getKey(), null);
         entries.put(RiversideChoiceKey.RIGHT.getKey(), null);
         entries.put(RiversideChoiceKey.BOTH.getKey(), null);
+
+        // remove infrastructures, because the values might be invalid
+        if (artifact instanceof SINFOArtifact)
+            removeInfrastructures((SINFOArtifact) artifact);
+
         return entries;
     }
 
+    private void removeInfrastructures(final SINFOArtifact artifact) {
+        final Collection<StateData> test = artifact.getAllData();
+
+        for (final StateData dataItem : test) {
+
+            if (dataItem.getName().equals(FloodInfrastructure.getDatakey()))
+                dataItem.setValue(null);
+        }
+    }
+
     @Override
     protected String getDatakey() {
         return "riverside";
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/VegetationWmsResource.java	Mon Oct 14 12:55:07 2019 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/VegetationWmsResource.java	Mon Oct 14 16:27:31 2019 +0200
@@ -57,8 +57,8 @@
             final Client client = new Client(new Context(), protocols);
             // FIXME
             /* Nachfolgende 2 Zeilen sind nur für die BCE-Entwicklungsumgebung bestimmt */
-            // client.getContext().getParameters().add("proxyHost", "proxy.bce01.de");
-            // client.getContext().getParameters().add("proxyPort", "8080");
+            client.getContext().getParameters().add("proxyHost", "proxy.bce01.de");
+            client.getContext().getParameters().add("proxyPort", "8080");
             return client;
         }
     };
--- a/artifacts/src/main/resources/messages.properties	Mon Oct 14 12:55:07 2019 +0200
+++ b/artifacts/src/main/resources/messages.properties	Mon Oct 14 16:27:31 2019 +0200
@@ -1071,6 +1071,7 @@
 sinfo.flood_duration.absolute.height.right = Absolute Height Infrastructures BWaStr (right)
 sinfo.flood_duration.infrastructures.left = Flooding Durations Infrastructures BWaStr (left)
 sinfo.flood_duration.infrastructures.right = Flooding Durations Infrastructures BWaStr (right)
+sinfo.flood_duration.infrastructures=Infrastructures
 
 sinfo.export.flow_depth_minmax.csv.header.min = Minimum Flow Depth
 sinfo.export.flow_depth_minmax.csv.header.max = Maximum Flow Depth
--- a/artifacts/src/main/resources/messages_de.properties	Mon Oct 14 12:55:07 2019 +0200
+++ b/artifacts/src/main/resources/messages_de.properties	Mon Oct 14 16:27:31 2019 +0200
@@ -1071,6 +1071,7 @@
 sinfo.flood_duration.absolute.height.right = Absolute H\u00f6he Infrastrukturen BWaStr (rechts)
 sinfo.flood_duration.infrastructures.left = \u00dcberflutungsdauern Infrastrukturen BWaStr (links)
 sinfo.flood_duration.infrastructures.right = \u00dcberflutungsdauern Infrastrukturen BWaStr (rechts)
+sinfo.flood_duration.infrastructures=Infrastrukturen
 
 sinfo.export.flow_depth_minmax.csv.header.min = Minimale Flie\u00dftiefe
 sinfo.export.flow_depth_minmax.csv.header.max = Maximale Flie\u00dftiefe
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/was/Authenticator.java	Mon Oct 14 12:55:07 2019 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/was/Authenticator.java	Mon Oct 14 16:27:31 2019 +0200
@@ -13,9 +13,11 @@
 import javax.servlet.ServletContext;
 
 import org.apache.http.HttpEntity;
+import org.apache.http.HttpHost;
 import org.apache.http.HttpResponse;
 import org.apache.http.StatusLine;
 import org.apache.http.client.HttpClient;
+import org.apache.http.conn.params.ConnRoutePNames;
 import org.apache.http.conn.scheme.Scheme;
 import org.apache.http.conn.ssl.SSLSocketFactory;
 import org.apache.http.impl.client.DefaultHttpClient;
@@ -49,6 +51,9 @@
 
                 Request httpget = new Request("https://geoportal.bafg.de/" +
                         "administration/WAS", username, password, encoding);
+                HttpHost proxy = new HttpHost("proxy.bce01.de",8080);
+                httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,proxy); 
+
                 HttpResponse response = httpclient.execute(httpget);
                 StatusLine stline = response.getStatusLine();
                 if (stline.getStatusCode() != 200) {

http://dive4elements.wald.intevation.org