# HG changeset patch # User Felix Wolfsteller # Date 1379679764 -7200 # Node ID 39237f4985a705b399f8aff70c33058c3b6fff3c # Parent b17634649e6119460d3fa808780b60e41c17f3be issue1494: Spawn Q facet only if Q data is there. diff -r b17634649e61 -r 39237f4985a7 artifacts/src/main/java/org/dive4elements/river/artifacts/states/StaticWQKmsState.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/StaticWQKmsState.java Thu Sep 19 12:53:11 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/StaticWQKmsState.java Fri Sep 20 14:22:44 2013 +0200 @@ -10,6 +10,8 @@ import java.util.List; +import gnu.trove.TDoubleArrayList; + import org.apache.log4j.Logger; import org.dive4elements.artifacts.CallContext; @@ -79,18 +81,30 @@ name = STATIC_WQKMS; } */ + // Spawn Q Facet only if at least one discharge value + // is != -1 + boolean qEmpty = true; + TDoubleArrayList qs = wqkms.allQs(); + for (int i = 0; i < qs.size(); i++) { + if (qs.getQuick(i) != -1d) { + qEmpty = false; + break; + } + } String wkmsName = wqkms.getName(); - Facet qfacet = new WQKmsFacet( - STATIC_WQKMS_Q, - wkmsName - // TODO re-enable translations. - /* - Resources.getMsg( - metaLocale, - wkmsName, - wkmsName)*/); - facets.add(qfacet); + if (!qEmpty) { + Facet qfacet = new WQKmsFacet( + STATIC_WQKMS_Q, + wkmsName + // TODO re-enable translations. + /* + Resources.getMsg( + metaLocale, + wkmsName, + wkmsName)*/); + facets.add(qfacet); + } Facet rpFacet = new RelativePointFacet(wkmsName); facets.add(rpFacet);