comparison src/java/de/intevation/mxd/reader/CartoLineSymbolReader.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 7632850b9520
comparison
equal deleted inserted replaced
134:acc9e5430177 135:a4ab239509f1
93 col.getBlue()); 93 col.getBlue());
94 symbolElement.setAttribute("color", String.valueOf(c.getRGB())); 94 symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
95 } 95 }
96 } 96 }
97 catch(IOException ioe) { 97 catch(IOException ioe) {
98 logger.warn( 98 logger.warn("Could not read color.");
99 "Could not read color." +
100 " Setting color to black with no transparency");
101 Color black = new Color(0, 0, 0);
102 symbolElement.setAttribute("color", String.valueOf(black.getRGB()));
103 symbolElement.setAttribute("transparency", "-1");
104 } 99 }
105 100
106 int cap; 101 int cap;
102 String capStyle = "";
107 try { 103 try {
108 cap = symbol.getCap(); 104 cap = symbol.getCap();
109 } 105 }
110 catch(IOException ioe) { 106 catch(IOException ioe) {
111 logger.warn( 107 logger.warn(
112 "Could not read line cap." + 108 "Could not read line cap.");
113 " Setting line cap to \"butt\"");
114 cap = -1; 109 cap = -1;
115 } 110 }
116 String capStyle = "butt";
117 switch(cap) { 111 switch(cap) {
118 case esriLineCapStyle.esriLCSRound: capStyle = "round"; break; 112 case esriLineCapStyle.esriLCSRound: capStyle = "round"; break;
119 case esriLineCapStyle.esriLCSSquare: capStyle = "square"; break; 113 case esriLineCapStyle.esriLCSSquare: capStyle = "square"; break;
120 default: break; 114 default: break;
121 } 115 }
122 116
123 117
124 int join; 118 int join;
119 String joinStyle = "";
125 try { 120 try {
126 join = symbol.getJoin(); 121 join = symbol.getJoin();
127 } 122 }
128 catch(IOException ioe) { 123 catch(IOException ioe) {
129 logger.warn( 124 logger.warn(
130 "Could not read line join." + 125 "Could not read line join." +
131 " Setting line join to \"bevel\"."); 126 " Setting line join to \"bevel\".");
132 join = -1; 127 join = -1;
133 } 128 }
134 String joinStyle = "bevel";
135 switch(join) { 129 switch(join) {
136 case esriLineJoinStyle.esriLJSRound: joinStyle = "round"; break; 130 case esriLineJoinStyle.esriLJSRound: joinStyle = "round"; break;
137 case esriLineJoinStyle.esriLJSMitre: joinStyle = "miter"; break; 131 case esriLineJoinStyle.esriLJSMitre: joinStyle = "miter"; break;
138 default: break; 132 default: break;
139 } 133 }
140 symbolElement.setAttribute("cap", capStyle); 134 if(!capStyle.equals("")) {
141 symbolElement.setAttribute("join", joinStyle); 135 symbolElement.setAttribute("cap", capStyle);
136 }
137 if (!joinStyle.equals("")) {
138 symbolElement.setAttribute("join", joinStyle);
139 }
142 140
143 try { 141 try {
144 symbolElement.setAttribute( 142 symbolElement.setAttribute(
145 "linestart", 143 "linestart",
146 String.valueOf(symbol.getLineStartOffset())); 144 String.valueOf(symbol.getLineStartOffset()));
147 } 145 }
148 catch(IOException ioe) { 146 catch(IOException ioe) {
149 logger.warn( 147 logger.warn("Could not read line start offset.");
150 "Could not read line start offset." +
151 " Setting line start offset to 0.");
152 symbolElement.setAttribute("linestart", "0");
153 } 148 }
154 149
155 try { 150 try {
156 symbolElement.setAttribute( 151 symbolElement.setAttribute(
157 "miterlimit", 152 "miterlimit",
158 String.valueOf(symbol.getMiterLimit())); 153 String.valueOf(symbol.getMiterLimit()));
159 } 154 }
160 catch(IOException ioe) { 155 catch(IOException ioe) {
161 logger.warn( 156 logger.warn("Could not read miter limit.");
162 "Could not read miter limit. " +
163 " Setting miter limit to 0.");
164 symbolElement.setAttribute("miterlimit", "0");
165 } 157 }
166 158
167 try { 159 try {
168 symbolElement.setAttribute( 160 symbolElement.setAttribute(
169 "offset", 161 "offset",
170 String.valueOf(symbol.getOffset())); 162 String.valueOf(symbol.getOffset()));
171 } 163 }
172 catch(IOException ioe) { 164 catch(IOException ioe) {
173 logger.warn("Could not read offset. Setting offset to 0."); 165 logger.warn("Could not read offset.");
174 symbolElement.setAttribute("offset", "0");
175 } 166 }
176 167
177 try { 168 try {
178 symbolElement.setAttribute( 169 symbolElement.setAttribute(
179 "width", 170 "width",
180 String.valueOf(symbol.getWidth())); 171 String.valueOf(symbol.getWidth()));
181 } 172 }
182 catch(IOException ioe) { 173 catch(IOException ioe) {
183 logger.warn("Could not read width. Setting width to 1."); 174 logger.warn("Could not read width.");
184 symbolElement.setAttribute("width", "1");
185 } 175 }
186 //TODO Read further attributes depending on the Mapscript functionality: 176 //TODO Read further attributes depending on the Mapscript functionality:
187 // Template, MarkerSymbol, LineDecorations 177 // Template, MarkerSymbol, LineDecorations
188 symbolElement.setAttribute("type", "line"); 178 symbolElement.setAttribute("type", "line");
189 symbolElement.setAttribute("style", "carto"); 179 symbolElement.setAttribute("style", "carto");
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)