Mercurial > mxd2map
comparison src/java/de/intevation/mxd/reader/MarkerSymbolReader.java @ 79:5becdfe6ebae
merged with raimunds stuff
author | Stephan Holl <stephan.holl@intevation.de> |
---|---|
date | Fri, 27 May 2011 12:54:55 +0200 |
parents | 9ea64427ac7e |
children | fb93f20478cc |
comparison
equal
deleted
inserted
replaced
78:df17d4c2f9eb | 79:5becdfe6ebae |
---|---|
5 import org.w3c.dom.Element; | 5 import org.w3c.dom.Element; |
6 | 6 |
7 import org.apache.log4j.Logger; | 7 import org.apache.log4j.Logger; |
8 | 8 |
9 import com.esri.arcgis.display.ISymbol; | 9 import com.esri.arcgis.display.ISymbol; |
10 import com.esri.arcgis.display.IMarkerSymbol; | |
10 import com.esri.arcgis.display.SimpleMarkerSymbol; | 11 import com.esri.arcgis.display.SimpleMarkerSymbol; |
11 import com.esri.arcgis.display.ArrowMarkerSymbol; | 12 import com.esri.arcgis.display.ArrowMarkerSymbol; |
12 import com.esri.arcgis.display.CharacterMarkerSymbol; | 13 import com.esri.arcgis.display.CharacterMarkerSymbol; |
13 import com.esri.arcgis.display.PictureMarkerSymbol; | 14 import com.esri.arcgis.display.PictureMarkerSymbol; |
14 import com.esri.arcgis.display.MultiLayerMarkerSymbol; | 15 import com.esri.arcgis.display.MultiLayerMarkerSymbol; |
23 | 24 |
24 /** | 25 /** |
25 * The logger. | 26 * The logger. |
26 */ | 27 */ |
27 private static final Logger logger = | 28 private static final Logger logger = |
28 Logger.getLogger(SimpleFillSymbolReader.class); | 29 Logger.getLogger(MarkerSymbolReader.class); |
29 | 30 |
30 private ISymbol symbol; | 31 private ISymbol symbol; |
32 private IMarkerSymbol markerSymbol; | |
31 | 33 |
32 public MarkerSymbolReader(ISymbol symbol) | 34 public MarkerSymbolReader(ISymbol symbol) |
33 throws Exception { | 35 throws Exception { |
34 logger.debug("contructor(ISymbol)"); | 36 logger.debug("contructor(ISymbol)"); |
35 this.symbol = symbol; | 37 this.symbol = symbol; |
38 this.markerSymbol = null; | |
39 } | |
40 | |
41 public MarkerSymbolReader(IMarkerSymbol symbol) | |
42 throws Exception { | |
43 logger.debug("contructor(ISymbol)"); | |
44 this.markerSymbol = symbol; | |
45 this.symbol = null; | |
36 } | 46 } |
37 | 47 |
38 public MarkerSymbolReader() { | 48 public MarkerSymbolReader() { |
39 logger.debug("contructor()"); | 49 logger.debug("contructor()"); |
40 this.symbol = null; | 50 this.symbol = null; |
51 this.markerSymbol = null; | |
41 } | 52 } |
42 | 53 |
43 public Element read() throws Exception { | 54 public Element read() |
44 if(symbol == null) { | 55 throws Exception { |
45 return parent; | 56 logger.debug("read()"); |
57 ISymbolReader sreader = null; | |
58 | |
59 if(symbol != null) { | |
60 if(symbol instanceof SimpleMarkerSymbol) { | |
61 sreader = new SimpleMarkerSymbolReader(symbol); | |
62 } | |
63 else if(symbol instanceof ArrowMarkerSymbol) { | |
64 sreader = new ArrowMarkerSymbolReader(symbol); | |
65 } | |
66 else if(symbol instanceof CharacterMarkerSymbol) { | |
67 sreader = new CharacterMarkerSymbolReader(symbol); | |
68 } | |
69 else if(symbol instanceof PictureMarkerSymbol) { | |
70 sreader = new PictureMarkerSymbolReader(symbol); | |
71 } | |
72 else if(symbol instanceof MultiLayerMarkerSymbol) { | |
73 sreader = new MultiLayerMarkerSymbolReader(symbol); | |
74 } | |
75 else { | |
76 logger.debug("The reader for type " + symbol.getClass().toString() + | |
77 " is not implemented!"); | |
78 return parent; | |
79 } | |
46 } | 80 } |
47 | 81 else if(markerSymbol != null) { |
48 ISymbolReader sreader = null; | 82 if(markerSymbol instanceof SimpleMarkerSymbol) { |
49 if(symbol instanceof SimpleMarkerSymbol) { | 83 sreader = new SimpleMarkerSymbolReader(markerSymbol); |
50 sreader = new SimpleMarkerSymbolReader(symbol); | 84 } |
51 } | 85 else if(markerSymbol instanceof ArrowMarkerSymbol) { |
52 else if(symbol instanceof ArrowMarkerSymbol) { | 86 sreader = new ArrowMarkerSymbolReader(markerSymbol); |
53 sreader = new ArrowMarkerSymbolReader(symbol); | 87 } |
54 } | 88 else if(markerSymbol instanceof CharacterMarkerSymbol) { |
55 else if(symbol instanceof CharacterMarkerSymbol) { | 89 sreader = new CharacterMarkerSymbolReader(markerSymbol); |
56 sreader = new CharacterMarkerSymbolReader(symbol); | 90 } |
57 } | 91 else if(markerSymbol instanceof PictureMarkerSymbol) { |
58 else if(symbol instanceof PictureMarkerSymbol) { | 92 sreader = new PictureMarkerSymbolReader(markerSymbol); |
59 sreader = new PictureMarkerSymbolReader(symbol); | 93 } |
60 } | 94 else if(markerSymbol instanceof MultiLayerMarkerSymbol) { |
61 else if(symbol instanceof MultiLayerMarkerSymbol) { | 95 sreader = new MultiLayerMarkerSymbolReader(markerSymbol); |
62 sreader = new MultiLayerMarkerSymbolReader(symbol); | 96 } |
63 } | 97 else { |
64 else { | 98 logger.debug("The reader for type " + symbol.getClass().toString() + |
65 logger.debug("The reader for type " + symbol.getClass().toString() + | 99 " is not implemented!"); |
66 " is not implemented!"); | 100 return parent; |
67 return parent; | 101 } |
68 } | 102 } |
69 if (sreader != null) { | 103 if (sreader != null) { |
70 sreader.setParent(parent); | 104 sreader.setParent(parent); |
71 sreader.setUtil(util); | 105 sreader.setUtil(util); |
72 return sreader.read(); | 106 sreader.read(); |
73 } | 107 } |
74 return parent; | 108 return parent; |
75 } | 109 } |
76 | 110 |
77 public void setSymbol(ISymbol sym) { | 111 public void setSymbol(ISymbol sym) { |
78 this.symbol = sym; | 112 this.symbol = sym; |
113 this.markerSymbol = null; | |
114 } | |
115 | |
116 public void setSymbol(IMarkerSymbol sym) { | |
117 this.markerSymbol = sym; | |
118 this.symbol = null; | |
79 } | 119 } |
80 | 120 |
81 public boolean canRead(ISymbol sym) { | 121 public boolean canRead(ISymbol sym) { |
82 if(sym instanceof SimpleMarkerSymbol || | 122 if(sym instanceof SimpleMarkerSymbol || |
83 sym instanceof ArrowMarkerSymbol || | 123 sym instanceof ArrowMarkerSymbol || |
89 else { | 129 else { |
90 return false; | 130 return false; |
91 } | 131 } |
92 } | 132 } |
93 | 133 |
134 public boolean canRead(IMarkerSymbol sym) { | |
135 if(sym instanceof SimpleMarkerSymbol || | |
136 sym instanceof ArrowMarkerSymbol || | |
137 sym instanceof PictureMarkerSymbol || | |
138 sym instanceof CharacterMarkerSymbol || | |
139 sym instanceof MultiLayerMarkerSymbol) { | |
140 return true; | |
141 } | |
142 else { | |
143 return false; | |
144 } | |
145 } | |
146 | |
94 } | 147 } |