Commit 78e3f791 authored by Matija Obreza's avatar Matija Obreza
Browse files

Default tile color #88ba41

parent 3ff39190
......@@ -16,12 +16,15 @@
package org.genesys2.server.service;
import java.awt.Color;
import java.io.IOException;
import org.genesys2.server.service.impl.FilterHandler.AppliedFilters;
public interface MappingService {
public Color DEFAULT_TILE_COLOR = Color.decode("#88ba41");
void clearCache();
String filteredKml(AppliedFilters filters);
......
......@@ -16,7 +16,6 @@
package org.genesys2.server.service.impl;
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
......@@ -172,8 +171,7 @@ public class MappingServiceImpl implements MappingService {
// bi.setRGB(i, 255, Color.red.getRGB());
// }
Color color = new Color(Color.yellow.getRed(), Color.yellow.getGreen(), Color.yellow.getBlue(), 170);
final int colorWithAlpha = color.getRGB();
final int colorWithoutAlpha = MappingService.DEFAULT_TILE_COLOR.getRGB();
filterService.listGeoTile(true, filters, null, zoom, xtile, ytile, new RowCallbackHandler() {
@Override
......@@ -190,7 +188,7 @@ public class MappingServiceImpl implements MappingService {
for (int i = -pixelSize / 2; i <= pixelSize / 2; i++) {
for (int j = -pixelSize / 2; j <= pixelSize / 2; j++) {
if (longitude + i >= 0 && latitude + j >= 0 && longitude + i < 256 && latitude + j < 256) {
bi.setRGB(longitude + i, latitude + j, colorWithAlpha);
bi.setRGB(longitude + i, latitude + j, colorWithoutAlpha);
}
}
}
......
......@@ -44,9 +44,7 @@ import org.genesys2.server.service.ElasticService;
import org.genesys2.server.service.FilterConstants;
import org.genesys2.server.service.GenesysFilterService;
import org.genesys2.server.service.GenesysService;
import org.genesys2.server.service.InstituteService;
import org.genesys2.server.service.MappingService;
import org.genesys2.server.service.TaxonomyService;
import org.genesys2.server.service.TraitService;
import org.genesys2.server.service.impl.FilterHandler;
import org.genesys2.server.service.impl.FilterHandler.AppliedFilter;
......@@ -88,15 +86,9 @@ public class ExplorerController extends BaseController {
@Autowired
private TraitService traitService;
@Autowired
private InstituteService instituteService;
@Autowired
private GenesysService genesysService;
@Autowired
private TaxonomyService taxonomyService;
@Autowired
private MappingService mappingService;
......@@ -449,15 +441,12 @@ public class ExplorerController extends BaseController {
try {
final Color newColor = Color.decode(color);
if (newColor.equals(Color.yellow)) {
if (newColor.equals(MappingService.DEFAULT_TILE_COLOR)) {
return imageBytes;
}
Color origColor = new Color(Color.yellow.getRed(), Color.yellow.getGreen(), Color.yellow.getBlue(), 170);
final int originalColor = origColor.getRGB();
Color alphaColor = new Color(newColor.getRed(), newColor.getGreen(), newColor.getBlue(), 170);
final int updatedColor = alphaColor.getRGB();
final int originalColor = MappingService.DEFAULT_TILE_COLOR.getRGB();
final int updatedColor = newColor.getRGB();
final MapColorsFilter mcf = new MapColorsFilter(originalColor, updatedColor);
final ByteArrayInputStream bios = new ByteArrayInputStream(imageBytes);
......@@ -477,8 +466,8 @@ public class ExplorerController extends BaseController {
}
@RequestMapping(value = "/explore/overview")
public String overview(ModelMap model, @RequestParam(value = "filter", required = false, defaultValue = "{}") String jsonFilter) throws IOException,
SearchException {
public String overview(ModelMap model, @RequestParam(value = "filter", required = false, defaultValue = "{}") String jsonFilter)
throws IOException, SearchException {
AppliedFilters appliedFilters = mapper.readValue(jsonFilter, AppliedFilters.class);
String[] selectedFilters = appliedFilters.getFilterNames();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment