Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/VelocityProcessor.java @ 8941:a9950a3a71e5
SINFO - tkh, configured result facets and themes
Configured datacages
author | gernotbelger |
---|---|
date | Wed, 07 Mar 2018 17:36:04 +0100 |
parents | 82998242ba84 |
children | 5d5d482da3e9 |
rev | line source |
---|---|
8940 | 1 /* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
2 * Software engineering by | |
3 * Björnsen Beratende Ingenieure GmbH | |
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt | |
5 * | |
6 * This file is Free Software under the GNU AGPL (>=v3) | |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
8 * documentation coming with Dive4Elements River for details. | |
9 */ | |
10 | |
11 package org.dive4elements.river.artifacts.sinfo.common; | |
12 | |
13 import java.util.HashSet; | |
14 import java.util.Set; | |
15 | |
16 import org.dive4elements.artifactdatabase.state.Facet; | |
17 import org.dive4elements.artifacts.CallContext; | |
18 import org.dive4elements.river.artifacts.resources.Resources; | |
19 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; | |
20 | |
21 public final class VelocityProcessor extends AbstractSInfoLineProcessor { | |
22 | |
8941
a9950a3a71e5
SINFO - tkh, configured result facets and themes
gernotbelger
parents:
8940
diff
changeset
|
23 // FIXME: check: filtered or not? |
a9950a3a71e5
SINFO - tkh, configured result facets and themes
gernotbelger
parents:
8940
diff
changeset
|
24 public static final String FACET_TKH_VELOCITY_FILTERED = "sinfo_facet_velocity.filtered"; |
8940 | 25 |
8941
a9950a3a71e5
SINFO - tkh, configured result facets and themes
gernotbelger
parents:
8940
diff
changeset
|
26 private static final String I18N_AXIS_LABEL = "sinfo.chart.tkh_velocity.section.yaxis.label"; |
8940 | 27 |
8941
a9950a3a71e5
SINFO - tkh, configured result facets and themes
gernotbelger
parents:
8940
diff
changeset
|
28 private static final String SINFO_CHART_VELOCITY_YAXIS_LABEL = "sinfo.chart.tkh_velocity.yaxis.label"; |
8940 | 29 |
30 private static final String I18N_FACET_TKH_VELOCITY_FILTERED_DESCRIPTION = "sinfo.facet.tkh_velocity.filtered.description"; | |
31 | |
32 private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>(); | |
33 | |
34 static { | |
35 HANDLED_FACET_TYPES.add(FACET_TKH_VELOCITY_FILTERED); | |
36 } | |
37 | |
38 public VelocityProcessor() { | |
39 super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES); | |
40 } | |
41 | |
42 @Override | |
43 protected double[][] doGetPoints(final AbstractSInfoCalculationResult<?> data, final String facetName) { | |
44 | |
45 if (FACET_TKH_VELOCITY_FILTERED.contentEquals(facetName)) | |
46 return data.getVelocityPoints(); | |
47 | |
48 final String error = String.format("Unknown facet name: %s", facetName); | |
49 throw new UnsupportedOperationException(error); | |
50 } | |
51 | |
52 public static Facet createVelocityFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult<?> result, | |
53 final int index) { | |
54 final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_TKH_VELOCITY_FILTERED_DESCRIPTION, | |
55 I18N_FACET_TKH_VELOCITY_FILTERED_DESCRIPTION, result.getLabel()); | |
56 return new SInfoResultFacet(index, VelocityProcessor.FACET_TKH_VELOCITY_FILTERED, facetFlowDepthFilteredDescription, SINFO_CHART_VELOCITY_YAXIS_LABEL, | |
57 ComputeType.ADVANCE, id, hash); | |
58 } | |
59 } |