0

Merge branch 'master' into minecraft113

This commit is contained in:
Aaron Griffith
2019-02-19 14:28:34 -05:00
7 changed files with 66 additions and 16 deletions

View File

@@ -22,11 +22,6 @@ script:
- python overviewer.py ~/mcoa/exmaple ~/test-output --rendermodes=smooth-lighting -p1
notifications:
email: false
irc:
channels:
- "chat.freenode.net#overviewer"
template:
- "\x0313Minecraft-Overviewer\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"
# matrix:
# allow_failures:
# - python: "3.2"

View File

@@ -15,6 +15,7 @@ overviewer.worldCtrl = null;
overviewer.layerCtrl = null;
overviewer.compass = null;
overviewer.coord_box = null;
overviewer.progress = null;
overviewer.current_world = null;
/// Records the current layer by name (if any) of each world

View File

@@ -67,6 +67,48 @@ overviewer.util = {
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({
initialize: function(imagedict, options) {
L.Util.setOptions(this, options);
@@ -247,6 +289,7 @@ overviewer.util = {
overviewer.compass = new overviewer.compassClass(
overviewerConfig.CONST.image.compass);
overviewer.coord_box = new overviewer.coordBoxClass();
overviewer.progress = new overviewer.progressClass();
overviewerConfig.worlds.forEach(function(world_name, idx) {
@@ -258,6 +301,7 @@ overviewer.util = {
overviewer.compass.addTo(overviewer.map);
overviewer.worldCtrl.addTo(overviewer.map);
overviewer.coord_box.addTo(overviewer.map);
overviewer.progress.addTo(overviewer.map);
overviewer.map.on('mousemove', function(ev) {
overviewer.coord_box.render(ev.latlng);
@@ -290,7 +334,8 @@ overviewer.util = {
for (var mkidx = 0; mkidx < markers[obj.path].length; mkidx++) {
var marker_group = new L.layerGroup();
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);
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 m_icon;
if (db.icon != undefined) {
m_icon = L.icon({iconUrl: db.icon});
m_icon = L.icon({iconUrl: db.icon,
className: "ov-marker"});
} else {
m_icon = icon;
}
let new_marker = new L.marker(latlng, {icon: m_icon, title: db.hovertext});
new_marker.bindPopup(db.text);
if (marker_entry.createInfoWindow) {
new_marker.bindPopup(db.text);
}
marker_group.addLayer(new_marker);
}
obj.marker_groups[marker_entry.displayName] = marker_group;
@@ -324,9 +372,9 @@ overviewer.util = {
if (typeof(obj.spawn) == "object") {
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 {
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);
overviewer.current_world = overviewerConfig.worlds[0];
//myLayer.addTo(overviewer.map);
overviewer.map.setView(overviewer.util.fromWorldToLatLng(tset.spawn[0], tset.spawn[1], tset.spawn[2], tset), 1);
let center = overviewer.collections.centers[overviewer.current_world];
overviewer.map.setView(center[0], center[1]);
if (!overviewer.util.initHash()) {
overviewer.worldCtrl.onChange({target: {value: overviewer.current_world}});

View File

@@ -165,7 +165,7 @@ div.worldcontrol select {
font-size: 1.2em;
}
.leaflet-container .coordbox {
.leaflet-container .coordbox, .leaflet-container .progress {
box-shadow: none;
font-size: 11px;
background: rgba(255, 255, 255, 0.7);
@@ -173,3 +173,9 @@ div.worldcontrol select {
padding: 0 5px;
color: #333;
}
.ov-marker {
position:relative;
margin-left:-50%;
margin-top:-50%;
}

View File

@@ -150,7 +150,7 @@ class NBTFileReader(object):
# Read the string
string = self._file.read(length)
# decode it and return
return string.decode("UTF-8")
return string.decode("UTF-8", 'replace')
def _read_tag_list(self):
tagid = self._read_tag_byte()

View File

@@ -294,7 +294,7 @@ class JSObserver(Observer):
"""
self._current_value = current_value
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.truncate()
if self.get_current_value():

View File

@@ -590,7 +590,7 @@ class TileSet(object):
if (self.regionset.get_type() == None and self.options.get("showspawn", True)):
d.update({"spawn": self.options.get("spawn")})
else:
d.update({"spawn": "false"});
d.update({"spawn": False})
try:
d['north_direction'] = self.regionset.north_dir