comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AreaFacet.java @ 2018:3f1a63da2cf4

Prepare ability to paint areas in longitudinal section diagrams, too (next to CrossSection diagrams). flys-artifacts/trunk@3473 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 20 Dec 2011 06:37:41 +0000
parents 7f99845e9499
children 3c3693e9c538
comparison
equal deleted inserted replaced
2017:e384d78ff78b 2018:3f1a63da2cf4
19 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; 19 import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
20 20
21 21
22 /** 22 /**
23 * Trival Facet for areas. 23 * Trival Facet for areas.
24 * Note that this Facet comes in two "types" (names):
25 * <ul>
26 * <li>CROSS_SECTION_AREA (cross_section.area) and</li>
27 * <li>LONGITUDINAL_SECTION_AREA (longitudinal.area</li>
28 * </ul>
29 * This is to support different diagram types without being painted in both
30 * at the same time. The name has to be given when constructing.
24 */ 31 */
25 public class AreaFacet 32 public class AreaFacet
26 extends DefaultFacet 33 extends DefaultFacet
27 implements FacetTypes { 34 implements FacetTypes {
28 35
29 private static Logger logger = Logger.getLogger(AreaFacet.class); 36 private static Logger logger = Logger.getLogger(AreaFacet.class);
30 37
31 /** Trivial constructor, set (maybe localized) description. */ 38 /**
32 public AreaFacet(int idx, String description) { 39 * Constructor, set (maybe localized) description and name.
33 super(idx, AREA, description); 40 * @param idx Index given when querying artifact for data.
41 * @param name important to discern areas in different diagram types.
42 */
43 public AreaFacet(int idx, String name, String description) {
44 super(idx, name, description);
34 } 45 }
35 46
36 47
37 /** 48 /**
38 * Gets Cross Section (profile). 49 * Gets Cross Section (profile).
52 Object upperData = null; 63 Object upperData = null;
53 64
54 List<DataProvider> providers = context. 65 List<DataProvider> providers = context.
55 getDataProvider(artifact.getLowerDPKey()); 66 getDataProvider(artifact.getLowerDPKey());
56 if (providers.size() < 1) { 67 if (providers.size() < 1) {
57 logger.warn("No 'lower' given for area"); 68 logger.warn("No 'lower' provider given for area [" +
69 artifact.getLowerDPKey() + "]");
58 } 70 }
59 else { 71 else {
60 lowerData = providers.get(0).provideData( 72 lowerData = providers.get(0).provideData(
61 artifact.getLowerDPKey(), null, context); 73 artifact.getLowerDPKey(), null, context);
62 } 74 }
63 75
64 providers = context.getDataProvider(artifact.getUpperDPKey()); 76 providers = context.getDataProvider(artifact.getUpperDPKey());
65 if (providers.size() < 1) { 77 if (providers.size() < 1) {
66 logger.warn("No 'upper' given for area"); 78 logger.warn("No 'upper' provider given for area [" +
79 artifact.getUpperDPKey() + "]");
67 } 80 }
68 else { 81 else {
69 upperData = providers.get(0).provideData( 82 upperData = providers.get(0).provideData(
70 artifact.getUpperDPKey(), null, context); 83 artifact.getUpperDPKey(), null, context);
71 } 84 }
79 92
80 93
81 /** Do a deep copy. */ 94 /** Do a deep copy. */
82 @Override 95 @Override
83 public Facet deepCopy() { 96 public Facet deepCopy() {
84 AreaFacet copy = new AreaFacet(this.index, this.description); 97 AreaFacet copy = new AreaFacet(this.index, this.name, this.description);
85 copy.set(this); 98 copy.set(this);
86 return copy; 99 return copy;
87 } 100 }
88 } 101 }
89 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 102 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org