comparison artifacts/src/main/java/org/dive4elements/river/exports/MapGenerator.java @ 8202:e4606eae8ea5

sed src/**/*.java 's/logger/log/g'
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 05 Sep 2014 12:58:17 +0200
parents ada424214b02
children 76a2268942c6
comparison
equal deleted inserted replaced
8201:4b8c5a08de04 8202:e4606eae8ea5
42 import com.vividsolutions.jts.geom.Envelope; 42 import com.vividsolutions.jts.geom.Envelope;
43 43
44 44
45 public class MapGenerator implements OutGenerator, FacetTypes { 45 public class MapGenerator implements OutGenerator, FacetTypes {
46 46
47 private static Logger logger = Logger.getLogger(MapGenerator.class); 47 private static Logger log = Logger.getLogger(MapGenerator.class);
48 48
49 protected D4EArtifactCollection collection; 49 protected D4EArtifactCollection collection;
50 50
51 protected Artifact master; 51 protected Artifact master;
52 52
67 67
68 protected String outName; 68 protected String outName;
69 69
70 @Override 70 @Override
71 public void setup(Object config) { 71 public void setup(Object config) {
72 logger.debug("MapGenerator.setup"); 72 log.debug("MapGenerator.setup");
73 } 73 }
74 74
75 @Override 75 @Override
76 public void init(String outName, Document request, OutputStream out, CallContext context) { 76 public void init(String outName, Document request, OutputStream out, CallContext context) {
77 logger.debug("MapGenerator.init"); 77 log.debug("MapGenerator.init");
78 78
79 this.outName = outName; 79 this.outName = outName;
80 this.request = request; 80 this.request = request;
81 this.out = out; 81 this.out = out;
82 this.context = context; 82 this.context = context;
88 } 88 }
89 89
90 90
91 @Override 91 @Override
92 public void setMasterArtifact(Artifact master) { 92 public void setMasterArtifact(Artifact master) {
93 logger.debug("MapGenerator.setMasterArtifact"); 93 log.debug("MapGenerator.setMasterArtifact");
94 this.master = master; 94 this.master = master;
95 } 95 }
96 96
97 @Override 97 @Override
98 public void setCollection(D4EArtifactCollection collection) { 98 public void setCollection(D4EArtifactCollection collection) {
105 ThemeDocument attr, 105 ThemeDocument attr,
106 boolean visible) 106 boolean visible)
107 { 107 {
108 String name = artifactFacet.getFacetName(); 108 String name = artifactFacet.getFacetName();
109 109
110 logger.debug("MapGenerator.doOut: " + 110 log.debug("MapGenerator.doOut: " +
111 artifactFacet.getArtifact().identifier() + " | " + name); 111 artifactFacet.getArtifact().identifier() + " | " + name);
112 D4EArtifact flys = (D4EArtifact) artifactFacet.getArtifact(); 112 D4EArtifact flys = (D4EArtifact) artifactFacet.getArtifact();
113 113
114 Facet nativeFacet = artifactFacet.getFacet(); 114 Facet nativeFacet = artifactFacet.getFacet();
115 115
130 // wms has a wrong SRID which would break that layer 130 // wms has a wrong SRID which would break that layer
131 //else if (FLOODMAP_USERSHAPE.equals(name)) { 131 //else if (FLOODMAP_USERSHAPE.equals(name)) {
132 // createUserShapeLayer(flys, wms); 132 // createUserShapeLayer(flys, wms);
133 //} 133 //}
134 else { 134 else {
135 logger.debug("doOut: createDatabaseLayer for facet name: " + name); 135 log.debug("doOut: createDatabaseLayer for facet name: " + name);
136 createDatabaseLayer(flys, wms, attr); 136 createDatabaseLayer(flys, wms, attr);
137 } 137 }
138 } 138 }
139 else { 139 else {
140 logger.warn("Facet not supported: " + nativeFacet.getClass()); 140 log.warn("Facet not supported: " + nativeFacet.getClass());
141 } 141 }
142 } 142 }
143 143
144 144
145 protected void createWSPLGENLayer( 145 protected void createWSPLGENLayer(
169 attr.createDynamicMapserverStyle( 169 attr.createDynamicMapserverStyle(
170 from, to, step, context.getMeta()), 170 from, to, step, context.getMeta()),
171 context); 171 context);
172 } 172 }
173 else { 173 else {
174 logger.warn("Cannot create WSPLGEN layer from: " + 174 log.warn("Cannot create WSPLGEN layer from: " +
175 wms.getClass()); 175 wms.getClass());
176 } 176 }
177 } 177 }
178 catch (IOException ioe) { 178 catch (IOException ioe) {
179 logger.error(ioe, ioe); 179 log.error(ioe, ioe);
180 } 180 }
181 } 181 }
182 182
183 183
184 protected void createUserShapeLayer(D4EArtifact flys, WMSLayerFacet wms) { 184 protected void createUserShapeLayer(D4EArtifact flys, WMSLayerFacet wms) {
186 186
187 try { 187 try {
188 mfg.createUserShapeLayer(flys, wms); 188 mfg.createUserShapeLayer(flys, wms);
189 } 189 }
190 catch (FileNotFoundException fnfe) { 190 catch (FileNotFoundException fnfe) {
191 logger.error(fnfe, fnfe); 191 log.error(fnfe, fnfe);
192 } 192 }
193 catch (IOException ioe) { 193 catch (IOException ioe) {
194 logger.error(ioe, ioe); 194 log.error(ioe, ioe);
195 } 195 }
196 } 196 }
197 197
198 198
199 protected void createDatabaseLayer( 199 protected void createDatabaseLayer(
200 D4EArtifact flys, 200 D4EArtifact flys,
201 WMSLayerFacet wms, 201 WMSLayerFacet wms,
202 ThemeDocument attr 202 ThemeDocument attr
203 ) { 203 ) {
204 logger.debug("createDatabaseLayer for facet: " + wms.getName()); 204 log.debug("createDatabaseLayer for facet: " + wms.getName());
205 205
206 ArtifactMapfileGenerator mfg = new ArtifactMapfileGenerator(); 206 ArtifactMapfileGenerator mfg = new ArtifactMapfileGenerator();
207 207
208 try { 208 try {
209 File baseDir = mfg.getShapefileBaseDir(); 209 File baseDir = mfg.getShapefileBaseDir();
210 File artDir = new File(baseDir, flys.identifier()); 210 File artDir = new File(baseDir, flys.identifier());
211 211
212 if (artDir != null && !artDir.exists()) { 212 if (artDir != null && !artDir.exists()) {
213 logger.debug("Create new directory: " + artDir.getPath()); 213 log.debug("Create new directory: " + artDir.getPath());
214 artDir.mkdir(); 214 artDir.mkdir();
215 } 215 }
216 216
217 if (wms instanceof WMSDBLayerFacet) { 217 if (wms instanceof WMSDBLayerFacet) {
218 mfg.createDatabaseLayer( 218 mfg.createDatabaseLayer(
219 flys, 219 flys,
220 (WMSDBLayerFacet) wms, 220 (WMSDBLayerFacet) wms,
221 attr.createMapserverStyle()); 221 attr.createMapserverStyle());
222 } 222 }
223 else { 223 else {
224 logger.warn("Cannot create DB layer from: " + wms.getClass()); 224 log.warn("Cannot create DB layer from: " + wms.getClass());
225 } 225 }
226 } 226 }
227 catch (FileNotFoundException fnfe) { 227 catch (FileNotFoundException fnfe) {
228 logger.error(fnfe, fnfe); 228 log.error(fnfe, fnfe);
229 } 229 }
230 catch (IOException ioe) { 230 catch (IOException ioe) {
231 logger.error(ioe, ioe); 231 log.error(ioe, ioe);
232 } 232 }
233 } 233 }
234 234
235 235
236 @Override 236 @Override
237 public void generate() 237 public void generate()
238 throws IOException 238 throws IOException
239 { 239 {
240 logger.debug("MapGenerator.generate"); 240 log.debug("MapGenerator.generate");
241 241
242 ArtifactMapfileGenerator mfg = new ArtifactMapfileGenerator(); 242 ArtifactMapfileGenerator mfg = new ArtifactMapfileGenerator();
243 mfg.generate(); 243 mfg.generate();
244 244
245 Document response = XMLUtils.newDocument(); 245 Document response = XMLUtils.newDocument();
272 if (maxExtent == null) { 272 if (maxExtent == null) {
273 return; 273 return;
274 } 274 }
275 275
276 if (this.maxExtent == null) { 276 if (this.maxExtent == null) {
277 logger.debug("Set max extent to: " + maxExtent); 277 log.debug("Set max extent to: " + maxExtent);
278 this.maxExtent = new Envelope(maxExtent); 278 this.maxExtent = new Envelope(maxExtent);
279 return; 279 return;
280 } 280 }
281 281
282 this.maxExtent.expandToInclude(maxExtent); 282 this.maxExtent.expandToInclude(maxExtent);
283 } 283 }
284 284
285 285
286 protected void setInitialExtent(Envelope initialExtent) { 286 protected void setInitialExtent(Envelope initialExtent) {
287 if (this.initialExtent == null && initialExtent != null) { 287 if (this.initialExtent == null && initialExtent != null) {
288 logger.debug("Set initial extent to: " + initialExtent); 288 log.debug("Set initial extent to: " + initialExtent);
289 this.initialExtent = new Envelope(initialExtent); 289 this.initialExtent = new Envelope(initialExtent);
290 } 290 }
291 } 291 }
292 292
293 293

http://dive4elements.wald.intevation.org