Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineState.java @ 9426:b6e595f1696f
Activated cross section output mode for salix line and implemented some themes preliminary.
author | gernotbelger |
---|---|
date | Fri, 17 Aug 2018 15:31:16 +0200 |
parents | 6f7e92c16050 |
children | bd5f5d2220fa |
comparison
equal
deleted
inserted
replaced
9425:3f49835a00c3 | 9426:b6e595f1696f |
---|---|
15 import org.dive4elements.artifacts.CallContext; | 15 import org.dive4elements.artifacts.CallContext; |
16 import org.dive4elements.river.artifacts.ChartArtifact; | 16 import org.dive4elements.river.artifacts.ChartArtifact; |
17 import org.dive4elements.river.artifacts.D4EArtifact; | 17 import org.dive4elements.river.artifacts.D4EArtifact; |
18 import org.dive4elements.river.artifacts.model.Calculation; | 18 import org.dive4elements.river.artifacts.model.Calculation; |
19 import org.dive4elements.river.artifacts.model.CalculationResult; | 19 import org.dive4elements.river.artifacts.model.CalculationResult; |
20 import org.dive4elements.river.artifacts.model.CrossSectionWaterLineFacet; | |
20 import org.dive4elements.river.artifacts.model.DataFacet; | 21 import org.dive4elements.river.artifacts.model.DataFacet; |
21 import org.dive4elements.river.artifacts.model.EmptyFacet; | 22 import org.dive4elements.river.artifacts.model.EmptyFacet; |
22 import org.dive4elements.river.artifacts.model.FacetTypes; | 23 import org.dive4elements.river.artifacts.model.FacetTypes; |
23 import org.dive4elements.river.artifacts.model.ReportFacet; | 24 import org.dive4elements.river.artifacts.model.ReportFacet; |
24 import org.dive4elements.river.artifacts.resources.Resources; | 25 import org.dive4elements.river.artifacts.resources.Resources; |
46 if (artifact instanceof ChartArtifact) { | 47 if (artifact instanceof ChartArtifact) { |
47 facets.add(new EmptyFacet()); | 48 facets.add(new EmptyFacet()); |
48 return null; | 49 return null; |
49 } | 50 } |
50 | 51 |
51 return compute((UINFOArtifact) artifact, context, hash, facets, old); | 52 return compute((UINFOArtifact) artifact, context, ComputeType.FEED, hash, facets, old); |
52 } | 53 } |
53 | 54 |
54 @Override | 55 @Override |
55 public Object computeAdvance(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { | 56 public Object computeAdvance(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { |
56 if (artifact instanceof ChartArtifact) { | 57 if (artifact instanceof ChartArtifact) { |
57 facets.add(new EmptyFacet()); | 58 facets.add(new EmptyFacet()); |
58 return null; | 59 return null; |
59 } | 60 } |
60 return compute((UINFOArtifact) artifact, context, hash, facets, old); | 61 return compute((UINFOArtifact) artifact, context, ComputeType.ADVANCE, hash, facets, old); |
61 } | 62 } |
62 | 63 |
63 /** | 64 /** |
64 * Compute result or returned object from cache, create facets. | 65 * Compute result or returned object from cache, create facets. |
65 * | 66 * |
66 * @param old | 67 * @param old |
67 * Object that was cached. | 68 * Object that was cached. |
68 */ | 69 */ |
69 private Object compute(final UINFOArtifact uinfo, final CallContext context, final String hash, final List<Facet> facets, final Object old) { | 70 private Object compute(final UINFOArtifact uinfo, final CallContext context, final ComputeType type, final String hash, final List<Facet> facets, |
71 final Object old) { | |
70 | 72 |
71 final CalculationResult res = doCompute(uinfo, context, old); | 73 final CalculationResult res = doCompute(uinfo, context, old); |
72 | 74 |
73 if (facets == null) | 75 if (facets == null) |
74 return res; | 76 return res; |
75 | 77 |
76 final SalixLineCalculationResults results = (SalixLineCalculationResults) res.getData(); | 78 final SalixLineCalculationResults results = (SalixLineCalculationResults) res.getData(); |
77 | 79 |
78 final List<SalixLineCalculationResult> resultList = results.getResults(); | 80 final List<SalixLineCalculationResult> resultList = results.getResults(); |
79 | 81 |
82 final String stateId = getID(); | |
83 | |
80 int facetIndex = 0; | 84 int facetIndex = 0; |
81 | 85 |
82 if (!resultList.isEmpty()) { | 86 if (!resultList.isEmpty()) { |
83 facets.add(SalixLineProcessor.createSalixLineFilteredFacet(context, hash, this.id, facetIndex++, 0)); | 87 facets.add(SalixLineProcessor.createSalixLineFilteredFacet(context, hash, stateId, facetIndex++, 0)); |
84 facets.add(SalixLineProcessor.createSalixLineRawFacet(context, hash, this.id, facetIndex++, 0)); | 88 facets.add(SalixLineProcessor.createSalixLineRawFacet(context, hash, stateId, facetIndex++, 0)); |
85 facets.add(SalixLineProcessor.createSalixMnwMwFilteredFacet(context, hash, this.id, facetIndex++, 0)); | 89 facets.add(SalixLineProcessor.createSalixMnwMwFilteredFacet(context, hash, stateId, facetIndex++, 0)); |
86 facets.add(SalixLineProcessor.createSalixMnwMwRawFacet(context, hash, this.id, facetIndex++, 0)); | 90 facets.add(SalixLineProcessor.createSalixMnwMwRawFacet(context, hash, stateId, facetIndex++, 0)); |
87 facets.add(SalixLineProcessor.createSalixRankFacet(context, hash, this.id, facetIndex++, 0)); | 91 facets.add(SalixLineProcessor.createSalixRankFacet(context, hash, stateId, facetIndex++, 0)); |
92 | |
93 facets.add(new CrossSectionWaterLineFacet(facetIndex++, "Salix Linie (!I10N!)", type, hash, stateId, SalixLineCrossSectionIndexData.salixLine())); | |
88 | 94 |
89 final SalixLineCalculationResult result = resultList.get(0); | 95 final SalixLineCalculationResult result = resultList.get(0); |
90 | 96 |
91 for (int i = 0; i <= result.getScenarioCount() - 1; i++) { | 97 for (int i = 0; i <= result.getScenarioCount() - 1; i++) { |
92 final String sublabel = Resources.getMsg(context.getMeta(), "uinfo_salix_scenario_deltaw", "uinfo_salix_scenario_deltaw", | 98 final String sublabel = Resources.getMsg(context.getMeta(), "uinfo_salix_scenario_deltaw", "uinfo_salix_scenario_deltaw", |
93 result.getScenarioLabel(i)); | 99 result.getScenarioLabel(i)); |
94 // REMARK: using data index as facetIndex, as we know there is only one result of this type. Else we should just | 100 // REMARK: using data index as facetIndex, as we know there is only one result of this type. Else we should just |
95 // increment | 101 // increment |
96 facets.add(SalixLineProcessor.createSalixScenarioFilteredFacet(context, hash, this.id, i, 0, facetIndex++, sublabel)); | 102 facets.add(SalixLineProcessor.createSalixScenarioFilteredFacet(context, hash, stateId, i, 0, facetIndex++, sublabel)); |
97 facets.add(SalixLineProcessor.createSalixScenarioRawFacet(context, hash, this.id, i, 0, facetIndex++, sublabel)); | 103 facets.add(SalixLineProcessor.createSalixScenarioRawFacet(context, hash, stateId, i, 0, facetIndex++, sublabel)); |
104 | |
105 facets.add(new CrossSectionWaterLineFacet(facetIndex++, "Salix Linie Scenario (!I10N! )" + i, type, hash, stateId, | |
106 SalixLineCrossSectionIndexData.scenario(i))); | |
98 } | 107 } |
99 | 108 |
100 final Facet csv = new DataFacet(FacetTypes.CSV, "CSV data", ComputeType.ADVANCE, hash, this.id); | 109 // FIXME: add cross section wst lines (MW, MMHW, ...) |
101 final Facet pdf = new DataFacet(FacetTypes.PDF, "PDF data", ComputeType.ADVANCE, hash, this.id); | 110 |
111 final Facet csv = new DataFacet(FacetTypes.CSV, "CSV data", ComputeType.ADVANCE, hash, stateId); | |
112 final Facet pdf = new DataFacet(FacetTypes.PDF, "PDF data", ComputeType.ADVANCE, hash, stateId); | |
102 | 113 |
103 facets.add(csv); | 114 facets.add(csv); |
104 facets.add(pdf); | 115 facets.add(pdf); |
105 } | 116 } |
106 | 117 |
107 final Calculation report = res.getReport(); | 118 final Calculation report = res.getReport(); |
108 | 119 |
109 if (report.hasProblems()) | 120 if (report.hasProblems()) |
110 facets.add(new ReportFacet(ComputeType.ADVANCE, hash, this.id)); | 121 facets.add(new ReportFacet(ComputeType.ADVANCE, hash, stateId)); |
111 | 122 |
112 return res; | 123 return res; |
113 } | 124 } |
114 | 125 |
115 private CalculationResult doCompute(final UINFOArtifact uinfo, final CallContext context, final Object old) { | 126 private CalculationResult doCompute(final UINFOArtifact uinfo, final CallContext context, final Object old) { |