Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/LegendAggregator.java @ 9612:f8308db94634
#20 UI, Diagramme
author | dnt_bjoernsen <d.tironi@bjoernsen.de> |
---|---|
date | Wed, 09 Oct 2019 16:17:16 +0200 |
parents | ef5754ba5573 |
children |
comparison
equal
deleted
inserted
replaced
9611:8ed6c45136fa | 9612:f8308db94634 |
---|---|
15 import java.awt.Stroke; | 15 import java.awt.Stroke; |
16 import java.util.AbstractMap.SimpleEntry; | 16 import java.util.AbstractMap.SimpleEntry; |
17 import java.util.ArrayList; | 17 import java.util.ArrayList; |
18 import java.util.HashMap; | 18 import java.util.HashMap; |
19 import java.util.HashSet; | 19 import java.util.HashSet; |
20 import java.util.IdentityHashMap; | |
21 import java.util.Iterator; | 20 import java.util.Iterator; |
22 import java.util.List; | 21 import java.util.List; |
23 import java.util.Map; | 22 import java.util.Map; |
24 import java.util.Map.Entry; | 23 import java.util.Map.Entry; |
25 import java.util.Set; | 24 import java.util.Set; |
142 /** | 141 /** |
143 * Extract distinct items, curently only those that are different regarding their shape | 142 * Extract distinct items, curently only those that are different regarding their shape |
144 */ | 143 */ |
145 private List<LegendItem> findDistinctItems(final List<LegendItem> items) { | 144 private List<LegendItem> findDistinctItems(final List<LegendItem> items) { |
146 | 145 |
147 // HACKY: we hash by unique shape, because we know that the used shapes are cashed in a static cache. | 146 final Map<Shape, LegendItem> shapeMap = new HashMap<>(); |
148 final Map<Shape, LegendItem> shapeMap = new IdentityHashMap<>(); | |
149 | 147 |
150 for (final LegendItem item : items) { | 148 for (final LegendItem item : items) { |
151 | 149 |
152 final Shape shape = item.isShapeVisible() ? item.getShape() : null; | 150 final Shape shape = item.isShapeVisible() ? item.getShape() : null; |
153 if (!shapeMap.containsKey(shape)) | 151 if (!shapeMap.containsKey(shape)) |