Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/CrossSectionArtifact.java @ 1971:741d2067cfe1
Given CrossSections a name, let crosssection facets survive.
flys-artifacts/trunk@3387 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 12 Dec 2011 11:19:56 +0000 |
parents | 27bb2e24f7f8 |
children | e0b081105a82 |
comparison
equal
deleted
inserted
replaced
1970:368040e5c400 | 1971:741d2067cfe1 |
---|---|
88 // Assume we start at km 0. | 88 // Assume we start at km 0. |
89 addStringData(DATA_KM, "0"); | 89 addStringData(DATA_KM, "0"); |
90 addStringData(DATA_IS_MASTER, "0"); | 90 addStringData(DATA_IS_MASTER, "0"); |
91 | 91 |
92 List<Facet> fs = new ArrayList<Facet>(); | 92 List<Facet> fs = new ArrayList<Facet>(); |
93 fs.add(new CrossSectionFacet(0, "TODO GET NAME FROM DB")); | 93 CrossSection cs = CrossSectionFactory.getCrossSection(Integer.valueOf(ids)); |
94 fs.add(new CrossSectionFacet(0, cs.getDescription())); | |
94 | 95 |
95 StaticState state = (StaticState) getCurrentState(context); | 96 StaticState state = (StaticState) getCurrentState(context); |
96 state.computeInit(this, hash(), context, callMeta, fs); | |
97 | 97 |
98 if (!fs.isEmpty()) { | 98 if (!fs.isEmpty()) { |
99 facets.put(getCurrentStateId(), fs); | 99 facets.put(getCurrentStateId(), fs); |
100 } | 100 } |
101 } | 101 } |
115 /** | 115 /** |
116 * Create and return a new StaticState with charting output. | 116 * Create and return a new StaticState with charting output. |
117 */ | 117 */ |
118 @Override | 118 @Override |
119 public State getCurrentState(Object cc) { | 119 public State getCurrentState(Object cc) { |
120 StaticState state = new StaticState(STATIC_STATE_NAME); | 120 final List<Facet> fs = facets.get(getCurrentStateId()); |
121 | 121 |
122 List<Facet> fs = facets.get(getCurrentStateId()); | 122 StaticState state = new StaticState(STATIC_STATE_NAME) { |
123 public Object staticCompute(List<Facet> facets) { | |
124 if (facets != null) { | |
125 facets.addAll(fs); | |
126 } | |
127 return null; | |
128 } | |
129 }; | |
123 | 130 |
124 state.addDefaultChartOutput("cross_section", fs); | 131 state.addDefaultChartOutput("cross_section", fs); |
125 | 132 |
126 return state; | 133 return state; |
127 } | 134 } |