comparison src/java/de/intevation/mxd/reader/LabelEngineReader.java @ 180:f4eb506499f5

Done some code styling and removed TODOs.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 11 Jul 2011 12:11:08 +0200
parents f3a91cd7440b
children 0bde090506f9
comparison
equal deleted inserted replaced
179:f3a91cd7440b 180:f4eb506499f5
42 throws Exception { 42 throws Exception {
43 if(prop instanceof LabelEngineLayerProperties) { 43 if(prop instanceof LabelEngineLayerProperties) {
44 this.properties = (LabelEngineLayerProperties)prop; 44 this.properties = (LabelEngineLayerProperties)prop;
45 } 45 }
46 else { 46 else {
47 throw new Exception("Not an instance of LaberEngineLayerProperties: " + 47 throw new Exception("Not an instance of" +
48 prop.getClass().toString()); 48 " LaberEngineLayerProperties: " +
49 prop.getClass().toString());
49 } 50 }
50 } 51 }
51 52
52 /** 53 /**
53 * Setter for XML document helper. 54 * Setter for XML document helper.
57 public void setUtil(MapToXMLUtils util) { 58 public void setUtil(MapToXMLUtils util) {
58 this.util = util; 59 this.util = util;
59 } 60 }
60 61
61 public void setParent(Element parent) { 62 public void setParent(Element parent) {
62 this.parent = parent; 63 this.parent = parent;
63 } 64 }
64 65
65 66
66 67
67 /** 68 /**
70 * @return The label XML element. 71 * @return The label XML element.
71 */ 72 */
72 public Element read() 73 public Element read()
73 throws IOException{ 74 throws IOException{
74 logger.debug("read()"); 75 logger.debug("read()");
75 Element labelElement; 76 Element labelElement;
76 try { 77 try {
77 labelElement = util.addLabel(parent); 78 labelElement = util.addLabel(parent);
78 } 79 }
79 catch(Exception e) { 80 catch(Exception e) {
80 logger.error("Failed to create DOM-Element for Label."); 81 logger.error("Failed to create DOM-Element for Label.");
81 return null; 82 return null;
82 } 83 }
83 84
84 try { 85 try {
85 labelElement.setAttribute("expression", properties.getExpression()); 86 labelElement.setAttribute(
86 } 87 "expression",
87 catch(IOException ioe) { 88 properties.getExpression());
88 logger.warn("Could not read label expression."); 89 }
89 return null; 90 catch(IOException ioe) {
90 } 91 logger.warn("Could not read label expression.");
92 return null;
93 }
91 94
92 try { 95 try {
93 labelElement.setAttribute( 96 labelElement.setAttribute(
94 "offset", 97 "offset",
95 String.valueOf(properties.getOffset())); 98 String.valueOf(properties.getOffset()));
96 } 99 }
97 catch(IOException ioe) { 100 catch(IOException ioe) {
98 logger.warn("Could not read label offset."); 101 logger.warn("Could not read label offset.");
99 } 102 }
100
101 try {
102 labelElement.setAttribute(
103 "definition_query",
104 properties.getWhereClause());
105 }
106 catch(IOException ioe) {
107 logger.warn("Could not read label where clause.");
108 }
109 103
110 try { 104 try {
111 labelElement.setAttribute( 105 labelElement.setAttribute(
112 "max_scale", 106 "definition_query",
113 String.valueOf(properties.getAnnotationMaximumScale())); 107 properties.getWhereClause());
114 labelElement.setAttribute( 108 }
115 "min_scale", 109 catch(IOException ioe) {
116 String.valueOf(properties.getAnnotationMinimumScale())); 110 logger.warn("Could not read label where clause.");
117 } 111 }
118 catch(IOException ioe) {
119 logger.warn("Could not read label scale.");
120 }
121 112
122 try { 113 try {
114 labelElement.setAttribute(
115 "max_scale",
116 String.valueOf(properties.getAnnotationMaximumScale()));
117 labelElement.setAttribute(
118 "min_scale",
119 String.valueOf(properties.getAnnotationMinimumScale()));
120 }
121 catch(IOException ioe) {
122 logger.warn("Could not read label scale.");
123 }
124
125 try {
123 ITextSymbol sym = properties.getSymbol(); 126 ITextSymbol sym = properties.getSymbol();
124 if(sym instanceof TextSymbol) { 127 if(sym instanceof TextSymbol) {
125 TextSymbolReader tsr = new TextSymbolReader(sym); 128 TextSymbolReader tsr = new TextSymbolReader(sym);
126 tsr.setParent(labelElement); 129 tsr.setParent(labelElement);
127 tsr.setUtil(util); 130 tsr.setUtil(util);
128 tsr.read(); 131 tsr.read();
129 } 132 }
130 } 133 }
131 catch(Exception e) { 134 catch(Exception e) {
132 logger.warn("Could not read label text symbol."); 135 logger.warn("Could not read label text symbol.");
133 } 136 }
134 137
135 return labelElement; 138 return labelElement;
136 } 139 }
137 } 140 }
138 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 141 // 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)