@@ -84,12 +84,12 @@ class _SolarSystem(_UniqueObject): | |||||
@property | @property | ||||
def is_nullsec(self): | def is_nullsec(self): | ||||
"""Whether the solar system is in nullsec.""" | """Whether the solar system is in nullsec.""" | ||||
return self.security < 0.05 | |||||
return self.security <= 0.0 | |||||
@property | @property | ||||
def is_lowsec(self): | def is_lowsec(self): | ||||
"""Whether the solar system is in nullsec.""" | """Whether the solar system is in nullsec.""" | ||||
return self.security >= 0.05 and self.security < 0.45 | |||||
return self.security > 0.0 and self.security < 0.45 | |||||
@property | @property | ||||
def is_highsec(self): | def is_highsec(self): | ||||
@@ -79,6 +79,6 @@ def format_security(value): | |||||
def get_security_class(value): | def get_security_class(value): | ||||
"""Given a system security status, return the corresponding CSS class.""" | """Given a system security status, return the corresponding CSS class.""" | ||||
if value < 0.05: | |||||
if value <= 0.0: | |||||
return "sec-null" | return "sec-null" | ||||
return "sec-" + str(round(value, 1)).replace(".", "_") | |||||
return "sec-" + str(round(max(value, 0.1), 1)).replace(".", "_") |
@@ -22,9 +22,10 @@ def map(): | |||||
def mapdata(): | def mapdata(): | ||||
"""Render and return the map data as a JSON object.""" | """Render and return the map data as a JSON object.""" | ||||
payload = { | payload = { | ||||
"galaxy": { | |||||
"systems": { | |||||
system.id: { | system.id: { | ||||
"name": system.name, | "name": system.name, | ||||
"region": system.region.id, | |||||
"security": system.security, | "security": system.security, | ||||
"coords": system.coords, | "coords": system.coords, | ||||
"gates": [dest.id for dest in system.gates], | "gates": [dest.id for dest in system.gates], | ||||
@@ -32,6 +33,13 @@ def mapdata(): | |||||
} | } | ||||
for system in g.eve.universe.systems() if not system.is_whspace | for system in g.eve.universe.systems() if not system.is_whspace | ||||
}, | }, | ||||
"regions": { | |||||
region.id: { | |||||
"name": region.name, | |||||
"faction": region.faction.id if region.faction else -1 | |||||
} | |||||
for region in g.eve.universe.regions() if not region.is_whspace | |||||
}, | |||||
"factions": { | "factions": { | ||||
faction.id: { | faction.id: { | ||||
"name": faction.name | "name": faction.name | ||||
@@ -21,7 +21,7 @@ var get_bounds = function(galaxy) { | |||||
$(function() { | $(function() { | ||||
$("#map .preload").append($("<p>").text("Loading map data...")); | $("#map .preload").append($("<p>").text("Loading map data...")); | ||||
$.getJSON( "map/data.json", data => { | $.getJSON( "map/data.json", data => { | ||||
var galaxy = data["galaxy"]; | |||||
var galaxy = data["systems"]; | |||||
var systems = Object.values(galaxy); | var systems = Object.values(galaxy); | ||||
var jumps = [].concat | var jumps = [].concat | ||||
.apply([], Object.keys(galaxy) | .apply([], Object.keys(galaxy) | ||||
@@ -67,8 +67,8 @@ $(function() { | |||||
.attr("r", 2) | .attr("r", 2) | ||||
.attr("class", d => { | .attr("class", d => { | ||||
var sec = d["security"]; | var sec = d["security"]; | ||||
var klass = sec < 0.05 ? "null" : | |||||
Number(sec).toFixed(1).replace(".", "_"); | |||||
var klass = sec <= 0.0 ? "null" : | |||||
Number(Math.max(sec, 0.1)).toFixed(1).replace(".", "_"); | |||||
return "system sec-" + klass; | return "system sec-" + klass; | ||||
}); | }); | ||||
@@ -82,13 +82,13 @@ $(function() { | |||||
trans.x = Math.max(Math.min(trans.x, clamp), -clamp); | trans.x = Math.max(Math.min(trans.x, clamp), -clamp); | ||||
trans.y = Math.max(Math.min(trans.y, clamp), -clamp); | trans.y = Math.max(Math.min(trans.y, clamp), -clamp); | ||||
stars.attr("transform", trans); | stars.attr("transform", trans); | ||||
$("#map-scale").val(Math.log2(trans.k + 1)); | |||||
if (trans.k != lastk) { | |||||
if (Math.abs((trans.k - lastk) / lastk) > 0.1) { | |||||
stars.selectAll("circle") | stars.selectAll("circle") | ||||
.attr("r", 6 / (trans.k + 2)); | .attr("r", 6 / (trans.k + 2)); | ||||
stars.selectAll("line") | stars.selectAll("line") | ||||
.style("stroke-width", 2 / (trans.k + 1)); | .style("stroke-width", 2 / (trans.k + 1)); | ||||
$("#map-scale").val(Math.log2(trans.k + 1)); | |||||
lastk = trans.k; | lastk = trans.k; | ||||
} | } | ||||
}); | }); | ||||