annotate artifacts/src/main/java/org/dive4elements/river/artifacts/ManualPointsArtifact.java @ 8755:30b1ddadf275

(issue1801) Unify reference gauge finding code The basic way as described in the method comment of the determineRefGauge method is now used in the WINFOArtifact, MainValuesService and RiverUtils.getGauge method. RiverUtils.getGauge previously just returned the first gauge found. While this is now a behavior change I believe that it is always more correct then the undeterministic behavior of the previous implmenentation.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 24 Jun 2015 14:07:26 +0200
parents e4606eae8ea5
children 5e38e2924c07
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
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
40 /** The log for this class. */
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
41 private static Logger log = Logger.getLogger(ManualPointsArtifact.class);
2172
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() {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
48 log.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,
7842
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 5994
diff changeset
61 Document data,
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 5994
diff changeset
62 List<Class> loadFacets)
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
64 log.debug("ManualPointsArtifact.setup");
7842
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 5994
diff changeset
65 super.setup(identifier, factory, context, callMeta, data, loadFacets);
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66 initialize(null, context, callMeta);
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
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 /** Return the name of this artifact. */
3761
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
71 @Override
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 public String getName() {
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 return ARTIFACT_NAME;
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
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 /** 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
78 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
79 return getDataAsString(facetName + ".data");
2172
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
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
82
3198
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
83 /**
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
84 * 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
85 * @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
86 * 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
87 * @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
88 */
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
89 public String getLinesData(String facetName) {
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
90 if (facetName == null)
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
91 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
92 // TODO .lineS?
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
93 return getDataAsString(facetName + ".line");
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
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
96
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
97 /** Setup state and facet. */
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
98 @Override
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
99 protected void initialize(Artifact artifact, Object context, CallMeta meta) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
100 log.debug("ManualPointsArtifact.initialize");
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
101 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
102
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
103 DefaultState state = (DefaultState) getCurrentState(context);
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
104 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
105 if (!fs.isEmpty()) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
106 log.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
107 addFacets(getCurrentStateId(), fs);
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2206
diff changeset
108 }
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2206
diff changeset
109 else {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
110 log.debug("No facets to add in ManualPointsArtifact.initialize ("
3761
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
111 + state.getID() + ").");
2172
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
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
116 /**
3198
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
117 * 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
118 * @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
119 * @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
120 */
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
121 protected double getLine(int index) {
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
122 try {
3761
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
123 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
124 JSONArray array = lines.getJSONArray(index);
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
125
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
126 return array.getDouble(0);
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
127 }
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
128 catch(JSONException e){
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
129 log.error("Could not decode json for line.");
3198
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
130 return 0d;
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 /**
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
136 * 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
137 * @param index index of facets data.
3284
d9af29a4bb85 Various cosmetic doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3272
diff changeset
138 * @param csl 'ground' against which to determine water surface.
d9af29a4bb85 Various cosmetic doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3272
diff changeset
139 * @param a (ignored in this implementation).
d9af29a4bb85 Various cosmetic doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3272
diff changeset
140 * @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
141 * @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
142 */
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
143 @Override
3284
d9af29a4bb85 Various cosmetic doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3272
diff changeset
144 public Lines.LineData getWaterLines(
3761
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
145 int index,
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
146 FastCrossSectionLine csl,
4478
6153c50f78cf WaterLineArtifact: Added callcontext-parameter to interfaces getWaterLine.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3761
diff changeset
147 double a, double b,
6153c50f78cf WaterLineArtifact: Added callcontext-parameter to interfaces getWaterLine.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3761
diff changeset
148 CallContext context
3761
066e2b4d69ca Fix missing import
Christian Lins <christian.lins@intevation.de>
parents: 3556
diff changeset
149 ) {
3198
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
150 List<Point2D> points = csl.getPoints();
d35f28655fa6 Create and handle new manual line type facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
151 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
152 }
2172
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
153 }
3ecc76ef25a9 New, basic infrastructure for user-provided data ('manual points').
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
154 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org