annotate src/java/de/intevation/mxd/reader/FeatureClassReader.java @ 310:be441fa4bed0

Throw an exception in case reading Raster layer fails
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 14 Sep 2012 11:50:40 +0200
parents df4e0946ef02
children
rev   line source
243
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
1 /*
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
2 * Copyright (c) 2011 by Intevation GmbH, Germany <info@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
3 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
4 * This file is part of MXD2map.
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
5 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
6 * This program is free software under the LGPL (>=v2.1)
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
7 * Read the file LICENCE.txt coming with the software for details
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
8 * or visit http://www.gnu.org/licenses/ if it does not exist.
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
9 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
10 * MXD2map has been developed on behalf of the
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
11 * Bundesamt fuer Seeschifffahrt und Hydrographie (BSH) in Hamburg
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
12 * by Intevation GmbH.
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
13 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
14 * Authors:
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
15 * Raimund Renkert <raimund.renkert@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
16 * Bjoern Schilberg <bjoern.schilberg@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
17 * Stephan Holl <stephan.holl@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
18 */
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
19
33
c51376f8e24c Separated converter components into packages.
Raimund Renkert <rrenkert@intevation.de>
parents: 31
diff changeset
20 package de.intevation.mxd.reader;
30
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 import java.io.IOException;
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 import org.apache.log4j.Logger;
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 import com.esri.arcgis.geodatabase.IClass;
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 import com.esri.arcgis.geodatabase.FeatureClass;
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 import org.w3c.dom.Node;
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 /**
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 * Reads FeatureClass information.
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 *
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 */
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
36 public class FeatureClassReader
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
37 implements IClassReader {
30
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
39 /**
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
40 * The Logger.
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
41 */
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
42 private static final Logger logger =
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
43 Logger.getLogger(FeatureClassReader.class);
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
44
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
45 /**
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
46 * Private member.
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
47 */
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
48 private IClass fclass;
30
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49 private Node parent;
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
50
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
51 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
52 * Constructor with class object.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
53 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
54 * @param cl The ArcGIS class object.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
55 */
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
56 public FeatureClassReader(IClass cl)
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
57 throws Exception {
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
58 if(cl instanceof FeatureClass) {
30
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
59 this.fclass = cl;
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
60 }
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
61 else {
31
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents: 30
diff changeset
62 throw new Exception("Not a FeatureClass object!" +
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents: 30
diff changeset
63 cl.getClass().toString());
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
64 }
30
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
65 }
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
66
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
67 /**
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68 * Reads the Layer content.
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
69 *
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
70 * @return Currently always false.
30
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
71 */
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
72 public boolean read()
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
73 throws IOException {
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
74 logger.debug("read() -> not implemented jet.");
30
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 return false;
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76 }
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
78 public void getClassDoc()
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
79 throws IOException {
30
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
80 logger.debug("getLayer() -> not implemented jet.");
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
81 return;
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
82 }
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
83
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 public void setXMLNode(Node node) {
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
85 parent = node;
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
86 }
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
87 }
c34c450edb06 Introduced class reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
88 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)