Merge branch 'master' into minecraft113
This commit is contained in:
@@ -22,11 +22,6 @@ script:
|
|||||||
- python overviewer.py ~/mcoa/exmaple ~/test-output --rendermodes=smooth-lighting -p1
|
- python overviewer.py ~/mcoa/exmaple ~/test-output --rendermodes=smooth-lighting -p1
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
irc:
|
|
||||||
channels:
|
|
||||||
- "chat.freenode.net#overviewer"
|
|
||||||
template:
|
|
||||||
- "\x0313Minecraft-Overviewer\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"
|
|
||||||
# matrix:
|
# matrix:
|
||||||
# allow_failures:
|
# allow_failures:
|
||||||
# - python: "3.2"
|
# - python: "3.2"
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ overviewer.worldCtrl = null;
|
|||||||
overviewer.layerCtrl = null;
|
overviewer.layerCtrl = null;
|
||||||
overviewer.compass = null;
|
overviewer.compass = null;
|
||||||
overviewer.coord_box = null;
|
overviewer.coord_box = null;
|
||||||
|
overviewer.progress = null;
|
||||||
overviewer.current_world = null;
|
overviewer.current_world = null;
|
||||||
|
|
||||||
/// Records the current layer by name (if any) of each world
|
/// Records the current layer by name (if any) of each world
|
||||||
|
|||||||
@@ -67,6 +67,48 @@ overviewer.util = {
|
|||||||
return this.coord_box;
|
return this.coord_box;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
overviewer.progressClass = L.Control.extend({
|
||||||
|
options: {
|
||||||
|
position: 'bottomright'
|
||||||
|
},
|
||||||
|
initialize: function() {
|
||||||
|
this.progress = L.DomUtil.create("div", "progress");
|
||||||
|
this.progress.innerHTML = 'Current render progress';
|
||||||
|
this.progress.style.visibility = 'hidden';
|
||||||
|
},
|
||||||
|
update: function() {
|
||||||
|
fetch("progress.json")
|
||||||
|
.then(response => {
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error('Response was not ok');
|
||||||
|
}
|
||||||
|
return response.json();
|
||||||
|
})
|
||||||
|
.then(data => {
|
||||||
|
this.progress.innerHTML = data.message;
|
||||||
|
if (data.update > 0) {
|
||||||
|
setTimeout(this.update.bind(this), data.update);
|
||||||
|
this.progress.style.visibility = '';
|
||||||
|
} else {
|
||||||
|
setTimeout(this.update.bind(this), 60000);
|
||||||
|
this.progress.innerHTML = 'Hidden - data.update < 0';
|
||||||
|
this.progress.style.visibility = 'hidden';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
this.progress.innerHtml = 'Hidden - no data';
|
||||||
|
this.progress.style.visibility = 'hidden';
|
||||||
|
console.info('Error getting progress; hiding control', error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onAdd: function() {
|
||||||
|
// Not all browsers may have this
|
||||||
|
if ('fetch' in window) {
|
||||||
|
setTimeout(this.update.bind(this), 0);
|
||||||
|
}
|
||||||
|
return this.progress;
|
||||||
|
}
|
||||||
|
});
|
||||||
overviewer.compassClass = L.Control.extend({
|
overviewer.compassClass = L.Control.extend({
|
||||||
initialize: function(imagedict, options) {
|
initialize: function(imagedict, options) {
|
||||||
L.Util.setOptions(this, options);
|
L.Util.setOptions(this, options);
|
||||||
@@ -247,6 +289,7 @@ overviewer.util = {
|
|||||||
overviewer.compass = new overviewer.compassClass(
|
overviewer.compass = new overviewer.compassClass(
|
||||||
overviewerConfig.CONST.image.compass);
|
overviewerConfig.CONST.image.compass);
|
||||||
overviewer.coord_box = new overviewer.coordBoxClass();
|
overviewer.coord_box = new overviewer.coordBoxClass();
|
||||||
|
overviewer.progress = new overviewer.progressClass();
|
||||||
|
|
||||||
|
|
||||||
overviewerConfig.worlds.forEach(function(world_name, idx) {
|
overviewerConfig.worlds.forEach(function(world_name, idx) {
|
||||||
@@ -258,6 +301,7 @@ overviewer.util = {
|
|||||||
overviewer.compass.addTo(overviewer.map);
|
overviewer.compass.addTo(overviewer.map);
|
||||||
overviewer.worldCtrl.addTo(overviewer.map);
|
overviewer.worldCtrl.addTo(overviewer.map);
|
||||||
overviewer.coord_box.addTo(overviewer.map);
|
overviewer.coord_box.addTo(overviewer.map);
|
||||||
|
overviewer.progress.addTo(overviewer.map);
|
||||||
|
|
||||||
overviewer.map.on('mousemove', function(ev) {
|
overviewer.map.on('mousemove', function(ev) {
|
||||||
overviewer.coord_box.render(ev.latlng);
|
overviewer.coord_box.render(ev.latlng);
|
||||||
@@ -290,7 +334,8 @@ overviewer.util = {
|
|||||||
for (var mkidx = 0; mkidx < markers[obj.path].length; mkidx++) {
|
for (var mkidx = 0; mkidx < markers[obj.path].length; mkidx++) {
|
||||||
var marker_group = new L.layerGroup();
|
var marker_group = new L.layerGroup();
|
||||||
var marker_entry = markers[obj.path][mkidx];
|
var marker_entry = markers[obj.path][mkidx];
|
||||||
var icon = L.icon({iconUrl: marker_entry.icon});
|
var icon = L.icon({iconUrl: marker_entry.icon,
|
||||||
|
className: "ov-marker"});
|
||||||
console.log("marker group:", marker_entry.displayName, marker_entry.groupName);
|
console.log("marker group:", marker_entry.displayName, marker_entry.groupName);
|
||||||
|
|
||||||
for (var dbidx = 0; dbidx < markersDB[marker_entry.groupName].raw.length; dbidx++) {
|
for (var dbidx = 0; dbidx < markersDB[marker_entry.groupName].raw.length; dbidx++) {
|
||||||
@@ -298,12 +343,15 @@ overviewer.util = {
|
|||||||
var latlng = overviewer.util.fromWorldToLatLng(db.x, db.y, db.z, obj);
|
var latlng = overviewer.util.fromWorldToLatLng(db.x, db.y, db.z, obj);
|
||||||
var m_icon;
|
var m_icon;
|
||||||
if (db.icon != undefined) {
|
if (db.icon != undefined) {
|
||||||
m_icon = L.icon({iconUrl: db.icon});
|
m_icon = L.icon({iconUrl: db.icon,
|
||||||
|
className: "ov-marker"});
|
||||||
} else {
|
} else {
|
||||||
m_icon = icon;
|
m_icon = icon;
|
||||||
}
|
}
|
||||||
let new_marker = new L.marker(latlng, {icon: m_icon, title: db.hovertext});
|
let new_marker = new L.marker(latlng, {icon: m_icon, title: db.hovertext});
|
||||||
|
if (marker_entry.createInfoWindow) {
|
||||||
new_marker.bindPopup(db.text);
|
new_marker.bindPopup(db.text);
|
||||||
|
}
|
||||||
marker_group.addLayer(new_marker);
|
marker_group.addLayer(new_marker);
|
||||||
}
|
}
|
||||||
obj.marker_groups[marker_entry.displayName] = marker_group;
|
obj.marker_groups[marker_entry.displayName] = marker_group;
|
||||||
@@ -324,9 +372,9 @@ overviewer.util = {
|
|||||||
|
|
||||||
if (typeof(obj.spawn) == "object") {
|
if (typeof(obj.spawn) == "object") {
|
||||||
var latlng = overviewer.util.fromWorldToLatLng(obj.spawn[0], obj.spawn[1], obj.spawn[2], obj);
|
var latlng = overviewer.util.fromWorldToLatLng(obj.spawn[0], obj.spawn[1], obj.spawn[2], obj);
|
||||||
overviewer.collections.centers[obj.world] = [ latlng, 1 ];
|
overviewer.collections.centers[obj.world] = [ latlng, obj.defaultZoom ];
|
||||||
} else {
|
} else {
|
||||||
overviewer.collections.centers[obj.world] = [ [0, 0], 1 ];
|
overviewer.collections.centers[obj.world] = [ [0, 0], obj.defaultZoom ];
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -338,8 +386,8 @@ overviewer.util = {
|
|||||||
.addTo(overviewer.map);
|
.addTo(overviewer.map);
|
||||||
overviewer.current_world = overviewerConfig.worlds[0];
|
overviewer.current_world = overviewerConfig.worlds[0];
|
||||||
|
|
||||||
//myLayer.addTo(overviewer.map);
|
let center = overviewer.collections.centers[overviewer.current_world];
|
||||||
overviewer.map.setView(overviewer.util.fromWorldToLatLng(tset.spawn[0], tset.spawn[1], tset.spawn[2], tset), 1);
|
overviewer.map.setView(center[0], center[1]);
|
||||||
|
|
||||||
if (!overviewer.util.initHash()) {
|
if (!overviewer.util.initHash()) {
|
||||||
overviewer.worldCtrl.onChange({target: {value: overviewer.current_world}});
|
overviewer.worldCtrl.onChange({target: {value: overviewer.current_world}});
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ div.worldcontrol select {
|
|||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.leaflet-container .coordbox {
|
.leaflet-container .coordbox, .leaflet-container .progress {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
background: rgba(255, 255, 255, 0.7);
|
background: rgba(255, 255, 255, 0.7);
|
||||||
@@ -173,3 +173,9 @@ div.worldcontrol select {
|
|||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ov-marker {
|
||||||
|
position:relative;
|
||||||
|
margin-left:-50%;
|
||||||
|
margin-top:-50%;
|
||||||
|
}
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ class NBTFileReader(object):
|
|||||||
# Read the string
|
# Read the string
|
||||||
string = self._file.read(length)
|
string = self._file.read(length)
|
||||||
# decode it and return
|
# decode it and return
|
||||||
return string.decode("UTF-8")
|
return string.decode("UTF-8", 'replace')
|
||||||
|
|
||||||
def _read_tag_list(self):
|
def _read_tag_list(self):
|
||||||
tagid = self._read_tag_byte()
|
tagid = self._read_tag_byte()
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ class JSObserver(Observer):
|
|||||||
"""
|
"""
|
||||||
self._current_value = current_value
|
self._current_value = current_value
|
||||||
if self._need_update():
|
if self._need_update():
|
||||||
refresh = max(1500*(time.time() - self.last_update_time), self.minrefresh) // 1
|
refresh = max(1500*(time.time() - max(self.start_time, self.last_update_time)), self.minrefresh) // 1
|
||||||
self.logfile.seek(0)
|
self.logfile.seek(0)
|
||||||
self.logfile.truncate()
|
self.logfile.truncate()
|
||||||
if self.get_current_value():
|
if self.get_current_value():
|
||||||
|
|||||||
@@ -590,7 +590,7 @@ class TileSet(object):
|
|||||||
if (self.regionset.get_type() == None and self.options.get("showspawn", True)):
|
if (self.regionset.get_type() == None and self.options.get("showspawn", True)):
|
||||||
d.update({"spawn": self.options.get("spawn")})
|
d.update({"spawn": self.options.get("spawn")})
|
||||||
else:
|
else:
|
||||||
d.update({"spawn": "false"});
|
d.update({"spawn": False})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
d['north_direction'] = self.regionset.north_dir
|
d['north_direction'] = self.regionset.north_dir
|
||||||
|
|||||||
Reference in New Issue
Block a user