changeset 7645:7e5d4a0d9bad

issue1020: Make WQKms able to build from WKms.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 05 Dec 2013 15:35:04 +0100
parents f2f34d722807
children f603a53e45dc
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/WQKms.java
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WQKms.java	Wed Dec 04 10:21:08 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WQKms.java	Thu Dec 05 15:35:04 2013 +0100
@@ -66,12 +66,26 @@
         this(kms, wq.getQs(), wq.getWs(), wq.getName(), wq.getReferenceSystem());
     }
 
+    public WQKms(TDoubleArrayList kms, TDoubleArrayList qs, TDoubleArrayList ws, String name) {
+        super(qs, ws, name);
+        this.kms = kms;
+        setReferenceSystem(0);
+    }
+
     public WQKms(double [] kms, double [] qs, double [] ws, String name, int wReferenceSystem) {
         super(qs, ws, name);
         this.kms = new TDoubleArrayList(kms);
         setReferenceSystem(wReferenceSystem);
     }
 
+    /** Create a WQKms from WKms, filling the Qs with given q. */
+    public static WQKms fromWKms(WKms wkms, double q) {
+        TDoubleArrayList qs = new TDoubleArrayList(wkms.allKms().size());
+        qs.fill(q);
+        WQKms wqkms = new WQKms(wkms.allKms(), qs, wkms.allWs(), wkms.getName());
+        return wqkms;
+    }
+
     @Override
     public void removeNaNs() {
         DoubleUtil.removeNaNs(new TDoubleArrayList [] { ws, qs, kms });

http://dive4elements.wald.intevation.org