1 package ini
.trakem2
.display
;
3 import ini
.trakem2
.utils
.History
;
4 import java
.util
.HashMap
;
5 import java
.util
.Iterator
;
8 import java
.util
.ArrayList
;
9 import java
.awt
.geom
.AffineTransform
;
11 public class TransformationStep
implements History
.Step
<Displayable
> {
12 final HashMap
<Displayable
,AffineTransform
> ht
;
13 TransformationStep(final HashMap
<Displayable
,AffineTransform
> ht
) {
16 public List
<Displayable
> remove(final long id
) {
17 final List
<Displayable
> al
= new ArrayList
<Displayable
>();
18 for (Iterator
<Displayable
> it
= ht
.keySet().iterator(); it
.hasNext(); ) {
19 final Displayable d
= it
.next();
20 if (d
.getId() == id
) {
27 public boolean isEmpty() {
30 public boolean isIdentical(final History
.Step step
) {
31 if (step
.getClass() != TransformationStep
.class) return false;
32 final HashMap
<Displayable
,AffineTransform
> m
= ((TransformationStep
)step
).ht
;
34 if (m
.size() != this.ht
.size()) return false;
36 for (final Map
.Entry
<Displayable
,AffineTransform
> e
: m
.entrySet()) {
37 final AffineTransform aff
= this.ht
.get(e
.getKey());
38 if (null == aff
) return false; // at least one Displayable is missing
39 if (!aff
.equals(e
.getValue())) return false; // at least one Displayable has a different AffineTransform