annotate artifacts/src/main/java/org/dive4elements/river/artifacts/ManualPointsArtifact.java @ 7471:fff862f4ef76

Experimental caching of datacage recommendations. The respective hook is called a lot and running the datacage over and over again when loading data can be expensive. So the generated recommendations are cached for some time. Hopefully this improves the overall speed of loading data from the datacage.
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 30 Oct 2013 15:26:21 +0100
parents af13ceeba52a
children 8d5ca5175038
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
9 package org.dive4elements.river.artifacts;
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10
3761
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
11 import java.awt.geom.Point2D;
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12 import java.util.ArrayList;
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 import java.util.List;
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 import org.apache.log4j.Logger;
3761
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
16 import org.json.JSONArray;
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
17 import org.json.JSONException;
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 import org.w3c.dom.Document;
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
20 import org.dive4elements.artifactdatabase.state.Facet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
21 import org.dive4elements.artifacts.Artifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
22 import org.dive4elements.artifacts.ArtifactFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
23 import org.dive4elements.artifacts.CallContext;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
24 import org.dive4elements.artifacts.CallMeta;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
25 import org.dive4elements.river.artifacts.geom.Lines;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
26 import org.dive4elements.river.artifacts.model.FacetTypes;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
27 import org.dive4elements.river.artifacts.states.DefaultState;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
28 import org.dive4elements.river.model.FastCrossSectionLine;
3198
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
29
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31 /**
3225
049ccd2c5935 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3198
diff changeset
32 * Artifact to store user-added points and water lines.
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 */
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 public class ManualPointsArtifact
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
35 extends StaticD4EArtifact
3198
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
36 implements FacetTypes, WaterLineArtifact
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37 {
3761
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
38 private static final long serialVersionUID = 7096025125474986011L;
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
39
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 /** The logger for this class. */
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41 private static Logger logger = Logger.getLogger(ManualPointsArtifact.class);
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 /** The name of the artifact. */
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 public static final String ARTIFACT_NAME = "manualpoints";
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 public ManualPointsArtifact() {
2206
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2173
diff changeset
48 logger.debug("ManualPointsArtifact.ManualPointsArtifact()");
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49 }
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 /**
3761
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
53 * Gets called from factory to set things up.
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 */
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55 @Override
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56 public void setup(
3761
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
57 String identifier,
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
58 ArtifactFactory factory,
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
59 Object context,
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
60 CallMeta callMeta,
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
61 Document data)
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62 {
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63 logger.debug("ManualPointsArtifact.setup");
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64 super.setup(identifier, factory, context, callMeta, data);
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65 initialize(null, context, callMeta);
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66 }
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69 /** Return the name of this artifact. */
3761
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
70 @Override
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71 public String getName() {
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 return ARTIFACT_NAME;
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 }
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76 /** Access state data storing the jsonstring with points. */
2206
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2173
diff changeset
77 public String getPointsData(String facetName) {
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2173
diff changeset
78 return getDataAsString(facetName + ".data");
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79 }
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
80
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81
3198
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
82 /**
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
83 * Access state data storing the jsonstring with lines.
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
84 * @param facetName Name of facet or null if the so far
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
85 * only known case should be picked.
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
86 * @return (String) value of data element (expect json).
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
87 */
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
88 public String getLinesData(String facetName) {
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
89 if (facetName == null)
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
90 return getDataAsString("cross_section.manualpoints.lines");
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
91 // TODO .lineS?
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
92 return getDataAsString(facetName + ".line");
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
93 }
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
94
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
95
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
96 /** Setup state and facet. */
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
97 @Override
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
98 protected void initialize(Artifact artifact, Object context, CallMeta meta) {
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
99 logger.debug("ManualPointsArtifact.initialize");
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
100 List<Facet> fs = new ArrayList<Facet>();
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
101
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
102 DefaultState state = (DefaultState) getCurrentState(context);
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
103 state.computeInit(this, hash(), context, meta, fs);
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2206
diff changeset
104 if (!fs.isEmpty()) {
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2206
diff changeset
105 logger.debug("Facets to add in ManualPointsArtifact.initialize .");
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4478
diff changeset
106 addFacets(getCurrentStateId(), fs);
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2206
diff changeset
107 }
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2206
diff changeset
108 else {
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
109 logger.debug("No facets to add in ManualPointsArtifact.initialize ("
3761
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
110 + state.getID() + ").");
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
111 }
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
112 }
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
113
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
114
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
115 /**
3198
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
116 * Get value of line at index.
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
117 * @param index index in json array defining lines.
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
118 * @return water height of line at given index.
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
119 */
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
120 protected double getLine(int index) {
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
121 try {
3761
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
122 JSONArray lines = new JSONArray(getLinesData(null));
3198
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
123 JSONArray array = lines.getJSONArray(index);
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
124
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
125 return array.getDouble(0);
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
126 }
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
127 catch(JSONException e){
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
128 logger.error("Could not decode json for line.");
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
129 return 0d;
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
130 }
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
131 }
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
132
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
133
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
134 /**
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
135 * Get the water line "surface".
3272
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
136 * @param index index of facets data.
3284
d9af29a4bb85 Various cosmetic doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3272
diff changeset
137 * @param csl 'ground' against which to determine water surface.
d9af29a4bb85 Various cosmetic doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3272
diff changeset
138 * @param a (ignored in this implementation).
d9af29a4bb85 Various cosmetic doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3272
diff changeset
139 * @param b (ignored in this implementation).
4478
6153c50f78cf WaterLineArtifact: Added callcontext-parameter to interfaces getWaterLine.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3761
diff changeset
140 * @param context (ignored in this implementation).
3198
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
141 */
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
142 @Override
3284
d9af29a4bb85 Various cosmetic doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3272
diff changeset
143 public Lines.LineData getWaterLines(
3761
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
144 int index,
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
145 FastCrossSectionLine csl,
4478
6153c50f78cf WaterLineArtifact: Added callcontext-parameter to interfaces getWaterLine.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3761
diff changeset
146 double a, double b,
6153c50f78cf WaterLineArtifact: Added callcontext-parameter to interfaces getWaterLine.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3761
diff changeset
147 CallContext context
3761
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
148 ) {
3198
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
149 List<Point2D> points = csl.getPoints();
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
150 return Lines.createWaterLines(points, getLine(index));
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
151 }
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
152 }
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
153 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org