comparison src/java/de/intevation/mxd/reader/MarkerSymbolReader.java @ 75:9ea64427ac7e

Added marker fill symbol reader.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 27 May 2011 12:04:19 +0200
parents 7eba97e8201b
children fb93f20478cc
comparison
equal deleted inserted replaced
74:7eba97e8201b 75:9ea64427ac7e
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() 54 public Element read()
44 throws Exception { 55 throws Exception {
45 if(symbol == null) { 56 logger.debug("read()");
46 return parent; 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 }
47 } 80 }
48 81 else if(markerSymbol != null) {
49 ISymbolReader sreader = null; 82 if(markerSymbol instanceof SimpleMarkerSymbol) {
50 if(symbol instanceof SimpleMarkerSymbol) { 83 sreader = new SimpleMarkerSymbolReader(markerSymbol);
51 sreader = new SimpleMarkerSymbolReader(symbol); 84 }
52 } 85 else if(markerSymbol instanceof ArrowMarkerSymbol) {
53 else if(symbol instanceof ArrowMarkerSymbol) { 86 sreader = new ArrowMarkerSymbolReader(markerSymbol);
54 sreader = new ArrowMarkerSymbolReader(symbol); 87 }
55 } 88 else if(markerSymbol instanceof CharacterMarkerSymbol) {
56 else if(symbol instanceof CharacterMarkerSymbol) { 89 sreader = new CharacterMarkerSymbolReader(markerSymbol);
57 sreader = new CharacterMarkerSymbolReader(symbol); 90 }
58 } 91 else if(markerSymbol instanceof PictureMarkerSymbol) {
59 else if(symbol instanceof PictureMarkerSymbol) { 92 sreader = new PictureMarkerSymbolReader(markerSymbol);
60 sreader = new PictureMarkerSymbolReader(symbol); 93 }
61 } 94 else if(markerSymbol instanceof MultiLayerMarkerSymbol) {
62 else if(symbol instanceof MultiLayerMarkerSymbol) { 95 sreader = new MultiLayerMarkerSymbolReader(markerSymbol);
63 sreader = new MultiLayerMarkerSymbolReader(symbol); 96 }
64 } 97 else {
65 else { 98 logger.debug("The reader for type " + symbol.getClass().toString() +
66 logger.debug("The reader for type " + symbol.getClass().toString() + 99 " is not implemented!");
67 " is not implemented!"); 100 return parent;
68 return parent; 101 }
69 } 102 }
70 if (sreader != null) { 103 if (sreader != null) {
71 sreader.setParent(parent); 104 sreader.setParent(parent);
72 sreader.setUtil(util); 105 sreader.setUtil(util);
73 return sreader.read(); 106 sreader.read();
74 } 107 }
75 return parent; 108 return parent;
76 } 109 }
77 110
78 public void setSymbol(ISymbol sym) { 111 public void setSymbol(ISymbol sym) {
79 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;
80 } 119 }
81 120
82 public boolean canRead(ISymbol sym) { 121 public boolean canRead(ISymbol sym) {
83 if(sym instanceof SimpleMarkerSymbol || 122 if(sym instanceof SimpleMarkerSymbol ||
84 sym instanceof ArrowMarkerSymbol || 123 sym instanceof ArrowMarkerSymbol ||
90 else { 129 else {
91 return false; 130 return false;
92 } 131 }
93 } 132 }
94 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
95 } 147 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)