Author: bpoussin Date: 2016-11-30 14:29:51 +0100 (Wed, 30 Nov 2016) New Revision: 4376 Url: http://forge.codelutin.com/projects/isis-fish/repository/revisions/4376 Log: fixes #8833: Lorsqu'on utilise ses propres fichiers cartes, ne pas utiliser de couleur de fond Modified: trunk/src/main/java/fr/ifremer/isisfish/map/IsisMapBean.java Modified: trunk/src/main/java/fr/ifremer/isisfish/map/IsisMapBean.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/map/IsisMapBean.java 2016-11-29 16:22:02 UTC (rev 4375) +++ trunk/src/main/java/fr/ifremer/isisfish/map/IsisMapBean.java 2016-11-30 13:29:51 UTC (rev 4376) @@ -356,6 +356,15 @@ } } + protected void addDrawingAttributes(Properties p, String layerId, String lineColor, String fillColor) { + if (lineColor != null) { + p.setProperty(layerId + "." + DrawingAttributes.linePaintProperty, lineColor); + } + if (fillColor != null) { + p.setProperty(layerId + "." + DrawingAttributes.fillPaintProperty, fillColor); + } + } + /** * Manage shp layer display. * @@ -377,8 +386,7 @@ ShapeLayer shapeLayer = new ShapeLayer(); Properties p = new Properties(); p.setProperty(layerId + "." + ShapeLayer.shapeFileProperty, mapFile); - p.setProperty(layerId + "." + DrawingAttributes.linePaintProperty, lineColor); - p.setProperty(layerId + "." + DrawingAttributes.fillPaintProperty, fillColor); + addDrawingAttributes(p, layerId, lineColor, fillColor); shapeLayer.setProperties(layerId, p); shapeLayer.setName(layerId); @@ -404,8 +412,7 @@ E00Layer e00Layer = new E00Layer(); Properties p = new Properties(); p.setProperty(layerId + ".FileName", mapFile); - p.setProperty(layerId + "." + DrawingAttributes.linePaintProperty, lineColor); - p.setProperty(layerId + "." + DrawingAttributes.fillPaintProperty, fillColor); + addDrawingAttributes(p, layerId, lineColor, fillColor); e00Layer.setProperties(layerId, p); e00Layer.setName(layerId); @@ -436,8 +443,7 @@ DTEDLayer dtedLayer = new DTEDLayer(); Properties p = new Properties(); p.setProperty(layerId + ".dted.paths", parentFolder); - p.setProperty(layerId + "." + DrawingAttributes.linePaintProperty, lineColor); - p.setProperty(layerId + "." + DrawingAttributes.fillPaintProperty, fillColor); + addDrawingAttributes(p, layerId, lineColor, fillColor); dtedLayer.setProperties(layerId, p); dtedLayer.setName(layerId); @@ -467,8 +473,7 @@ Properties p = new Properties(); p.setProperty(layerId + "." + MIFLayer.MIF_FileProperty, mapFile); p.setProperty(layerId + "." + MIFLayer.pointVisibleProperty, "true"); - p.setProperty(layerId + "." + DrawingAttributes.linePaintProperty, lineColor); - p.setProperty(layerId + "." + DrawingAttributes.fillPaintProperty, fillColor); + addDrawingAttributes(p, layerId, lineColor, fillColor); mifLayer.setProperties(layerId, p); mifLayer.setName(layerId); @@ -506,8 +511,7 @@ // This property should reflect the paths to the RPF directories p.setProperty(layerId + ".rpf.paths", parentFolder); p.setProperty(layerId + "." + MIFLayer.pointVisibleProperty, "true"); - p.setProperty(layerId + "." + DrawingAttributes.linePaintProperty, lineColor); - p.setProperty(layerId + "." + DrawingAttributes.fillPaintProperty, fillColor); + addDrawingAttributes(p, layerId, lineColor, fillColor); rpfLayer.setProperties(layerId, p); rpfLayer.setName(layerId); @@ -543,8 +547,7 @@ Properties p = new Properties(); p.setProperty(layerId + "." + VPFLayer.pathProperty, mapFile); p.setProperty(layerId + "." + VPFLayer.defaultLayerProperty, "vmapCoastline"); - p.setProperty(layerId + "." + DrawingAttributes.linePaintProperty, lineColor); - p.setProperty(layerId + "." + DrawingAttributes.fillPaintProperty, fillColor); + addDrawingAttributes(p, layerId, lineColor, fillColor); vpfLayer.setProperties(layerId, p); vpfLayer.setName(layerId); @@ -618,6 +621,9 @@ //setScale(SCALE); addGraticuleLayer(); + String lineColor = "ff000000"; + String fillColor = "ffbdde83"; + // ajout des shapes boolean shapeLoaded = false; for (String filename : getFisheryRegion().getMapFilePath()) { @@ -625,7 +631,7 @@ if (log.isDebugEnabled()) { log.debug(t("isisfish.message.load.map", filename)); } - addLayer(filename, filename, "ff000000", "ffbdde83"); + addLayer(filename, filename, lineColor, null); shapeLoaded = true; } } @@ -637,7 +643,7 @@ // a pas reussi a charger les fichiers demandés, on charge la // carte du monde String filename = IsisFish.config.getDefaultMapFilename(); - addLayer(filename, filename, "ff000000", "ffbdde83"); + addLayer(filename, filename, lineColor, fillColor); } addSpecificLayer();