comparison src/java/de/intevation/mxd/reader/CharacterMarkerSymbolReader.java @ 135:a4ab239509f1

Updated the default values and reader error handling.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 22 Jun 2011 13:55:22 +0200
parents fb93f20478cc
children 0bde090506f9
comparison
equal deleted inserted replaced
134:acc9e5430177 135:a4ab239509f1
67 symbolElement.setAttribute( 67 symbolElement.setAttribute(
68 "angle", 68 "angle",
69 String.valueOf(symbol.getAngle())); 69 String.valueOf(symbol.getAngle()));
70 } 70 }
71 catch(IOException ioe) { 71 catch(IOException ioe) {
72 logger.warn("Could not read angle. Setting angle to 0."); 72 logger.warn("Could not read angle.");
73 symbolElement.setAttribute("angle", "0");
74 } 73 }
75 74
76 try { 75 try {
77 symbolElement.setAttribute( 76 symbolElement.setAttribute(
78 "size", 77 "size",
79 String.valueOf(symbol.getSize())); 78 String.valueOf(symbol.getSize()));
80 } 79 }
81 catch(IOException ioe) { 80 catch(IOException ioe) {
82 logger.warn("Could not read size. Setting size to 1"); 81 logger.warn("Could not read size.");
83 symbolElement.setAttribute("size", "1");
84 } 82 }
85 83
86 try { 84 try {
87 symbolElement.setAttribute( 85 symbolElement.setAttribute(
88 "x_offset", 86 "x_offset",
89 String.valueOf(symbol.getXOffset())); 87 String.valueOf(symbol.getXOffset()));
90 } 88 }
91 catch(IOException ioe) { 89 catch(IOException ioe) {
92 logger.warn("Could not read x-offset. Setting x-offset to 0."); 90 logger.warn("Could not read x-offset.");
93 symbolElement.setAttribute("x_offset", "0");
94 } 91 }
95 92
96 try { 93 try {
97 symbolElement.setAttribute( 94 symbolElement.setAttribute(
98 "y_offset", 95 "y_offset",
99 String.valueOf(symbol.getYOffset())); 96 String.valueOf(symbol.getYOffset()));
100 } 97 }
101 catch(IOException ioe) { 98 catch(IOException ioe) {
102 logger.warn("Could not read y-offset. Setting y-offset to 0."); 99 logger.warn("Could not read y-offset.");
103 symbolElement.setAttribute("y_offset", "0");
104 } 100 }
105 101
106 try { 102 try {
107 symbolElement.setAttribute( 103 symbolElement.setAttribute(
108 "name", 104 "name",
118 "char", 114 "char",
119 String.valueOf(symbol.getCharacterIndex())); 115 String.valueOf(symbol.getCharacterIndex()));
120 } 116 }
121 catch(IOException ioe) { 117 catch(IOException ioe) {
122 logger.warn( 118 logger.warn(
123 "Could not read character." + 119 "Could not read character number.");
124 " Setting character number to 60");
125 symbolElement.setAttribute("char", "60");
126 } 120 }
127 121
128 try { 122 try {
129 if(symbol.getColor() instanceof IRgbColor) { 123 if(symbol.getColor() instanceof IRgbColor) {
130 IRgbColor color = (IRgbColor)symbol.getColor(); 124 IRgbColor color = (IRgbColor)symbol.getColor();
147 symbolElement.setAttribute("transparency", 141 symbolElement.setAttribute("transparency",
148 String.valueOf(col.getTransparency())); 142 String.valueOf(col.getTransparency()));
149 } 143 }
150 } 144 }
151 catch(IOException ioe) { 145 catch(IOException ioe) {
152 logger.warn( 146 logger.warn("Could not read color.");
153 "Could not read color." +
154 " Setting color to black with no transparency.");
155 Color black = new Color(0, 0, 0);
156 symbolElement.setAttribute("color", String.valueOf(black.getRGB()));
157 symbolElement.setAttribute("transparency", "-1");
158 } 147 }
159 148
160 try { 149 try {
161 Font f = symbol.getFont(); 150 Font f = symbol.getFont();
162 symbolElement.setAttribute("font", f.getName()); 151 symbolElement.setAttribute("font", f.getName());
168 "strike_through", 157 "strike_through",
169 String.valueOf(f.getStrikethrough())); 158 String.valueOf(f.getStrikethrough()));
170 symbolElement.setAttribute("weight", String.valueOf(f.getWeight())); 159 symbolElement.setAttribute("weight", String.valueOf(f.getWeight()));
171 } 160 }
172 catch(IOException ioe) { 161 catch(IOException ioe) {
173 logger.warn("Could not read font. Setting font to \"Unknown\"."); 162 logger.warn("Could not read font. Setting font to \"FreeSans\".");
174 symbolElement.setAttribute("font", "Unknown"); 163 symbolElement.setAttribute("font", "FreeSans");
175 } 164 }
176 symbolElement.setAttribute("style", "char"); 165 symbolElement.setAttribute("style", "char");
177 symbolElement.setAttribute("type", "marker"); 166 symbolElement.setAttribute("type", "marker");
178 return symbolElement; 167 return symbolElement;
179 } 168 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)