Browse Source

working on large map markers and large maps

master
poikilos 9 years ago
committed by Jacob Gustafson
parent
commit
7c1be9146e
  1. 3
      README.md
  2. 13
      singleimage.py
  3. 6
      web/chunkymap.php
  4. 2
      web/viewchunkymap.php

3
README.md

@ -8,6 +8,8 @@ This program comes without any warranty, to the extent permitted by applicable l
## Features:
* Fast HTML Canvas map with only players who moved recently
* A virtually unlimited number of markers (with alpha for outlines etc) can be placed on the map.
For markers with images that are 32px or below, px is scaled to pt (pt is manually determined for display type and orientation, instead of using default pt which is rather small on mobile devices such as iPhone® 5c)
* No mods are required--Uses Python and PHP (generator.py detects border chunks by setting a flag color as the bgcolor; distinguishes empty chunks from locked database [retries if locked])
* generator.py can loop forever (to keeps certain runtime data to reduce drive reads & writes):
```perl
@ -185,6 +187,7 @@ chmod +x set-minutely-crontab-job.sh && ./set-minutely-crontab-job.sh
(the installer will automatically download and install numpy and Pillow -- see also install-on-windows-manually.md)
## Known Issues
* var debug_adjustment = 1.345; is needed in JavaScript to resize map markers correctly to same scale as map size (for unknown reason)
* webapp: save selected world to a config file (click world on first visit to write initial config) instead of being silently autoselected
* Fix chunk generation and draw decachunks to canvas (so singleimage.py is not required to be run before generator.py)
* Make pythoninfo have a pythonmeta.yml (currently the following is detected by running executable):

13
singleimage.py

@ -51,10 +51,14 @@ class ChunkymapOfflineRenderer:
cmd_suffix = " 1> \""+genresult_path+"\""
cmd_suffix += " 2> \""+gen_error_path+"\""
#blank since singleimage mode:
geometry_string = "-10000:-10000+20000+20000"
#VERY BIG since singleimage mode (if no geometry param, minetestmapper-numpy reverts to its default which is -2000 2000 -2000 2000):
region_string = "-10000 10000 -10000 10000"
#geometry_string = str(min_x)+":"+str(min_z)+"+"+str(int(max_x)-int(min_x)+1)+"+"+str(int(max_z)-int(min_z)+1) # +1 since max-min is exclusive and width must be inclusive for minetestmapper.py
#geometry_param = " --geometry "+geometry_string
geometry_param = ""
region_param = " --region "+region_string # minetestmapper-numpy.py --region xmin xmax zmin zmax
geometry_param = " --geometry -10000:-10000+20000+20000" # minetestmapper-expertmm.py --geometry <xmin>:<zmin>+<width>+<height>
limit_param = geometry_param
#expertmm_region_string = str(min_x) + ":" + str(max_x) + "," + str(min_z) + ":" + str(max_z)
#cmd_no_out_string = python_exe_path+" "+self.minetestmapper_py_path+" --bgcolor '"+self.FLAG_EMPTY_HEXCOLOR+"' --input \""+minetestinfo.get_var("primary_world_path")+"\" --geometry "+geometry_string+" --output \""+tmp_png_path+"\""
@ -66,9 +70,10 @@ class ChunkymapOfflineRenderer:
squote = "'"
io_string = " --input \""+self.world_path+"\" --output \""+tmp_png_path+"\""
if "numpy" in self.minetestmapper_py_path:
limit_param = region_param
io_string = " \""+self.world_path+"\" \""+tmp_png_path+"\""
#geometry_param = " --region " + str(min_x) + " " + str(max_x) + " " + str(min_z) + " " + str(max_z)
cmd_no_out_string = python_exe_path+" "+self.minetestmapper_py_path+" --bgcolor "+squote+FLAG_EMPTY_HEXCOLOR+squote+io_string
cmd_no_out_string = python_exe_path+" "+self.minetestmapper_py_path+" --bgcolor "+squote+FLAG_EMPTY_HEXCOLOR+squote+io_string+limit_param
cmd_string = cmd_no_out_string + cmd_suffix
print("")
print("")

6
web/chunkymap.php

@ -832,18 +832,22 @@ function echo_chunkymap_canvas($show_player_names_enable, $decachunks_enable, $c
//size_em: size_width_keeping_aspect_this_many_em
function draw_markers(this_list, size_em, default_color_string) {
is_debug_shown = false;
var debug_adjustment = 1.345; //TODO: debug--why is this needed?
for (i=0; i<this_list.length; i++) {
this_marker = this_list[i];
screen_point = get_screen_point_from_world_coords(this_marker.x, this_marker.z);
var pen_x = 0;
var pen_y = 0;
var w = size_em*size_1em_pixel_count;
if (w<zoomed_size_1pt_pixel_count) {
w = zoomed_size_1pt_pixel_count;
}
if (this_marker.img_enable) {
this_image = document.getElementById(this_marker.img_id);
if (this_image.width>32) {
w = this_image.width*zoomed_size_1pt_pixel_count*debug_adjustment;
}
var h = w*(this_image.height/this_image.width);
ctx.drawImage(this_image, screen_point.x-w/2.0, screen_point.y-h/2.0, w, h);
//pen_y += h;

2
web/viewchunkymap.php

@ -1,5 +1,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html style="width:100%; height:100%">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Chunkymap</title>
<?php
$html4_mode_enable=false; //if true, does not echo canvas nor client-side scripting

Loading…
Cancel
Save