Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AnnotationFacet.java @ 2153:734d5f5e55c0
'New chart' for cross sections.
flys-artifacts/trunk@3735 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 20 Jan 2012 09:14:53 +0000 |
parents | a4bdf7d8527e |
children | df70f14af981 |
rev | line source |
---|---|
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1677
diff
changeset
|
3 import java.util.ArrayList; |
2144
a4bdf7d8527e
Use FastAnnotations for LocationProvider.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1962
diff
changeset
|
4 import java.util.Iterator; |
1677
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
5 import java.util.List; |
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
6 |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 import org.apache.log4j.Logger; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1677
diff
changeset
|
9 import org.jfree.chart.annotations.XYTextAnnotation; |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1677
diff
changeset
|
10 |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifacts.Artifact; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.artifacts.CallContext; |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.flys.artifacts.AnnotationArtifact; |
2144
a4bdf7d8527e
Use FastAnnotations for LocationProvider.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1962
diff
changeset
|
15 |
1677
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
16 import de.intevation.flys.jfree.FLYSAnnotation; |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1677
diff
changeset
|
17 import de.intevation.flys.jfree.StickyAxisAnnotation; |
1677
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
18 |
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
19 import de.intevation.flys.model.Annotation; |
2144
a4bdf7d8527e
Use FastAnnotations for LocationProvider.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1962
diff
changeset
|
20 import de.intevation.flys.model.FastAnnotations; |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.artifactdatabase.state.DefaultFacet; |
1061
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
23 import de.intevation.artifactdatabase.state.Facet; |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 |
2144
a4bdf7d8527e
Use FastAnnotations for LocationProvider.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1962
diff
changeset
|
25 import de.intevation.flys.utils.FLYSUtils; |
a4bdf7d8527e
Use FastAnnotations for LocationProvider.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1962
diff
changeset
|
26 |
a4bdf7d8527e
Use FastAnnotations for LocationProvider.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1962
diff
changeset
|
27 import de.intevation.flys.artifacts.FLYSArtifact; |
a4bdf7d8527e
Use FastAnnotations for LocationProvider.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1962
diff
changeset
|
28 |
a4bdf7d8527e
Use FastAnnotations for LocationProvider.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1962
diff
changeset
|
29 |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 /** |
1077
3067e700fc13
Minor cosmetics and docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
31 * Facet to access Annotations (landmarks, POIs) of a river. |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 */ |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 public class AnnotationFacet |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 extends DefaultFacet |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 /** Logger for this class. */ |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 private static final Logger logger = Logger.getLogger(AnnotationFacet.class); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 |
1077
3067e700fc13
Minor cosmetics and docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
39 |
3067e700fc13
Minor cosmetics and docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
40 /** |
3067e700fc13
Minor cosmetics and docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
41 * Trivial Constructor. |
3067e700fc13
Minor cosmetics and docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
42 */ |
1061
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
43 public AnnotationFacet() { |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
44 } |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
45 |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 /** |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 * Trivial Constructor for a AnnotationFacet. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 * |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 * @param index Database-Index to use. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 * @param name Name (~type) of Facet. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 * @param description Description of Facet. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 */ |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 public AnnotationFacet(int index, String name, String description) { |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 super(index, name, description); |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 } |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 /** |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 * Get List of Annotations for river from Artifact. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 * |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 * @param artifact (Annotation-)Artifact to query for list of Annotations. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 * @param context Ignored. |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 */ |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 @Override |
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
66 public Object getData(Artifact artifact, CallContext context) { |
1077
3067e700fc13
Minor cosmetics and docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
67 AnnotationArtifact annotationArtifact = (AnnotationArtifact) artifact; |
1677
dd9dfe1e48fa
Bugfixes for various issues: Improved rendering process of annotations.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
68 |
2144
a4bdf7d8527e
Use FastAnnotations for LocationProvider.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1962
diff
changeset
|
69 String riverName = FLYSUtils.getRivername((FLYSArtifact)artifact); |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1677
diff
changeset
|
70 |
2144
a4bdf7d8527e
Use FastAnnotations for LocationProvider.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1962
diff
changeset
|
71 FastAnnotations fas = LocationProvider.getAnnotations(riverName); |
a4bdf7d8527e
Use FastAnnotations for LocationProvider.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1962
diff
changeset
|
72 |
a4bdf7d8527e
Use FastAnnotations for LocationProvider.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1962
diff
changeset
|
73 List<XYTextAnnotation> xy = |
a4bdf7d8527e
Use FastAnnotations for LocationProvider.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1962
diff
changeset
|
74 new ArrayList<XYTextAnnotation>(fas.size()); |
a4bdf7d8527e
Use FastAnnotations for LocationProvider.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1962
diff
changeset
|
75 |
a4bdf7d8527e
Use FastAnnotations for LocationProvider.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1962
diff
changeset
|
76 for (Iterator<FastAnnotations.Annotation> iter = |
a4bdf7d8527e
Use FastAnnotations for LocationProvider.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1962
diff
changeset
|
77 fas.filter(FastAnnotations.IS_POINT); iter.hasNext();) { |
a4bdf7d8527e
Use FastAnnotations for LocationProvider.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1962
diff
changeset
|
78 FastAnnotations.Annotation fa = iter.next(); |
a4bdf7d8527e
Use FastAnnotations for LocationProvider.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1962
diff
changeset
|
79 |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1677
diff
changeset
|
80 xy.add(new StickyAxisAnnotation( |
2144
a4bdf7d8527e
Use FastAnnotations for LocationProvider.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1962
diff
changeset
|
81 fa.getPosition(), |
a4bdf7d8527e
Use FastAnnotations for LocationProvider.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1962
diff
changeset
|
82 (float)fa.getA(), |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1677
diff
changeset
|
83 StickyAxisAnnotation.SimpleAxis.X_AXIS)); |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1677
diff
changeset
|
84 } |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1677
diff
changeset
|
85 |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1677
diff
changeset
|
86 return new FLYSAnnotation(description, xy); |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
87 } |
1061
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
88 |
1077
3067e700fc13
Minor cosmetics and docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
89 |
1061
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
90 @Override |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
91 public Facet deepCopy() { |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
92 AnnotationFacet copy = new AnnotationFacet(); |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
93 copy.set(this); |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
94 return copy; |
b1b0a0b61845
Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1026
diff
changeset
|
95 } |
1026
a39511688679
Added initial version of AnnotationArtifact and friends.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
96 } |
1962
59622ba800c8
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1679
diff
changeset
|
97 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |