Revision d05bf8bd
Added by Patrick Plitzner almost 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrixBottomToolbar.java | ||
---|---|---|
18 | 18 |
import java.util.UUID; |
19 | 19 |
import java.util.stream.Collectors; |
20 | 20 |
|
21 |
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; |
|
21 | 22 |
import org.eclipse.jface.layout.GridDataFactory; |
22 | 23 |
import org.eclipse.jface.window.Window; |
23 | 24 |
import org.eclipse.swt.SWT; |
... | ... | |
38 | 39 |
import eu.etaxonomy.cdm.model.description.Feature; |
39 | 40 |
import eu.etaxonomy.cdm.model.description.QuantitativeData; |
40 | 41 |
import eu.etaxonomy.cdm.model.description.SpecimenDescription; |
42 |
import eu.etaxonomy.cdm.model.description.StatisticalMeasure; |
|
41 | 43 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
42 | 44 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
43 | 45 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
... | ... | |
157 | 159 |
matrix.addUpdateResult(result); |
158 | 160 |
matrix.setDirty(); |
159 | 161 |
|
160 |
//aggregate histogram for categorical tooltip |
|
161 |
Map<Feature, CategoricalDataHistogram> featureToHistogramMap = matrix.getFeatureToHistogramMap(); |
|
162 |
featureToHistogramMap.clear(); |
|
163 |
aggregateCategorcialHistogram(featureToHistogramMap); |
|
162 |
aggregateCategorcialHistogram(matrix.getFeatureToHistogramMap()); |
|
163 |
aggregateQuantitativeSummary(matrix.getFeatureToQuantStatisticsMap()); |
|
164 | 164 |
} |
165 | 165 |
|
166 | 166 |
}); |
... | ... | |
168 | 168 |
|
169 | 169 |
@SuppressWarnings("unchecked") |
170 | 170 |
private void aggregateCategorcialHistogram(Map<Feature, CategoricalDataHistogram> featureToHistogramMap) { |
171 |
featureToHistogramMap.clear(); |
|
171 | 172 |
matrix.getDescriptions() |
172 | 173 |
.forEach(o -> ((RowWrapperDTO) o).getSpecimenDescription().getElements().stream() |
173 | 174 |
.filter(descriptionElement -> descriptionElement instanceof CategoricalData) |
... | ... | |
183 | 184 |
})); |
184 | 185 |
} |
185 | 186 |
|
187 |
@SuppressWarnings("unchecked") |
|
188 |
private void aggregateQuantitativeSummary(Map<Feature, DescriptiveStatistics> featureToQuantStatisticsMap) { |
|
189 |
featureToQuantStatisticsMap.clear(); |
|
190 |
matrix.getDescriptions() |
|
191 |
.forEach(o -> ((RowWrapperDTO) o).getSpecimenDescription().getElements().stream() |
|
192 |
.filter(descriptionElement -> descriptionElement instanceof QuantitativeData) |
|
193 |
.forEach(quantData -> { |
|
194 |
Feature feature = ((QuantitativeData) quantData).getFeature(); |
|
195 |
DescriptiveStatistics statistics = featureToQuantStatisticsMap.get(feature); |
|
196 |
if(statistics==null){ |
|
197 |
statistics = new DescriptiveStatistics(); |
|
198 |
} |
|
199 |
featureToQuantStatisticsMap.put(feature, statistics); |
|
200 |
((QuantitativeData) quantData).getStatisticalValues().stream() |
|
201 |
.filter(value -> value.getType().equals(StatisticalMeasure.EXACT_VALUE())) |
|
202 |
.forEach(value -> featureToQuantStatisticsMap.get(feature).addValue(value.getValue())); |
|
203 |
})); |
|
204 |
} |
|
205 |
|
|
186 | 206 |
private SpecimenDescription getDescriptionForDescriptiveDataSet(SpecimenOrObservationBase specimen){ |
187 | 207 |
Set<Feature> wsFeatures = matrix.getDescriptiveDataSet().getDescriptiveSystem().getDistinctFeatures(); |
188 | 208 |
List<DescriptionElementBase> matchingDescriptionElements = new ArrayList<>(); |
Also available in: Unified diff
ref #7549 Add quant statistic tooltip to character matrix