Mercurial > mxd2map
annotate src/java/de/intevation/mxd/reader/MarkerSymbolReader.java @ 78:df17d4c2f9eb
Merged in Raimunds changes
author | Stephan Holl <stephan.holl@intevation.de> |
---|---|
date | Thu, 26 May 2011 16:13:50 +0200 |
parents | 260748e3d08f |
children | 7eba97e8201b |
rev | line source |
---|---|
70
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.mxd.reader; |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
2 |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
3 import java.lang.Exception; |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
4 |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
5 import org.w3c.dom.Element; |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
6 |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
7 import org.apache.log4j.Logger; |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
8 |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 import com.esri.arcgis.display.ISymbol; |
71
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
10 import com.esri.arcgis.display.SimpleMarkerSymbol; |
70
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
11 import com.esri.arcgis.display.ArrowMarkerSymbol; |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 import com.esri.arcgis.display.CharacterMarkerSymbol; |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
13 import com.esri.arcgis.display.PictureMarkerSymbol; |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
14 import com.esri.arcgis.display.MultiLayerMarkerSymbol; |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
15 |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
16 /** |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
17 * Wrapper for marker symbol reader. |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
18 * |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 */ |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 public class MarkerSymbolReader |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 extends AbstractSymbolReader { |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
24 /** |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
25 * The logger. |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 */ |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 private static final Logger logger = |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 Logger.getLogger(SimpleFillSymbolReader.class); |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
30 private ISymbol symbol; |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 |
71
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
32 public MarkerSymbolReader(ISymbol symbol) |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
33 throws Exception { |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
34 logger.debug("contructor(ISymbol)"); |
70
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 this.symbol = symbol; |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 } |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 |
71
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
38 public MarkerSymbolReader() { |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
39 logger.debug("contructor()"); |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
40 this.symbol = null; |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
41 } |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
42 |
70
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 public Element read() throws Exception { |
71
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
44 if(symbol == null) { |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
45 return parent; |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
46 } |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
47 |
70
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
48 ISymbolReader sreader = null; |
71
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
49 if(symbol instanceof SimpleMarkerSymbol) { |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
50 sreader = new SimpleMarkerSymbolReader(symbol); |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
51 } |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
52 else if(symbol instanceof ArrowMarkerSymbol) { |
70
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
53 sreader = new ArrowMarkerSymbolReader(symbol); |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
54 } |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
55 else if(symbol instanceof CharacterMarkerSymbol) { |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
56 sreader = new CharacterMarkerSymbolReader(symbol); |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
57 } |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
58 else if(symbol instanceof PictureMarkerSymbol) { |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
59 sreader = new PictureMarkerSymbolReader(symbol); |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
60 } |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
61 else if(symbol instanceof MultiLayerMarkerSymbol) { |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
62 sreader = new MultiLayerMarkerSymbolReader(symbol); |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
63 } |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
64 else { |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
65 logger.debug("The reader for type " + symbol.getClass().toString() + |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
66 " is not implemented!"); |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
67 return parent; |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
68 } |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
69 if (sreader != null) { |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
70 sreader.setParent(parent); |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
71 sreader.setUtil(util); |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
72 return sreader.read(); |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
73 } |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
74 return parent; |
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
75 } |
71
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
76 |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
77 public void setSymbol(ISymbol sym) { |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
78 this.symbol = sym; |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
79 } |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
80 |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
81 public boolean canRead(ISymbol sym) { |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
82 if(sym instanceof SimpleMarkerSymbol || |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
83 sym instanceof ArrowMarkerSymbol || |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
84 sym instanceof PictureMarkerSymbol || |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
85 sym instanceof CharacterMarkerSymbol || |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
86 sym instanceof MultiLayerMarkerSymbol) { |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
87 return true; |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
88 } |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
89 else { |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
90 return false; |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
91 } |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
92 } |
260748e3d08f
Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
93 |
70
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
94 } |