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