Modulo:Mapframe: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
tolgo funzione non utilizzata |
Nessun oggetto della modifica |
||
Riga 14:
local points = {}
local geo = args.dati or -1
local sinottico = tonumber(args.sinottico) or 0
local colore = args.colore or '#b80000' --colore
local simbolo = args.simbolo or '-number' --simbolo
local gruppo = args.gruppo or ''
local autozoom = args.autozoom or 's'
local dsimbolo = 'medium'
if (sinottico == 1) then dsimbolo = 'small' end
local cornice
if args.cornice then cornice = tonumber(args.cornice) or 1 else cornice = 1 end
Riga 27 ⟶ 30:
points[num] = {
nome = args['nome' .. num], -- nome del punto
desc = args['desc' .. num], -- descrizione del punto
lat = tonumber(args['lat' .. num]) or -400, --latitudine
lon
col = args['colore' .. num] or colore, -- colore del punto
simb = args['simbolo' .. num] or simbolo, --simbolo da mostrare
dsimb = args['dim_simbolo' .. num] or dsimbolo, --dimensione del simbolo da mostrare
}
if (points[num].simb == '-number' and gruppo ~= '') then points[num].simb = '-number-' .. gruppo end
Riga 48 ⟶ 53:
local m_args = {}
m_args.width = args.larghezza or 350▼
-- valori predefiniti
m_args.height = args.altezza or 300▼
m_args.
m_args.height = 300
m_args.align = 'right'
-- valori per sinottico
if (sinottico == 1) then
m_args.height = 260
m_args.align = 'center'
end
-- valori inseriti
m_args.align = args.allinea or m_args.align
if (cornice ~= 1 or sinottico == 1) then m_args.frameless = 1 end
-- valore ingrandimento --
if args.zoom then
m_args.zoom = tonumber(args.zoom)
elseif (geo == -1
if (#points == 1) then
local dx = 1.1 * (lon2 - lon1) / 360▼
m_args.zoom = 10 -- valore predefinito per singolo punto
local dy = 1.1 * (math.log(math.tan(math.pi * (1 + lat2 / 90) / 4)) - math.log(math.tan( math.pi * (1 + lat1 / 90) / 4))) / (2 * math.pi)▼
if (sinottico == 1) then
m_args.zoom = 13 -- valore predefinito per sinottico con singolo punto
end
elseif (autozoom == 's') then -- calcola zoom automaticamente
▲ local dx = 1.1 * (lon2 - lon1) / 360
▲ local dy = 1.1 * (math.log(math.tan(math.pi * (1 + lat2 / 90) / 4)) - math.log(math.tan( math.pi * (1 + lat1 / 90) / 4))) / (2 * math.pi)
local scalax, scalay
if dx == 0 then scalax = 18 else scalax = math.floor(-math.log(dx) / math.log(2)) end
if dy == 0 then scalay = 18 else scalay = math.floor(-math.log(dy) / math.log(2)) end
if (dx == 0 and dy == 0) then
m_args.zoom = 10 -- valore default per singolo punto
else
m_args.zoom = math.max(0, math.min(18, scalax, scalay))
end
end
end
-- esclude didascalia per cornice = 0 e per sinottico = 1
if (cornice == 1 and sinottico ~= 1) and args.didascalia then m_args.text = args.didascalia end
if args.centro_lon then
m_args.longitude = tonumber(args.centro_lon)
elseif geo == -1 then
if (#points == 1) then
m_args.longitude = (lon1 + lon2) / 2▼
m_args.longitude = points[1].lon
else
▲ m_args.longitude = (lon1 + lon2) / 2
end
end
Riga 81 ⟶ 111:
m_args.latitude = tonumber(args.centro_lat)
elseif (geo == -1) then
if (#points == 1) then
local l1 = 1 - math.log(math.tan(math.pi * (1 + lat1 / 90) / 4)) / math.pi▼
m_args.latitude = points[1].lat
local l2 = 1 - math.log(math.tan(math.pi * (1 + lat2 / 90) / 4)) / math.pi▼
else
local centroy = (l1 + l2) / 2▼
▲ m_args.latitude = centroy
▲ local centroy = (l1 + l2) / 2
▲
m_args.latitude = centroy
end
end
Riga 102 ⟶ 136:
m_dati.features[i].properties['marker-symbol'] = points[i].simb
m_dati.features[i].properties['marker-color'] = points[i].col
m_dati.features[i].properties['marker-size'] = points[i].dsimb
m_dati.features[i].properties.title = points[i].nome
m_dati.features[i].properties.description = points[i].desc
end
m_dati = mw.text.jsonEncode(m_dati)
else
m_dati =
end
|