Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/ChartInfoServiceImpl.java @ 794:40269a176cd2
Set default values in the BooleanPanel, TextProvider and AutoIntegerPanel.
flys-client/trunk@2303 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 07 Jul 2011 14:46:55 +0000 |
parents | 460b8e0f0563 |
children | ab8eb2f544f2 |
rev | line source |
---|---|
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.io.InputStream; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import java.io.IOException; |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
5 import java.util.ArrayList; |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
6 import java.util.List; |
549
e74bf6bfeeb6
Use the same code to create the attribute document for the chart creation in ChartOutputService and ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
547
diff
changeset
|
7 import java.util.Map; |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import javax.xml.xpath.XPathConstants; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import org.w3c.dom.Document; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import org.w3c.dom.Node; |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
13 import org.w3c.dom.NodeList; |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import com.google.gwt.user.server.rpc.RemoteServiceServlet; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.artifacts.common.ArtifactNamespaceContext; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.artifacts.common.utils.ClientProtocolUtils; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.artifacts.common.utils.XMLUtils; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.artifacts.httpclient.http.HttpClient; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.artifacts.httpclient.http.HttpClientImpl; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.flys.client.shared.Transform2D; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.flys.client.shared.exceptions.ServerException; |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
26 import de.intevation.flys.client.shared.model.Axis; |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
27 import de.intevation.flys.client.shared.model.ChartInfo; |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 import de.intevation.flys.client.shared.model.Collection; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 import de.intevation.flys.client.client.services.ChartInfoService; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 /** |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 * This service fetches a document that contains meta information for a specific |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 * chart. |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 * |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 */ |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 public class ChartInfoServiceImpl |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 extends RemoteServiceServlet |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 implements ChartInfoService |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 { |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 public static final String XPATH_TRANSFORM_MATRIX = |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
44 "/art:chartinfo/art:transformation-matrix/art:matrix"; |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
46 public static final String XPATH_X_AXES = |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
47 "/art:chartinfo/art:axes/art:domain"; |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
48 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
49 public static final String XPATH_Y_AXES = |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
50 "/art:chartinfo/art:axes/art:range"; |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
51 |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 public static final String EXCEPTION_STRING = "error_chart_info_service"; |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
55 public ChartInfo getChartInfo( |
549
e74bf6bfeeb6
Use the same code to create the attribute document for the chart creation in ChartOutputService and ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
547
diff
changeset
|
56 Collection collection, |
e74bf6bfeeb6
Use the same code to create the attribute document for the chart creation in ChartOutputService and ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
547
diff
changeset
|
57 String url, |
e74bf6bfeeb6
Use the same code to create the attribute document for the chart creation in ChartOutputService and ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
547
diff
changeset
|
58 String locale, |
e74bf6bfeeb6
Use the same code to create the attribute document for the chart creation in ChartOutputService and ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
547
diff
changeset
|
59 String type, |
e74bf6bfeeb6
Use the same code to create the attribute document for the chart creation in ChartOutputService and ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
547
diff
changeset
|
60 Map<String, String> attr) |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 throws ServerException |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 { |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 System.out.println("ChartInfoServiceImpl.getChartInfo"); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 Document request = ClientProtocolUtils.newOutCollectionDocument( |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 collection.identifier(), |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 type, |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 type, |
549
e74bf6bfeeb6
Use the same code to create the attribute document for the chart creation in ChartOutputService and ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
547
diff
changeset
|
69 ChartServiceHelper.getChartAttributes(attr)); |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 try { |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 HttpClient client = new HttpClientImpl(url, locale); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 InputStream in = client.collectionOut( |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 request, |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 collection.identifier(), |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 type + "_chartinfo"); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 Document info = XMLUtils.parseDocument(in); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 return parseInfoDocument(info); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 } |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 catch (IOException ioe) { |
556
046f43e1d305
Avoid NPE while parsing axes in ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
553
diff
changeset
|
83 ioe.printStackTrace(); |
046f43e1d305
Avoid NPE while parsing axes in ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
553
diff
changeset
|
84 } |
046f43e1d305
Avoid NPE while parsing axes in ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
553
diff
changeset
|
85 catch (Exception e) { |
046f43e1d305
Avoid NPE while parsing axes in ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
553
diff
changeset
|
86 e.printStackTrace(); |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 } |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 System.err.println("Error while fetching chart info."); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 throw new ServerException(EXCEPTION_STRING); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 } |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
95 protected ChartInfo parseInfoDocument(Document doc) { |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
96 Transform2D[] transformer = parseTransformationMatrix(doc); |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
97 Axis[] xAxes = parseXAxes(doc); |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
98 Axis[] yAxes = parseYAxes(doc); |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
99 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
100 return new ChartInfo(xAxes, yAxes, transformer); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
101 } |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
102 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
103 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
104 protected Axis[] parseXAxes(Document doc) { |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
105 System.out.println("ChartInfoServiceImpl.parseXAxes"); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
106 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
107 NodeList axes = (NodeList) XMLUtils.xpath( |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
108 doc, |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
109 XPATH_X_AXES, |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
110 XPathConstants.NODESET, |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
111 ArtifactNamespaceContext.INSTANCE); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
112 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
113 return parseAxes(axes); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
114 } |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
115 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
116 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
117 protected Axis[] parseYAxes(Document doc) { |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
118 System.out.println("ChartInfoServiceImpl.parseYAxes"); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
119 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
120 NodeList axes = (NodeList) XMLUtils.xpath( |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
121 doc, |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
122 XPATH_Y_AXES, |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
123 XPathConstants.NODESET, |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
124 ArtifactNamespaceContext.INSTANCE); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
125 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
126 return parseAxes(axes); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
127 } |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
128 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
129 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
130 protected Axis[] parseAxes(NodeList axes) { |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
131 System.out.println("ChartInfoServiceImpl.parseAxes"); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
132 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
133 int count = axes != null ? axes.getLength() : 0; |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
134 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
135 System.out.println("Chart has " + count + " axes."); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
136 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
137 if (count == 0) { |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
138 return null; |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
139 } |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
140 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
141 Axis[] result = new Axis[count]; |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
142 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
143 for (int i = 0; i < count; i++) { |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
144 Node node = axes.item(i); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
145 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
146 String posStr = XMLUtils.xpathString( |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
147 node, "@art:pos", ArtifactNamespaceContext.INSTANCE); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
148 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
149 String fromStr = XMLUtils.xpathString( |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
150 node, "@art:from", ArtifactNamespaceContext.INSTANCE); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
151 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
152 String toStr = XMLUtils.xpathString( |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
153 node, "@art:to", ArtifactNamespaceContext.INSTANCE); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
154 |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
155 String minStr = XMLUtils.xpathString( |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
156 node, "@art:min", ArtifactNamespaceContext.INSTANCE); |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
157 |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
158 String maxStr = XMLUtils.xpathString( |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
159 node, "@art:max", ArtifactNamespaceContext.INSTANCE); |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
160 |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
161 try { |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
162 int pos = Integer.parseInt(posStr); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
163 double from = Double.parseDouble(fromStr); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
164 double to = Double.parseDouble(toStr); |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
165 double min = Double.parseDouble(minStr); |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
166 double max = Double.parseDouble(maxStr); |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
167 |
556
046f43e1d305
Avoid NPE while parsing axes in ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
553
diff
changeset
|
168 if (pos >= result.length) { |
046f43e1d305
Avoid NPE while parsing axes in ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
553
diff
changeset
|
169 // this should never happen |
046f43e1d305
Avoid NPE while parsing axes in ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
553
diff
changeset
|
170 System.err.println("The axis is out of valid range: " + pos); |
046f43e1d305
Avoid NPE while parsing axes in ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
553
diff
changeset
|
171 continue; |
046f43e1d305
Avoid NPE while parsing axes in ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
553
diff
changeset
|
172 } |
046f43e1d305
Avoid NPE while parsing axes in ChartInfoService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
553
diff
changeset
|
173 |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
174 result[pos] = new Axis(pos, from, to, min, max); |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
175 } |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
176 catch (NumberFormatException nfe) { |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
177 nfe.printStackTrace(); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
178 } |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
179 } |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
180 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
181 System.out.println("Parsed " + result.length + " axes"); |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
182 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
183 return result; |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
184 } |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
185 |
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
186 |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
187 /** |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
188 * Parses the chart info document and extract the Transform2D values. |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
189 * |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
190 * @param doc The chart info document. |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 * |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
192 * @return a Transform2D object to transfrom pixel coordinates into chart |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 * coordinates. |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
194 */ |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
195 protected Transform2D[] parseTransformationMatrix(Document doc) { |
552
6050d49eaba3
Adapted the ChartInfoService to return more information about charts than before. In addition, the PanControl is added to the chart toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
549
diff
changeset
|
196 System.out.println("ChartInfoServiceImpl.parseTransformationMatrix"); |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
197 |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
198 NodeList matrix = (NodeList) XMLUtils.xpath( |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
199 doc, |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
200 XPATH_TRANSFORM_MATRIX, |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
201 XPathConstants.NODESET, |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
202 ArtifactNamespaceContext.INSTANCE); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
203 |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
204 int num = matrix != null ? matrix.getLength() : 0; |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
205 |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
206 List<Transform2D> transformer = new ArrayList<Transform2D>(num); |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
207 |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
208 for (int i = 0; i < num; i++) { |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
209 Transform2D t = createTransformer(matrix.item(i)); |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
210 |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
211 if (t == null) { |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
212 System.err.println("Broken transformation matrix at pos: " + i); |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
213 continue; |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
214 } |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
215 |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
216 transformer.add(t); |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
217 } |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
218 |
561
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
219 return (Transform2D[]) transformer.toArray(new Transform2D[num]); |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
220 } |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
221 |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
222 |
460b8e0f0563
Parse the min/max axes ranges for the ChartInfo and modified the zoom and pan actions to match the current server implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
556
diff
changeset
|
223 protected Transform2D createTransformer(Node matrix) { |
535
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
224 String sx = XMLUtils.xpathString( |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
225 matrix, "@art:sx", ArtifactNamespaceContext.INSTANCE); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
226 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
227 String sy = XMLUtils.xpathString( |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
228 matrix, "@art:sy", ArtifactNamespaceContext.INSTANCE); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
229 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
230 String tx = XMLUtils.xpathString( |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
231 matrix, "@art:tx", ArtifactNamespaceContext.INSTANCE); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
232 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
233 String ty = XMLUtils.xpathString( |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
234 matrix, "@art:ty", ArtifactNamespaceContext.INSTANCE); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
235 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
236 if (sx != null && sy != null && tx != null && ty != null) { |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
237 try { |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
238 return new Transform2D( |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
239 Double.parseDouble(sx), |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
240 Double.parseDouble(sy), |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
241 Double.parseDouble(tx), |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
242 Double.parseDouble(ty)); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
243 } |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
244 catch (NumberFormatException nfe) { |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
245 System.err.println("Error while parsing matrix values."); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
246 } |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
247 } |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
248 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
249 System.err.println("No matrix values found."); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
250 |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
251 return new Transform2D(1d, 1d, 0d, 0d); |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
252 } |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
253 } |
017371801479
Added a chart info service to fetch the info document for a specific chart from artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
254 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |